diff --git a/CHANGELOG.md b/CHANGELOG.md index 068e3e7..0bcedab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ +# v3.0.1 +## 02/03/2020 + +1. [](#bugfix) + * Fixed an issue indexing via Admin with Grav 1.7 + # v3.0.0 -## 04/14/2018 +## 04/14/2019 1. [](#new) * Added new Grav Scheduler integration diff --git a/blueprints.yaml b/blueprints.yaml index 3c91a85..0ce2d5d 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: TNT Search -version: 3.0.0 +version: 3.0.1 testing: false description: Powerful indexed-based full text search engine powered by TNTSearch icon: binoculars diff --git a/tntsearch.php b/tntsearch.php index 1394c05..9f2955e 100644 --- a/tntsearch.php +++ b/tntsearch.php @@ -4,6 +4,7 @@ use Composer\Autoload\ClassLoader; use Grav\Common\Grav; use Grav\Common\Page\Page; +use Grav\Common\Page\Pages; use Grav\Common\Plugin; use Grav\Common\Scheduler\Scheduler; use Grav\Plugin\TNTSearch\GravTNTSearch; @@ -315,6 +316,10 @@ public function onAdminTaskExecute(Event $e) */ public function onObjectSave($event) { + if (defined('CLI_DISABLE_TNTSEARCH')) { + return true; + } + $obj = $event['object'] ?: $event['page']; if ($obj) { @@ -332,6 +337,9 @@ public function onObjectSave($event) */ public function onObjectDelete($event) { + if (defined('CLI_DISABLE_TNTSEARCH')) { + return true; + } $obj = $event['object'] ?: $event['page']; if ($obj) { @@ -433,6 +441,9 @@ public static function indexJob() $language = $grav['language']; + /** @var Pages $pages */ + $pages = $grav['pages']; + ob_start(); if ($language->enabled()) { @@ -441,12 +452,23 @@ public static function indexJob() $language->setActive($lang); echo("\nLanguage: $lang\n"); - $grav['pages']->init(); + + if (method_exists($pages, 'enablePages')) { + $pages->enablePages(); + } else { + $pages->init(); + } + $gtnt = static::getSearchObjectType(); $gtnt->createIndex(); } } else { - $grav['pages']->init(); + if (method_exists($pages, 'enablePages')) { + $pages->enablePages(); + } else { + $pages->init(); + } + $gtnt = static::getSearchObjectType(); $gtnt->createIndex(); }