diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index cece03476b..a2fd6dd7b1 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -323,24 +323,21 @@ class acp_search foreach ($this->search_backend_collection as $search) { - if ($search->is_available()) - { - $this->template->assign_block_vars('backends', [ - 'NAME' => $search->get_name(), - 'TYPE' => $search->get_type(), + $this->template->assign_block_vars('backends', [ + 'NAME' => $search->get_name(), + 'TYPE' => $search->get_type(), - 'S_ACTIVE' => $search->get_type() === $this->config['search_type'], - 'S_HIDDEN_FIELDS' => build_hidden_fields(['search_type' => $search->get_type()]), - 'S_INDEXED' => $search->index_created(), - 'S_STATS' => $search->index_stats(), - ]); - - $this->template->assign_vars([ - 'U_ACTION' => $this->u_action . '&hash=' . generate_link_hash('acp_search'), - 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&action=progress_bar'), - ]); - } + 'S_ACTIVE' => $search->get_type() === $this->config['search_type'], + 'S_HIDDEN_FIELDS' => build_hidden_fields(['search_type' => $search->get_type()]), + 'S_INDEXED' => $search->index_created(), + 'S_STATS' => $search->index_stats(), + ]); } + + $this->template->assign_vars([ + 'U_ACTION' => $this->u_action . '&hash=' . generate_link_hash('acp_search'), + 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&action=progress_bar'), + ]); } /** diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php index 82c1c3d62a..ac1f642b26 100644 --- a/phpBB/language/en/cli.php +++ b/phpBB/language/en/cli.php @@ -152,8 +152,6 @@ $lang = array_merge($lang, array( 'CLI_SEARCHINDEX_CREATE_FAILURE' => 'Error creating search index', 'CLI_SEARCHINDEX_DELETE_SUCCESS' => 'Search index deleted successfully', 'CLI_SEARCHINDEX_DELETE_FAILURE' => 'Error deleting search index', - 'CLI_SEARCHINDEX_ALREADY_CREATED' => 'Search index is already created, try removing it first', - 'CLI_SEARCHINDEX_NO_CREATED' => 'Search index is already empty, try creating it first', 'CLI_SEARCHINDEX_ACTION_IN_PROGRESS' => 'There is an action currently in progress. CLI doesn\'t support incomplete index/delete actions, please solve it from the ACP', 'CLI_SEARCHINDEX_ACTIVE_NOT_INDEXED' => 'Active search backend isn\'t indexed', diff --git a/phpBB/phpbb/console/command/searchindex/create.php b/phpBB/phpbb/console/command/searchindex/create.php index 0bd291b99e..f10184eb4f 100644 --- a/phpBB/phpbb/console/command/searchindex/create.php +++ b/phpBB/phpbb/console/command/searchindex/create.php @@ -18,7 +18,6 @@ use phpbb\console\command\command; use phpbb\language\language; use phpbb\log\log; use phpbb\post\post_helper; -use phpbb\search\exception\index_created_exception; use phpbb\search\exception\no_search_backend_found_exception; use phpbb\search\search_backend_factory; use phpbb\search\state_helper; @@ -146,12 +145,6 @@ class create extends command $io->newLine(2); } - catch (index_created_exception $e) - { - $this->state_helper->clear_state(); - $io->error($this->language->lang('CLI_SEARCHINDEX_ALREADY_CREATED', $name)); - return command::FAILURE; - } catch (\Exception $e) { $io->error($this->language->lang('CLI_SEARCHINDEX_CREATE_FAILURE', $name)); diff --git a/phpBB/phpbb/console/command/searchindex/delete.php b/phpBB/phpbb/console/command/searchindex/delete.php index 8ffaa808f3..6981ef9807 100644 --- a/phpBB/phpbb/console/command/searchindex/delete.php +++ b/phpBB/phpbb/console/command/searchindex/delete.php @@ -18,7 +18,6 @@ use phpbb\console\command\command; use phpbb\language\language; use phpbb\log\log; use phpbb\post\post_helper; -use phpbb\search\exception\index_empty_exception; use phpbb\search\exception\no_search_backend_found_exception; use phpbb\search\search_backend_factory; use phpbb\search\state_helper; @@ -146,12 +145,6 @@ class delete extends command $io->newLine(2); } - catch (index_empty_exception $e) - { - $this->state_helper->clear_state(); - $io->error($this->language->lang('CLI_SEARCHINDEX_NO_CREATED', $name)); - return command::FAILURE; - } catch (\Exception $e) { $io->error($this->language->lang('CLI_SEARCHINDEX_DELETE_FAILURE', $name)); diff --git a/phpBB/phpbb/search/backend/base.php b/phpBB/phpbb/search/backend/base.php index e554e0cc71..2ddd893400 100644 --- a/phpBB/phpbb/search/backend/base.php +++ b/phpBB/phpbb/search/backend/base.php @@ -16,8 +16,6 @@ namespace phpbb\search\backend; use phpbb\cache\service; use phpbb\config\config; use phpbb\db\driver\driver_interface; -use phpbb\search\exception\index_created_exception; -use phpbb\search\exception\index_empty_exception; use phpbb\user; /** @@ -332,11 +330,6 @@ abstract class base implements search_backend_interface */ public function create_index(int &$post_counter = 0): ?array { - if ($this->index_created()) - { - throw new index_created_exception(); - } - $max_post_id = $this->get_max_post_id(); $forums_indexing_enabled = $this->forum_ids_with_indexing_enabled(); @@ -399,11 +392,6 @@ abstract class base implements search_backend_interface */ public function delete_index(int &$post_counter = null): ?array { - if (!$this->index_created()) - { - throw new index_empty_exception(); - } - $max_post_id = $this->get_max_post_id(); $starttime = microtime(true); diff --git a/phpBB/phpbb/search/backend/fulltext_mysql.php b/phpBB/phpbb/search/backend/fulltext_mysql.php index e9fce05fc1..6b30408ce8 100644 --- a/phpBB/phpbb/search/backend/fulltext_mysql.php +++ b/phpBB/phpbb/search/backend/fulltext_mysql.php @@ -17,8 +17,6 @@ use phpbb\config\config; use phpbb\db\driver\driver_interface; use phpbb\event\dispatcher_interface; use phpbb\language\language; -use phpbb\search\exception\index_created_exception; -use phpbb\search\exception\index_empty_exception; use phpbb\search\exception\search_exception; use phpbb\user; @@ -916,11 +914,6 @@ class fulltext_mysql extends base implements search_backend_interface */ public function create_index(int &$post_counter = 0): ?array { - if ($this->index_created()) - { - throw new index_created_exception(); - } - // Make sure we can actually use MySQL with fulltext indexes if ($error = $this->init()) { @@ -993,11 +986,6 @@ class fulltext_mysql extends base implements search_backend_interface */ public function delete_index(int &$post_counter = null): ?array { - if (!$this->index_created()) - { - throw new index_empty_exception(); - } - // Make sure we can actually use MySQL with fulltext indexes if ($error = $this->init()) { diff --git a/phpBB/phpbb/search/backend/fulltext_native.php b/phpBB/phpbb/search/backend/fulltext_native.php index dac6ebf803..57e5ba99d6 100644 --- a/phpBB/phpbb/search/backend/fulltext_native.php +++ b/phpBB/phpbb/search/backend/fulltext_native.php @@ -17,7 +17,6 @@ use phpbb\config\config; use phpbb\db\driver\driver_interface; use phpbb\event\dispatcher_interface; use phpbb\language\language; -use phpbb\search\exception\index_empty_exception; use phpbb\user; /** @@ -1615,11 +1614,6 @@ class fulltext_native extends base implements search_backend_interface */ public function delete_index(int &$post_counter = null): ?array { - if (!$this->index_created()) - { - throw new index_empty_exception(); - } - $sql_queries = []; switch ($this->db->get_sql_layer()) diff --git a/phpBB/phpbb/search/backend/fulltext_postgres.php b/phpBB/phpbb/search/backend/fulltext_postgres.php index 9b9822d2da..fbd10dd081 100644 --- a/phpBB/phpbb/search/backend/fulltext_postgres.php +++ b/phpBB/phpbb/search/backend/fulltext_postgres.php @@ -17,8 +17,6 @@ use phpbb\config\config; use phpbb\db\driver\driver_interface; use phpbb\event\dispatcher_interface; use phpbb\language\language; -use phpbb\search\exception\index_created_exception; -use phpbb\search\exception\index_empty_exception; use phpbb\search\exception\search_exception; use phpbb\user; @@ -871,11 +869,6 @@ class fulltext_postgres extends base implements search_backend_interface */ public function create_index(int &$post_counter = 0): ?array { - if ($this->index_created()) - { - throw new index_created_exception(); - } - // Make sure we can actually use PostgreSQL with fulltext indexes if ($error = $this->init()) { @@ -935,11 +928,6 @@ class fulltext_postgres extends base implements search_backend_interface */ public function delete_index(int &$post_counter = null): ?array { - if (!$this->index_created()) - { - throw new index_empty_exception(); - } - // Make sure we can actually use PostgreSQL with fulltext indexes if ($error = $this->init()) { diff --git a/phpBB/phpbb/search/backend/fulltext_sphinx.php b/phpBB/phpbb/search/backend/fulltext_sphinx.php index 53342e6214..8023bc161a 100644 --- a/phpBB/phpbb/search/backend/fulltext_sphinx.php +++ b/phpBB/phpbb/search/backend/fulltext_sphinx.php @@ -20,7 +20,6 @@ use phpbb\db\tools\tools_interface; use phpbb\event\dispatcher_interface; use phpbb\language\language; use phpbb\log\log; -use phpbb\search\exception\index_empty_exception; use phpbb\user; /** @@ -632,11 +631,6 @@ class fulltext_sphinx implements search_backend_interface */ public function create_index(int &$post_counter = 0): ?array { - if ($this->index_created()) - { - throw new index_empty_exception(); - } - $table_data = array( 'COLUMNS' => array( 'counter_id' => array('UINT', 0), @@ -664,11 +658,6 @@ class fulltext_sphinx implements search_backend_interface */ public function delete_index(int &$post_counter = null): ?array { - if (!$this->index_created()) - { - throw new index_empty_exception(); - } - $this->db_tools->sql_table_drop(SPHINX_TABLE); return null; diff --git a/phpBB/phpbb/search/exception/index_created_exception.php b/phpBB/phpbb/search/exception/index_created_exception.php deleted file mode 100644 index e46f995baf..0000000000 --- a/phpBB/phpbb/search/exception/index_created_exception.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @license GNU General Public License, version 2 (GPL-2.0) - * - * For full copyright and license information, please see - * the docs/CREDITS.txt file. - * - */ - -namespace phpbb\search\exception; - -class index_created_exception extends search_exception -{ - -} diff --git a/phpBB/phpbb/search/exception/index_empty_exception.php b/phpBB/phpbb/search/exception/index_empty_exception.php deleted file mode 100644 index 6045866235..0000000000 --- a/phpBB/phpbb/search/exception/index_empty_exception.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @license GNU General Public License, version 2 (GPL-2.0) - * - * For full copyright and license information, please see - * the docs/CREDITS.txt file. - * - */ - -namespace phpbb\search\exception; - -class index_empty_exception extends search_exception -{ - -}