summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-01-02 14:29:46 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-01-02 14:29:46 +0000
commitaf343084b819c483130e4f444932bedef30ed987 (patch)
treec02c67e8241b53b0f1fae37e1abc0c32c993fc99 /app
parent6c25d5a2159219aa4543a1a56482f5f1d61e5dcc (diff)
downloadwebtrees-af343084b819c483130e4f444932bedef30ed987.tar.gz
webtrees-af343084b819c483130e4f444932bedef30ed987.tar.bz2
webtrees-af343084b819c483130e4f444932bedef30ed987.zip
Remove dead code. Add tests
Diffstat (limited to 'app')
-rw-r--r--app/Module/WelcomeBlockModule.php2
-rw-r--r--app/Tree.php36
2 files changed, 1 insertions, 37 deletions
diff --git a/app/Module/WelcomeBlockModule.php b/app/Module/WelcomeBlockModule.php
index f7bfd743d1..747d29b34e 100644
--- a/app/Module/WelcomeBlockModule.php
+++ b/app/Module/WelcomeBlockModule.php
@@ -55,7 +55,7 @@ class WelcomeBlockModule extends AbstractModule implements ModuleBlockInterface
*/
public function getBlock(Tree $tree, int $block_id, string $ctype = '', array $cfg = []): string
{
- $individual = $tree->getSignificantIndividual();
+ $individual = $tree->significantIndividual(Auth::user());
$links = [];
diff --git a/app/Tree.php b/app/Tree.php
index 75ff3b0649..2d533d038e 100644
--- a/app/Tree.php
+++ b/app/Tree.php
@@ -942,40 +942,4 @@ class Tree
return $individual;
}
-
- /**
- * Get significant information from this page, to allow other pages such as
- * charts and reports to initialise with the same records
- *
- * @return Individual
- */
- public function getSignificantIndividual(): Individual
- {
- static $individual; // Only query the DB once.
-
- if (!$individual && $this->getUserPreference(Auth::user(), 'rootid') !== '') {
- $individual = Individual::getInstance($this->getUserPreference(Auth::user(), 'rootid'), $this);
- }
- if (!$individual && $this->getUserPreference(Auth::user(), 'gedcomid') !== '') {
- $individual = Individual::getInstance($this->getUserPreference(Auth::user(), 'gedcomid'), $this);
- }
- if (!$individual) {
- $individual = Individual::getInstance($this->getPreference('PEDIGREE_ROOT_ID'), $this);
- }
- if (!$individual) {
- $xref = (string) Database::prepare(
- "SELECT MIN(i_id) FROM `##individuals` WHERE i_file = :tree_id"
- )->execute([
- 'tree_id' => $this->id(),
- ])->fetchOne();
-
- $individual = Individual::getInstance($xref, $this);
- }
- if (!$individual) {
- // always return a record
- $individual = new Individual('I', '0 @I@ INDI', null, $this);
- }
-
- return $individual;
- }
}