1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-24 09:30:34 +01:00

Merge pull request #4736 from rubencm/ticket/15123

[ticket/15123] Check if extension was enabled/disabled before enable or disable

* rubencm/ticket/15123:
  [ticket/15123] modified return error codes
  [ticket/15123] modified language strings
  [ticket/15123] modified language string
  [ticket/15123] removed blank spaces
  [ticket/15123] add check before enable or disable extension
This commit is contained in:
Tristan Darricau 2017-03-19 18:17:41 +01:00
commit 4b6b73ea9d
No known key found for this signature in database
GPG Key ID: 817043C2E29DB881
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_DISABLED' => 'Extension %s is not enabled',
'CLI_EXTENSION_ENABLE_FAILURE' => 'Could not enable extension %s',
'CLI_EXTENSION_ENABLE_SUCCESS' => 'Successfully enabled extension %s',
'CLI_EXTENSION_ENABLED' => 'Extension %s is 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_DISABLED', $name));
return 2;
}
$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_ENABLED', $name));
return 2;
}
$this->manager->enable($name);
$this->manager->load_extensions();