mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/12683] Remove check to avoid index twice (ticket 16755)
PHPBB3-12683
This commit is contained in:
parent
1cef5f83a0
commit
9a6d42770e
11 changed files with 13 additions and 123 deletions
|
@ -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'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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',
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @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
|
||||
{
|
||||
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @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
|
||||
{
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue