Skip to content

Commit

Permalink
Fixed an issue indexing via Admin with Grav 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Jan 21, 2020
1 parent 35859bb commit 3105b20
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# v3.0.1
## mm/dd/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
Expand Down
19 changes: 17 additions & 2 deletions tntsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -440,6 +441,9 @@ public static function indexJob()

$language = $grav['language'];

/** @var Pages $pages */
$pages = $grav['pages'];

ob_start();

if ($language->enabled()) {
Expand All @@ -448,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();
}
Expand Down

0 comments on commit 3105b20

Please sign in to comment.