1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-22 08:30:26 +01:00

[ticket/15123] add check before enable or disable extension

PHPBB3-15123
This commit is contained in:
Rubén Calvo 2017-03-11 20:34:40 +01:00
parent 5d597787eb
commit 891aab0593
3 changed files with 16 additions and 0 deletions

View File

@ -110,8 +110,10 @@ $lang = array_merge($lang, array(
'CLI_EXTENSION_DISABLE_FAILURE' => 'Could not disable extension %s',
'CLI_EXTENSION_DISABLE_SUCCESS' => 'Successfully disabled extension %s',
'CLI_EXTENSION_ALREADY_DISABLED' => 'Extension %s was already disabled',
'CLI_EXTENSION_ENABLE_FAILURE' => 'Could not enable extension %s',
'CLI_EXTENSION_ENABLE_SUCCESS' => 'Successfully enabled extension %s',
'CLI_EXTENSION_ALREADY_ENABLED' => 'Extension %s was already enabled',
'CLI_EXTENSION_NAME' => 'Name of the extension',
'CLI_EXTENSION_PURGE_FAILURE' => 'Could not purge extension %s',
'CLI_EXTENSION_PURGE_SUCCESS' => 'Successfully purged extension %s',

View File

@ -37,6 +37,13 @@ class disable extends command
$io = new SymfonyStyle($input, $output);
$name = $input->getArgument('extension-name');
if (!$this->manager->is_enabled($name))
{
$io->error($this->user->lang('CLI_EXTENSION_ALREADY_DISABLED', $name));
return 1;
}
$this->manager->disable($name);
$this->manager->load_extensions();

View File

@ -37,6 +37,13 @@ class enable extends command
$io = new SymfonyStyle($input, $output);
$name = $input->getArgument('extension-name');
if ($this->manager->is_enabled($name))
{
$io->error($this->user->lang('CLI_EXTENSION_ALREADY_ENABLED', $name));
return 1;
}
$this->manager->enable($name);
$this->manager->load_extensions();