From: Vincent Vanwaelscappel Date: Wed, 21 Aug 2019 18:34:11 +0000 (+0200) Subject: wip #2941 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=674da470e155cc137da795b2104d8604ad1fcfe9;p=cubist_cms-back.git wip #2941 --- diff --git a/src/app/Console/Commands/SearchIndexCommand.php b/src/app/Console/Commands/SearchIndexCommand.php index a049e3a..1d5009f 100644 --- a/src/app/Console/Commands/SearchIndexCommand.php +++ b/src/app/Console/Commands/SearchIndexCommand.php @@ -43,6 +43,8 @@ class SearchIndexCommand extends Command /** @var Cubist\Backpack\app\Magic\Menu\Item[] $pages */ $pages = Menu::getNavigation()->findAll(); + $indexed = []; + foreach ($pages as $page) { // Skip nav items if ($page instanceof VirtualItem) { @@ -58,11 +60,14 @@ class SearchIndexCommand extends Command } $href = $page->getHref(); - if ($href == '#') { + if ($href == '#' || $href=='home') { continue; } $url = action("PageController@catchall", ['page' => $href]); + if (isset($indexed[$url])) { + continue; + } $html = @file_get_contents($url); if (!$html) { @@ -94,6 +99,9 @@ class SearchIndexCommand extends Command 'id' => $url, ]; + echo $href . ' : ' . $url . "\n"; + $indexed[$url] = true; + Elasticsearch::index($data); } } diff --git a/src/app/Http/Controllers/CubistPageController.php b/src/app/Http/Controllers/CubistPageController.php index 9626756..6e3a334 100644 --- a/src/app/Http/Controllers/CubistPageController.php +++ b/src/app/Http/Controllers/CubistPageController.php @@ -41,7 +41,6 @@ class CubistPageController extends CubistFrontController $c['params']['path'] = implode('/', $e); } } else { - $path = trim($main . '/' . $subs, '/'); if (!$path) { $path = 'home'; @@ -51,7 +50,6 @@ class CubistPageController extends CubistFrontController if (null === $item) { $this->_404(); } - $c = $item->getController(); } diff --git a/src/app/Magic/Menu/PageItem.php b/src/app/Magic/Menu/PageItem.php index b866ced..d2632a8 100644 --- a/src/app/Magic/Menu/PageItem.php +++ b/src/app/Magic/Menu/PageItem.php @@ -36,7 +36,6 @@ class PageItem extends Item public function getHref() { - if ($this->getPage()->template == 'first_redirection' && $this->hasChildren()) { return $this->getChildren()[0]->getHref(); } else if ($this->getPage()->template == 'internal_redirection') {