diff options
author | Tristan Darricau <github@nicofuma.fr> | 2017-03-19 18:17:41 +0100 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2017-03-19 18:17:41 +0100 |
commit | 4b6b73ea9d85e24bb69a58197973686411391f9c (patch) | |
tree | a64cc8f14d1672c327578d3fd18c5bdce6345cb0 | |
parent | 0730d142475aee08285b5cb466a9c45c520f59c0 (diff) | |
parent | 45f0adcd0a4e6c7e43183fe641fa03ef2d90d45b (diff) | |
download | forums-4b6b73ea9d85e24bb69a58197973686411391f9c.tar forums-4b6b73ea9d85e24bb69a58197973686411391f9c.tar.gz forums-4b6b73ea9d85e24bb69a58197973686411391f9c.tar.bz2 forums-4b6b73ea9d85e24bb69a58197973686411391f9c.tar.xz forums-4b6b73ea9d85e24bb69a58197973686411391f9c.zip |
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
-rw-r--r-- | phpBB/language/en/cli.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/console/command/extension/disable.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/console/command/extension/enable.php | 7 |
3 files changed, 16 insertions, 0 deletions
diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php index 9940609364..9b3fa7f32c 100644 --- a/phpBB/language/en/cli.php +++ b/phpBB/language/en/cli.php @@ -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', diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index d022755753..b2e10fb960 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -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(); diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 14077d688b..a8312d5c15 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -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(); |