From 7672fa9408c399a8c362d644ea413ad4da31b4ac Mon Sep 17 00:00:00 2001 From: Norbert Micheel Date: Tue, 16 Aug 2022 21:13:00 +0200 Subject: [PATCH] Fix autoreindex on yform change for PHP 8.1 --- CHANGELOG.md | 3 +++ lib/search_it.php | 12 ++++++++---- package.yml | 2 +- plugins/autocomplete/package.yml | 2 +- plugins/documentation/package.yml | 2 +- plugins/plaintext/package.yml | 2 +- plugins/stats/package.yml | 2 +- 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca6dc59..f90b6f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +## Version 6.9.3 (2022-08-16) +- Fix autoreindex on yform change for PHP 8.1 (#337) thx @gharlan + ## Version 6.9.2 (2022-08-16) - Fix stats PlugIn for PHP 8.1 diff --git a/lib/search_it.php b/lib/search_it.php index cf85b5f..451576b 100644 --- a/lib/search_it.php +++ b/lib/search_it.php @@ -1141,7 +1141,7 @@ private static function getMaxFID($_table) public function deleteIndex() { $delete = rex_sql::factory(); - $delete->setQuery('TRUNCATE '. self::getTempTablePrefix() .'search_it_index'); + $delete->setQuery('TRUNCATE ' . self::getTempTablePrefix() . 'search_it_index'); $this->deleteCache(); } @@ -2000,9 +2000,13 @@ public function deleteCache($_indexIds = false) if ($_indexIds === false) { // delete entire search-cache $delete = rex_sql::factory(); - $delete->setQuery('TRUNCATE '. self::getTempTablePrefix() . 'search_it_cacheindex_ids'); - $delete->setQuery('TRUNCATE '. self::getTempTablePrefix() . 'search_it_cache'); - + if ($delete->inTransaction()) { + $delete->setQuery('DELETE FROM ' . self::getTempTablePrefix() . 'search_it_cacheindex_ids'); + $delete->setQuery('DELETE FROM ' . self::getTempTablePrefix() . 'search_it_cache'); + } else { + $delete->setQuery('TRUNCATE ' . self::getTempTablePrefix() . 'search_it_cacheindex_ids'); + $delete->setQuery('TRUNCATE ' . self::getTempTablePrefix() . 'search_it_cache'); + } } elseif (is_array($_indexIds) AND !empty($_indexIds)) { $sql = rex_sql::factory(); diff --git a/package.yml b/package.yml index c0b1af7..543be79 100644 --- a/package.yml +++ b/package.yml @@ -1,5 +1,5 @@ package: search_it -version: '6.9.2' +version: '6.9.3' author: Friends Of REDAXO supportpage: https://github.com/FriendsOfREDAXO/search_it diff --git a/plugins/autocomplete/package.yml b/plugins/autocomplete/package.yml index 8072f9d..fed88de 100644 --- a/plugins/autocomplete/package.yml +++ b/plugins/autocomplete/package.yml @@ -1,5 +1,5 @@ package: search_it/autocomplete -version: '6.9.2' +version: '6.9.3' author: Manétage title: 'translate:search_it_autocomplete_plugin_title' diff --git a/plugins/documentation/package.yml b/plugins/documentation/package.yml index d517dd6..0d088dd 100644 --- a/plugins/documentation/package.yml +++ b/plugins/documentation/package.yml @@ -1,5 +1,5 @@ package: search_it/documentation -version: '6.9.2' +version: '6.9.3' author: Friends Of REDAXO title: 'translate:search_it_documentation_title' diff --git a/plugins/plaintext/package.yml b/plugins/plaintext/package.yml index c90e389..9023cdc 100644 --- a/plugins/plaintext/package.yml +++ b/plugins/plaintext/package.yml @@ -1,5 +1,5 @@ package: search_it/plaintext -version: '6.9.2' +version: '6.9.3' author: Friends Of REDAXO title: 'translate:search_it_plaintext_title' diff --git a/plugins/stats/package.yml b/plugins/stats/package.yml index ad282d5..bda3dd6 100644 --- a/plugins/stats/package.yml +++ b/plugins/stats/package.yml @@ -1,5 +1,5 @@ package: search_it/stats -version: '6.9.2' +version: '6.9.3' author: Friends Of REDAXO title: 'translate:search_it_stats_plugin_title'