diff options
author | Marc Alexander <admin@m-a-styles.de> | 2018-02-22 20:34:24 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2018-02-22 20:34:24 +0100 |
commit | 50cf6443b981c6072f5a42c60b8dea3d548345c8 (patch) | |
tree | 2d44b54d84e5abe5c9ef6957b8f8f819718dd009 /phpBB/phpbb/search/fulltext_native.php | |
parent | cf517509c86c8a747dc0c58e61cb3f9d4535deae (diff) | |
parent | a6dc32b381dea235c979d089fc7897dd7e213011 (diff) | |
download | forums-50cf6443b981c6072f5a42c60b8dea3d548345c8.tar forums-50cf6443b981c6072f5a42c60b8dea3d548345c8.tar.gz forums-50cf6443b981c6072f5a42c60b8dea3d548345c8.tar.bz2 forums-50cf6443b981c6072f5a42c60b8dea3d548345c8.tar.xz forums-50cf6443b981c6072f5a42c60b8dea3d548345c8.zip |
Merge pull request #5131 from kasimi/ticket/15561
[ticket/15561] Add events for adding columns to search index
Diffstat (limited to 'phpBB/phpbb/search/fulltext_native.php')
-rw-r--r-- | phpBB/phpbb/search/fulltext_native.php | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index eb972a257a..4172e2cc4f 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -1696,20 +1696,43 @@ class fulltext_native extends \phpbb\search\base */ public function delete_index($acp_module, $u_action) { + $sql_queries = []; + switch ($this->db->get_sql_layer()) { case 'sqlite3': - $this->db->sql_query('DELETE FROM ' . SEARCH_WORDLIST_TABLE); - $this->db->sql_query('DELETE FROM ' . SEARCH_WORDMATCH_TABLE); - $this->db->sql_query('DELETE FROM ' . SEARCH_RESULTS_TABLE); + $sql_queries[] = 'DELETE FROM ' . SEARCH_WORDLIST_TABLE; + $sql_queries[] = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE; + $sql_queries[] = 'DELETE FROM ' . SEARCH_RESULTS_TABLE; break; default: - $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_WORDLIST_TABLE); - $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_WORDMATCH_TABLE); - $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); + $sql_queries[] = 'TRUNCATE TABLE ' . SEARCH_WORDLIST_TABLE; + $sql_queries[] = 'TRUNCATE TABLE ' . SEARCH_WORDMATCH_TABLE; + $sql_queries[] = 'TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE; break; } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the native search index is deleted + * + * @event core.search_native_delete_index_before + * @var array sql_queries Array with queries for deleting the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_delete_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } } /** |