mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/12683] Code review
PHPBB3-12683
This commit is contained in:
@@ -21,6 +21,7 @@ use phpbb\search\exception\no_search_backend_found_exception;
|
||||
use phpbb\search\search_backend_factory;
|
||||
use phpbb\search\state_helper;
|
||||
use phpbb\user;
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -108,13 +109,13 @@ class create extends command
|
||||
catch (no_search_backend_found_exception $e)
|
||||
{
|
||||
$io->error($this->language->lang('CLI_SEARCHINDEX_BACKEND_NOT_FOUND', $search_backend));
|
||||
return command::FAILURE;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
if ($this->state_helper->is_action_in_progress())
|
||||
{
|
||||
$io->error($this->language->lang('CLI_SEARCHINDEX_ACTION_IN_PROGRESS', $search_backend));
|
||||
return command::FAILURE;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
try
|
||||
@@ -130,7 +131,6 @@ class create extends command
|
||||
{
|
||||
$this->state_helper->update_counter($status['post_counter']);
|
||||
|
||||
$progress->setMaxSteps($status['max_post_id']);
|
||||
$progress->setProgress($status['post_counter']);
|
||||
$progress->setMessage(round($status['rows_per_second'], 2) . ' rows/s');
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class create extends command
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$io->error($this->language->lang('CLI_SEARCHINDEX_CREATE_FAILURE', $name));
|
||||
return command::FAILURE;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
$search->tidy();
|
||||
@@ -152,6 +152,6 @@ class create extends command
|
||||
$this->log->add('admin', ANONYMOUS, '', 'LOG_SEARCH_INDEX_CREATED', false, array($name));
|
||||
$io->success($this->language->lang('CLI_SEARCHINDEX_CREATE_SUCCESS', $name));
|
||||
|
||||
return command::SUCCESS;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ use phpbb\search\exception\no_search_backend_found_exception;
|
||||
use phpbb\search\search_backend_factory;
|
||||
use phpbb\search\state_helper;
|
||||
use phpbb\user;
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -108,13 +109,13 @@ class delete extends command
|
||||
catch (no_search_backend_found_exception $e)
|
||||
{
|
||||
$io->error($this->language->lang('CLI_SEARCHINDEX_BACKEND_NOT_FOUND', $search_backend));
|
||||
return command::FAILURE;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
if ($this->state_helper->is_action_in_progress())
|
||||
{
|
||||
$io->error($this->language->lang('CLI_SEARCHINDEX_ACTION_IN_PROGRESS', $search_backend));
|
||||
return command::FAILURE;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
try
|
||||
@@ -130,7 +131,6 @@ class delete extends command
|
||||
{
|
||||
$this->state_helper->update_counter($status['post_counter']);
|
||||
|
||||
$progress->setMaxSteps($status['max_post_id']);
|
||||
$progress->setProgress($status['post_counter']);
|
||||
$progress->setMessage(round($status['rows_per_second'], 2) . ' rows/s');
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class delete extends command
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$io->error($this->language->lang('CLI_SEARCHINDEX_DELETE_FAILURE', $name));
|
||||
return command::FAILURE;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
$search->tidy();
|
||||
@@ -152,6 +152,6 @@ class delete extends command
|
||||
$this->log->add('admin', ANONYMOUS, '', 'LOG_SEARCH_INDEX_REMOVED', false, array($name));
|
||||
$io->success($this->language->lang('CLI_SEARCHINDEX_DELETE_SUCCESS', $name));
|
||||
|
||||
return command::SUCCESS;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use phpbb\console\command\command;
|
||||
use phpbb\di\service_collection;
|
||||
use phpbb\language\language;
|
||||
use phpbb\user;
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
@@ -92,6 +93,6 @@ class list_all extends command
|
||||
|
||||
$io->listing($search_backends);
|
||||
|
||||
return command::SUCCESS;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -93,19 +93,13 @@ class fulltext_native extends base implements search_backend_interface
|
||||
*/
|
||||
protected $phpbb_dispatcher;
|
||||
|
||||
/**
|
||||
* @var language
|
||||
*/
|
||||
/** @var language */
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
/** @var string */
|
||||
protected $search_wordlist_table;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
/** @var string */
|
||||
protected $search_wordmatch_table;
|
||||
|
||||
/**
|
||||
|
@@ -44,7 +44,7 @@ class state_helper
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if there is an action in progress
|
||||
* Returns whether there is an action in progress
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -101,7 +101,7 @@ class state_helper
|
||||
*/
|
||||
public function init(string $search_type, string $action): void
|
||||
{
|
||||
// Is not possible to start a new process when there is one already running
|
||||
// It's not possible to start a new process when there is one already running
|
||||
if ($this->is_action_in_progress())
|
||||
{
|
||||
throw new action_in_progress_exception();
|
||||
@@ -158,7 +158,7 @@ class state_helper
|
||||
*/
|
||||
private function load_state(): array
|
||||
{
|
||||
// Is not possible to execute an action over state if is empty
|
||||
// Is not possible to execute an action over state if it's empty
|
||||
if (!$this->is_action_in_progress())
|
||||
{
|
||||
throw new no_action_in_progress_exception();
|
||||
|
Reference in New Issue
Block a user