Skip to content

Commit

Permalink
Merge branch 'release/3.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Feb 3, 2020
2 parents cb529b8 + 3c5b5ea commit 431fd82
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 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
## 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
Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 24 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 @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -433,6 +441,9 @@ public static function indexJob()

$language = $grav['language'];

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

ob_start();

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

0 comments on commit 431fd82

Please sign in to comment.