From 891aab05935e9ebc237a83cef0b248998cb5fccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sat, 11 Mar 2017 20:34:40 +0100 Subject: [PATCH 1/5] [ticket/15123] add check before enable or disable extension PHPBB3-15123 --- phpBB/language/en/cli.php | 2 ++ phpBB/phpbb/console/command/extension/disable.php | 7 +++++++ phpBB/phpbb/console/command/extension/enable.php | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php index 9940609364..35f56be008 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_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', diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index d022755753..be5c77a9a0 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_ALREADY_DISABLED', $name)); + return 1; + } + $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..2de7498c71 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_ALREADY_ENABLED', $name)); + return 1; + } + $this->manager->enable($name); $this->manager->load_extensions(); From 68c167fe7a5f0c86d97c9c3dda30f66d9df5b032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sat, 11 Mar 2017 20:39:16 +0100 Subject: [PATCH 2/5] [ticket/15123] removed blank spaces PHPBB3-15123 --- phpBB/phpbb/console/command/extension/disable.php | 2 +- phpBB/phpbb/console/command/extension/enable.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index be5c77a9a0..323f9b6d83 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -43,7 +43,7 @@ class disable extends command $io->error($this->user->lang('CLI_EXTENSION_ALREADY_DISABLED', $name)); return 1; } - + $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 2de7498c71..e6b5f66c7f 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -43,7 +43,7 @@ class enable extends command $io->error($this->user->lang('CLI_EXTENSION_ALREADY_ENABLED', $name)); return 1; } - + $this->manager->enable($name); $this->manager->load_extensions(); From 8994295f2b7d5b2beece7bbd8f7a2861fa15625d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sat, 11 Mar 2017 23:03:31 +0100 Subject: [PATCH 3/5] [ticket/15123] modified language string PHPBB3-15123 --- phpBB/language/en/cli.php | 4 ++-- phpBB/phpbb/console/command/extension/disable.php | 2 +- phpBB/phpbb/console/command/extension/enable.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php index 35f56be008..44b17c3147 100644 --- a/phpBB/language/en/cli.php +++ b/phpBB/language/en/cli.php @@ -110,10 +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_DISABLE_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_ALREADY_ENABLED' => 'Extension %s was already enabled', + 'CLI_EXTENSION_ENABLE_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', diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index 323f9b6d83..05f7ce9704 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -40,7 +40,7 @@ class disable extends command if (!$this->manager->is_enabled($name)) { - $io->error($this->user->lang('CLI_EXTENSION_ALREADY_DISABLED', $name)); + $io->error($this->user->lang('CLI_EXTENSION_DISABLE_DISABLED', $name)); return 1; } diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index e6b5f66c7f..c7c336cdc9 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -40,7 +40,7 @@ class enable extends command if ($this->manager->is_enabled($name)) { - $io->error($this->user->lang('CLI_EXTENSION_ALREADY_ENABLED', $name)); + $io->error($this->user->lang('CLI_EXTENSION_ENABLE_ENABLED', $name)); return 1; } From 9b3609d6f60af328e6681146014453da0af4ee01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sun, 12 Mar 2017 22:44:18 +0100 Subject: [PATCH 4/5] [ticket/15123] modified language strings PHPBB3-15123 --- phpBB/language/en/cli.php | 4 ++-- phpBB/phpbb/console/command/extension/disable.php | 2 +- phpBB/phpbb/console/command/extension/enable.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php index 44b17c3147..9b3fa7f32c 100644 --- a/phpBB/language/en/cli.php +++ b/phpBB/language/en/cli.php @@ -110,10 +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_DISABLE_DISABLED' => 'Extension %s is not enabled', + '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_ENABLE_ENABLED' => 'Extension %s was already enabled', + '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 05f7ce9704..12674c16cb 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -40,7 +40,7 @@ class disable extends command if (!$this->manager->is_enabled($name)) { - $io->error($this->user->lang('CLI_EXTENSION_DISABLE_DISABLED', $name)); + $io->error($this->user->lang('CLI_EXTENSION_DISABLED', $name)); return 1; } diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index c7c336cdc9..079e4ce1f6 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -40,7 +40,7 @@ class enable extends command if ($this->manager->is_enabled($name)) { - $io->error($this->user->lang('CLI_EXTENSION_ENABLE_ENABLED', $name)); + $io->error($this->user->lang('CLI_EXTENSION_ENABLED', $name)); return 1; } From 45f0adcd0a4e6c7e43183fe641fa03ef2d90d45b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sun, 12 Mar 2017 22:45:33 +0100 Subject: [PATCH 5/5] [ticket/15123] modified return error codes PHPBB3-15123 --- phpBB/phpbb/console/command/extension/disable.php | 2 +- phpBB/phpbb/console/command/extension/enable.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index 12674c16cb..b2e10fb960 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -41,7 +41,7 @@ class disable extends command if (!$this->manager->is_enabled($name)) { $io->error($this->user->lang('CLI_EXTENSION_DISABLED', $name)); - return 1; + return 2; } $this->manager->disable($name); diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 079e4ce1f6..a8312d5c15 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -41,7 +41,7 @@ class enable extends command if ($this->manager->is_enabled($name)) { $io->error($this->user->lang('CLI_EXTENSION_ENABLED', $name)); - return 1; + return 2; } $this->manager->enable($name);