From 743a0560c3cced8c37b5ae840e449a60a0b51a33 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 3 Nov 2013 04:14:36 +0100 Subject: [ticket/11998] Add console command for recalculating email hash. PHPBB3-11998 --- .../command/fixup/recalculate_email_hash.php | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 phpBB/phpbb/console/command/fixup/recalculate_email_hash.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php new file mode 100644 index 0000000000..b788fe5631 --- /dev/null +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -0,0 +1,72 @@ +db = $db; + + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('fixup:recalculate-email-hash') + ->setDescription('Recalculates the user_email_hash column of the users table.') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $sql = 'SELECT user_id, user_email, user_email_hash + FROM ' . USERS_TABLE . ' + WHERE user_type <> ' . USER_IGNORE . " + AND user_email <> ''"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $user_email_hash = phpbb_email_hash($row['user_email']); + if ($user_email_hash !== $row['user_email_hash']) + { + $sql_ary = array( + 'user_email_hash' => $user_email_hash, + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . (int) $row['user_id']; + $this->db->sql_query($sql); + + if ($output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) + { + $output->writeln(sprintf( + 'user_id %d, email %s => %s', + $row['user_id'], + $row['user_email'], + $user_email_hash + )); + } + } + } + $this->db->sql_freeresult($result); + + $output->writeln('Successfully recalculated all email hashes.'); + } +} -- cgit v1.2.1 From 73ea5daf97bf5447b9bb2ff912cce4a9ea21c58e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 5 Nov 2013 19:42:34 +0100 Subject: [ticket/11998] Add phpBB abstraction for application and command. PHPBB3-11998 --- phpBB/phpbb/console/command/command.php | 14 ++++++++++++++ .../phpbb/console/command/fixup/recalculate_email_hash.php | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 phpBB/phpbb/console/command/command.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/command.php b/phpBB/phpbb/console/command/command.php new file mode 100644 index 0000000000..6abbdd203c --- /dev/null +++ b/phpBB/phpbb/console/command/command.php @@ -0,0 +1,14 @@ + Date: Tue, 5 Nov 2013 21:40:42 +0100 Subject: [ticket/11998] Turn develop/extensions.php into console commands. PHPBB3-11998 --- phpBB/phpbb/console/command/extension/command.php | 22 +++++++++ phpBB/phpbb/console/command/extension/disable.php | 47 ++++++++++++++++++ phpBB/phpbb/console/command/extension/enable.php | 47 ++++++++++++++++++ phpBB/phpbb/console/command/extension/purge.php | 47 ++++++++++++++++++ phpBB/phpbb/console/command/extension/show.php | 58 +++++++++++++++++++++++ 5 files changed, 221 insertions(+) create mode 100644 phpBB/phpbb/console/command/extension/command.php create mode 100644 phpBB/phpbb/console/command/extension/disable.php create mode 100644 phpBB/phpbb/console/command/extension/enable.php create mode 100644 phpBB/phpbb/console/command/extension/purge.php create mode 100644 phpBB/phpbb/console/command/extension/show.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php new file mode 100644 index 0000000000..edde7ce2e2 --- /dev/null +++ b/phpBB/phpbb/console/command/extension/command.php @@ -0,0 +1,22 @@ +manager = $manager; + + parent::__construct(); + } +} diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php new file mode 100644 index 0000000000..e4de70ca34 --- /dev/null +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -0,0 +1,47 @@ +setName('extension:disable') + ->setDescription('Disables the specified extension.') + ->addArgument( + 'extension-name', + InputArgument::REQUIRED, + 'Name of the extension' + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $name = $input->getArgument('extension-name'); + $this->manager->disable($name); + $this->manager->load_extensions(); + + if ($this->manager->enabled($name)) + { + $output->writeln("Could not disable extension $name"); + return 1; + } + else + { + $output->writeln("Successfully disabled extension $name"); + return 0; + } + } +} diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php new file mode 100644 index 0000000000..ee7dae76aa --- /dev/null +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -0,0 +1,47 @@ +setName('extension:enable') + ->setDescription('Enables the specified extension.') + ->addArgument( + 'extension-name', + InputArgument::REQUIRED, + 'Name of the extension' + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $name = $input->getArgument('extension-name'); + $this->manager->enable($name); + $this->manager->load_extensions(); + + if ($this->manager->enabled($name)) + { + $output->writeln("Successfully enabled extension $name"); + return 0; + } + else + { + $output->writeln("Could not enable extension $name"); + return 1; + } + } +} diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php new file mode 100644 index 0000000000..c2e1d2928c --- /dev/null +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -0,0 +1,47 @@ +setName('extension:purge') + ->setDescription('Purges the specified extension.') + ->addArgument( + 'extension-name', + InputArgument::REQUIRED, + 'Name of the extension' + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $name = $input->getArgument('extension-name'); + $this->manager->purge($name); + $this->manager->load_extensions(); + + if ($this->manager->enabled($name)) + { + $output->writeln("Could not purge extension $name"); + return 1; + } + else + { + $output->writeln("Successfully purge extension $name"); + return 0; + } + } +} diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php new file mode 100644 index 0000000000..0f48ac2379 --- /dev/null +++ b/phpBB/phpbb/console/command/extension/show.php @@ -0,0 +1,58 @@ +setName('extension:show') + ->setDescription('Lists all extensions in the database and on the filesystem.') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->manager->load_extensions(); + $all = array_keys($this->manager->all_available()); + + if (empty($all)) + { + $output->writeln('No extensions were found.'); + return 3; + } + + $enabled = array_keys($this->manager->all_enabled()); + $this->print_extension_list($output, 'Enabled', $enabled); + + $output->writeln(''); + + $disabled = array_keys($this->manager->all_disabled()); + $this->print_extension_list($output, 'Disabled', $disabled); + + $output->writeln(''); + + $purged = array_diff($all, $enabled, $disabled); + $this->print_extension_list($output, 'Available', $purged); + } + + protected function print_extension_list(OutputInterface $output, $type, array $extensions) + { + $output->writeln("$type:"); + + foreach ($extensions as $extension) + { + $output->writeln(" - $extension"); + } + } +} -- cgit v1.2.1 From d5743f008d9221f4199570fb0a6cb63d0cf88038 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 26 Nov 2013 18:11:54 +0100 Subject: [ticket/12039] Add config:* to the command line interface tool PHPBB3-12039 --- phpBB/phpbb/console/command/config/delete.php | 56 +++++++++++++++++ phpBB/phpbb/console/command/config/increment.php | 62 +++++++++++++++++++ phpBB/phpbb/console/command/config/set.php | 62 +++++++++++++++++++ phpBB/phpbb/console/command/config/set_atomic.php | 75 +++++++++++++++++++++++ 4 files changed, 255 insertions(+) create mode 100644 phpBB/phpbb/console/command/config/delete.php create mode 100644 phpBB/phpbb/console/command/config/increment.php create mode 100644 phpBB/phpbb/console/command/config/set.php create mode 100644 phpBB/phpbb/console/command/config/set_atomic.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php new file mode 100644 index 0000000000..1f397904ca --- /dev/null +++ b/phpBB/phpbb/console/command/config/delete.php @@ -0,0 +1,56 @@ +config = $config; + + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('config:delete') + ->setDescription('Sets a configuration option\'s value') + ->addArgument( + 'config-key', + InputArgument::REQUIRED, + 'The configuration option\'s name' + ) + ->addArgument( + 'use-cache', + InputArgument::OPTIONAL, + 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', + true + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $key = $input->getArgument('config-key'); + $use_cache = $input->getArgument('use-cache'); + $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + + $this->config->delete($key, $use_cache); + + $output->writeln("Successfully deleted config $key"); + } +} diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php new file mode 100644 index 0000000000..0974d34cc5 --- /dev/null +++ b/phpBB/phpbb/console/command/config/increment.php @@ -0,0 +1,62 @@ +config = $config; + + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('config:increment') + ->setDescription('Sets a configuration option\'s value') + ->addArgument( + 'config-key', + InputArgument::REQUIRED, + 'The configuration option\'s name' + ) + ->addArgument( + 'increment', + InputArgument::REQUIRED, + 'Amount to increment by' + ) + ->addArgument( + 'use-cache', + InputArgument::OPTIONAL, + 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', + true + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $key = $input->getArgument('config-key'); + $increment = $input->getArgument('increment'); + $use_cache = $input->getArgument('use-cache'); + $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + + $this->config->increment($key, $increment, $use_cache); + + $output->writeln("Successfully incremented config $key"); + } +} diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php new file mode 100644 index 0000000000..471a92ca8b --- /dev/null +++ b/phpBB/phpbb/console/command/config/set.php @@ -0,0 +1,62 @@ +config = $config; + + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('config:set') + ->setDescription('Sets a configuration option\'s value') + ->addArgument( + 'config-key', + InputArgument::REQUIRED, + 'The configuration option\'s name' + ) + ->addArgument( + 'config-value', + InputArgument::REQUIRED, + 'New configuration value' + ) + ->addArgument( + 'use-cache', + InputArgument::OPTIONAL, + 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', + true + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $key = $input->getArgument('config-key'); + $value = $input->getArgument('config-value'); + $use_cache = $input->getArgument('use-cache'); + $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + + $this->config->set($key, $value, $use_cache); + + $output->writeln("Successfully set config $key"); + } +} diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php new file mode 100644 index 0000000000..17583c89de --- /dev/null +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -0,0 +1,75 @@ +config = $config; + + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('config:set-atomic') + ->setDescription('Sets a configuration option\'s value') + ->addArgument( + 'config-key', + InputArgument::REQUIRED, + 'The configuration option\'s name' + ) + ->addArgument( + 'old-value', + InputArgument::REQUIRED, + 'Current configuration value' + ) + ->addArgument( + 'new-value', + InputArgument::REQUIRED, + 'New configuration value' + ) + ->addArgument( + 'use-cache', + InputArgument::OPTIONAL, + 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', + true + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $key = $input->getArgument('config-key'); + $old_value = $input->getArgument('old-value'); + $new_value = $input->getArgument('new-value'); + $use_cache = $input->getArgument('use-cache'); + $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + + if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache)) + { + $output->writeln("Successfully set config $key"); + return 0; + } + else + { + $output->writeln("Could not set config $key"); + return 1; + } + } +} -- cgit v1.2.1 From e6749261f1797cd4bb9b93398ed92ae5d9c32b26 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 27 Nov 2013 14:16:34 +0100 Subject: [ticket/12039] Use an abstract class and some more minor adjustments PHPBB3-12039 --- phpBB/phpbb/console/command/config/command.php | 22 +++++++++++ phpBB/phpbb/console/command/config/delete.php | 31 ++++----------- phpBB/phpbb/console/command/config/get.php | 44 ++++++++++++++++++++++ phpBB/phpbb/console/command/config/increment.php | 34 ++++++----------- phpBB/phpbb/console/command/config/set.php | 41 ++++++++------------ phpBB/phpbb/console/command/config/set_atomic.php | 46 +++++++++-------------- 6 files changed, 119 insertions(+), 99 deletions(-) create mode 100644 phpBB/phpbb/console/command/config/command.php create mode 100644 phpBB/phpbb/console/command/config/get.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/command.php b/phpBB/phpbb/console/command/config/command.php new file mode 100644 index 0000000000..b105bc826d --- /dev/null +++ b/phpBB/phpbb/console/command/config/command.php @@ -0,0 +1,22 @@ +config = $config; + + parent::__construct(); + } +} diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 1f397904ca..2b53f27098 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -10,46 +10,29 @@ namespace phpbb\console\command\config; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class delete extends \phpbb\console\command\command +class delete extends command { - /** @var \phpbb\config\config */ - protected $config; - - function __construct(\phpbb\config\config $config) - { - $this->config = $config; - - parent::__construct(); - } - protected function configure() { $this ->setName('config:delete') - ->setDescription('Sets a configuration option\'s value') + ->setDescription("Sets a configuration option's value") ->addArgument( - 'config-key', + 'key', InputArgument::REQUIRED, - 'The configuration option\'s name' - ) - ->addArgument( - 'use-cache', - InputArgument::OPTIONAL, - 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', - true + "The configuration option's name" ) ; } protected function execute(InputInterface $input, OutputInterface $output) { - $key = $input->getArgument('config-key'); - $use_cache = $input->getArgument('use-cache'); - $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + $key = $input->getArgument('key'); - $this->config->delete($key, $use_cache); + $this->config->delete($key); $output->writeln("Successfully deleted config $key"); } diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php new file mode 100644 index 0000000000..aeb40cff16 --- /dev/null +++ b/phpBB/phpbb/console/command/config/get.php @@ -0,0 +1,44 @@ +setName('config:get') + ->setDescription("Gets a configuration option's value") + ->addArgument( + 'key', + InputArgument::REQUIRED, + "The configuration option's name" + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $key = $input->getArgument('key'); + + if (isset($this->config[$key])) + { + $output->writeln("{$this->config[$key]}"); + } + else + { + $output->writeln("Could not get config $key"); + } + } +} diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 0974d34cc5..06b2772230 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -10,50 +10,40 @@ namespace phpbb\console\command\config; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class increment extends \phpbb\console\command\command +class increment extends command { - /** @var \phpbb\config\config */ - protected $config; - - function __construct(\phpbb\config\config $config) - { - $this->config = $config; - - parent::__construct(); - } - protected function configure() { $this ->setName('config:increment') - ->setDescription('Sets a configuration option\'s value') + ->setDescription("Sets a configuration option's value") ->addArgument( - 'config-key', + 'key', InputArgument::REQUIRED, - 'The configuration option\'s name' + "The configuration option's name" ) ->addArgument( 'increment', InputArgument::REQUIRED, 'Amount to increment by' ) - ->addArgument( - 'use-cache', - InputArgument::OPTIONAL, - 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', - true + ->addOption( + 'dynamic', + 'd', + InputOption::VALUE_NONE, + 'Set this option if the configuration option changes too frequently to be efficiently cached.' ) ; } protected function execute(InputInterface $input, OutputInterface $output) { - $key = $input->getArgument('config-key'); + $key = $input->getArgument('key'); $increment = $input->getArgument('increment'); - $use_cache = $input->getArgument('use-cache'); - $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + $use_cache = !$input->getOption('dynamic'); $this->config->increment($key, $increment, $use_cache); diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index 471a92ca8b..51d3efad1e 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -10,51 +10,42 @@ namespace phpbb\console\command\config; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class set extends \phpbb\console\command\command +class set extends command { - /** @var \phpbb\config\config */ - protected $config; - - function __construct(\phpbb\config\config $config) - { - $this->config = $config; - - parent::__construct(); - } - protected function configure() { $this ->setName('config:set') - ->setDescription('Sets a configuration option\'s value') + ->setDescription("Sets a configuration option's value") ->addArgument( - 'config-key', + 'key', InputArgument::REQUIRED, - 'The configuration option\'s name' + "The configuration option's name" ) ->addArgument( - 'config-value', + 'value', InputArgument::REQUIRED, - 'New configuration value' + 'New configuration value, use 0 and 1 to specify boolean values' ) - ->addArgument( - 'use-cache', - InputArgument::OPTIONAL, - 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', - true + ->addOption( + 'dynamic', + 'd', + InputOption::VALUE_NONE, + 'Set this option if the configuration option changes too frequently to be efficiently cached.' ) ; } protected function execute(InputInterface $input, OutputInterface $output) { - $key = $input->getArgument('config-key'); - $value = $input->getArgument('config-value'); - $use_cache = $input->getArgument('use-cache'); - $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + $key = $input->getArgument('key'); + $value = $input->getArgument('value'); + $use_cache = !$input->getOption('dynamic'); + var_dump($key, $value, $use_cache); $this->config->set($key, $value, $use_cache); $output->writeln("Successfully set config $key"); diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index 17583c89de..1393549a1e 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -10,56 +10,46 @@ namespace phpbb\console\command\config; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class set_atomic extends \phpbb\console\command\command +class set_atomic extends command { - /** @var \phpbb\config\config */ - protected $config; - - function __construct(\phpbb\config\config $config) - { - $this->config = $config; - - parent::__construct(); - } - protected function configure() { $this ->setName('config:set-atomic') - ->setDescription('Sets a configuration option\'s value') + ->setDescription("Sets a configuration option's value") ->addArgument( - 'config-key', + 'key', InputArgument::REQUIRED, - 'The configuration option\'s name' + "The configuration option's name" ) ->addArgument( - 'old-value', + 'old', InputArgument::REQUIRED, - 'Current configuration value' + 'Current configuration value, use 0 and 1 to specify boolean values' ) ->addArgument( - 'new-value', + 'new', InputArgument::REQUIRED, - 'New configuration value' + 'New configuration value, use 0 and 1 to specify boolean values' ) - ->addArgument( - 'use-cache', - InputArgument::OPTIONAL, - 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', - true + ->addOption( + 'dynamic', + 'd', + InputOption::VALUE_NONE, + 'Set this option if the configuration option changes too frequently to be efficiently cached.' ) ; } protected function execute(InputInterface $input, OutputInterface $output) { - $key = $input->getArgument('config-key'); - $old_value = $input->getArgument('old-value'); - $new_value = $input->getArgument('new-value'); - $use_cache = $input->getArgument('use-cache'); - $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + $key = $input->getArgument('key'); + $old_value = $input->getArgument('old'); + $new_value = $input->getArgument('new'); + $use_cache = !$input->getOption('dynamic'); if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache)) { -- cgit v1.2.1 From de727b80e285970c0e770c8597c6b56adb513a4d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 27 Nov 2013 15:16:40 +0100 Subject: [ticket/12039] Fix option descriptions PHPBB3-12039 --- phpBB/phpbb/console/command/config/delete.php | 2 +- phpBB/phpbb/console/command/config/increment.php | 2 +- phpBB/phpbb/console/command/config/set_atomic.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 2b53f27098..af3d189445 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -19,7 +19,7 @@ class delete extends command { $this ->setName('config:delete') - ->setDescription("Sets a configuration option's value") + ->setDescription("Deletes a configuration option") ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 06b2772230..5f5d03b50b 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -19,7 +19,7 @@ class increment extends command { $this ->setName('config:increment') - ->setDescription("Sets a configuration option's value") + ->setDescription("Increment a configuration option's value") ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index 1393549a1e..ef2cb5c3e1 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -19,7 +19,7 @@ class set_atomic extends command { $this ->setName('config:set-atomic') - ->setDescription("Sets a configuration option's value") + ->setDescription("Sets a configuration option's value only if the old_value matches the current configuration value or the configuration value does not exist yet.") ->addArgument( 'key', InputArgument::REQUIRED, -- cgit v1.2.1 From 86e629e5338b1b21d3908eb2c8a01fe84ac18159 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 2 Dec 2013 13:26:49 +0100 Subject: [ticket/12039] Remove debug code PHPBB3-12039 --- phpBB/phpbb/console/command/config/set.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index 51d3efad1e..9d471a96ad 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -45,7 +45,6 @@ class set extends command $value = $input->getArgument('value'); $use_cache = !$input->getOption('dynamic'); - var_dump($key, $value, $use_cache); $this->config->set($key, $value, $use_cache); $output->writeln("Successfully set config $key"); -- cgit v1.2.1 From 98200161fc642ce447395a4b8db3b1a3c674c734 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 26 Dec 2013 19:03:43 +0100 Subject: [ticket/12039] Update command descriptions PHPBB3-12039 --- phpBB/phpbb/console/command/config/delete.php | 2 +- phpBB/phpbb/console/command/config/increment.php | 2 +- phpBB/phpbb/console/command/config/set_atomic.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index af3d189445..5dbeeff20f 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -19,7 +19,7 @@ class delete extends command { $this ->setName('config:delete') - ->setDescription("Deletes a configuration option") + ->setDescription('Deletes a configuration option') ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 5f5d03b50b..bc6b63c6ff 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -19,7 +19,7 @@ class increment extends command { $this ->setName('config:increment') - ->setDescription("Increment a configuration option's value") + ->setDescription("Increments a configuration option's value") ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index ef2cb5c3e1..03e7a60210 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -19,7 +19,7 @@ class set_atomic extends command { $this ->setName('config:set-atomic') - ->setDescription("Sets a configuration option's value only if the old_value matches the current configuration value or the configuration value does not exist yet.") + ->setDescription("Sets a configuration option's value only if the old matches the current value.") ->addArgument( 'key', InputArgument::REQUIRED, -- cgit v1.2.1 From 52c452c768b30fa479e91faee548abf5038f2642 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jan 2014 23:56:50 +0100 Subject: [ticket/12039] Do not colour returned value in get command PHPBB3-12039 --- phpBB/phpbb/console/command/config/get.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index aeb40cff16..1f9781ea9c 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -34,7 +34,7 @@ class get extends command if (isset($this->config[$key])) { - $output->writeln("{$this->config[$key]}"); + $output->writeln($this->config[$key]); } else { -- cgit v1.2.1 From 5d89c283f0dfbce0f615432671628d9d10736334 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jan 2014 23:59:46 +0100 Subject: [ticket/12039] Do not print success message when config did not exist PHPBB3-12039 --- phpBB/phpbb/console/command/config/delete.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 5dbeeff20f..9a2d00561d 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -32,8 +32,15 @@ class delete extends command { $key = $input->getArgument('key'); - $this->config->delete($key); + if (isset($this->config[$key])) + { + $this->config->delete($key); - $output->writeln("Successfully deleted config $key"); + $output->writeln("Successfully deleted config $key"); + } + else + { + $output->writeln("Config $key does not exist"); + } } } -- cgit v1.2.1 From a70973ea423fda2a26fc8ff17e6e9c33bee11547 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 9 Jan 2014 00:05:32 +0100 Subject: [ticket/12039] Allow getting the value without a new line at the end PHPBB3-12039 --- phpBB/phpbb/console/command/config/get.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index 1f9781ea9c..275c82b53f 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -25,6 +25,12 @@ class get extends command InputArgument::REQUIRED, "The configuration option's name" ) + ->addOption( + 'no-newline', + null, + InputOption::VALUE_NONE, + 'Set this option if the value should be printed without a new line at the end.' + ) ; } @@ -32,7 +38,11 @@ class get extends command { $key = $input->getArgument('key'); - if (isset($this->config[$key])) + if (isset($this->config[$key]) && $input->getOption('no-newline')) + { + $output->write($this->config[$key]); + } + elseif (isset($this->config[$key])) { $output->writeln($this->config[$key]); } -- cgit v1.2.1 From 11a9104b8a50cbc62cba0c242dee554b5209a327 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 17 Mar 2014 13:29:35 +0100 Subject: [ticket/12282] Use interface for type hinting PHPBB3-12282 --- phpBB/phpbb/console/command/fixup/recalculate_email_hash.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index 04db880091..8c520673d9 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -13,10 +13,10 @@ use Symfony\Component\Console\Output\OutputInterface; class recalculate_email_hash extends \phpbb\console\command\command { - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; - function __construct(\phpbb\db\driver\driver $db) + function __construct(\phpbb\db\driver\driver_interface $db) { $this->db = $db; -- cgit v1.2.1 From 99a932e0f93a6777fa78ca50a6cfff3d692515c8 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 2 May 2014 19:02:49 +0200 Subject: [ticket/12473] Add console command for database migration. PHPBB3-12473 --- phpBB/phpbb/console/command/db/migrate.php | 127 +++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 phpBB/phpbb/console/command/db/migrate.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php new file mode 100644 index 0000000000..79a803e8fb --- /dev/null +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -0,0 +1,127 @@ +migrator = $migrator; + $this->extension_manager = $extension_manager; + $this->config = $config; + $this->cache = $cache; + $this->log = $log; + $this->user = $user; + $this->user->add_lang(array('common', 'acp/common', 'install', 'migrator')); + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('db:migrate') + ->setDescription('Updates the database by applying migrations.') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->load_migrations(); + $orig_version = $this->config['version']; + while (!$this->migrator->finished()) + { + $migration_start_time = microtime(true); + + try + { + $this->migrator->update(); + } + catch (\phpbb\db\migration\exception $e) + { + $output->writeln($e->getLocalisedMessage($this->user)); + $this->finalise_update(); + return 1; + } + + $migration_stop_time = microtime(true) - $migration_start_time; + + $state = array_merge( + array( + 'migration_schema_done' => false, + 'migration_data_done' => false, + ), + $this->migrator->last_run_migration['state'] + ); + + if (!empty($this->migrator->last_run_migration['effectively_installed'])) + { + $msg = $this->user->lang('MIGRATION_EFFECTIVELY_INSTALLED', $this->migrator->last_run_migration['name']); + $output->writeln("$msg"); + } + else if ($this->migrator->last_run_migration['task'] == 'process_data_step' && $state['migration_data_done']) + { + $msg = $this->user->lang('MIGRATION_DATA_DONE', $this->migrator->last_run_migration['name'], $migration_stop_time); + $output->writeln("$msg"); + } + else if ($this->migrator->last_run_migration['task'] == 'process_data_step') + { + $output->writeln($this->user->lang('MIGRATION_DATA_IN_PROGRESS', $this->migrator->last_run_migration['name'], $migration_stop_time)); + } + else if ($state['migration_schema_done']) + { + $msg = $this->user->lang('MIGRATION_SCHEMA_DONE', $this->migrator->last_run_migration['name'], $migration_stop_time); + $output->writeln("$msg"); + } + } + + if ($orig_version != $this->config['version']) + { + $log->add('admin', 'LOG_UPDATE_DATABASE', $orig_version, $this->config['version']); + } + + $this->finalise_update(); + $output->writeln($this->user->lang['DATABASE_UPDATE_COMPLETE']); + } + + protected function load_migrations() + { + $migrations = $this->extension_manager + ->get_finder() + ->core_path('phpbb/db/migration/data/') + ->get_classes(); + $this->migrator->set_migrations($migrations); + } + + protected function finalise_update() + { + $this->cache->purge(); + $this->config->increment('assets_version', 1); + } +} -- cgit v1.2.1 From b302c6c1456f2fb9e13d02b1e9268fafda11726d Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Fri, 2 May 2014 19:31:48 +0200 Subject: [ticket/12474] Error messages should be displayed with tag PHPBB3-12474 --- phpBB/phpbb/console/command/db/migrate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 79a803e8fb..044929adaa 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -65,7 +65,7 @@ class migrate extends \phpbb\console\command\command } catch (\phpbb\db\migration\exception $e) { - $output->writeln($e->getLocalisedMessage($this->user)); + $output->writeln('' . $e->getLocalisedMessage($this->user) . ''); $this->finalise_update(); return 1; } -- cgit v1.2.1 From 4bbace8c0d9ed9810c85604cad7bf383e827fc5f Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Fri, 2 May 2014 19:40:18 +0200 Subject: [ticket/12475] Error in db:update console command PHPBB3-12475 --- phpBB/phpbb/console/command/db/migrate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 79a803e8fb..4c7284bc18 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -103,7 +103,7 @@ class migrate extends \phpbb\console\command\command if ($orig_version != $this->config['version']) { - $log->add('admin', 'LOG_UPDATE_DATABASE', $orig_version, $this->config['version']); + $this->log->add('admin', 'LOG_UPDATE_DATABASE', $orig_version, $this->config['version']); } $this->finalise_update(); -- cgit v1.2.1 From 3420f8f3201ac337434f73ee00bda6df7b378212 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 2 May 2014 19:55:19 +0200 Subject: [ticket/12475] Load extension migrations on cli updater too PHPBB3-12475 --- phpBB/phpbb/console/command/db/migrate.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index c7ccd4646e..08016ea4d8 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -114,7 +114,8 @@ class migrate extends \phpbb\console\command\command { $migrations = $this->extension_manager ->get_finder() - ->core_path('phpbb/db/migration/data/') + ->core_path('phpbb/db/migration/data/') + ->extension_directory('/migrations') ->get_classes(); $this->migrator->set_migrations($migrations); } -- cgit v1.2.1 From 03594b64438464ba7f234ce38d3344561bc0a66b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 2 May 2014 20:03:40 +0200 Subject: [ticket/12475] Tabs, spaces, ... PHPBB3-12475 --- phpBB/phpbb/console/command/db/migrate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 08016ea4d8..16a09af6fc 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -114,8 +114,8 @@ class migrate extends \phpbb\console\command\command { $migrations = $this->extension_manager ->get_finder() - ->core_path('phpbb/db/migration/data/') - ->extension_directory('/migrations') + ->core_path('phpbb/db/migration/data/') + ->extension_directory('/migrations') ->get_classes(); $this->migrator->set_migrations($migrations); } -- cgit v1.2.1 From 66b7eaa1cabd98f00d5720e2382d672782e1e01a Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 4 May 2014 22:20:22 +0200 Subject: [ticket/12499] Incorrect call to phpbb\log\log::add() in db:migrate https://tracker.phpbb.com/browse/PHPBB3-12499 PHPBB3-12499 --- phpBB/phpbb/console/command/db/migrate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 16a09af6fc..d984ac9e7a 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -103,7 +103,7 @@ class migrate extends \phpbb\console\command\command if ($orig_version != $this->config['version']) { - $this->log->add('admin', 'LOG_UPDATE_DATABASE', $orig_version, $this->config['version']); + $this->log->add('admin', ANONYMOUS, '', 'LOG_UPDATE_DATABASE', time(), array($orig_version, $this->config['version'])); } $this->finalise_update(); -- cgit v1.2.1 From 06ecb62abd5b1bee7ec25094e56968e28d2a29bf Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 6 May 2014 16:50:18 +0200 Subject: [ticket/12507] Add console command to purge the cache PHPBB3-12507 --- phpBB/phpbb/console/command/cache/purge.php | 62 +++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 phpBB/phpbb/console/command/cache/purge.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php new file mode 100644 index 0000000000..017bdc5144 --- /dev/null +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -0,0 +1,62 @@ +cache = $cache; + $this->db = $db; + $this->auth = $auth; + $this->log = $log; + $this->user = $user; + $this->user->add_lang(array('acp/common')); + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('cache:purge') + ->setDescription('Purge the cache.') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->cache->purge(); + + // Clear permissions + $this->auth->acl_clear_prefetch(); + phpbb_cache_moderators($this->db, $this->cache, $this->auth); + + $this->log->add('admin', ANONYMOUS, '', 'LOG_PURGE_CACHE', time(), array()); + + $output->writeln($this->user->lang('PURGE_CACHE_SUCCESS')); + } +} -- cgit v1.2.1 From a640a455f35ccec26a80e9f9de5693dbb9e71c85 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 9 May 2014 00:07:56 +0200 Subject: [ticket/12074] Managing extensions doesn't produce any log entry PHPBB3-12074 --- phpBB/phpbb/console/command/extension/command.php | 6 +++++- phpBB/phpbb/console/command/extension/disable.php | 2 ++ phpBB/phpbb/console/command/extension/enable.php | 2 ++ phpBB/phpbb/console/command/extension/purge.php | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php index edde7ce2e2..d133c2224f 100644 --- a/phpBB/phpbb/console/command/extension/command.php +++ b/phpBB/phpbb/console/command/extension/command.php @@ -13,9 +13,13 @@ abstract class command extends \phpbb\console\command\command /** @var \phpbb\extension\manager */ protected $manager; - function __construct(\phpbb\extension\manager $manager) + /** @var \phpbb\log\log */ + protected $log; + + function __construct(\phpbb\extension\manager $manager, \phpbb\log\log $log) { $this->manager = $manager; + $this->log = $log; parent::__construct(); } diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index e4de70ca34..fb0c23762f 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -35,11 +35,13 @@ class disable extends command if ($this->manager->enabled($name)) { + $this->log->add('critical', ANONYMOUS, '', 'LOG_EXT_DISABLE_ERROR', time(), array($name)); $output->writeln("Could not disable extension $name"); return 1; } else { + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name)); $output->writeln("Successfully disabled extension $name"); return 0; } diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index ee7dae76aa..e20a5ba81d 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -35,11 +35,13 @@ class enable extends command if ($this->manager->enabled($name)) { + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXTENSION_ENABLE', time(), array($name)); $output->writeln("Successfully enabled extension $name"); return 0; } else { + $this->log->add('critical', ANONYMOUS, '', 'LOG_EXT_ENABLE_ERROR', time(), array($name)); $output->writeln("Could not enable extension $name"); return 1; } diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index c2e1d2928c..234d32f302 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -35,11 +35,13 @@ class purge extends command if ($this->manager->enabled($name)) { + $this->log->add('critical', ANONYMOUS, '', 'LOG_EXT_PURGE_ERROR', time(), array($name)); $output->writeln("Could not purge extension $name"); return 1; } else { + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name)); $output->writeln("Successfully purge extension $name"); return 0; } -- cgit v1.2.1 From 3029f93000198908bddacb0079aae2d0ecda0c5d Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 9 May 2014 00:26:07 +0200 Subject: [ticket/12074] Don't log errors PHPBB3-12074 --- phpBB/phpbb/console/command/extension/disable.php | 1 - phpBB/phpbb/console/command/extension/enable.php | 1 - phpBB/phpbb/console/command/extension/purge.php | 1 - 3 files changed, 3 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index fb0c23762f..ceaf168108 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -35,7 +35,6 @@ class disable extends command if ($this->manager->enabled($name)) { - $this->log->add('critical', ANONYMOUS, '', 'LOG_EXT_DISABLE_ERROR', time(), array($name)); $output->writeln("Could not disable extension $name"); return 1; } diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index e20a5ba81d..757f19005e 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -41,7 +41,6 @@ class enable extends command } else { - $this->log->add('critical', ANONYMOUS, '', 'LOG_EXT_ENABLE_ERROR', time(), array($name)); $output->writeln("Could not enable extension $name"); return 1; } diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index 234d32f302..0342d116f5 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -35,7 +35,6 @@ class purge extends command if ($this->manager->enabled($name)) { - $this->log->add('critical', ANONYMOUS, '', 'LOG_EXT_PURGE_ERROR', time(), array($name)); $output->writeln("Could not purge extension $name"); return 1; } -- cgit v1.2.1 From 93d3c517e3aac385e5ce8adb7e20592abf8b4b14 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 9 May 2014 00:48:34 +0200 Subject: [ticket/12074] Update the visibility of the constructor PHPBB3-12074 --- phpBB/phpbb/console/command/extension/command.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php index d133c2224f..72325ce768 100644 --- a/phpBB/phpbb/console/command/extension/command.php +++ b/phpBB/phpbb/console/command/extension/command.php @@ -16,7 +16,7 @@ abstract class command extends \phpbb\console\command\command /** @var \phpbb\log\log */ protected $log; - function __construct(\phpbb\extension\manager $manager, \phpbb\log\log $log) + public function __construct(\phpbb\extension\manager $manager, \phpbb\log\log $log) { $this->manager = $manager; $this->log = $log; -- cgit v1.2.1 From f2471878a6f7ea2f6fd243520709f693e4260da7 Mon Sep 17 00:00:00 2001 From: n-aleha Date: Fri, 9 May 2014 00:30:09 +0300 Subject: [ticket/12476] Increase assets also from acp_styles and phpbbcli Increase assets also from "ACP > Styles > Purge Cache" and phpbbcli PHPBB3-12476 --- phpBB/phpbb/console/command/cache/purge.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 017bdc5144..9c880a859f 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -28,13 +28,17 @@ class purge extends \phpbb\console\command\command /** @var \phpbb\user */ protected $user; - function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user) + /** @var \phpbb\config\config */ + protected $config; + + function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user, \phpbb\config\config $config) { $this->cache = $cache; $this->db = $db; $this->auth = $auth; $this->log = $log; $this->user = $user; + $this->config = $config; $this->user->add_lang(array('acp/common')); parent::__construct(); } @@ -49,6 +53,7 @@ class purge extends \phpbb\console\command\command protected function execute(InputInterface $input, OutputInterface $output) { + $this->config->increment('assets_version', 1); $this->cache->purge(); // Clear permissions -- cgit v1.2.1 From 5dacd7ff5ba7826a1831f6b243fc3c5e8fb2ce0e Mon Sep 17 00:00:00 2001 From: n-aleha Date: Fri, 9 May 2014 00:54:20 +0300 Subject: [ticket/12476] Label the constructor as public Label the the constructor as public. PHPBB3-12476 --- phpBB/phpbb/console/command/cache/purge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 9c880a859f..013183cb35 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -31,7 +31,7 @@ class purge extends \phpbb\console\command\command /** @var \phpbb\config\config */ protected $config; - function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user, \phpbb\config\config $config) + public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user, \phpbb\config\config $config) { $this->cache = $cache; $this->db = $db; -- cgit v1.2.1 From abb8a2892d862c097285ee7f300d12c32428e12c Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Tue, 27 May 2014 12:36:44 +0200 Subject: [ticket/12597] Command for executing all available cron tasks Command cron:execute-all executes all available cron tasks. Test files in tests/console/cron folder PHPBB3-12597 --- phpBB/phpbb/console/command/cron/execute_all.php | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 phpBB/phpbb/console/command/cron/execute_all.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/execute_all.php b/phpBB/phpbb/console/command/cron/execute_all.php new file mode 100644 index 0000000000..4f0f225e91 --- /dev/null +++ b/phpBB/phpbb/console/command/cron/execute_all.php @@ -0,0 +1,65 @@ +cron_manager = $cron_manager; + $this->lock_db = $lock_db; + $this->user = $user; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('cron:execute-all') + ->setDescription($this->user->lang('CLI_DESCR_CRON_EXECUTE_ALL')) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + if ($this->lock_db->acquire()) + { + $run_tasks = $this->cron_manager->find_all_ready_tasks(); + + foreach ($run_tasks as $task) + { + if ($input->getOption('verbose')) + { + $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name()) . "\n"); + } + + $task->run(); + } + $this->lock_db->release(); + } + else + { + $output->writeln('' . $this->user->lang('CRON_LOCK_ERROR') . ''); + } + } +} + -- cgit v1.2.1 From a759704b39fc1c1353f865a633759b1369589b67 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Tue, 27 May 2014 20:18:06 +0200 Subject: [ticket/12594] Remove @package tags and update file headers PHPBB3-12594 --- phpBB/phpbb/console/command/cache/purge.php | 10 +++++++--- phpBB/phpbb/console/command/command.php | 10 +++++++--- phpBB/phpbb/console/command/config/command.php | 10 +++++++--- phpBB/phpbb/console/command/config/delete.php | 10 +++++++--- phpBB/phpbb/console/command/config/get.php | 10 +++++++--- phpBB/phpbb/console/command/config/increment.php | 10 +++++++--- phpBB/phpbb/console/command/config/set.php | 10 +++++++--- phpBB/phpbb/console/command/config/set_atomic.php | 10 +++++++--- phpBB/phpbb/console/command/db/migrate.php | 10 +++++++--- phpBB/phpbb/console/command/extension/command.php | 10 +++++++--- phpBB/phpbb/console/command/extension/disable.php | 10 +++++++--- phpBB/phpbb/console/command/extension/enable.php | 10 +++++++--- phpBB/phpbb/console/command/extension/purge.php | 10 +++++++--- phpBB/phpbb/console/command/extension/show.php | 10 +++++++--- phpBB/phpbb/console/command/fixup/recalculate_email_hash.php | 10 +++++++--- 15 files changed, 105 insertions(+), 45 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 013183cb35..1e2adaeb4d 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\cache; diff --git a/phpBB/phpbb/console/command/command.php b/phpBB/phpbb/console/command/command.php index 6abbdd203c..d3449c0c38 100644 --- a/phpBB/phpbb/console/command/command.php +++ b/phpBB/phpbb/console/command/command.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/console/command/config/command.php b/phpBB/phpbb/console/command/config/command.php index b105bc826d..de3fbd7fa7 100644 --- a/phpBB/phpbb/console/command/config/command.php +++ b/phpBB/phpbb/console/command/config/command.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 9a2d00561d..e29afdbf82 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index 275c82b53f..0ed2a12608 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index bc6b63c6ff..64b5d42b9d 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index 9d471a96ad..fce1edb93e 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index 03e7a60210..4df2d90722 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index d984ac9e7a..0f74664095 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\db; diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php index 72325ce768..21bb640504 100644 --- a/phpBB/phpbb/console/command/extension/command.php +++ b/phpBB/phpbb/console/command/extension/command.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\extension; diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index ceaf168108..5f0e74b984 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\extension; diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 757f19005e..0cdf26d4db 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\extension; diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index 0342d116f5..4e57641d83 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\extension; diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php index 0f48ac2379..2db1c59e24 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\extension; diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index 8c520673d9..ec04da4267 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\fixup; -- cgit v1.2.1 From 50cb9d583845bb99c94355266705e25994770622 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 11:57:20 +0200 Subject: [ticket/12597] Correcing coding style mistakes PHPBB3-12597 --- phpBB/phpbb/console/command/cron/execute_all.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/execute_all.php b/phpBB/phpbb/console/command/cron/execute_all.php index 4f0f225e91..6f061212ae 100644 --- a/phpBB/phpbb/console/command/cron/execute_all.php +++ b/phpBB/phpbb/console/command/cron/execute_all.php @@ -62,4 +62,3 @@ class execute_all extends \phpbb\console\command\command } } } - -- cgit v1.2.1 From 8a1e189970c57364a3192296546717d70fbdd2d4 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 12:20:02 +0200 Subject: [ticket/12597] Add doc blocs in execute_all.php PHPBB3-12597 --- phpBB/phpbb/console/command/cron/execute_all.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/execute_all.php b/phpBB/phpbb/console/command/cron/execute_all.php index 6f061212ae..bc46fbe81b 100644 --- a/phpBB/phpbb/console/command/cron/execute_all.php +++ b/phpBB/phpbb/console/command/cron/execute_all.php @@ -23,6 +23,14 @@ class execute_all extends \phpbb\console\command\command /** @var \phpbb\user */ protected $user; + /** + * Construct method + * + * @param \phpbb\cron\manager $cron_manager The cron manager containing + * the cron tasks to be executed. + * @param \phpbb\lock\db $lock_db The lock for accessing database. + * @param \phobb\user $user The user object (used to get language information) + */ public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db, \phpbb\user $user) { $this->cron_manager = $cron_manager; @@ -31,6 +39,11 @@ class execute_all extends \phpbb\console\command\command parent::__construct(); } + /** + * Sets the command name and description + * + * @return null + */ protected function configure() { $this @@ -39,6 +52,16 @@ class execute_all extends \phpbb\console\command\command ; } + /** + * Executes the function. Each cron tasks is executed. + * If option "--verbose" is not seted, there will be no output in case of + * successful execution. + * + * @param InputInterface input The input stream, unused here + * @param OutputInterface output The output stream, used for printig verbose-mode + * and error information. + * @return null + */ protected function execute(InputInterface $input, OutputInterface $output) { if ($this->lock_db->acquire()) -- cgit v1.2.1 From 9761c1bf617763671308fabc569ec13d40cb6843 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 12:57:49 +0200 Subject: [ticket/12597] Fix various refactoring mistakes PHPBB3-12597 --- phpBB/phpbb/console/command/cron/execute_all.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/execute_all.php b/phpBB/phpbb/console/command/cron/execute_all.php index bc46fbe81b..f7157f4d3a 100644 --- a/phpBB/phpbb/console/command/cron/execute_all.php +++ b/phpBB/phpbb/console/command/cron/execute_all.php @@ -72,7 +72,7 @@ class execute_all extends \phpbb\console\command\command { if ($input->getOption('verbose')) { - $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name()) . "\n"); + $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name())); } $task->run(); -- cgit v1.2.1 From 6f279c1bf47c4c86a507acc9ea7d705dad6e9b97 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 14:39:02 +0200 Subject: [ticket/12597] Update pull-request Removes a useless comment. Switchs command name from cron:execute-all to cron:run-all. Replaces assertEquals by assertSame PHPBB3-12597 --- phpBB/phpbb/console/command/cron/execute_all.php | 87 ------------------------ phpBB/phpbb/console/command/cron/run_all.php | 87 ++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 87 deletions(-) delete mode 100644 phpBB/phpbb/console/command/cron/execute_all.php create mode 100644 phpBB/phpbb/console/command/cron/run_all.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/execute_all.php b/phpBB/phpbb/console/command/cron/execute_all.php deleted file mode 100644 index f7157f4d3a..0000000000 --- a/phpBB/phpbb/console/command/cron/execute_all.php +++ /dev/null @@ -1,87 +0,0 @@ -cron_manager = $cron_manager; - $this->lock_db = $lock_db; - $this->user = $user; - parent::__construct(); - } - - /** - * Sets the command name and description - * - * @return null - */ - protected function configure() - { - $this - ->setName('cron:execute-all') - ->setDescription($this->user->lang('CLI_DESCR_CRON_EXECUTE_ALL')) - ; - } - - /** - * Executes the function. Each cron tasks is executed. - * If option "--verbose" is not seted, there will be no output in case of - * successful execution. - * - * @param InputInterface input The input stream, unused here - * @param OutputInterface output The output stream, used for printig verbose-mode - * and error information. - * @return null - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - if ($this->lock_db->acquire()) - { - $run_tasks = $this->cron_manager->find_all_ready_tasks(); - - foreach ($run_tasks as $task) - { - if ($input->getOption('verbose')) - { - $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name())); - } - - $task->run(); - } - $this->lock_db->release(); - } - else - { - $output->writeln('' . $this->user->lang('CRON_LOCK_ERROR') . ''); - } - } -} diff --git a/phpBB/phpbb/console/command/cron/run_all.php b/phpBB/phpbb/console/command/cron/run_all.php new file mode 100644 index 0000000000..39b3e0c616 --- /dev/null +++ b/phpBB/phpbb/console/command/cron/run_all.php @@ -0,0 +1,87 @@ +cron_manager = $cron_manager; + $this->lock_db = $lock_db; + $this->user = $user; + parent::__construct(); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('cron:run-all') + ->setDescription($this->user->lang('CLI_DESCR_CRON_EXECUTE_ALL')) + ; + } + + /** + * Executes the function. Each cron tasks is executed. + * If option "--verbose" is not seted, there will be no output in case of + * successful execution. + * + * @param InputInterface input The input stream, unused here + * @param OutputInterface output The output stream, used for printig verbose-mode + * and error information. + * @return null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if ($this->lock_db->acquire()) + { + $run_tasks = $this->cron_manager->find_all_ready_tasks(); + + foreach ($run_tasks as $task) + { + if ($input->getOption('verbose')) + { + $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name())); + } + + $task->run(); + } + $this->lock_db->release(); + } + else + { + $output->writeln('' . $this->user->lang('CRON_LOCK_ERROR') . ''); + } + } +} -- cgit v1.2.1 From 9a7877274596b8330c075299adf3683c189ba6ab Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 14:57:16 +0200 Subject: [ticket/12597] Change EXECUTE to RUN in language Fix previous commit : change execute to run in language keys PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run_all.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run_all.php b/phpBB/phpbb/console/command/cron/run_all.php index 39b3e0c616..38a7735c03 100644 --- a/phpBB/phpbb/console/command/cron/run_all.php +++ b/phpBB/phpbb/console/command/cron/run_all.php @@ -48,7 +48,7 @@ class run_all extends \phpbb\console\command\command { $this ->setName('cron:run-all') - ->setDescription($this->user->lang('CLI_DESCR_CRON_EXECUTE_ALL')) + ->setDescription($this->user->lang('CLI_DESCR_CRON_RUN_ALL')) ; } -- cgit v1.2.1 From 0d839cbefc19247fd2b4c1132b91083bf0983305 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 18:02:30 +0200 Subject: [ticket/12597] Modification of return statuses and of test files PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run_all.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run_all.php b/phpBB/phpbb/console/command/cron/run_all.php index 38a7735c03..e2d235395b 100644 --- a/phpBB/phpbb/console/command/cron/run_all.php +++ b/phpBB/phpbb/console/command/cron/run_all.php @@ -60,7 +60,7 @@ class run_all extends \phpbb\console\command\command * @param InputInterface input The input stream, unused here * @param OutputInterface output The output stream, used for printig verbose-mode * and error information. - * @return null + * @return boolean 0 if all is ok, 1 if a lock error occured */ protected function execute(InputInterface $input, OutputInterface $output) { -- cgit v1.2.1 From 18875894ec046e48e8627a9c1b2158670eea70e9 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 18:19:46 +0200 Subject: [ticket/12597] Fix constructor bug and servral doc blocs PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run_all.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run_all.php b/phpBB/phpbb/console/command/cron/run_all.php index e2d235395b..b398e46ab9 100644 --- a/phpBB/phpbb/console/command/cron/run_all.php +++ b/phpBB/phpbb/console/command/cron/run_all.php @@ -53,12 +53,15 @@ class run_all extends \phpbb\console\command\command } /** - * Executes the function. Each cron tasks is executed. - * If option "--verbose" is not seted, there will be no output in case of - * successful execution. + * Executes the function. + * Tries to acquire the cron lock, then runs all ready cron tasks. + * If the cron lock can not be obtained, an error message is printed + * and the exit status is set to 1. + *If the verbose option is specified, each start of a task is printed. + Otherwise there is no output. * - * @param InputInterface input The input stream, unused here - * @param OutputInterface output The output stream, used for printig verbose-mode + * @param InputInterface $input The input stream, unused here + * @param OutputInterface $output The output stream, used for printig verbose-mode * and error information. * @return boolean 0 if all is ok, 1 if a lock error occured */ -- cgit v1.2.1 From 61ad42790f653c0fe7bf1c1b5d27181794bec997 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 18:28:46 +0200 Subject: [ticket/12597] Fix various problems Actually fix the return status of command cron:run-all Fix some doc block coding style issue Fix missing and obsolete file headers Delete a useless constructor method PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run_all.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run_all.php b/phpBB/phpbb/console/command/cron/run_all.php index b398e46ab9..2f8166b857 100644 --- a/phpBB/phpbb/console/command/cron/run_all.php +++ b/phpBB/phpbb/console/command/cron/run_all.php @@ -1,11 +1,16 @@ run(); } $this->lock_db->release(); + + return 0; } else { $output->writeln('' . $this->user->lang('CRON_LOCK_ERROR') . ''); + return 1; } } } -- cgit v1.2.1 From 9f942776ad5a3b396045e6f97db6ef655c5d9fcc Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 19:51:59 +0200 Subject: [ticket/12597] Changes name of command cron:run-all to cron:run. Also adds an optional argument to specify one precise cron task to lauch, and modifies test file accordingly. PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 121 +++++++++++++++++++++++++++ phpBB/phpbb/console/command/cron/run_all.php | 99 ---------------------- 2 files changed, 121 insertions(+), 99 deletions(-) create mode 100644 phpBB/phpbb/console/command/cron/run.php delete mode 100644 phpBB/phpbb/console/command/cron/run_all.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php new file mode 100644 index 0000000000..701f0f02fb --- /dev/null +++ b/phpBB/phpbb/console/command/cron/run.php @@ -0,0 +1,121 @@ +cron_manager = $cron_manager; + $this->lock_db = $lock_db; + $this->user = $user; + parent::__construct(); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('cron:run') + ->setDescription($this->user->lang('CLI_DESCR_CRON_RUN')) + ->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCR_CRON_ARG_RUN_1')); + ; + } + + /** + * Executes the function. + * + * Tries to acquire the cron lock, then if no argument has been given runs all ready cron tasks. + * If the cron lock can not be obtained, an error message is printed + * and the exit status is set to 1. + * If the verbose option is specified, each start of a task is printed. + * Otherwise there is no output. + * If an argument is given to the command, only the task whose name matches the + * argument will be started. If none exists, an error message is + * printed and theexit status is set to -1. Verbose option does nothing in + * this case. + * + * @param InputInterface $input The input stream, unused here + * @param OutputInterface $output The output stream, used for printig verbose-mode and error information. + * + * @return int 0 if all is ok, 1 if a lock error occured and -1 if no task matching the argument was found + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if ($this->lock_db->acquire()) + { + if ($task_name = $input->getArgument('name')) + { + if ($task = $this->cron_manager->find_task($task_name)) + { + $task->run(); + return 0; + } + else + { + $output->writeln('' . $this->user->lang('CRON_NO_TASK') . ''); + return -1; + } + } + else + { + $run_tasks = $this->cron_manager->find_all_ready_tasks(); + + foreach ($run_tasks as $task) + { + if ($input->getOption('verbose')) + { + $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name())); + } + + $task->run(); + } + $this->lock_db->release(); + + return 0; + } + } + else + { + $output->writeln('' . $this->user->lang('CRON_LOCK_ERROR') . ''); + return 1; + } + } +} diff --git a/phpBB/phpbb/console/command/cron/run_all.php b/phpBB/phpbb/console/command/cron/run_all.php deleted file mode 100644 index 2f8166b857..0000000000 --- a/phpBB/phpbb/console/command/cron/run_all.php +++ /dev/null @@ -1,99 +0,0 @@ -cron_manager = $cron_manager; - $this->lock_db = $lock_db; - $this->user = $user; - parent::__construct(); - } - - /** - * Sets the command name and description - * - * @return null - */ - protected function configure() - { - $this - ->setName('cron:run-all') - ->setDescription($this->user->lang('CLI_DESCR_CRON_RUN_ALL')) - ; - } - - /** - * Executes the function. - * - * Tries to acquire the cron lock, then runs all ready cron tasks. - * If the cron lock can not be obtained, an error message is printed - * and the exit status is set to 1. - * If the verbose option is specified, each start of a task is printed. - * Otherwise there is no output. - * - * @param InputInterface $input The input stream, unused here - * @param OutputInterface $output The output stream, used for printig verbose-mode - * and error information. - * @return int 0 if all is ok, 1 if a lock error occured - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - if ($this->lock_db->acquire()) - { - $run_tasks = $this->cron_manager->find_all_ready_tasks(); - - foreach ($run_tasks as $task) - { - if ($input->getOption('verbose')) - { - $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name())); - } - - $task->run(); - } - $this->lock_db->release(); - - return 0; - } - else - { - $output->writeln('' . $this->user->lang('CRON_LOCK_ERROR') . ''); - return 1; - } - } -} -- cgit v1.2.1 From 54d60e3f7864cf0da4c6da9c824e29ba51d57a37 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 21:26:33 +0200 Subject: [ticket/12597] Fix coding style and typing mistakes PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 701f0f02fb..7387c260a9 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -55,7 +55,7 @@ class run extends \phpbb\console\command\command $this ->setName('cron:run') ->setDescription($this->user->lang('CLI_DESCR_CRON_RUN')) - ->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCR_CRON_ARG_RUN_1')); + ->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCR_CRON_ARG_RUN_1')) ; } @@ -69,11 +69,11 @@ class run extends \phpbb\console\command\command * Otherwise there is no output. * If an argument is given to the command, only the task whose name matches the * argument will be started. If none exists, an error message is - * printed and theexit status is set to -1. Verbose option does nothing in + * printed and the exit status is set to 2. Verbose option does nothing in * this case. * - * @param InputInterface $input The input stream, unused here - * @param OutputInterface $output The output stream, used for printig verbose-mode and error information. + * @param InputInterface $input The input stream used to get the argument + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. * * @return int 0 if all is ok, 1 if a lock error occured and -1 if no task matching the argument was found */ @@ -81,9 +81,11 @@ class run extends \phpbb\console\command\command { if ($this->lock_db->acquire()) { - if ($task_name = $input->getArgument('name')) + $task_name = $input->getArgument('name'); + if ($task_name) { - if ($task = $this->cron_manager->find_task($task_name)) + $task = $this->cron_manager->find_task($task_name); + if ($task) { $task->run(); return 0; @@ -91,7 +93,7 @@ class run extends \phpbb\console\command\command else { $output->writeln('' . $this->user->lang('CRON_NO_TASK') . ''); - return -1; + return 2; } } else -- cgit v1.2.1 From 532e4470ea08e6245878e49e77f1ca51354681e7 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 22:09:38 +0200 Subject: [ticket/12597] Fix language key name PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 7387c260a9..df69b05321 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -54,8 +54,8 @@ class run extends \phpbb\console\command\command { $this ->setName('cron:run') - ->setDescription($this->user->lang('CLI_DESCR_CRON_RUN')) - ->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCR_CRON_ARG_RUN_1')) + ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_RUN')) + ->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1')) ; } -- cgit v1.2.1 From e7fd259766ff78edf98ee08fff83cb70ac46b6f7 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 16:37:45 +0200 Subject: [ticket/12597] Refactoring and test improving Adding tests of return status Refactoring code Adding consistency in verbose mode PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 104 ++++++++++++++++++++++--------- 1 file changed, 75 insertions(+), 29 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index df69b05321..14cda84e7f 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -33,7 +33,7 @@ class run extends \phpbb\console\command\command * Construct method * * @param \phpbb\cron\manager $cron_manager The cron manager containing - * the cron tasks to be executed. + * the cron tasks to be executed. * @param \phpbb\lock\db $lock_db The lock for accessing database. * @param \phobb\user $user The user object (used to get language information) */ @@ -68,14 +68,15 @@ class run extends \phpbb\console\command\command * If the verbose option is specified, each start of a task is printed. * Otherwise there is no output. * If an argument is given to the command, only the task whose name matches the - * argument will be started. If none exists, an error message is - * printed and the exit status is set to 2. Verbose option does nothing in - * this case. + * argument will be started. If verbose option is specified, + * an info message containing the name of the task is printed. + * If no task matches the argument given, an error message is printed + * and the exit status is set to 2. * - * @param InputInterface $input The input stream used to get the argument + * @param InputInterface $input The input stream used to get the argument and verboe option. * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. * - * @return int 0 if all is ok, 1 if a lock error occured and -1 if no task matching the argument was found + * @return int 0 if all is ok, 1 if a lock error occured and 2 if no task matching the argument was found. */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -84,40 +85,85 @@ class run extends \phpbb\console\command\command $task_name = $input->getArgument('name'); if ($task_name) { - $task = $this->cron_manager->find_task($task_name); - if ($task) - { - $task->run(); - return 0; - } - else - { - $output->writeln('' . $this->user->lang('CRON_NO_TASK') . ''); - return 2; - } + return $this->run_one($input, $output, $task_name); } else { - $run_tasks = $this->cron_manager->find_all_ready_tasks(); + $this->run_all($input, $output); + return 0; + } + } + else + { + $output->writeln('' . $this->user->lang('CRON_LOCK_ERROR') . ''); + return 1; + } + } - foreach ($run_tasks as $task) - { - if ($input->getOption('verbose')) - { - $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name())); - } + /* + * Executes the command in the case when no argument was given. + * + * If verbose mode is set, an info message will be printed if their is no task to + * be run, or else for each starting task. + * + * @see execute + * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * @return null + */ + private function run_all(InputInterface $input, OutputInterface $output) + { + $run_tasks = $this->cron_manager->find_all_ready_tasks(); - $task->run(); + if ($run_tasks) { + foreach ($run_tasks as $task) + { + if ($input->getOption('verbose')) + { + $output->writeln('' . $this->user->lang('RUNNING_TASK', $task->get_name()) . ''); } - $this->lock_db->release(); - return 0; + $task->run(); } } else { - $output->writeln('' . $this->user->lang('CRON_LOCK_ERROR') . ''); - return 1; + $output->writeln('' . $this->user->lang('CRON_NO_TASK') . ''); + } + $this->lock_db->release(); + } + + /* + * Executes the command in the case where an argument is given. + * + * If their is a task whose name matches the argument, it is run and 0 is returned. + * and if verbose mode is set, print an info message with the name of the task. + * If there is no task matching $task_name, the function prints an error message + * and returns with status 2. + * + * @see execute + * @param string $task_name The name of the task that should be run. + * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * @return int 0 if all is well, 2 if no task matches $task_name. + */ + private function run_one(InputInterface $input, OutputInterface $output, $task_name) + { + $task = $this->cron_manager->find_task($task_name); + if ($task) + { + if ($input->getOption('verbose')) + { + $output->writeln('' . $this->user->lang('RUNNING_TASK', $task_nameœ) . ''); + } + + $task->run(); + return 0; + } + else + { + $output->writeln('' . $this->user->lang('CRON_NO_SUCH_TASK') . ''); + return 2; } } } -- cgit v1.2.1 From c17a1e92c5d63beb0f7f602a061c33a9eb093639 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 16:59:41 +0200 Subject: [ticket/12597] Fix visibilty of two functions in run.php PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 14cda84e7f..0da4d7c86d 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -111,7 +111,7 @@ class run extends \phpbb\console\command\command * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. * @return null */ - private function run_all(InputInterface $input, OutputInterface $output) + protected function run_all(InputInterface $input, OutputInterface $output) { $run_tasks = $this->cron_manager->find_all_ready_tasks(); @@ -147,7 +147,7 @@ class run extends \phpbb\console\command\command * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. * @return int 0 if all is well, 2 if no task matches $task_name. */ - private function run_one(InputInterface $input, OutputInterface $output, $task_name) + protected function run_one(InputInterface $input, OutputInterface $output, $task_name) { $task = $this->cron_manager->find_task($task_name); if ($task) -- cgit v1.2.1 From 7508d2b546392c4a1e3ae4ea48cb45ebc502e5e7 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 17:03:34 +0200 Subject: [ticket/12597] Fix various mistakes Typing mistakes Coding style issue Verbose mode messag PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 0da4d7c86d..cb304d9161 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -115,7 +115,8 @@ class run extends \phpbb\console\command\command { $run_tasks = $this->cron_manager->find_all_ready_tasks(); - if ($run_tasks) { + if ($run_tasks) + { foreach ($run_tasks as $task) { if ($input->getOption('verbose')) @@ -128,7 +129,10 @@ class run extends \phpbb\console\command\command } else { - $output->writeln('' . $this->user->lang('CRON_NO_TASK') . ''); + if ($input->getOption('verbose')) + { + $output->writeln('' . $this->user->lang('CRON_NO_TASK') . ''); + } } $this->lock_db->release(); } @@ -154,7 +158,7 @@ class run extends \phpbb\console\command\command { if ($input->getOption('verbose')) { - $output->writeln('' . $this->user->lang('RUNNING_TASK', $task_nameœ) . ''); + $output->writeln('' . $this->user->lang('RUNNING_TASK', $task_name) . ''); } $task->run(); -- cgit v1.2.1 From 03e0e736ab054d8ad355012f5d34cfccb56c7955 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 17:26:58 +0200 Subject: [ticket/12597] Typing corrections and improvement of code consistency PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index cb304d9161..07949cc962 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -60,7 +60,7 @@ class run extends \phpbb\console\command\command } /** - * Executes the function. + * Executes the command cron:run. * * Tries to acquire the cron lock, then if no argument has been given runs all ready cron tasks. * If the cron lock can not be obtained, an error message is printed @@ -89,8 +89,7 @@ class run extends \phpbb\console\command\command } else { - $this->run_all($input, $output); - return 0; + return $this->run_all($input, $output); } } else @@ -101,15 +100,15 @@ class run extends \phpbb\console\command\command } /* - * Executes the command in the case when no argument was given. + * Executes all ready cron tasks. * - * If verbose mode is set, an info message will be printed if their is no task to + * If verbose mode is set, an info message will be printed if there is no task to * be run, or else for each starting task. * * @see execute * @param InputInterface $input The input stream used to get the argument and verboe option. * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. - * @return null + * @return int 0 */ protected function run_all(InputInterface $input, OutputInterface $output) { @@ -134,13 +133,15 @@ class run extends \phpbb\console\command\command $output->writeln('' . $this->user->lang('CRON_NO_TASK') . ''); } } + $this->lock_db->release(); + return 0; } /* - * Executes the command in the case where an argument is given. + * Executes a given cron task, if it is ready. * - * If their is a task whose name matches the argument, it is run and 0 is returned. + * If there is a task whose name matches the argument, it is run and 0 is returned. * and if verbose mode is set, print an info message with the name of the task. * If there is no task matching $task_name, the function prints an error message * and returns with status 2. @@ -162,11 +163,13 @@ class run extends \phpbb\console\command\command } $task->run(); + $this->lock_db->release(); return 0; } else { $output->writeln('' . $this->user->lang('CRON_NO_SUCH_TASK') . ''); + $this->lock_db->release(); return 2; } } -- cgit v1.2.1 From fda2cc636cd3df852c7dc7ca0f12b4696ff0553c Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 18:03:23 +0200 Subject: [ticket/12597] Changing place of lock release in execute() method PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 07949cc962..c0fb521c52 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -85,12 +85,15 @@ class run extends \phpbb\console\command\command $task_name = $input->getArgument('name'); if ($task_name) { - return $this->run_one($input, $output, $task_name); + $exit_status = $this->run_one($input, $output, $task_name); } else { - return $this->run_all($input, $output); + $exit_status = $this->run_all($input, $output); } + + $this->lock_db->release(); + return $exit_status; } else { @@ -134,7 +137,6 @@ class run extends \phpbb\console\command\command } } - $this->lock_db->release(); return 0; } @@ -163,13 +165,11 @@ class run extends \phpbb\console\command\command } $task->run(); - $this->lock_db->release(); return 0; } else { $output->writeln('' . $this->user->lang('CRON_NO_SUCH_TASK') . ''); - $this->lock_db->release(); return 2; } } -- cgit v1.2.1 From 3b845b189316b341594fe3eeb0b63e42df033d57 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 18:08:02 +0200 Subject: [ticket/12597] Typo corrections PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index c0fb521c52..835c93e4c4 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -109,7 +109,7 @@ class run extends \phpbb\console\command\command * be run, or else for each starting task. * * @see execute - * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param InputInterface $input The input stream used to get the argument and verbose option. * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. * @return int 0 */ @@ -143,7 +143,7 @@ class run extends \phpbb\console\command\command /* * Executes a given cron task, if it is ready. * - * If there is a task whose name matches the argument, it is run and 0 is returned. + * If there is a task whose name matches $task_name, it is run and 0 is returned. * and if verbose mode is set, print an info message with the name of the task. * If there is no task matching $task_name, the function prints an error message * and returns with status 2. -- cgit v1.2.1 From 43fbb84cc39385a237e101bf3c915bdd711113de Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 18:09:42 +0200 Subject: [ticket/12597] Typo correction PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 835c93e4c4..f76fb30e3b 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -150,7 +150,7 @@ class run extends \phpbb\console\command\command * * @see execute * @param string $task_name The name of the task that should be run. - * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param InputInterface $input The input stream used to get the argument and verbose option. * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. * @return int 0 if all is well, 2 if no task matches $task_name. */ -- cgit v1.2.1 From 4d80d90f7300f9dca96b5c72be5c3b66ce598791 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 30 May 2014 19:51:11 +0200 Subject: [ticket/12597] Improve language for cron:run command. PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index f76fb30e3b..1029a2e085 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -3,7 +3,7 @@ * * This file is part of the phpBB Forum Software package. * -* @copyright (c) phpBB Limited +* @copyright (c) phpBB Limited * @license GNU General Public License, version 2 (GPL-2.0) * * For full copyright and license information, please see @@ -67,7 +67,7 @@ class run extends \phpbb\console\command\command * and the exit status is set to 1. * If the verbose option is specified, each start of a task is printed. * Otherwise there is no output. - * If an argument is given to the command, only the task whose name matches the + * If an argument is given to the command, only the task whose name matches the * argument will be started. If verbose option is specified, * an info message containing the name of the task is printed. * If no task matches the argument given, an error message is printed @@ -169,7 +169,7 @@ class run extends \phpbb\console\command\command } else { - $output->writeln('' . $this->user->lang('CRON_NO_SUCH_TASK') . ''); + $output->writeln('' . $this->user->lang('CRON_NO_SUCH_TASK', $task_name) . ''); return 2; } } -- cgit v1.2.1 From 58d7302b495783edd6e0826c100ffa93acb0693d Mon Sep 17 00:00:00 2001 From: Etienne Baroux Date: Mon, 2 Jun 2014 12:17:37 +0200 Subject: [ticket/12602] Add files to print the cron list and test files. PHPBB3-12602 --- phpBB/phpbb/console/command/cron/cron_list.php | 80 ++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 phpBB/phpbb/console/command/cron/cron_list.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php new file mode 100644 index 0000000000..0018d9542d --- /dev/null +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -0,0 +1,80 @@ +cron_manager = $cron_manager; + $this->user = $user; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('cron:list') + ->setDescription($this->user->lang('CLI_DESCR_CRON_LIST')) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $tasks = $this->cron_manager->get_tasks(); + + if (empty($tasks)) + { + $output->writeln($this->user->lang('NO_TASK')); + return; + } + + $ready_tasks = array(); + $not_ready_tasks = array(); + foreach ($tasks as $task) + { + if ($task->is_ready()) + { + $ready_tasks[] = $task; + } + else + { + $not_ready_tasks[] = $task; + } + } + + if (!empty($ready_tasks)) + { + $output->writeln('' . $this->user->lang('TASKS_READY') . ''); + foreach ($ready_tasks as $task) + { + $output->writeln($task->get_name()); + } + $output->writeln(''); + } + + if (!empty($not_ready_tasks)) + { + $output->writeln('' . $this->user->lang('TASKS_NOT_READY') . ''); + foreach ($not_ready_tasks as $task) + { + $output->writeln($task->get_name()); + } + } + } +} -- cgit v1.2.1 From dc7be4f273f68e85aa218a6731e4cb691c4691e0 Mon Sep 17 00:00:00 2001 From: Etienne Baroux Date: Mon, 2 Jun 2014 15:58:02 +0200 Subject: [ticket/12602] Correction of the output message for the cron list PHPBB3-12602 --- phpBB/phpbb/console/command/cron/cron_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index 0018d9542d..beedc3c932 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -30,7 +30,7 @@ class cron_list extends \phpbb\console\command\command { $this ->setName('cron:list') - ->setDescription($this->user->lang('CLI_DESCR_CRON_LIST')) + ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_LIST')) ; } -- cgit v1.2.1 From 760aa9d402aa300349b18ba785fa7ccc4b5fccf5 Mon Sep 17 00:00:00 2001 From: Etienne Baroux Date: Tue, 3 Jun 2014 10:42:50 +0200 Subject: [ticket/12602] Changes to respect coding style and to factorize code. PHPBB3-12602 --- phpBB/phpbb/console/command/cron/cron_list.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index beedc3c932..f95cb6fb03 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -61,20 +61,26 @@ class cron_list extends \phpbb\console\command\command if (!empty($ready_tasks)) { $output->writeln('' . $this->user->lang('TASKS_READY') . ''); - foreach ($ready_tasks as $task) - { - $output->writeln($task->get_name()); - } + $this->print_tasks_names($ready_tasks, $output); + } + + if (!empty($ready_tasks) && !empty($not_ready_tasks)) + { $output->writeln(''); } if (!empty($not_ready_tasks)) { $output->writeln('' . $this->user->lang('TASKS_NOT_READY') . ''); - foreach ($not_ready_tasks as $task) - { - $output->writeln($task->get_name()); - } + $this->print_tasks_names($not_ready_tasks, $output); + } + } + + public function print_tasks_names ($tasks, $output) + { + foreach ($tasks as $task) + { + $output->writeln($task->get_name()); } } } -- cgit v1.2.1 From 721a1d0bc49fce52a8e438946a58ba0ca6db2f28 Mon Sep 17 00:00:00 2001 From: Etienne Baroux Date: Tue, 3 Jun 2014 10:50:00 +0200 Subject: [ticket/12602] Headers updated. PHPBB3-12602 --- phpBB/phpbb/console/command/cron/cron_list.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index f95cb6fb03..c933bc6d69 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\cron; -- cgit v1.2.1 From 5aca27e8cfc0f9387bc62756c8f296e2cec823a3 Mon Sep 17 00:00:00 2001 From: Etienne Baroux Date: Tue, 3 Jun 2014 10:54:28 +0200 Subject: [ticket/12602] Fix coding style mistakes. PHPBB3-12602 --- phpBB/phpbb/console/command/cron/cron_list.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index c933bc6d69..c6677db1f5 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -88,3 +88,4 @@ class cron_list extends \phpbb\console\command\command } } } + -- cgit v1.2.1 From 6c9518ea3232d02605ea4bd57e1bf56a91d05855 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 4 Jun 2014 14:47:00 +0200 Subject: [ticket/12655] Don't require acp/common again in the commands PHPBB3-12655 --- phpBB/phpbb/console/command/cache/purge.php | 1 - phpBB/phpbb/console/command/db/migrate.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 1e2adaeb4d..50953185a4 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -43,7 +43,6 @@ class purge extends \phpbb\console\command\command $this->log = $log; $this->user = $user; $this->config = $config; - $this->user->add_lang(array('acp/common')); parent::__construct(); } diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 0f74664095..2abeaf5268 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -43,7 +43,7 @@ class migrate extends \phpbb\console\command\command $this->cache = $cache; $this->log = $log; $this->user = $user; - $this->user->add_lang(array('common', 'acp/common', 'install', 'migrator')); + $this->user->add_lang(array('common', 'install', 'migrator')); parent::__construct(); } -- cgit v1.2.1 From 7c22d653e92af46375a6547be7e9b2527bc3d385 Mon Sep 17 00:00:00 2001 From: Etienne Baroux Date: Wed, 4 Jun 2014 15:50:09 +0200 Subject: [ticket/12602] Coding style correction. PHPBB3-12602 --- phpBB/phpbb/console/command/cron/cron_list.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index c6677db1f5..c933bc6d69 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -88,4 +88,3 @@ class cron_list extends \phpbb\console\command\command } } } - -- cgit v1.2.1 From 442e12828b827239806e84dcd77641cfc5daca57 Mon Sep 17 00:00:00 2001 From: Etienne Baroux Date: Wed, 4 Jun 2014 21:56:55 +0200 Subject: [ticket/12602] Fix spaces issues. PHPBB3-12602 --- phpBB/phpbb/console/command/cron/cron_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index c933bc6d69..9d9a3bdef7 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -80,7 +80,7 @@ class cron_list extends \phpbb\console\command\command } } - public function print_tasks_names ($tasks, $output) + public function print_tasks_names($tasks, $output) { foreach ($tasks as $task) { -- cgit v1.2.1 From c6999481e7ebd4c24127161ad2b51d8c3e15dc05 Mon Sep 17 00:00:00 2001 From: Etienne Baroux Date: Thu, 5 Jun 2014 15:11:15 +0200 Subject: [ticket/12602] Add types, change description of cron:list. PHPBB3-12602 --- phpBB/phpbb/console/command/cron/cron_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index 9d9a3bdef7..1c32e6e306 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -80,7 +80,7 @@ class cron_list extends \phpbb\console\command\command } } - public function print_tasks_names($tasks, $output) + protected function print_tasks_names(array $tasks, OutputInterface $output) { foreach ($tasks as $task) { -- cgit v1.2.1 From 8f0a04f318a5cf11595eae9f52118bfef7f3d98c Mon Sep 17 00:00:00 2001 From: Etienne Baroux Date: Fri, 6 Jun 2014 10:21:00 +0200 Subject: [ticket/12602] Fix language var mistakes. PHPBB3-12602 --- phpBB/phpbb/console/command/cron/cron_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index 1c32e6e306..cc51a57f4b 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -44,7 +44,7 @@ class cron_list extends \phpbb\console\command\command if (empty($tasks)) { - $output->writeln($this->user->lang('NO_TASK')); + $output->writeln($this->user->lang('CRON_NO_RUNNABLE_TASK')); return; } -- cgit v1.2.1 From 347de7f060095cc43c2a5b5575924997ac8d3dbf Mon Sep 17 00:00:00 2001 From: Etienne Baroux Date: Fri, 6 Jun 2014 14:55:37 +0200 Subject: [ticket/12602] Rectify language keys. PHPBB3-12602 --- phpBB/phpbb/console/command/cron/cron_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index cc51a57f4b..9db6a23947 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -44,7 +44,7 @@ class cron_list extends \phpbb\console\command\command if (empty($tasks)) { - $output->writeln($this->user->lang('CRON_NO_RUNNABLE_TASK')); + $output->writeln($this->user->lang('CRON_NO_TASKS')); return; } -- cgit v1.2.1 From 2964fb37e84a8e7448598a07bfa62ade6c6fb7ae Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 10 Jun 2014 01:57:59 +0200 Subject: [ticket/12664] Refactor develop/migration_tips.php into a console command. PHPBB3-12664 --- phpBB/phpbb/console/command/dev/migration_tips.php | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 phpBB/phpbb/console/command/dev/migration_tips.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php new file mode 100644 index 0000000000..62a0a68865 --- /dev/null +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -0,0 +1,63 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\dev; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class migration_tips extends \phpbb\console\command\command +{ + /** @var \phpbb\extension\manager */ + protected $extension_manager; + + function __construct(\phpbb\extension\manager $extension_manager) + { + $this->extension_manager = $extension_manager; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('dev:migration-tips') + ->setDescription('Finds migrations that are not depended on.') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $migrations = $this->extension_manager->get_finder() + ->core_path('phpbb/db/migration/data/') + ->get_classes(); + $tips = $migrations; + + foreach ($migrations as $migration_class) + { + foreach ($migration_class::depends_on() as $dependency) + { + $tips_key = array_search($dependency, $tips); + if ($tips_key !== false) + { + unset($tips[$tips_key]); + } + } + } + + $output->writeln("\t\tarray("); + foreach ($tips as $migration) + { + $output->writeln("\t\t\t'{$migration}',"); + } + $output->writeln("\t\t);"); + } +} -- cgit v1.2.1 From 0134acd53fb93ef64b60504ac73e20dc27910578 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 10 Jun 2014 11:50:11 +0200 Subject: [ticket/12508] Ignore extensions in migration_tips dev tool PHPBB3-12508 --- phpBB/phpbb/console/command/dev/migration_tips.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php index 62a0a68865..c2f61568ea 100644 --- a/phpBB/phpbb/console/command/dev/migration_tips.php +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -37,6 +37,7 @@ class migration_tips extends \phpbb\console\command\command protected function execute(InputInterface $input, OutputInterface $output) { $migrations = $this->extension_manager->get_finder() + ->set_extensions(array()) ->core_path('phpbb/db/migration/data/') ->get_classes(); $tips = $migrations; -- cgit v1.2.1 From 48b19ac37c8494f798f101f1964c6eb9996c2165 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 15 Jun 2014 12:18:55 +0200 Subject: [ticket/12715] Update console command cache:purge comments PHPBB3-12715 --- phpBB/phpbb/console/command/cache/purge.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 50953185a4..379d2aa1ca 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -35,6 +35,16 @@ class purge extends \phpbb\console\command\command /** @var \phpbb\config\config */ protected $config; + /** + * Constructor + * + * @param \phpbb\cache\driver\driver_interface $cache Cache instance + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param \phpbb\auth\auth $auth Auth instance + * @param \phpbb\log\log $log Logger instance + * @param \phpbb\user $user User instance + * @param \phpbb\config\config $config Config instance + */ public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user, \phpbb\config\config $config) { $this->cache = $cache; @@ -46,6 +56,9 @@ class purge extends \phpbb\console\command\command parent::__construct(); } + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -54,6 +67,16 @@ class purge extends \phpbb\console\command\command ; } + /** + * Executes the command cache:purge. + * + * Purge the cache (including permissions) and increment the asset_version number + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ protected function execute(InputInterface $input, OutputInterface $output) { $this->config->increment('assets_version', 1); -- cgit v1.2.1 From 413754af1f2d10aae366f8255d0d91ec7e6fd878 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 15 Jun 2014 12:19:24 +0200 Subject: [ticket/12715] Update console command config:* comments PHPBB3-12715 --- phpBB/phpbb/console/command/config/delete.php | 15 ++++++++++++++- phpBB/phpbb/console/command/config/get.php | 14 ++++++++++++++ phpBB/phpbb/console/command/config/increment.php | 14 ++++++++++++++ phpBB/phpbb/console/command/config/set.php | 14 ++++++++++++++ phpBB/phpbb/console/command/config/set_atomic.php | 15 +++++++++++++++ 5 files changed, 71 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index e29afdbf82..1310bb18b4 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -14,11 +14,13 @@ namespace phpbb\console\command\config; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class delete extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -32,6 +34,17 @@ class delete extends command ; } + /** + * Executes the command config:delete. + * + * Removes a configuration option + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + * @see \phpbb\config\config::delete() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index 0ed2a12608..20164f0da1 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -19,6 +19,9 @@ use Symfony\Component\Console\Output\OutputInterface; class get extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -38,6 +41,17 @@ class get extends command ; } + /** + * Executes the command config:get. + * + * Retrieves a configuration value. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + * @see \phpbb\config\config::offsetGet() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 64b5d42b9d..21f0660e61 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -19,6 +19,9 @@ use Symfony\Component\Console\Output\OutputInterface; class increment extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -43,6 +46,17 @@ class increment extends command ; } + /** + * Executes the command config:increment. + * + * Increments an integer configuration value. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + * @see \phpbb\config\config::increment() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index fce1edb93e..587b7fb0de 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -19,6 +19,9 @@ use Symfony\Component\Console\Output\OutputInterface; class set extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -43,6 +46,17 @@ class set extends command ; } + /** + * Executes the command config:set. + * + * Sets a configuration option's value. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + * @see \phpbb\config\config::set() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index 4df2d90722..a7a52155f9 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -19,6 +19,9 @@ use Symfony\Component\Console\Output\OutputInterface; class set_atomic extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -48,6 +51,18 @@ class set_atomic extends command ; } + /** + * Executes the command config:set-atomic. + * + * Sets a configuration option's value only if the old_value matches the + * current configuration value or the configuration value does not exist yet. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return bool True if the value was changed, false otherwise. + * @see \phpbb\config\config::set_atomic() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); -- cgit v1.2.1 From 8966e4a26970bb082fc02e8e4e57144567e95d31 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 15 Jun 2014 12:26:23 +0200 Subject: [ticket/12715] Update console command cron:* comments PHPBB3-12715 --- phpBB/phpbb/console/command/cron/cron_list.php | 25 +++++++++++++++++++++++++ phpBB/phpbb/console/command/cron/run.php | 7 +++---- 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index 9db6a23947..4f4228d9b3 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -23,6 +23,12 @@ class cron_list extends \phpbb\console\command\command /** @var \phpbb\user */ protected $user; + /** + * Constructor + * + * @param \phpbb\cron\manager $cron_manager Cron manager + * @param \phpbb\user $user User instance + */ public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\user $user) { $this->cron_manager = $cron_manager; @@ -30,6 +36,9 @@ class cron_list extends \phpbb\console\command\command parent::__construct(); } + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -38,6 +47,16 @@ class cron_list extends \phpbb\console\command\command ; } + /** + * Executes the command cron:list. + * + * Prints a list of ready and unready cron jobs. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ protected function execute(InputInterface $input, OutputInterface $output) { $tasks = $this->cron_manager->get_tasks(); @@ -80,6 +99,12 @@ class cron_list extends \phpbb\console\command\command } } + /** + * Print a list of cron jobs + * + * @param array $tasks A list of task to display + * @param OutputInterface $output An OutputInterface instance + */ protected function print_tasks_names(array $tasks, OutputInterface $output) { foreach ($tasks as $task) diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 1029a2e085..32774bebe4 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -15,7 +15,6 @@ namespace phpbb\console\command\cron; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class run extends \phpbb\console\command\command @@ -35,7 +34,7 @@ class run extends \phpbb\console\command\command * @param \phpbb\cron\manager $cron_manager The cron manager containing * the cron tasks to be executed. * @param \phpbb\lock\db $lock_db The lock for accessing database. - * @param \phobb\user $user The user object (used to get language information) + * @param \phpbb\user $user The user object (used to get language information) */ public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db, \phpbb\user $user) { @@ -102,7 +101,7 @@ class run extends \phpbb\console\command\command } } - /* + /** * Executes all ready cron tasks. * * If verbose mode is set, an info message will be printed if there is no task to @@ -140,7 +139,7 @@ class run extends \phpbb\console\command\command return 0; } - /* + /** * Executes a given cron task, if it is ready. * * If there is a task whose name matches $task_name, it is run and 0 is returned. -- cgit v1.2.1 From 09fc008e62453352cb34f4391acda310ea8b41c7 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 15 Jun 2014 21:34:02 +0200 Subject: [ticket/12721] Add Squiz.ControlStructures.ElseIfDeclaration in legacy PHPBB3-12721 --- phpBB/phpbb/console/command/config/get.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index 20164f0da1..ee8c65110e 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -60,7 +60,7 @@ class get extends command { $output->write($this->config[$key]); } - elseif (isset($this->config[$key])) + else if (isset($this->config[$key])) { $output->writeln($this->config[$key]); } -- cgit v1.2.1 From 32a2c95f903cbbfad909945887a1cbabd84d5039 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 20 Jun 2014 15:02:08 +0200 Subject: [ticket/12723] Add Sniff ensuring PHP files use the correct file header PHPBB3-12723 --- phpBB/phpbb/console/command/cron/run.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 32774bebe4..0b365ece67 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -3,7 +3,7 @@ * * This file is part of the phpBB Forum Software package. * -* @copyright (c) phpBB Limited +* @copyright (c) phpBB Limited * @license GNU General Public License, version 2 (GPL-2.0) * * For full copyright and license information, please see -- cgit v1.2.1 From a54d74bf09a65a36c00daefed022e3e99fcd047f Mon Sep 17 00:00:00 2001 From: n-aleha Date: Thu, 26 Jun 2014 21:05:32 +0300 Subject: [ticket/12773] Fix language variable name in cli extension enable command PHPBB3-12773 --- phpBB/phpbb/console/command/extension/enable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 0cdf26d4db..05e1d927c6 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -39,7 +39,7 @@ class enable extends command if ($this->manager->enabled($name)) { - $this->log->add('admin', ANONYMOUS, '', 'LOG_EXTENSION_ENABLE', time(), array($name)); + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); $output->writeln("Successfully enabled extension $name"); return 0; } -- cgit v1.2.1 From d13e02c7b100ac43943f11912a8f4acb740f69b6 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 27 Jun 2014 10:49:13 +0200 Subject: [ticket/12777] Rename extension status functions and add is_configured() PHPBB3-12777 --- phpBB/phpbb/console/command/extension/disable.php | 2 +- phpBB/phpbb/console/command/extension/enable.php | 2 +- phpBB/phpbb/console/command/extension/purge.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index 5f0e74b984..c04848aa01 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -37,7 +37,7 @@ class disable extends command $this->manager->disable($name); $this->manager->load_extensions(); - if ($this->manager->enabled($name)) + if ($this->manager->is_enabled($name)) { $output->writeln("Could not disable extension $name"); return 1; diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 0cdf26d4db..d0d0c9f1cc 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -37,7 +37,7 @@ class enable extends command $this->manager->enable($name); $this->manager->load_extensions(); - if ($this->manager->enabled($name)) + if ($this->manager->is_enabled($name)) { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXTENSION_ENABLE', time(), array($name)); $output->writeln("Successfully enabled extension $name"); diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index 4e57641d83..841598b90a 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -37,7 +37,7 @@ class purge extends command $this->manager->purge($name); $this->manager->load_extensions(); - if ($this->manager->enabled($name)) + if ($this->manager->is_enabled($name)) { $output->writeln("Could not purge extension $name"); return 1; -- cgit v1.2.1 From 07ce29c081c8bbd24a5094d89346be33dda583c5 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 17 Jul 2014 17:19:36 +0200 Subject: [ticket/12656] Pass user object into all console commands. PHPBB3-12656 --- phpBB/phpbb/console/command/cache/purge.php | 10 +++------- phpBB/phpbb/console/command/command.php | 13 +++++++++++++ phpBB/phpbb/console/command/config/command.php | 4 ++-- phpBB/phpbb/console/command/cron/cron_list.php | 10 +++------- phpBB/phpbb/console/command/cron/run.php | 10 +++------- phpBB/phpbb/console/command/db/migrate.php | 8 ++------ phpBB/phpbb/console/command/dev/migration_tips.php | 4 ++-- phpBB/phpbb/console/command/extension/command.php | 4 ++-- .../phpbb/console/command/fixup/recalculate_email_hash.php | 4 ++-- 9 files changed, 32 insertions(+), 35 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 379d2aa1ca..8c51d1b5a8 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -29,31 +29,27 @@ class purge extends \phpbb\console\command\command /** @var \phpbb\log\log */ protected $log; - /** @var \phpbb\user */ - protected $user; - /** @var \phpbb\config\config */ protected $config; /** * Constructor * + * @param \phpbb\user $user User instance * @param \phpbb\cache\driver\driver_interface $cache Cache instance * @param \phpbb\db\driver\driver_interface $db Database connection * @param \phpbb\auth\auth $auth Auth instance * @param \phpbb\log\log $log Logger instance - * @param \phpbb\user $user User instance * @param \phpbb\config\config $config Config instance */ - public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user, \phpbb\config\config $config) + public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\config\config $config) { $this->cache = $cache; $this->db = $db; $this->auth = $auth; $this->log = $log; - $this->user = $user; $this->config = $config; - parent::__construct(); + parent::__construct($user); } /** diff --git a/phpBB/phpbb/console/command/command.php b/phpBB/phpbb/console/command/command.php index d3449c0c38..638c989da2 100644 --- a/phpBB/phpbb/console/command/command.php +++ b/phpBB/phpbb/console/command/command.php @@ -15,4 +15,17 @@ namespace phpbb\console\command; abstract class command extends \Symfony\Component\Console\Command\Command { + /** @var \phpbb\user */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\user $user User instance (mostly for translation) + */ + public function __construct(\phpbb\user $user) + { + $this->user = $user; + parent::__construct(); + } } diff --git a/phpBB/phpbb/console/command/config/command.php b/phpBB/phpbb/console/command/config/command.php index de3fbd7fa7..f0ad5d4d19 100644 --- a/phpBB/phpbb/console/command/config/command.php +++ b/phpBB/phpbb/console/command/config/command.php @@ -17,10 +17,10 @@ abstract class command extends \phpbb\console\command\command /** @var \phpbb\config\config */ protected $config; - function __construct(\phpbb\config\config $config) + function __construct(\phpbb\user $user, \phpbb\config\config $config) { $this->config = $config; - parent::__construct(); + parent::__construct($user); } } diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index 4f4228d9b3..c515fd9e80 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -20,20 +20,16 @@ class cron_list extends \phpbb\console\command\command /** @var \phpbb\cron\manager */ protected $cron_manager; - /** @var \phpbb\user */ - protected $user; - /** * Constructor * - * @param \phpbb\cron\manager $cron_manager Cron manager * @param \phpbb\user $user User instance + * @param \phpbb\cron\manager $cron_manager Cron manager */ - public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\user $user) + public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager) { $this->cron_manager = $cron_manager; - $this->user = $user; - parent::__construct(); + parent::__construct($user); } /** diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 0b365ece67..72ad1205ef 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -25,23 +25,19 @@ class run extends \phpbb\console\command\command /** @var \phpbb\lock\db */ protected $lock_db; - /** @var \phpbb\user */ - protected $user; - /** * Construct method * + * @param \phpbb\user $user The user object (used to get language information) * @param \phpbb\cron\manager $cron_manager The cron manager containing * the cron tasks to be executed. * @param \phpbb\lock\db $lock_db The lock for accessing database. - * @param \phpbb\user $user The user object (used to get language information) */ - public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db, \phpbb\user $user) + public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db) { $this->cron_manager = $cron_manager; $this->lock_db = $lock_db; - $this->user = $user; - parent::__construct(); + parent::__construct($user); } /** diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 2abeaf5268..758b125b13 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -32,19 +32,15 @@ class migrate extends \phpbb\console\command\command /** @var \phpbb\log\log */ protected $log; - /** @var \phpbb\user */ - protected $user; - - function __construct(\phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\user $user) + function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log) { $this->migrator = $migrator; $this->extension_manager = $extension_manager; $this->config = $config; $this->cache = $cache; $this->log = $log; - $this->user = $user; + parent::__construct($user); $this->user->add_lang(array('common', 'install', 'migrator')); - parent::__construct(); } protected function configure() diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php index c2f61568ea..e1387b34ae 100644 --- a/phpBB/phpbb/console/command/dev/migration_tips.php +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -20,10 +20,10 @@ class migration_tips extends \phpbb\console\command\command /** @var \phpbb\extension\manager */ protected $extension_manager; - function __construct(\phpbb\extension\manager $extension_manager) + function __construct(\phpbb\user $user, \phpbb\extension\manager $extension_manager) { $this->extension_manager = $extension_manager; - parent::__construct(); + parent::__construct($user); } protected function configure() diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php index 21bb640504..364d954082 100644 --- a/phpBB/phpbb/console/command/extension/command.php +++ b/phpBB/phpbb/console/command/extension/command.php @@ -20,11 +20,11 @@ abstract class command extends \phpbb\console\command\command /** @var \phpbb\log\log */ protected $log; - public function __construct(\phpbb\extension\manager $manager, \phpbb\log\log $log) + public function __construct(\phpbb\user $user, \phpbb\extension\manager $manager, \phpbb\log\log $log) { $this->manager = $manager; $this->log = $log; - parent::__construct(); + parent::__construct($user); } } diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index ec04da4267..cb821cfe20 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -20,11 +20,11 @@ class recalculate_email_hash extends \phpbb\console\command\command /** @var \phpbb\db\driver\driver_interface */ protected $db; - function __construct(\phpbb\db\driver\driver_interface $db) + function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db) { $this->db = $db; - parent::__construct(); + parent::__construct($user); } protected function configure() -- cgit v1.2.1 From 4092b63be39453f9a7ce4f985217099ab10aae90 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 23 Jul 2014 00:35:09 +0530 Subject: [ticket/12656] Use lang keys for CLI command descriptions PHPBB3-12656 --- phpBB/phpbb/console/command/cache/purge.php | 2 +- phpBB/phpbb/console/command/config/delete.php | 2 +- phpBB/phpbb/console/command/config/get.php | 2 +- phpBB/phpbb/console/command/config/increment.php | 2 +- phpBB/phpbb/console/command/config/set.php | 2 +- phpBB/phpbb/console/command/config/set_atomic.php | 2 +- phpBB/phpbb/console/command/db/migrate.php | 2 +- phpBB/phpbb/console/command/dev/migration_tips.php | 2 +- phpBB/phpbb/console/command/extension/disable.php | 2 +- phpBB/phpbb/console/command/extension/enable.php | 2 +- phpBB/phpbb/console/command/extension/purge.php | 2 +- phpBB/phpbb/console/command/extension/show.php | 2 +- phpBB/phpbb/console/command/fixup/recalculate_email_hash.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 8c51d1b5a8..ec8229200c 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -59,7 +59,7 @@ class purge extends \phpbb\console\command\command { $this ->setName('cache:purge') - ->setDescription('Purge the cache.') + ->setDescription($this->user->lang('PURGE_CACHE')) ; } diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 1310bb18b4..2fca8f6831 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -25,7 +25,7 @@ class delete extends command { $this ->setName('config:delete') - ->setDescription('Deletes a configuration option') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DELETE_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index ee8c65110e..9734833d23 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -26,7 +26,7 @@ class get extends command { $this ->setName('config:get') - ->setDescription("Gets a configuration option's value") + ->setDescription($this->user->lang('CLI_DESCRIPTION_GET_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 21f0660e61..a77b3ab912 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -26,7 +26,7 @@ class increment extends command { $this ->setName('config:increment') - ->setDescription("Increments a configuration option's value") + ->setDescription($this->user->lang('CLI_DESCRIPTION_INCREMENT_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index 587b7fb0de..a0cc36e02f 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -26,7 +26,7 @@ class set extends command { $this ->setName('config:set') - ->setDescription("Sets a configuration option's value") + ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index a7a52155f9..31460d5137 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -26,7 +26,7 @@ class set_atomic extends command { $this ->setName('config:set-atomic') - ->setDescription("Sets a configuration option's value only if the old matches the current value.") + ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_ATOMIC_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 758b125b13..bb5f83b16f 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -47,7 +47,7 @@ class migrate extends \phpbb\console\command\command { $this ->setName('db:migrate') - ->setDescription('Updates the database by applying migrations.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE')) ; } diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php index e1387b34ae..f9047bdac8 100644 --- a/phpBB/phpbb/console/command/dev/migration_tips.php +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -30,7 +30,7 @@ class migration_tips extends \phpbb\console\command\command { $this ->setName('dev:migration-tips') - ->setDescription('Finds migrations that are not depended on.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_FIND_MIGRATIONS')) ; } diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index c04848aa01..ce32105ed5 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -22,7 +22,7 @@ class disable extends command { $this ->setName('extension:disable') - ->setDescription('Disables the specified extension.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DISABLE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 86a034cdf4..001b3e2158 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -22,7 +22,7 @@ class enable extends command { $this ->setName('extension:enable') - ->setDescription('Enables the specified extension.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index 841598b90a..81d687d07c 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -22,7 +22,7 @@ class purge extends command { $this ->setName('extension:purge') - ->setDescription('Purges the specified extension.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_PURGE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php index 2db1c59e24..a6066818db 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -21,7 +21,7 @@ class show extends command { $this ->setName('extension:show') - ->setDescription('Lists all extensions in the database and on the filesystem.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_LIST_EXTENSIONS')) ; } diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index cb821cfe20..94f850240e 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -31,7 +31,7 @@ class recalculate_email_hash extends \phpbb\console\command\command { $this ->setName('fixup:recalculate-email-hash') - ->setDescription('Recalculates the user_email_hash column of the users table.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH')) ; } -- cgit v1.2.1 From c81438e1f85633dd770fcddd8e332b278338732f Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 23 Jul 2014 01:23:44 +0530 Subject: [ticket/12656] Use lang keys for all CLI strings PHPBB3-12656 --- phpBB/phpbb/console/command/config/delete.php | 6 +++--- phpBB/phpbb/console/command/config/get.php | 6 +++--- phpBB/phpbb/console/command/config/increment.php | 8 ++++---- phpBB/phpbb/console/command/config/set.php | 8 ++++---- phpBB/phpbb/console/command/config/set_atomic.php | 12 ++++++------ phpBB/phpbb/console/command/extension/disable.php | 6 +++--- phpBB/phpbb/console/command/extension/enable.php | 6 +++--- phpBB/phpbb/console/command/extension/purge.php | 6 +++--- phpBB/phpbb/console/command/extension/show.php | 2 +- phpBB/phpbb/console/command/fixup/recalculate_email_hash.php | 2 +- 10 files changed, 31 insertions(+), 31 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 2fca8f6831..7923afd182 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -29,7 +29,7 @@ class delete extends command ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ; } @@ -53,11 +53,11 @@ class delete extends command { $this->config->delete($key); - $output->writeln("Successfully deleted config $key"); + $output->writeln('' . $this->user->lang('CLI_CONFIG_DELETE_SUCCESS', $key) . ''); } else { - $output->writeln("Config $key does not exist"); + $output->writeln('' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '''); } } } diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index 9734833d23..9c03b49a3d 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -30,13 +30,13 @@ class get extends command ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addOption( 'no-newline', null, InputOption::VALUE_NONE, - 'Set this option if the value should be printed without a new line at the end.' + $this->user->lang('CLI_CONFIG_PRINT_WITHOUT_NEWLINE') ) ; } @@ -66,7 +66,7 @@ class get extends command } else { - $output->writeln("Could not get config $key"); + $output->writeln('' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . ''); } } } diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index a77b3ab912..0c25075ce8 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -30,18 +30,18 @@ class increment extends command ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addArgument( 'increment', InputArgument::REQUIRED, - 'Amount to increment by' + $this->user->lang('CLI_CONFIG_INCREMENT_BY') ) ->addOption( 'dynamic', 'd', InputOption::VALUE_NONE, - 'Set this option if the configuration option changes too frequently to be efficiently cached.' + $this->user-lang('CLI_CONFIG_CANNOT_CACHED') ) ; } @@ -65,6 +65,6 @@ class increment extends command $this->config->increment($key, $increment, $use_cache); - $output->writeln("Successfully incremented config $key"); + $output->writeln('' . $this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key) . ''); } } diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index a0cc36e02f..695de31013 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -30,18 +30,18 @@ class set extends command ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addArgument( 'value', InputArgument::REQUIRED, - 'New configuration value, use 0 and 1 to specify boolean values' + $this->user->lang('CLI_CONFIG_NEW') ) ->addOption( 'dynamic', 'd', InputOption::VALUE_NONE, - 'Set this option if the configuration option changes too frequently to be efficiently cached.' + $this->user->lang('CLI_CONFIG_CANNOT_CACHED') ) ; } @@ -65,6 +65,6 @@ class set extends command $this->config->set($key, $value, $use_cache); - $output->writeln("Successfully set config $key"); + $output->writeln('' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . ''); } } diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index 31460d5137..e8c69a0885 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -30,23 +30,23 @@ class set_atomic extends command ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addArgument( 'old', InputArgument::REQUIRED, - 'Current configuration value, use 0 and 1 to specify boolean values' + $this->user->lang('CLI_CONFIG_CURRENT') ) ->addArgument( 'new', InputArgument::REQUIRED, - 'New configuration value, use 0 and 1 to specify boolean values' + $this->user->lang('CLI_CONFIG_NEW') ) ->addOption( 'dynamic', 'd', InputOption::VALUE_NONE, - 'Set this option if the configuration option changes too frequently to be efficiently cached.' + $this->user->lang('CLI_CONFIG_CANNOT_CACHED') ) ; } @@ -72,12 +72,12 @@ class set_atomic extends command if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache)) { - $output->writeln("Successfully set config $key"); + $output->writeln('' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . ''); return 0; } else { - $output->writeln("Could not set config $key"); + $output->writeln('' . $this->user->lang('CLI_CONFIG_SET_FAILURE', $key) . ''); return 1; } } diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index ce32105ed5..1eee16cbd9 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -26,7 +26,7 @@ class disable extends command ->addArgument( 'extension-name', InputArgument::REQUIRED, - 'Name of the extension' + $this->user->lang('CLI_EXTENSION_NAME') ) ; } @@ -39,13 +39,13 @@ class disable extends command if ($this->manager->is_enabled($name)) { - $output->writeln("Could not disable extension $name"); + $output->writeln('' . $this->user->lang('CLI_EXTENSION_DISABLE_FAILURE', $name) . ''); return 1; } else { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name)); - $output->writeln("Successfully disabled extension $name"); + $output->writeln('' . $this->user->lang('CLI_EXTENSION_DISABLE_SUCCESS', $name) . ''); return 0; } } diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 001b3e2158..cca4975aa6 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -26,7 +26,7 @@ class enable extends command ->addArgument( 'extension-name', InputArgument::REQUIRED, - 'Name of the extension' + $this->user->lang('CLI_EXTENSION_NAME') ) ; } @@ -40,12 +40,12 @@ class enable extends command if ($this->manager->is_enabled($name)) { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); - $output->writeln("Successfully enabled extension $name"); + $output->writeln('' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . ''); return 0; } else { - $output->writeln("Could not enable extension $name"); + $output->writeln('' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . ''); return 1; } } diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index 81d687d07c..517e9a74c9 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -26,7 +26,7 @@ class purge extends command ->addArgument( 'extension-name', InputArgument::REQUIRED, - 'Name of the extension' + $this->user->lang('CLI_EXTENSION_NAME') ) ; } @@ -39,13 +39,13 @@ class purge extends command if ($this->manager->is_enabled($name)) { - $output->writeln("Could not purge extension $name"); + $output->writeln('' . $this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name) . ''); return 1; } else { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name)); - $output->writeln("Successfully purge extension $name"); + $output->writeln('' . $this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name) . ''); return 0; } } diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php index a6066818db..6ce9607098 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -32,7 +32,7 @@ class show extends command if (empty($all)) { - $output->writeln('No extensions were found.'); + $output->writeln('' . $this->user->lang('CLI_EXTENSION_NOT_FOUND') . ''); return 3; } diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index 94f850240e..ec4e1b0ee7 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -70,6 +70,6 @@ class recalculate_email_hash extends \phpbb\console\command\command } $this->db->sql_freeresult($result); - $output->writeln('Successfully recalculated all email hashes.'); + $output->writeln('' . $this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS') . ''); } } -- cgit v1.2.1 From 653185610873e4629ffc929ace2b72e2fe41704d Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 24 Jul 2014 01:12:40 +0530 Subject: [ticket/12656] Fix typo PHPBB3-12656 --- phpBB/phpbb/console/command/config/delete.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 7923afd182..efd276d7e3 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -57,7 +57,7 @@ class delete extends command } else { - $output->writeln('' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '''); + $output->writeln('' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . ''); } } } -- cgit v1.2.1 From 8b8e09f4d52cfa2d9d951d827114b2ae510dbfc8 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 26 Jul 2014 11:50:28 +0200 Subject: [ticket/12870] Create the migrations table in db:migrate PHPBB3-12870 --- phpBB/phpbb/console/command/db/migrate.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 758b125b13..29f0fe7c16 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -32,13 +32,21 @@ class migrate extends \phpbb\console\command\command /** @var \phpbb\log\log */ protected $log; - function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log) + /** @var \phpbb\db\tools */ + protected $db_tools; + + /** @var string */ + protected $table_prefix; + + function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\db\tools $db_tools, $table_prefix) { $this->migrator = $migrator; $this->extension_manager = $extension_manager; $this->config = $config; $this->cache = $cache; $this->log = $log; + $this->db_tools = $db_tools; + $this->table_prefix = $table_prefix; parent::__construct($user); $this->user->add_lang(array('common', 'install', 'migrator')); } @@ -53,6 +61,23 @@ class migrate extends \phpbb\console\command\command protected function execute(InputInterface $input, OutputInterface $output) { + // Make sure migrations have been installed. + if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations')) + { + $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array( + 'COLUMNS' => array( + 'migration_name' => array('VCHAR', ''), + 'migration_depends_on' => array('TEXT', ''), + 'migration_schema_done' => array('BOOL', 0), + 'migration_data_done' => array('BOOL', 0), + 'migration_data_state' => array('TEXT', ''), + 'migration_start_time' => array('TIMESTAMP', 0), + 'migration_end_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => 'migration_name', + )); + } + $this->load_migrations(); $orig_version = $this->config['version']; while (!$this->migrator->finished()) -- cgit v1.2.1 From a8e81b6e9f42c3187d7b17c6bb5da052c28944a6 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 27 Jul 2014 11:08:13 +0200 Subject: [ticket/12870] Create the migrations table with a method in the migrator PHPBB3-12870 --- phpBB/phpbb/console/command/db/migrate.php | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 29f0fe7c16..dc16ed0699 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -32,21 +32,13 @@ class migrate extends \phpbb\console\command\command /** @var \phpbb\log\log */ protected $log; - /** @var \phpbb\db\tools */ - protected $db_tools; - - /** @var string */ - protected $table_prefix; - - function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\db\tools $db_tools, $table_prefix) + function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log) { $this->migrator = $migrator; $this->extension_manager = $extension_manager; $this->config = $config; $this->cache = $cache; $this->log = $log; - $this->db_tools = $db_tools; - $this->table_prefix = $table_prefix; parent::__construct($user); $this->user->add_lang(array('common', 'install', 'migrator')); } @@ -61,22 +53,7 @@ class migrate extends \phpbb\console\command\command protected function execute(InputInterface $input, OutputInterface $output) { - // Make sure migrations have been installed. - if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations')) - { - $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array( - 'COLUMNS' => array( - 'migration_name' => array('VCHAR', ''), - 'migration_depends_on' => array('TEXT', ''), - 'migration_schema_done' => array('BOOL', 0), - 'migration_data_done' => array('BOOL', 0), - 'migration_data_state' => array('TEXT', ''), - 'migration_start_time' => array('TIMESTAMP', 0), - 'migration_end_time' => array('TIMESTAMP', 0), - ), - 'PRIMARY_KEY' => 'migration_name', - )); - } + $this->migrator->create_migrations_table(); $this->load_migrations(); $orig_version = $this->config['version']; -- cgit v1.2.1 From cf93b7e367bb8c47e9cbec8e87ccb2e64387175a Mon Sep 17 00:00:00 2001 From: n-aleha Date: Sun, 3 Aug 2014 08:34:25 +0300 Subject: [ticket/12908] Fix operator typo in increment.php PHPBB3-12908 --- phpBB/phpbb/console/command/config/increment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 0c25075ce8..b4d7438b66 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -41,7 +41,7 @@ class increment extends command 'dynamic', 'd', InputOption::VALUE_NONE, - $this->user-lang('CLI_CONFIG_CANNOT_CACHED') + $this->user->lang('CLI_CONFIG_CANNOT_CACHED') ) ; } -- cgit v1.2.1 From 752363b435d77f9b2cf8fbc35f29e29ac74e0c97 Mon Sep 17 00:00:00 2001 From: n-aleha Date: Sun, 3 Aug 2014 09:53:18 +0300 Subject: [ticket/12909] Use correct lang vars in cli extension enable PHPBB3-12909 --- phpBB/phpbb/console/command/extension/enable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index cca4975aa6..59ff11e9b7 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -40,12 +40,12 @@ class enable extends command if ($this->manager->is_enabled($name)) { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); - $output->writeln('' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . ''); + $output->writeln('' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . ''); return 0; } else { - $output->writeln('' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . ''); + $output->writeln('' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . ''); return 1; } } -- cgit v1.2.1 From 923a818e377af474023909caf604f36c7f79cd6b Mon Sep 17 00:00:00 2001 From: Mario Skouat Date: Thu, 21 Aug 2014 19:37:03 +0200 Subject: [ticket/13003] Add missing language keys PHPBB3-13003 --- phpBB/phpbb/console/command/extension/show.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php index 6ce9607098..f9322034d7 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -37,22 +37,22 @@ class show extends command } $enabled = array_keys($this->manager->all_enabled()); - $this->print_extension_list($output, 'Enabled', $enabled); + $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_ENABLED') . $this->user->lang('COLON'), $enabled); $output->writeln(''); $disabled = array_keys($this->manager->all_disabled()); - $this->print_extension_list($output, 'Disabled', $disabled); + $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_DISABLED') . $this->user->lang('COLON'), $disabled); $output->writeln(''); $purged = array_diff($all, $enabled, $disabled); - $this->print_extension_list($output, 'Available', $purged); + $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_AVAILABLE') . $this->user->lang('COLON'), $purged); } protected function print_extension_list(OutputInterface $output, $type, array $extensions) { - $output->writeln("$type:"); + $output->writeln("$type"); foreach ($extensions as $extension) { -- cgit v1.2.1 From 72ee4b3a7c4fca67cb226dab3ed27a8afa903144 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 10 Sep 2014 12:08:13 +0200 Subject: [ticket/12963] Load extensions migrations from /migration PHPBB3-12963 --- phpBB/phpbb/console/command/db/migrate.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index c3caae5f70..a25886fb82 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -117,8 +117,17 @@ class migrate extends \phpbb\console\command\command $migrations = $this->extension_manager ->get_finder() ->core_path('phpbb/db/migration/data/') + ->extension_directory('/migration') + ->get_classes(); + + // @deprecated to be removed in 3.2 final + $migrations_deprecated = $this->extension_manager + ->get_finder() ->extension_directory('/migrations') ->get_classes(); + + $migrations = array_merge($migrations, $migrations_deprecated); + $this->migrator->set_migrations($migrations); } -- cgit v1.2.1 From 8b16d3141396a11db3ab4ade49af91f2477f5fb6 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 16 Sep 2014 20:18:10 +0200 Subject: [ticket/12963] Edit deprecation message PHPBB3-12963 --- phpBB/phpbb/console/command/db/migrate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index a25886fb82..68638a9515 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -120,7 +120,7 @@ class migrate extends \phpbb\console\command\command ->extension_directory('/migration') ->get_classes(); - // @deprecated to be removed in 3.2 final + // @deprecated 3.1.0-RC4 (To be removed: 3.2.0) $migrations_deprecated = $this->extension_manager ->get_finder() ->extension_directory('/migrations') -- cgit v1.2.1 From c220fa89a1bf5652df6512ad78eb9ba550fe465e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Sep 2014 10:42:21 +0200 Subject: [ticket/12963] Revert back to "migrations" folder name for extensions The issues that can be created with the name change are just too much PHPBB3-12963 --- phpBB/phpbb/console/command/db/migrate.php | 8 -------- 1 file changed, 8 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 68638a9515..86545c237d 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -117,17 +117,9 @@ class migrate extends \phpbb\console\command\command $migrations = $this->extension_manager ->get_finder() ->core_path('phpbb/db/migration/data/') - ->extension_directory('/migration') - ->get_classes(); - - // @deprecated 3.1.0-RC4 (To be removed: 3.2.0) - $migrations_deprecated = $this->extension_manager - ->get_finder() ->extension_directory('/migrations') ->get_classes(); - $migrations = array_merge($migrations, $migrations_deprecated); - $this->migrator->set_migrations($migrations); } -- cgit v1.2.1 From 4a76763a8a404a04f141825f572ff65620f400c4 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 4 Jun 2014 16:24:33 +0200 Subject: [ticket/12657] Add a test file for base case PHPBB3-12657 --- phpBB/phpbb/console/command/cache/purge.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index ec8229200c..d0c2ef6f72 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -26,7 +26,7 @@ class purge extends \phpbb\console\command\command /** @var \phpbb\auth\auth */ protected $auth; - /** @var \phpbb\log\log */ + /** @var \phpbb\log\log_interface */ protected $log; /** @var \phpbb\config\config */ @@ -42,7 +42,7 @@ class purge extends \phpbb\console\command\command * @param \phpbb\log\log $log Logger instance * @param \phpbb\config\config $config Config instance */ - public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\config\config $config) + public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\config\config $config) { $this->cache = $cache; $this->db = $db; -- cgit v1.2.1 From bda68793054af20d817a81717f585de55d8dd254 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 5 Oct 2014 12:25:14 +0200 Subject: [ticket/12368] Always clean the cache prior to run the migrations PHPBB3-12368 --- phpBB/phpbb/console/command/db/migrate.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 86545c237d..c760cde5b5 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -55,6 +55,8 @@ class migrate extends \phpbb\console\command\command { $this->migrator->create_migrations_table(); + $this->cache->purge(); + $this->load_migrations(); $orig_version = $this->config['version']; while (!$this->migrator->finished()) -- cgit v1.2.1 From 56d7c2c6ed3e5924aeced53a163bfd1aa8288034 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 14 Oct 2014 17:58:29 +0200 Subject: [ticket/13126] Improve the feedback when running the migrations PHPBB3-13126 --- phpBB/phpbb/console/command/db/migrate.php | 56 +++++++++++++----------------- 1 file changed, 24 insertions(+), 32 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index c760cde5b5..ecb84d7401 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -53,6 +53,30 @@ class migrate extends \phpbb\console\command\command protected function execute(InputInterface $input, OutputInterface $output) { + $user = $this->user; + $this->migrator->set_output_handler( + new \phpbb\db\migrator_output_handler( + function($message, $verbosity) use ($output, $user) + { + if ($verbosity <= $output->getVerbosity()) + { + $final_message = call_user_func_array(array($user, 'lang'), $message); + + if ($verbosity === \phpbb\db\migrator_output_handler::VERBOSITY_NORMAL) + { + $final_message = '' . $final_message . ''; + } + else if ($verbosity === \phpbb\db\migrator_output_handler::VERBOSITY_VERY_VERBOSE) + { + $final_message = '' . $final_message . ''; + } + + $output->writeln($final_message); + } + } + ) + ); + $this->migrator->create_migrations_table(); $this->cache->purge(); @@ -61,8 +85,6 @@ class migrate extends \phpbb\console\command\command $orig_version = $this->config['version']; while (!$this->migrator->finished()) { - $migration_start_time = microtime(true); - try { $this->migrator->update(); @@ -73,36 +95,6 @@ class migrate extends \phpbb\console\command\command $this->finalise_update(); return 1; } - - $migration_stop_time = microtime(true) - $migration_start_time; - - $state = array_merge( - array( - 'migration_schema_done' => false, - 'migration_data_done' => false, - ), - $this->migrator->last_run_migration['state'] - ); - - if (!empty($this->migrator->last_run_migration['effectively_installed'])) - { - $msg = $this->user->lang('MIGRATION_EFFECTIVELY_INSTALLED', $this->migrator->last_run_migration['name']); - $output->writeln("$msg"); - } - else if ($this->migrator->last_run_migration['task'] == 'process_data_step' && $state['migration_data_done']) - { - $msg = $this->user->lang('MIGRATION_DATA_DONE', $this->migrator->last_run_migration['name'], $migration_stop_time); - $output->writeln("$msg"); - } - else if ($this->migrator->last_run_migration['task'] == 'process_data_step') - { - $output->writeln($this->user->lang('MIGRATION_DATA_IN_PROGRESS', $this->migrator->last_run_migration['name'], $migration_stop_time)); - } - else if ($state['migration_schema_done']) - { - $msg = $this->user->lang('MIGRATION_SCHEMA_DONE', $this->migrator->last_run_migration['name'], $migration_stop_time); - $output->writeln("$msg"); - } } if ($orig_version != $this->config['version']) -- cgit v1.2.1 From 58075e25e8173ec663e4e8908d1963b1947a225b Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 16 Oct 2014 01:34:23 +0200 Subject: [ticket/13126] Extends migrator_output_handler instead of using a closure PHPBB3-13126 --- .../command/db/console_migrator_output_handler.php | 72 ++++++++++++++++++++++ phpBB/phpbb/console/command/db/migrate.php | 24 +------- 2 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 phpBB/phpbb/console/command/db/console_migrator_output_handler.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php new file mode 100644 index 0000000000..be6c2ccd7a --- /dev/null +++ b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php @@ -0,0 +1,72 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\db; + +use phpbb\user; +use phpbb\db\migrator_output_handler; +use Symfony\Component\Console\Output\OutputInterface; + +class console_migrator_output_handler extends migrator_output_handler +{ + /** + * User object. + * + * @var user + */ + private $user; + + /** + * Console output object. + * + * @var OutputInterface + */ + private $output; + + /** + * Constructor + * + * @param user $user User object + * @param OutputInterface $output Console output object + */ + public function __construct(user $user, OutputInterface $output) + { + $this->user = $user; + $this->output = $output; + } + + /** + * Write output using the configured closure. + * + * @param string|array $message The message to write or an array containing the language key and all of its parameters. + * @param int $verbosity The verbosity of the message. + */ + public function write($message, $verbosity) + { + if ($verbosity <= $this->output->getVerbosity()) + { + $translated_message = call_user_func_array(array($this->user, 'lang'), $message); + + if ($verbosity === \phpbb\db\migrator_output_handler::VERBOSITY_NORMAL) + { + $translated_message = '' . $translated_message . ''; + } + else if ($verbosity === \phpbb\db\migrator_output_handler::VERBOSITY_VERY_VERBOSE) + { + $translated_message = '' . $translated_message . ''; + } + + $this->output->writeln($translated_message); + } + } +} diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index ecb84d7401..9d4b4a0c4d 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -53,29 +53,7 @@ class migrate extends \phpbb\console\command\command protected function execute(InputInterface $input, OutputInterface $output) { - $user = $this->user; - $this->migrator->set_output_handler( - new \phpbb\db\migrator_output_handler( - function($message, $verbosity) use ($output, $user) - { - if ($verbosity <= $output->getVerbosity()) - { - $final_message = call_user_func_array(array($user, 'lang'), $message); - - if ($verbosity === \phpbb\db\migrator_output_handler::VERBOSITY_NORMAL) - { - $final_message = '' . $final_message . ''; - } - else if ($verbosity === \phpbb\db\migrator_output_handler::VERBOSITY_VERY_VERBOSE) - { - $final_message = '' . $final_message . ''; - } - - $output->writeln($final_message); - } - } - ) - ); + $this->migrator->set_output_handler(new console_migrator_output_handler($this->user, $output)); $this->migrator->create_migrations_table(); -- cgit v1.2.1 From 8f6fcd2744a80795139600c2a7c1f46f59b8cbfe Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 20 Oct 2014 19:38:04 +0200 Subject: [ticket/13126] Move migrator_output_handler to an interface PHPBB3-13126 --- .../console/command/db/console_migrator_output_handler.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php index be6c2ccd7a..0c494cea63 100644 --- a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php +++ b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php @@ -17,7 +17,7 @@ use phpbb\user; use phpbb\db\migrator_output_handler; use Symfony\Component\Console\Output\OutputInterface; -class console_migrator_output_handler extends migrator_output_handler +class console_migrator_output_handler implements migrator_output_handler_interface { /** * User object. @@ -46,10 +46,7 @@ class console_migrator_output_handler extends migrator_output_handler } /** - * Write output using the configured closure. - * - * @param string|array $message The message to write or an array containing the language key and all of its parameters. - * @param int $verbosity The verbosity of the message. + * {@inheritdoc} */ public function write($message, $verbosity) { @@ -57,11 +54,11 @@ class console_migrator_output_handler extends migrator_output_handler { $translated_message = call_user_func_array(array($this->user, 'lang'), $message); - if ($verbosity === \phpbb\db\migrator_output_handler::VERBOSITY_NORMAL) + if ($verbosity === migrator_output_handler_interface::VERBOSITY_NORMAL) { $translated_message = '' . $translated_message . ''; } - else if ($verbosity === \phpbb\db\migrator_output_handler::VERBOSITY_VERY_VERBOSE) + else if ($verbosity === migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE) { $translated_message = '' . $translated_message . ''; } -- cgit v1.2.1 From faf4b03c43ecac7aa16e42433cce591512f3ef90 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 20 Oct 2014 19:42:54 +0200 Subject: [ticket/13126] Change messages verbosity levels PHPBB3-13126 --- phpBB/phpbb/console/command/db/console_migrator_output_handler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php index 0c494cea63..74549e8e42 100644 --- a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php +++ b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php @@ -58,7 +58,7 @@ class console_migrator_output_handler implements migrator_output_handler_interfa { $translated_message = '' . $translated_message . ''; } - else if ($verbosity === migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE) + else if ($verbosity === migrator_output_handler_interface::VERBOSITY_VERBOSE) { $translated_message = '' . $translated_message . ''; } -- cgit v1.2.1 From 981d3005f37d6298bd8775154e83194dbe0a0ed1 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 20 Oct 2014 19:59:36 +0200 Subject: [ticket/13126] Fix tests PHPBB3-13126 --- phpBB/phpbb/console/command/db/console_migrator_output_handler.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php index 74549e8e42..92a047605d 100644 --- a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php +++ b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php @@ -14,7 +14,6 @@ namespace phpbb\console\command\db; use phpbb\user; -use phpbb\db\migrator_output_handler; use Symfony\Component\Console\Output\OutputInterface; class console_migrator_output_handler implements migrator_output_handler_interface -- cgit v1.2.1 From fdece6cdf3cb375da1ee4ab488d2ec8d854845db Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 22 Oct 2014 15:25:50 +0200 Subject: [ticket/13126] Add missing use statement PHPBB3-13126 --- phpBB/phpbb/console/command/db/console_migrator_output_handler.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php index 92a047605d..b9741a3838 100644 --- a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php +++ b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php @@ -14,6 +14,7 @@ namespace phpbb\console\command\db; use phpbb\user; +use phpbb\db\migrator_output_handler_interface; use Symfony\Component\Console\Output\OutputInterface; class console_migrator_output_handler implements migrator_output_handler_interface -- cgit v1.2.1 From b27b9a6984f2ed3a9a186133657d30b4cca883c0 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 24 Oct 2014 13:33:26 -0700 Subject: [ticket/13211] Move console migrator output handler to db folder PHPBB3-13211 --- .../command/db/console_migrator_output_handler.php | 69 ---------------------- phpBB/phpbb/console/command/db/migrate.php | 2 +- 2 files changed, 1 insertion(+), 70 deletions(-) delete mode 100644 phpBB/phpbb/console/command/db/console_migrator_output_handler.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php deleted file mode 100644 index b9741a3838..0000000000 --- a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php +++ /dev/null @@ -1,69 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -namespace phpbb\console\command\db; - -use phpbb\user; -use phpbb\db\migrator_output_handler_interface; -use Symfony\Component\Console\Output\OutputInterface; - -class console_migrator_output_handler implements migrator_output_handler_interface -{ - /** - * User object. - * - * @var user - */ - private $user; - - /** - * Console output object. - * - * @var OutputInterface - */ - private $output; - - /** - * Constructor - * - * @param user $user User object - * @param OutputInterface $output Console output object - */ - public function __construct(user $user, OutputInterface $output) - { - $this->user = $user; - $this->output = $output; - } - - /** - * {@inheritdoc} - */ - public function write($message, $verbosity) - { - if ($verbosity <= $this->output->getVerbosity()) - { - $translated_message = call_user_func_array(array($this->user, 'lang'), $message); - - if ($verbosity === migrator_output_handler_interface::VERBOSITY_NORMAL) - { - $translated_message = '' . $translated_message . ''; - } - else if ($verbosity === migrator_output_handler_interface::VERBOSITY_VERBOSE) - { - $translated_message = '' . $translated_message . ''; - } - - $this->output->writeln($translated_message); - } - } -} diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 9d4b4a0c4d..15349e1230 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -53,7 +53,7 @@ class migrate extends \phpbb\console\command\command protected function execute(InputInterface $input, OutputInterface $output) { - $this->migrator->set_output_handler(new console_migrator_output_handler($this->user, $output)); + $this->migrator->set_output_handler(new \phpbb\db\console_migrator_output_handler($this->user, $output)); $this->migrator->create_migrations_table(); -- cgit v1.2.1 From 84434630065c2491cfa5e65a69b8b22d6844b6f4 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 25 Oct 2014 11:55:15 -0700 Subject: [ticket/13211] Also use log wrapper output handler for console migrations PHPBB3-13211 --- phpBB/phpbb/console/command/db/migrate.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 15349e1230..76550a8429 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -32,13 +32,17 @@ class migrate extends \phpbb\console\command\command /** @var \phpbb\log\log */ protected $log; - function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log) + /** @var string phpBB root path */ + protected $phpbb_root_path; + + function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, $phpbb_root_path) { $this->migrator = $migrator; $this->extension_manager = $extension_manager; $this->config = $config; $this->cache = $cache; $this->log = $log; + $this->phpbb_root_path = $phpbb_root_path; parent::__construct($user); $this->user->add_lang(array('common', 'install', 'migrator')); } @@ -53,7 +57,7 @@ class migrate extends \phpbb\console\command\command protected function execute(InputInterface $input, OutputInterface $output) { - $this->migrator->set_output_handler(new \phpbb\db\console_migrator_output_handler($this->user, $output)); + $this->migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($this->user, new \phpbb\db\console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log')); $this->migrator->create_migrations_table(); -- cgit v1.2.1 From 078e0c1e440f7f906b670348e8da00141e245876 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 25 Oct 2014 12:03:13 -0700 Subject: [ticket/13211] Move console migrator output handler back to console folder PHPBB3-13211 --- .../command/db/console_migrator_output_handler.php | 69 ++++++++++++++++++++++ phpBB/phpbb/console/command/db/migrate.php | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 phpBB/phpbb/console/command/db/console_migrator_output_handler.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php new file mode 100644 index 0000000000..b9741a3838 --- /dev/null +++ b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php @@ -0,0 +1,69 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\db; + +use phpbb\user; +use phpbb\db\migrator_output_handler_interface; +use Symfony\Component\Console\Output\OutputInterface; + +class console_migrator_output_handler implements migrator_output_handler_interface +{ + /** + * User object. + * + * @var user + */ + private $user; + + /** + * Console output object. + * + * @var OutputInterface + */ + private $output; + + /** + * Constructor + * + * @param user $user User object + * @param OutputInterface $output Console output object + */ + public function __construct(user $user, OutputInterface $output) + { + $this->user = $user; + $this->output = $output; + } + + /** + * {@inheritdoc} + */ + public function write($message, $verbosity) + { + if ($verbosity <= $this->output->getVerbosity()) + { + $translated_message = call_user_func_array(array($this->user, 'lang'), $message); + + if ($verbosity === migrator_output_handler_interface::VERBOSITY_NORMAL) + { + $translated_message = '' . $translated_message . ''; + } + else if ($verbosity === migrator_output_handler_interface::VERBOSITY_VERBOSE) + { + $translated_message = '' . $translated_message . ''; + } + + $this->output->writeln($translated_message); + } + } +} diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 76550a8429..87c2a057d1 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -57,7 +57,7 @@ class migrate extends \phpbb\console\command\command protected function execute(InputInterface $input, OutputInterface $output) { - $this->migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($this->user, new \phpbb\db\console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log')); + $this->migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($this->user, new console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log')); $this->migrator->create_migrations_table(); -- cgit v1.2.1 From 13851f308f57e0cda4c24f9a9a186aac912213d1 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 23 Aug 2015 15:14:08 -0700 Subject: [ticket/14123] Add descriptive help to the CLI help output PHPBB3-14123 --- phpBB/phpbb/console/command/cache/purge.php | 1 + phpBB/phpbb/console/command/config/delete.php | 1 + phpBB/phpbb/console/command/config/get.php | 1 + phpBB/phpbb/console/command/config/increment.php | 1 + phpBB/phpbb/console/command/config/set.php | 1 + phpBB/phpbb/console/command/config/set_atomic.php | 1 + phpBB/phpbb/console/command/cron/cron_list.php | 1 + phpBB/phpbb/console/command/cron/run.php | 1 + phpBB/phpbb/console/command/db/migrate.php | 1 + phpBB/phpbb/console/command/dev/migration_tips.php | 1 + phpBB/phpbb/console/command/extension/disable.php | 1 + phpBB/phpbb/console/command/extension/enable.php | 1 + phpBB/phpbb/console/command/extension/purge.php | 1 + phpBB/phpbb/console/command/extension/show.php | 1 + phpBB/phpbb/console/command/fixup/recalculate_email_hash.php | 1 + 15 files changed, 15 insertions(+) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index d0c2ef6f72..4a6c8cbbdd 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -60,6 +60,7 @@ class purge extends \phpbb\console\command\command $this ->setName('cache:purge') ->setDescription($this->user->lang('PURGE_CACHE')) + ->setHelp($this->user->lang('CLI_HELP_PURGE_CACHE')) ; } diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index efd276d7e3..51fe2165eb 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -26,6 +26,7 @@ class delete extends command $this ->setName('config:delete') ->setDescription($this->user->lang('CLI_DESCRIPTION_DELETE_CONFIG')) + ->setHelp($this->user->lang('CLI_HELP_DELETE_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index 9c03b49a3d..688fafc753 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -27,6 +27,7 @@ class get extends command $this ->setName('config:get') ->setDescription($this->user->lang('CLI_DESCRIPTION_GET_CONFIG')) + ->setHelp($this->user->lang('CLI_HELP_GET_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index b4d7438b66..a29473a471 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -27,6 +27,7 @@ class increment extends command $this ->setName('config:increment') ->setDescription($this->user->lang('CLI_DESCRIPTION_INCREMENT_CONFIG')) + ->setHelp($this->user->lang('CLI_HELP_INCREMENT_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index 695de31013..14ee9a2deb 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -27,6 +27,7 @@ class set extends command $this ->setName('config:set') ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_CONFIG')) + ->setHelp($this->user->lang('CLI_HELP_SET_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index e8c69a0885..cff89d5157 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -27,6 +27,7 @@ class set_atomic extends command $this ->setName('config:set-atomic') ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_ATOMIC_CONFIG')) + ->setHelp($this->user->lang('CLI_HELP_SET_ATOMIC_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index c515fd9e80..418f2d8c76 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -40,6 +40,7 @@ class cron_list extends \phpbb\console\command\command $this ->setName('cron:list') ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_LIST')) + ->setHelp($this->user->lang('CLI_HELP_CRON_LIST')) ; } diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 72ad1205ef..a9648fcd41 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -50,6 +50,7 @@ class run extends \phpbb\console\command\command $this ->setName('cron:run') ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_RUN')) + ->setHelp($this->user->lang('CLI_HELP_CRON_RUN')) ->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1')) ; } diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 87c2a057d1..e279e8ee0c 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -52,6 +52,7 @@ class migrate extends \phpbb\console\command\command $this ->setName('db:migrate') ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE')) + ->setHelp($this->user->lang('CLI_HELP_DB_MIGRATE')) ; } diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php index f9047bdac8..03d81a72a2 100644 --- a/phpBB/phpbb/console/command/dev/migration_tips.php +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -31,6 +31,7 @@ class migration_tips extends \phpbb\console\command\command $this ->setName('dev:migration-tips') ->setDescription($this->user->lang('CLI_DESCRIPTION_FIND_MIGRATIONS')) + ->setHelp($this->user->lang('CLI_HELP_FIND_MIGRATIONS')) ; } diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index 1eee16cbd9..dae63c4076 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -23,6 +23,7 @@ class disable extends command $this ->setName('extension:disable') ->setDescription($this->user->lang('CLI_DESCRIPTION_DISABLE_EXTENSION')) + ->setHelp($this->user->lang('CLI_HELP_DISABLE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 59ff11e9b7..94baaa0f44 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -23,6 +23,7 @@ class enable extends command $this ->setName('extension:enable') ->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION')) + ->setHelp($this->user->lang('CLI_HELP_ENABLE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index 517e9a74c9..b9fa038a4b 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -23,6 +23,7 @@ class purge extends command $this ->setName('extension:purge') ->setDescription($this->user->lang('CLI_DESCRIPTION_PURGE_EXTENSION')) + ->setHelp($this->user->lang('CLI_HELP_PURGE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php index f9322034d7..2e703e7156 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -22,6 +22,7 @@ class show extends command $this ->setName('extension:show') ->setDescription($this->user->lang('CLI_DESCRIPTION_LIST_EXTENSIONS')) + ->setHelp($this->user->lang('CLI_HELP_LIST_EXTENSIONS')) ; } diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index ec4e1b0ee7..94592409c5 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -32,6 +32,7 @@ class recalculate_email_hash extends \phpbb\console\command\command $this ->setName('fixup:recalculate-email-hash') ->setDescription($this->user->lang('CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH')) + ->setHelp($this->user->lang('CLI_HELP_RECALCULATE_EMAIL_HASH')) ; } -- cgit v1.2.1 From 6c36f56b12afcb97dbaa7cc248435df3e7a3fdc9 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 28 Aug 2015 07:49:07 -0700 Subject: [ticket/14123] Remove redundant help messages PHPBB3-14123 --- phpBB/phpbb/console/command/cache/purge.php | 1 - phpBB/phpbb/console/command/config/delete.php | 1 - phpBB/phpbb/console/command/config/get.php | 1 - phpBB/phpbb/console/command/config/increment.php | 1 - phpBB/phpbb/console/command/config/set.php | 1 - phpBB/phpbb/console/command/config/set_atomic.php | 1 - phpBB/phpbb/console/command/cron/cron_list.php | 1 - phpBB/phpbb/console/command/db/migrate.php | 1 - phpBB/phpbb/console/command/dev/migration_tips.php | 1 - phpBB/phpbb/console/command/extension/disable.php | 1 - phpBB/phpbb/console/command/extension/enable.php | 1 - phpBB/phpbb/console/command/extension/purge.php | 1 - phpBB/phpbb/console/command/extension/show.php | 1 - phpBB/phpbb/console/command/fixup/recalculate_email_hash.php | 1 - 14 files changed, 14 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 4a6c8cbbdd..d0c2ef6f72 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -60,7 +60,6 @@ class purge extends \phpbb\console\command\command $this ->setName('cache:purge') ->setDescription($this->user->lang('PURGE_CACHE')) - ->setHelp($this->user->lang('CLI_HELP_PURGE_CACHE')) ; } diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 51fe2165eb..efd276d7e3 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -26,7 +26,6 @@ class delete extends command $this ->setName('config:delete') ->setDescription($this->user->lang('CLI_DESCRIPTION_DELETE_CONFIG')) - ->setHelp($this->user->lang('CLI_HELP_DELETE_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index 688fafc753..9c03b49a3d 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -27,7 +27,6 @@ class get extends command $this ->setName('config:get') ->setDescription($this->user->lang('CLI_DESCRIPTION_GET_CONFIG')) - ->setHelp($this->user->lang('CLI_HELP_GET_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index a29473a471..b4d7438b66 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -27,7 +27,6 @@ class increment extends command $this ->setName('config:increment') ->setDescription($this->user->lang('CLI_DESCRIPTION_INCREMENT_CONFIG')) - ->setHelp($this->user->lang('CLI_HELP_INCREMENT_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index 14ee9a2deb..695de31013 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -27,7 +27,6 @@ class set extends command $this ->setName('config:set') ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_CONFIG')) - ->setHelp($this->user->lang('CLI_HELP_SET_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index cff89d5157..e8c69a0885 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -27,7 +27,6 @@ class set_atomic extends command $this ->setName('config:set-atomic') ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_ATOMIC_CONFIG')) - ->setHelp($this->user->lang('CLI_HELP_SET_ATOMIC_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index 418f2d8c76..c515fd9e80 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -40,7 +40,6 @@ class cron_list extends \phpbb\console\command\command $this ->setName('cron:list') ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_LIST')) - ->setHelp($this->user->lang('CLI_HELP_CRON_LIST')) ; } diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index e279e8ee0c..87c2a057d1 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -52,7 +52,6 @@ class migrate extends \phpbb\console\command\command $this ->setName('db:migrate') ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE')) - ->setHelp($this->user->lang('CLI_HELP_DB_MIGRATE')) ; } diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php index 03d81a72a2..f9047bdac8 100644 --- a/phpBB/phpbb/console/command/dev/migration_tips.php +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -31,7 +31,6 @@ class migration_tips extends \phpbb\console\command\command $this ->setName('dev:migration-tips') ->setDescription($this->user->lang('CLI_DESCRIPTION_FIND_MIGRATIONS')) - ->setHelp($this->user->lang('CLI_HELP_FIND_MIGRATIONS')) ; } diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index dae63c4076..1eee16cbd9 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -23,7 +23,6 @@ class disable extends command $this ->setName('extension:disable') ->setDescription($this->user->lang('CLI_DESCRIPTION_DISABLE_EXTENSION')) - ->setHelp($this->user->lang('CLI_HELP_DISABLE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 94baaa0f44..59ff11e9b7 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -23,7 +23,6 @@ class enable extends command $this ->setName('extension:enable') ->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION')) - ->setHelp($this->user->lang('CLI_HELP_ENABLE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index b9fa038a4b..517e9a74c9 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -23,7 +23,6 @@ class purge extends command $this ->setName('extension:purge') ->setDescription($this->user->lang('CLI_DESCRIPTION_PURGE_EXTENSION')) - ->setHelp($this->user->lang('CLI_HELP_PURGE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php index 2e703e7156..f9322034d7 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -22,7 +22,6 @@ class show extends command $this ->setName('extension:show') ->setDescription($this->user->lang('CLI_DESCRIPTION_LIST_EXTENSIONS')) - ->setHelp($this->user->lang('CLI_HELP_LIST_EXTENSIONS')) ; } diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index 94592409c5..ec4e1b0ee7 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -32,7 +32,6 @@ class recalculate_email_hash extends \phpbb\console\command\command $this ->setName('fixup:recalculate-email-hash') ->setDescription($this->user->lang('CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH')) - ->setHelp($this->user->lang('CLI_HELP_RECALCULATE_EMAIL_HASH')) ; } -- cgit v1.2.1 From 170613848ad86cea1f140ed1cfdb55d581324ffb Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 3 Jun 2017 11:07:34 +0200 Subject: [ticket/15219] Add console command for updating hashes to bcrypt PHPBB3-15219 --- .../phpbb/console/command/fixup/update_hashes.php | 117 +++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 phpBB/phpbb/console/command/fixup/update_hashes.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/fixup/update_hashes.php b/phpBB/phpbb/console/command/fixup/update_hashes.php new file mode 100644 index 0000000000..4bcc3b5d19 --- /dev/null +++ b/phpBB/phpbb/console/command/fixup/update_hashes.php @@ -0,0 +1,117 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\fixup; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Helper\ProgressBar; + +class update_hashes extends \phpbb\console\command\command +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\passwords\manager */ + protected $passwords_manager; + + /** @var string Default hashing type */ + protected $default_type; + + /** + * Update_hashes constructor + * + * @param \phpbb\config\config $config + * @param \phpbb\user $user + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\passwords\manager $passwords_manager + * @param array $hashing_algorithms Hashing driver + * service collection + * @param array $defaults Default password types + */ + public function __construct(\phpbb\config\config $config, \phpbb\user $user, + \phpbb\db\driver\driver_interface $db, \phpbb\passwords\manager $passwords_manager, + $hashing_algorithms, $defaults) + { + $this->config = $config; + $this->db = $db; + + $this->passwords_manager = $passwords_manager; + + foreach ($defaults as $type) + { + if ($hashing_algorithms[$type]->is_supported()) + { + $this->default_type = $type; + break; + } + } + + parent::__construct($user); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('fixup:update-hashes') + ->setDescription($this->user->lang('CLI_DESCRIPTION_UPDATE_HASH_BCRYPT')) + ; + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + // Get count to be able to display progress + $sql = 'SELECT COUNT(user_id) AS count + FROM ' . USERS_TABLE . ' + WHERE user_password ' . $this->db->sql_like_expression('$H$' . $this->db->get_any_char()) . ' + OR user_password ' . $this->db->sql_like_expression('$CP$' . $this->db->get_any_char()); + $result = $this->db->sql_query($sql); + $total_update_passwords = $this->db->sql_fetchfield('count'); + $this->db->sql_freeresult($result); + + // Create progress bar + $progress_bar = new ProgressBar($output, $total_update_passwords); + $progress_bar->start(); + + $sql = 'SELECT user_id, user_password + FROM ' . USERS_TABLE . ' + WHERE user_password ' . $this->db->sql_like_expression('$H$' . $this->db->get_any_char()) . ' + OR user_password ' . $this->db->sql_like_expression('$CP$' . $this->db->get_any_char()); + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $new_hash = $this->passwords_manager->hash($row['user_password'], array($this->default_type)); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_password = "' . $this->db->sql_escape($new_hash) . '" + WHERE user_id = ' . (int) $row['user_id']; + $this->db->sql_query($sql); + $progress_bar->advance(); + } + + $this->config->set('update_hashes_last_cron', time()); + + $progress_bar->finish(); + + $output->writeln('' . $this->user->lang('CLI_FIXUP_UPDATE_HASH_BCRYPT_SUCCESS') . ''); + } +} -- cgit v1.2.1 From fd822ade20a1407af6a464ffec71c4da0d330a3c Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 26 May 2017 20:27:30 +0700 Subject: [ticket/15238] Add console command to fix forums/modules left/right IDs PHPBB3-15238 --- .../console/command/fixup/fix_left_right_ids.php | 105 +++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 phpBB/phpbb/console/command/fixup/fix_left_right_ids.php (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php new file mode 100644 index 0000000000..df0968a601 --- /dev/null +++ b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php @@ -0,0 +1,105 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\fixup; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class fix_left_right_ids extends \phpbb\console\command\command +{ + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\cache\driver\driver_interface */ + protected $cache; + + public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache) + { + $this->user = $user; + $this->db = $db; + $this->cache = $cache; + + parent::__construct($user); + } + + protected function configure() + { + $this + ->setName('fixup:fix-left-right-ids') + ->setDescription($this->user->lang('CLI_DESCRIPTION_FIX_LEFT_RIGHT_IDS')) + ; + } + + /** + * The code is mainly borrowed from Support toolkit for phpBB Olympus + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $changes_made = false; + + // Fix Left/Right IDs for the modules table + $result = $this->db->sql_query('SELECT DISTINCT(module_class) FROM ' . MODULES_TABLE); + while ($row = $this->db->sql_fetchrow($result)) + { + $i = 1; + $where = array('module_class = \'' . $row['module_class'] .'\''); + $changes_made = (($this->fixem($i, 'module_id', MODULES_TABLE, 0, $where)) || $changes_made) ? true : false; + } + $this->db->sql_freeresult($result); + + // Fix the Left/Right IDs for the forums table + $i = 1; + $changes_made = (($this->fixem($i, 'forum_id', FORUMS_TABLE)) || $changes_made) ? true : false; + + $this->cache->purge(); + + $output->writeln('' . $this->user->lang('CLI_FIXUP_FIX_LEFT_RIGHT_IDS_SUCCESS') . ''); + } + + function fixem(&$i, $pkey, $table, $parent_id = 0, $where = array()) + { + $changes_made = false; + $sql = 'SELECT * FROM ' . $table . ' + WHERE parent_id = ' . (int) $parent_id . + ((!empty($where)) ? ' AND ' . implode(' AND ', $where) : '') . ' + ORDER BY left_id ASC'; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + // Update the left_id for this module + if ($row['left_id'] != $i) + { + $this->db->sql_query('UPDATE ' . $table . ' SET ' . $this->db->sql_build_array('UPDATE', array('left_id' => $i)) . " WHERE $pkey = {$row[$pkey]}"); + $changes_made = true; + } + $i++; + + // Go through children and update their left/right IDs + $changes_made = (($this->fixem($i, $pkey, $table, $row[$pkey], $where)) || $changes_made) ? true : false; + + // Update the right_id for the module + if ($row['right_id'] != $i) + { + $this->db->sql_query('UPDATE ' . $table . ' SET ' . $this->db->sql_build_array('UPDATE', array('right_id' => $i)) . " WHERE $pkey = {$row[$pkey]}"); + $changes_made = true; + } + $i++; + } + $this->db->sql_freeresult($result); + + return $changes_made; + } +} -- cgit v1.2.1 From c1fa252fc1fd9855d4a6dac92ece9a1690cda7bc Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 6 Jun 2017 00:50:22 +0700 Subject: [ticket/15238] Code cleanup, add docblocks PHPBB3-15238 --- .../console/command/fixup/fix_left_right_ids.php | 50 +++++++++++++++++----- 1 file changed, 39 insertions(+), 11 deletions(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php index df0968a601..3781a411f1 100644 --- a/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php +++ b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php @@ -26,6 +26,13 @@ class fix_left_right_ids extends \phpbb\console\command\command /** @var \phpbb\cache\driver\driver_interface */ protected $cache; + /** + * Constructor + * + * @param \phpbb\user $user User instance + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param \phpbb\cache\driver\driver_interface $cache Cache instance + */ public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache) { $this->user = $user; @@ -35,6 +42,9 @@ class fix_left_right_ids extends \phpbb\console\command\command parent::__construct($user); } + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -44,32 +54,50 @@ class fix_left_right_ids extends \phpbb\console\command\command } /** + * Executes the command fixup:fix-left-right-ids. + * + * Repairs the tree structure of the forums and modules. * The code is mainly borrowed from Support toolkit for phpBB Olympus + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { - $changes_made = false; - // Fix Left/Right IDs for the modules table $result = $this->db->sql_query('SELECT DISTINCT(module_class) FROM ' . MODULES_TABLE); while ($row = $this->db->sql_fetchrow($result)) { $i = 1; - $where = array('module_class = \'' . $row['module_class'] .'\''); - $changes_made = (($this->fixem($i, 'module_id', MODULES_TABLE, 0, $where)) || $changes_made) ? true : false; + $where = array("module_class = '" . $this->db->sql_escape($row['module_class']) . "'"); + $this->fix_ids_tree($i, 'module_id', MODULES_TABLE, 0, $where); } $this->db->sql_freeresult($result); // Fix the Left/Right IDs for the forums table $i = 1; - $changes_made = (($this->fixem($i, 'forum_id', FORUMS_TABLE)) || $changes_made) ? true : false; + $this->fix_ids_tree($i, 'forum_id', FORUMS_TABLE); $this->cache->purge(); $output->writeln('' . $this->user->lang('CLI_FIXUP_FIX_LEFT_RIGHT_IDS_SUCCESS') . ''); } - function fixem(&$i, $pkey, $table, $parent_id = 0, $where = array()) + /** + * Item's tree structure rebuild helper + * The item is either forum or ACP/MCP/UCP module + * + * @param int $i Item id offset index + * @param string $field The key field to fix, forum_id|module_id + * @param string $table The table name to perform, FORUMS_TABLE|MODULES_TABLE + * @param int $parent_id Parent item id + * @param string $where Additional WHERE clause condition + * + * @return bool True on rebuild success, false otherwise + */ + function fix_ids_tree(&$i, $field, $table, $parent_id = 0, $where = array()) { $changes_made = false; $sql = 'SELECT * FROM ' . $table . ' @@ -79,21 +107,21 @@ class fix_left_right_ids extends \phpbb\console\command\command $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - // Update the left_id for this module + // Update the left_id for the item if ($row['left_id'] != $i) { - $this->db->sql_query('UPDATE ' . $table . ' SET ' . $this->db->sql_build_array('UPDATE', array('left_id' => $i)) . " WHERE $pkey = {$row[$pkey]}"); + $this->db->sql_query('UPDATE ' . $table . ' SET ' . $this->db->sql_build_array('UPDATE', array('left_id' => $i)) . " WHERE $field = " . (int) $row[$field]); $changes_made = true; } $i++; // Go through children and update their left/right IDs - $changes_made = (($this->fixem($i, $pkey, $table, $row[$pkey], $where)) || $changes_made) ? true : false; + $changes_made = (($this->fix_ids_tree($i, $field, $table, $row[$field], $where)) || $changes_made) ? true : false; - // Update the right_id for the module + // Update the right_id for the item if ($row['right_id'] != $i) { - $this->db->sql_query('UPDATE ' . $table . ' SET ' . $this->db->sql_build_array('UPDATE', array('right_id' => $i)) . " WHERE $pkey = {$row[$pkey]}"); + $this->db->sql_query('UPDATE ' . $table . ' SET ' . $this->db->sql_build_array('UPDATE', array('right_id' => $i)) . " WHERE $field = " . (int) $row[$field]); $changes_made = true; } $i++; -- cgit v1.2.1 From 840cb510e47e3ed27fa5c07e0f05cf8598b88879 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 18 Jun 2017 23:15:05 +0700 Subject: [ticket/15238] More code cleanup PHPBB3-15238 --- phpBB/phpbb/console/command/fixup/fix_left_right_ids.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php index 3781a411f1..bcaf0043e1 100644 --- a/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php +++ b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php @@ -10,6 +10,7 @@ * the docs/CREDITS.txt file. * */ + namespace phpbb\console\command\fixup; use Symfony\Component\Console\Input\InputInterface; @@ -93,7 +94,7 @@ class fix_left_right_ids extends \phpbb\console\command\command * @param string $field The key field to fix, forum_id|module_id * @param string $table The table name to perform, FORUMS_TABLE|MODULES_TABLE * @param int $parent_id Parent item id - * @param string $where Additional WHERE clause condition + * @param array $where Additional WHERE clause condition * * @return bool True on rebuild success, false otherwise */ -- cgit v1.2.1 From 9402339af91dd81465ff5fdde0ccf4dab349d397 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 20 Jun 2017 21:06:01 +0700 Subject: [ticket/15238] Add missing protected keyword PHPBB3-15238 --- phpBB/phpbb/console/command/fixup/fix_left_right_ids.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command') diff --git a/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php index bcaf0043e1..f55e1761bc 100644 --- a/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php +++ b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php @@ -98,7 +98,7 @@ class fix_left_right_ids extends \phpbb\console\command\command * * @return bool True on rebuild success, false otherwise */ - function fix_ids_tree(&$i, $field, $table, $parent_id = 0, $where = array()) + protected function fix_ids_tree(&$i, $field, $table, $parent_id = 0, $where = array()) { $changes_made = false; $sql = 'SELECT * FROM ' . $table . ' -- cgit v1.2.1