mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/12683] Remove check to avoid index twice (ticket 16755)
PHPBB3-12683
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user