From abb8a2892d862c097285ee7f300d12c32428e12c Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Tue, 27 May 2014 12:36:44 +0200 Subject: [PATCH 01/27] [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/config/console.yml | 9 ++ phpBB/cron.php | 43 +++------- phpBB/language/en/acp/common.php | 4 + .../console/command/cron/execute_all.php | 65 ++++++++++++++ tests/console/cron/execute_all_test.php | 85 +++++++++++++++++++ tests/console/cron/fixtures/config.xml | 9 ++ tests/console/cron/tasks/simple_ready.php | 13 +++ 7 files changed, 199 insertions(+), 29 deletions(-) create mode 100644 phpBB/phpbb/console/command/cron/execute_all.php create mode 100644 tests/console/cron/execute_all_test.php create mode 100644 tests/console/cron/fixtures/config.xml create mode 100644 tests/console/cron/tasks/simple_ready.php diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml index d32befa15e..f268c2f05e 100644 --- a/phpBB/config/console.yml +++ b/phpBB/config/console.yml @@ -46,6 +46,15 @@ services: tags: - { name: console.command } + console.command.cron.execute_all: + class: phpbb\console\command\cron\execute_all + arguments: + - @cron.manager + - @cron.lock_db + - @user + tags: + - { name: console.command } + console.command.db.migrate: class: phpbb\console\command\db\migrate arguments: diff --git a/phpBB/cron.php b/phpBB/cron.php index f63642faa2..a8333aecaf 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -39,11 +39,6 @@ function do_cron($cron_lock, $run_tasks) foreach ($run_tasks as $task) { - if (defined('DEBUG') && $config['use_system_cron']) - { - echo "[phpBB cron] Running task '{$task->get_name()}'\n"; - } - $task->run(); } @@ -59,38 +54,28 @@ function do_cron($cron_lock, $run_tasks) // // If DEBUG is defined and cron lock cannot be obtained, a message will be printed. -if (!$config['use_system_cron']) -{ - $cron_type = request_var('cron_type', ''); +$cron_type = request_var('cron_type', ''); - // Comment this line out for debugging so the page does not return an image. - output_image(); -} +// Comment this line out for debugging so the page does not return an image. +output_image(); $cron_lock = $phpbb_container->get('cron.lock_db'); if ($cron_lock->acquire()) { $cron = $phpbb_container->get('cron.manager'); - if ($config['use_system_cron']) + // If invalid task is specified, empty $run_tasks is passed to do_cron which then does nothing + $run_tasks = array(); + $task = $cron->find_task($cron_type); + if ($task) { - $run_tasks = $cron->find_all_ready_tasks(); - } - else - { - // If invalid task is specified, empty $run_tasks is passed to do_cron which then does nothing - $run_tasks = array(); - $task = $cron->find_task($cron_type); - if ($task) + if ($task->is_parametrized()) { - if ($task->is_parametrized()) - { - $task->parse_parameters($request); - } - if ($task->is_ready()) - { - $run_tasks = array($task); - } + $task->parse_parameters($request); + } + if ($task->is_ready()) + { + $run_tasks = array($task); } } @@ -100,6 +85,6 @@ else { if (defined('DEBUG')) { - echo "Could not obtain cron lock.\n"; + echo $this->user->lang('CRON_LOCK_ERROR') . '\n'; } } diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 6f6a5f901f..9e7f280fa6 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -221,8 +221,11 @@ $lang = array_merge($lang, array( 'BACK' => 'Back', + 'CLI_DESCR_CRON_EXECUTE_ALL' => 'Executes all available cron tasks.', + 'COLOUR_SWATCH' => 'Web-safe colour swatch', 'CONFIG_UPDATED' => 'Configuration updated successfully.', + 'CRON_LOCK_ERROR' => 'Could not obtain cron lock.', 'DEACTIVATE' => 'Deactivate', 'DIRECTORY_DOES_NOT_EXIST' => 'The entered path “%s” does not exist.', @@ -283,6 +286,7 @@ $lang = array_merge($lang, array( 'REMIND' => 'Remind', 'RESYNC' => 'Resynchronise', + 'RUNNING_TASK' => 'Running task: %s.', 'SELECT_ANONYMOUS' => 'Select anonymous user', 'SELECT_OPTION' => 'Select option', 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') . ''); + } + } +} + diff --git a/tests/console/cron/execute_all_test.php b/tests/console/cron/execute_all_test.php new file mode 100644 index 0000000000..83cffd5be6 --- /dev/null +++ b/tests/console/cron/execute_all_test.php @@ -0,0 +1,85 @@ +createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); + } + + public function setUp() + { + global $db, $config, $phpbb_root_path, $pathEx; + + $db = $this->db = $this->new_dbal(); + $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); + set_config(null, null, null, $this->config); + $this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db); + + $this->user = $this->getMock('\phpbb\user'); + $this->user->method('lang')->will($this->returnArgument(0)); + + $tasks = array( + new phpbb_cron_task_core_simple_ready(), + ); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); + + $this->assertEquals('0', $config['cron_lock']); + } + + public function test_normal_use() + { + $command_tester = $this->get_command_tester(); + $command_tester->execute(array('command' => $command_name)); + + $this->assertEquals('', $command_tester->getDisplay()); + } + + public function test_verbose_mode() + { + $command_tester = $this->get_command_tester(); + $command_tester->execute(array('command' => $command_name, '--verbose' => true)); + + $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); + } + + public function test_error_lock() + { + $this->lock->acquire(); + $command_tester = $this->get_command_tester(); + $command_tester->execute(array('command' => $command_name)); + + $this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay()); + } + + public function get_command_tester() + { + $application = new Application(); + $application->add(new execute_all($this->cron_manager, $this->lock, $this->user)); + + $command = $application->find('cron:execute-all'); + $command_name = $command->getName(); + return new CommandTester($command); + } +} + diff --git a/tests/console/cron/fixtures/config.xml b/tests/console/cron/fixtures/config.xml new file mode 100644 index 0000000000..b49be1e05a --- /dev/null +++ b/tests/console/cron/fixtures/config.xml @@ -0,0 +1,9 @@ + + + + config_name + config_value + is_dynamic +
+
+ diff --git a/tests/console/cron/tasks/simple_ready.php b/tests/console/cron/tasks/simple_ready.php new file mode 100644 index 0000000000..245d9ba738 --- /dev/null +++ b/tests/console/cron/tasks/simple_ready.php @@ -0,0 +1,13 @@ + Date: Wed, 28 May 2014 10:13:37 +0200 Subject: [PATCH 02/27] [ticket/12597] Improvement of test files PHPBB3-12597 --- tests/console/cron/execute_all_test.php | 24 +++++++++++++++++------ tests/console/cron/tasks/simple.php | 15 ++++++++++++++ tests/console/cron/tasks/simple_ready.php | 13 ------------ 3 files changed, 33 insertions(+), 19 deletions(-) create mode 100644 tests/console/cron/tasks/simple.php delete mode 100644 tests/console/cron/tasks/simple_ready.php diff --git a/tests/console/cron/execute_all_test.php b/tests/console/cron/execute_all_test.php index 83cffd5be6..a0de754245 100644 --- a/tests/console/cron/execute_all_test.php +++ b/tests/console/cron/execute_all_test.php @@ -11,7 +11,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; use phpbb\console\command\cron\execute_all; -require_once dirname(__FILE__) . '/tasks/simple_ready.php'; +require_once dirname(__FILE__) . '/tasks/simple.php'; class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_case { @@ -30,6 +30,7 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca public function setUp() { global $db, $config, $phpbb_root_path, $pathEx; + global $cron_num_exec; $db = $this->db = $this->new_dbal(); $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); @@ -40,36 +41,47 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca $this->user->method('lang')->will($this->returnArgument(0)); $tasks = array( - new phpbb_cron_task_core_simple_ready(), + new phpbb_cron_task_simple(), ); $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); + $cron_num_exec = 0; + $this->assertEquals('0', $config['cron_lock']); } public function test_normal_use() { + global $cron_num_exec; + $command_tester = $this->get_command_tester(); - $command_tester->execute(array('command' => $command_name)); + $command_tester->execute(array('command' => $this->command_name)); $this->assertEquals('', $command_tester->getDisplay()); + $this->assertEquals(1, $cron_num_exec); } public function test_verbose_mode() { + global $cron_num_exec; + $command_tester = $this->get_command_tester(); - $command_tester->execute(array('command' => $command_name, '--verbose' => true)); + $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); + $this->assertEquals(1, $cron_num_exec); } public function test_error_lock() { + global $cron_num_exec; + $this->lock->acquire(); $command_tester = $this->get_command_tester(); - $command_tester->execute(array('command' => $command_name)); + $command_tester->execute(array('command' => $this->command_name)); $this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay()); + $this->assertEquals(0, $cron_num_exec); } public function get_command_tester() @@ -78,7 +90,7 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca $application->add(new execute_all($this->cron_manager, $this->lock, $this->user)); $command = $application->find('cron:execute-all'); - $command_name = $command->getName(); + $this->command_name = $command->getName(); return new CommandTester($command); } } diff --git a/tests/console/cron/tasks/simple.php b/tests/console/cron/tasks/simple.php new file mode 100644 index 0000000000..be2a8a1d9d --- /dev/null +++ b/tests/console/cron/tasks/simple.php @@ -0,0 +1,15 @@ + Date: Wed, 28 May 2014 11:57:20 +0200 Subject: [PATCH 03/27] [ticket/12597] Correcing coding style mistakes PHPBB3-12597 --- phpBB/phpbb/console/command/cron/execute_all.php | 1 - tests/console/cron/execute_all_test.php | 1 - tests/console/cron/fixtures/config.xml | 1 - 3 files changed, 3 deletions(-) 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 } } } - diff --git a/tests/console/cron/execute_all_test.php b/tests/console/cron/execute_all_test.php index a0de754245..48ea79e29d 100644 --- a/tests/console/cron/execute_all_test.php +++ b/tests/console/cron/execute_all_test.php @@ -94,4 +94,3 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca return new CommandTester($command); } } - diff --git a/tests/console/cron/fixtures/config.xml b/tests/console/cron/fixtures/config.xml index b49be1e05a..2cb683d409 100644 --- a/tests/console/cron/fixtures/config.xml +++ b/tests/console/cron/fixtures/config.xml @@ -6,4 +6,3 @@ is_dynamic - From 8a1e189970c57364a3192296546717d70fbdd2d4 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 12:20:02 +0200 Subject: [PATCH 04/27] [ticket/12597] Add doc blocs in execute_all.php PHPBB3-12597 --- .../console/command/cron/execute_all.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) 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()) From 6f0121e2a49eca777f6767f5c254878f7a255fa9 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 12:36:55 +0200 Subject: [PATCH 05/27] [ticket/12597] Correcting bug in cron.php PHPBB3-12597 --- phpBB/cron.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/cron.php b/phpBB/cron.php index a8333aecaf..c708527d99 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -85,6 +85,6 @@ else { if (defined('DEBUG')) { - echo $this->user->lang('CRON_LOCK_ERROR') . '\n'; + echo $user->lang('CRON_LOCK_ERROR') . "\n"; } } From 9761c1bf617763671308fabc569ec13d40cb6843 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 12:57:49 +0200 Subject: [PATCH 06/27] [ticket/12597] Fix various refactoring mistakes PHPBB3-12597 --- phpBB/cron.php | 20 +++---------------- .../console/command/cron/execute_all.php | 2 +- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/phpBB/cron.php b/phpBB/cron.php index c708527d99..b35d16632a 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -33,20 +33,6 @@ function output_image() flush(); } -function do_cron($cron_lock, $run_tasks) -{ - global $config; - - foreach ($run_tasks as $task) - { - $task->run(); - } - - // Unloading cache and closing db after having done the dirty work. - $cron_lock->release(); - garbage_collection(); -} - // Thanks to various fatal errors and lack of try/finally, it is quite easy to leave // the cron lock locked, especially when working on cron-related code. // @@ -65,7 +51,6 @@ if ($cron_lock->acquire()) $cron = $phpbb_container->get('cron.manager'); // If invalid task is specified, empty $run_tasks is passed to do_cron which then does nothing - $run_tasks = array(); $task = $cron->find_task($cron_type); if ($task) { @@ -75,11 +60,12 @@ if ($cron_lock->acquire()) } if ($task->is_ready()) { - $run_tasks = array($task); + $task->run(); + $cron_lock->release(); + garbage_collection(); } } - do_cron($cron_lock, $run_tasks); } else { 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(); From 6f279c1bf47c4c86a507acc9ea7d705dad6e9b97 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 14:39:02 +0200 Subject: [PATCH 07/27] [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/config/console.yml | 4 ++-- phpBB/cron.php | 1 - .../cron/{execute_all.php => run_all.php} | 4 ++-- .../{execute_all_test.php => run_all_test.php} | 18 +++++++++--------- 4 files changed, 13 insertions(+), 14 deletions(-) rename phpBB/phpbb/console/command/cron/{execute_all.php => run_all.php} (95%) rename tests/console/cron/{execute_all_test.php => run_all_test.php} (80%) diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml index f268c2f05e..2aa89ee0cc 100644 --- a/phpBB/config/console.yml +++ b/phpBB/config/console.yml @@ -46,8 +46,8 @@ services: tags: - { name: console.command } - console.command.cron.execute_all: - class: phpbb\console\command\cron\execute_all + console.command.cron.run_all: + class: phpbb\console\command\cron\run_all arguments: - @cron.manager - @cron.lock_db diff --git a/phpBB/cron.php b/phpBB/cron.php index b35d16632a..0c1397979d 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -50,7 +50,6 @@ if ($cron_lock->acquire()) { $cron = $phpbb_container->get('cron.manager'); - // If invalid task is specified, empty $run_tasks is passed to do_cron which then does nothing $task = $cron->find_task($cron_type); if ($task) { diff --git a/phpBB/phpbb/console/command/cron/execute_all.php b/phpBB/phpbb/console/command/cron/run_all.php similarity index 95% rename from phpBB/phpbb/console/command/cron/execute_all.php rename to phpBB/phpbb/console/command/cron/run_all.php index f7157f4d3a..39b3e0c616 100644 --- a/phpBB/phpbb/console/command/cron/execute_all.php +++ b/phpBB/phpbb/console/command/cron/run_all.php @@ -12,7 +12,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class execute_all extends \phpbb\console\command\command +class run_all extends \phpbb\console\command\command { /** @var \phpbb\cron\manager */ protected $cron_manager; @@ -47,7 +47,7 @@ class execute_all extends \phpbb\console\command\command protected function configure() { $this - ->setName('cron:execute-all') + ->setName('cron:run-all') ->setDescription($this->user->lang('CLI_DESCR_CRON_EXECUTE_ALL')) ; } diff --git a/tests/console/cron/execute_all_test.php b/tests/console/cron/run_all_test.php similarity index 80% rename from tests/console/cron/execute_all_test.php rename to tests/console/cron/run_all_test.php index 48ea79e29d..b718d1c117 100644 --- a/tests/console/cron/execute_all_test.php +++ b/tests/console/cron/run_all_test.php @@ -9,11 +9,11 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use phpbb\console\command\cron\execute_all; +use phpbb\console\command\cron\run_all; require_once dirname(__FILE__) . '/tasks/simple.php'; -class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_case +class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case { protected $db; protected $config; @@ -47,7 +47,7 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca $cron_num_exec = 0; - $this->assertEquals('0', $config['cron_lock']); + $this->assertSame('0', $config['cron_lock']); } public function test_normal_use() @@ -57,8 +57,8 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca $command_tester = $this->get_command_tester(); $command_tester->execute(array('command' => $this->command_name)); - $this->assertEquals('', $command_tester->getDisplay()); - $this->assertEquals(1, $cron_num_exec); + $this->assertSame('', $command_tester->getDisplay()); + $this->assertSame(1, $cron_num_exec); } public function test_verbose_mode() @@ -69,7 +69,7 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); - $this->assertEquals(1, $cron_num_exec); + $this->assertSame(1, $cron_num_exec); } public function test_error_lock() @@ -81,15 +81,15 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca $command_tester->execute(array('command' => $this->command_name)); $this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay()); - $this->assertEquals(0, $cron_num_exec); + $this->assertSame(0, $cron_num_exec); } public function get_command_tester() { $application = new Application(); - $application->add(new execute_all($this->cron_manager, $this->lock, $this->user)); + $application->add(new run_all($this->cron_manager, $this->lock, $this->user)); - $command = $application->find('cron:execute-all'); + $command = $application->find('cron:run-all'); $this->command_name = $command->getName(); return new CommandTester($command); } From 9a7877274596b8330c075299adf3683c189ba6ab Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 14:57:16 +0200 Subject: [PATCH 08/27] [ticket/12597] Change EXECUTE to RUN in language Fix previous commit : change execute to run in language keys PHPBB3-12597 --- phpBB/language/en/acp/common.php | 2 +- phpBB/phpbb/console/command/cron/run_all.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 9e7f280fa6..7b73aefcc5 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -221,7 +221,7 @@ $lang = array_merge($lang, array( 'BACK' => 'Back', - 'CLI_DESCR_CRON_EXECUTE_ALL' => 'Executes all available cron tasks.', + 'CLI_DESCR_CRON_RUN_ALL' => 'Runs all available cron tasks.', 'COLOUR_SWATCH' => 'Web-safe colour swatch', 'CONFIG_UPDATED' => 'Configuration updated successfully.', 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')) ; } From 5fca30813809c4fbbcad0ffc12903eda6279b88b Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 16:47:57 +0200 Subject: [PATCH 09/27] [ticket/12597] Fix misplaced release of db lock PHPBB3-12597 --- phpBB/cron.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/cron.php b/phpBB/cron.php index 0c1397979d..0cae2ea130 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -60,10 +60,10 @@ if ($cron_lock->acquire()) if ($task->is_ready()) { $task->run(); - $cron_lock->release(); garbage_collection(); } } + $cron_lock->release(); } else From 0d839cbefc19247fd2b4c1132b91083bf0983305 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 18:02:30 +0200 Subject: [PATCH 10/27] [ticket/12597] Modification of return statuses and of test files PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run_all.php | 2 +- tests/console/cron/run_all_test.php | 10 ++++++---- tests/console/cron/tasks/simple.php | 11 +++++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) 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) { diff --git a/tests/console/cron/run_all_test.php b/tests/console/cron/run_all_test.php index b718d1c117..b85d5eb901 100644 --- a/tests/console/cron/run_all_test.php +++ b/tests/console/cron/run_all_test.php @@ -21,6 +21,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case protected $user; protected $cron_manager; protected $command_name; + protected $task; public function getDataSet() { @@ -40,8 +41,9 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case $this->user = $this->getMock('\phpbb\user'); $this->user->method('lang')->will($this->returnArgument(0)); + $this->task = new phpbb_cron_task_simple(); $tasks = array( - new phpbb_cron_task_simple(), + $this->task, ); $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); @@ -58,7 +60,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case $command_tester->execute(array('command' => $this->command_name)); $this->assertSame('', $command_tester->getDisplay()); - $this->assertSame(1, $cron_num_exec); + $this->assertSame(true, $this->task->executed); } public function test_verbose_mode() @@ -69,7 +71,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); - $this->assertSame(1, $cron_num_exec); + $this->assertSame(true, $this->task->executed); } public function test_error_lock() @@ -81,7 +83,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case $command_tester->execute(array('command' => $this->command_name)); $this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay()); - $this->assertSame(0, $cron_num_exec); + $this->assertSame(false, $this->task->executed); } public function get_command_tester() diff --git a/tests/console/cron/tasks/simple.php b/tests/console/cron/tasks/simple.php index be2a8a1d9d..15194caaf7 100644 --- a/tests/console/cron/tasks/simple.php +++ b/tests/console/cron/tasks/simple.php @@ -2,6 +2,14 @@ class phpbb_cron_task_simple extends \phpbb\cron\task\base { + public $executed; + + public function __construct() + { + $executed = false; + parent::__construct(); + } + public function get_name() { return get_class($this); @@ -9,7 +17,6 @@ class phpbb_cron_task_simple extends \phpbb\cron\task\base public function run() { - global $cron_num_exec; - $cron_num_exec++; + $this->executed = true; } } From 18875894ec046e48e8627a9c1b2158670eea70e9 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 18:19:46 +0200 Subject: [PATCH 11/27] [ticket/12597] Fix constructor bug and servral doc blocs PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run_all.php | 13 ++++++++----- tests/console/cron/run_all_test.php | 9 --------- tests/console/cron/tasks/simple.php | 3 +-- 3 files changed, 9 insertions(+), 16 deletions(-) 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 */ diff --git a/tests/console/cron/run_all_test.php b/tests/console/cron/run_all_test.php index b85d5eb901..5306d27094 100644 --- a/tests/console/cron/run_all_test.php +++ b/tests/console/cron/run_all_test.php @@ -31,7 +31,6 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case public function setUp() { global $db, $config, $phpbb_root_path, $pathEx; - global $cron_num_exec; $db = $this->db = $this->new_dbal(); $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); @@ -47,15 +46,11 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case ); $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); - $cron_num_exec = 0; - $this->assertSame('0', $config['cron_lock']); } public function test_normal_use() { - global $cron_num_exec; - $command_tester = $this->get_command_tester(); $command_tester->execute(array('command' => $this->command_name)); @@ -65,8 +60,6 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case public function test_verbose_mode() { - global $cron_num_exec; - $command_tester = $this->get_command_tester(); $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); @@ -76,8 +69,6 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case public function test_error_lock() { - global $cron_num_exec; - $this->lock->acquire(); $command_tester = $this->get_command_tester(); $command_tester->execute(array('command' => $this->command_name)); diff --git a/tests/console/cron/tasks/simple.php b/tests/console/cron/tasks/simple.php index 15194caaf7..b1fd41f34e 100644 --- a/tests/console/cron/tasks/simple.php +++ b/tests/console/cron/tasks/simple.php @@ -6,8 +6,7 @@ class phpbb_cron_task_simple extends \phpbb\cron\task\base public function __construct() { - $executed = false; - parent::__construct(); + $this->executed = false; } public function get_name() From 61ad42790f653c0fe7bf1c1b5d27181794bec997 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 18:28:46 +0200 Subject: [PATCH 12/27] [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 ++++++++++++++------ tests/console/cron/run_all_test.php | 10 ++++++--- tests/console/cron/tasks/simple.php | 18 ++++++++++----- 3 files changed, 35 insertions(+), 16 deletions(-) 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; } } } diff --git a/tests/console/cron/run_all_test.php b/tests/console/cron/run_all_test.php index 5306d27094..716ad50d81 100644 --- a/tests/console/cron/run_all_test.php +++ b/tests/console/cron/run_all_test.php @@ -1,9 +1,13 @@ executed = false; - } + public $executed = false; public function get_name() { From 9f942776ad5a3b396045e6f97db6ef655c5d9fcc Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 19:51:59 +0200 Subject: [PATCH 13/27] [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/config/console.yml | 4 +- phpBB/language/en/acp/common.php | 4 +- .../command/cron/{run_all.php => run.php} | 54 +++++++++++++------ .../cron/{run_all_test.php => run_test.php} | 35 ++++++++++-- 4 files changed, 74 insertions(+), 23 deletions(-) rename phpBB/phpbb/console/command/cron/{run_all.php => run.php} (58%) rename tests/console/cron/{run_all_test.php => run_test.php} (67%) diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml index 2aa89ee0cc..344274f963 100644 --- a/phpBB/config/console.yml +++ b/phpBB/config/console.yml @@ -46,8 +46,8 @@ services: tags: - { name: console.command } - console.command.cron.run_all: - class: phpbb\console\command\cron\run_all + console.command.cron.run: + class: phpbb\console\command\cron\run arguments: - @cron.manager - @cron.lock_db diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 7b73aefcc5..a4117a2158 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -221,11 +221,13 @@ $lang = array_merge($lang, array( 'BACK' => 'Back', - 'CLI_DESCR_CRON_RUN_ALL' => 'Runs all available cron tasks.', + 'CLI_DESCR_CRON_RUN' => 'Runs all available cron tasks.', + 'CLI_DESCR_CRON_ARG_RUN_1' => 'What task do you what to run?', 'COLOUR_SWATCH' => 'Web-safe colour swatch', 'CONFIG_UPDATED' => 'Configuration updated successfully.', 'CRON_LOCK_ERROR' => 'Could not obtain cron lock.', + 'CRON_NO_TASK' => 'No such cron task', 'DEACTIVATE' => 'Deactivate', 'DIRECTORY_DOES_NOT_EXIST' => 'The entered path “%s” does not exist.', diff --git a/phpBB/phpbb/console/command/cron/run_all.php b/phpBB/phpbb/console/command/cron/run.php similarity index 58% rename from phpBB/phpbb/console/command/cron/run_all.php rename to phpBB/phpbb/console/command/cron/run.php index 2f8166b857..701f0f02fb 100644 --- a/phpBB/phpbb/console/command/cron/run_all.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -14,10 +14,11 @@ 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_all extends \phpbb\console\command\command +class run extends \phpbb\console\command\command { /** @var \phpbb\cron\manager */ protected $cron_manager; @@ -52,43 +53,64 @@ class run_all extends \phpbb\console\command\command protected function configure() { $this - ->setName('cron:run-all') - ->setDescription($this->user->lang('CLI_DESCR_CRON_RUN_ALL')) + ->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 runs all ready cron tasks. + * 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 + * @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()) { - $run_tasks = $this->cron_manager->find_all_ready_tasks(); - - foreach ($run_tasks as $task) + if ($task_name = $input->getArgument('name')) { - if ($input->getOption('verbose')) + if ($task = $this->cron_manager->find_task($task_name)) { - $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name())); + $task->run(); + return 0; + } + else + { + $output->writeln('' . $this->user->lang('CRON_NO_TASK') . ''); + return -1; } - - $task->run(); } - $this->lock_db->release(); + else + { + $run_tasks = $this->cron_manager->find_all_ready_tasks(); - return 0; + 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 { diff --git a/tests/console/cron/run_all_test.php b/tests/console/cron/run_test.php similarity index 67% rename from tests/console/cron/run_all_test.php rename to tests/console/cron/run_test.php index 716ad50d81..c7c514c084 100644 --- a/tests/console/cron/run_all_test.php +++ b/tests/console/cron/run_test.php @@ -13,11 +13,11 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use phpbb\console\command\cron\run_all; +use phpbb\console\command\cron\run; require_once dirname(__FILE__) . '/tasks/simple.php'; -class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case +class phpbb_console_command_cron_run_test extends phpbb_database_test_case { protected $db; protected $config; @@ -81,12 +81,39 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case $this->assertSame(false, $this->task->executed); } + public function test_arg_valid() + { + $command_tester = $this->get_command_tester(); + $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple')); + + $this->assertSame('', $command_tester->getDisplay()); + $this->assertSame(true, $this->task->executed); + } + + public function test_arg_invalid() + { + $command_tester = $this->get_command_tester(); + $command_tester->execute(array('command' => $this->command_name, 'name' => 'foo')); + + $this->assertContains('CRON_NO_TASK', $command_tester->getDisplay()); + $this->assertSame(false, $this->task->executed); + } + + public function test_arg_valid_verbose() + { + $command_tester = $this->get_command_tester(); + $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple', '--verbose' => true)); + + $this->assertSame('', $command_tester->getDisplay()); + $this->assertSame(true, $this->task->executed); + } + public function get_command_tester() { $application = new Application(); - $application->add(new run_all($this->cron_manager, $this->lock, $this->user)); + $application->add(new run($this->cron_manager, $this->lock, $this->user)); - $command = $application->find('cron:run-all'); + $command = $application->find('cron:run'); $this->command_name = $command->getName(); return new CommandTester($command); } From 54d60e3f7864cf0da4c6da9c824e29ba51d57a37 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 21:26:33 +0200 Subject: [PATCH 14/27] [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(-) 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 From 532e4470ea08e6245878e49e77f1ca51354681e7 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 22:09:38 +0200 Subject: [PATCH 15/27] [ticket/12597] Fix language key name PHPBB3-12597 --- phpBB/language/en/acp/common.php | 5 +++-- phpBB/phpbb/console/command/cron/run.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index a4117a2158..f9f38788a6 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -221,8 +221,9 @@ $lang = array_merge($lang, array( 'BACK' => 'Back', - 'CLI_DESCR_CRON_RUN' => 'Runs all available cron tasks.', - 'CLI_DESCR_CRON_ARG_RUN_1' => 'What task do you what to run?', + 'CLI_DESCRIPTION_CRON_RUN' => 'Runs all available cron tasks.', + 'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'What task do you what to run?', + 'COLOUR_SWATCH' => 'Web-safe colour swatch', 'CONFIG_UPDATED' => 'Configuration updated successfully.', 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')) ; } From e7fd259766ff78edf98ee08fff83cb70ac46b6f7 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 16:37:45 +0200 Subject: [PATCH 16/27] [ticket/12597] Refactoring and test improving Adding tests of return status Refactoring code Adding consistency in verbose mode PHPBB3-12597 --- phpBB/language/en/acp/common.php | 6 +- phpBB/phpbb/console/command/cron/run.php | 106 ++++++++++++++++------- tests/console/cron/run_test.php | 34 ++++++-- 3 files changed, 105 insertions(+), 41 deletions(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index f9f38788a6..c3bf60f642 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -222,13 +222,13 @@ $lang = array_merge($lang, array( 'BACK' => 'Back', 'CLI_DESCRIPTION_CRON_RUN' => 'Runs all available cron tasks.', - 'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'What task do you what to run?', - + 'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'Name of the task to be run', 'COLOUR_SWATCH' => 'Web-safe colour swatch', 'CONFIG_UPDATED' => 'Configuration updated successfully.', 'CRON_LOCK_ERROR' => 'Could not obtain cron lock.', - 'CRON_NO_TASK' => 'No such cron task', + 'CRON_NO_SUCH_TASK' => 'No such cron task', + 'CRON_NO_TASK' => 'No task to be run', 'DEACTIVATE' => 'Deactivate', 'DIRECTORY_DOES_NOT_EXIST' => 'The entered path “%s” does not exist.', 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,33 +85,11 @@ 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(); - - 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(); - + $this->run_all($input, $output); return 0; } } @@ -120,4 +99,71 @@ class run extends \phpbb\console\command\command return 1; } } + + /* + * 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(); + + if ($run_tasks) { + foreach ($run_tasks as $task) + { + if ($input->getOption('verbose')) + { + $output->writeln('' . $this->user->lang('RUNNING_TASK', $task->get_name()) . ''); + } + + $task->run(); + } + } + else + { + $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; + } + } } diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index c7c514c084..e5cd170492 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -56,56 +56,74 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case public function test_normal_use() { $command_tester = $this->get_command_tester(); - $command_tester->execute(array('command' => $this->command_name)); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); $this->assertSame('', $command_tester->getDisplay()); $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); } public function test_verbose_mode() { $command_tester = $this->get_command_tester(); - $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); + $exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); } public function test_error_lock() { $this->lock->acquire(); $command_tester = $this->get_command_tester(); - $command_tester->execute(array('command' => $this->command_name)); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); $this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay()); $this->assertSame(false, $this->task->executed); + $this->assertSame(1, $exit_status); + } + + public function test_no_task() + { + $tasks = array( + ); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); + + $this->assertContains('CRON_NO_TASK', $command_tester->getDisplay()); + $this->assertSame(0, $exit_status); } public function test_arg_valid() { $command_tester = $this->get_command_tester(); - $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple')); + $exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple')); $this->assertSame('', $command_tester->getDisplay()); $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); } public function test_arg_invalid() { $command_tester = $this->get_command_tester(); - $command_tester->execute(array('command' => $this->command_name, 'name' => 'foo')); + $exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'foo')); - $this->assertContains('CRON_NO_TASK', $command_tester->getDisplay()); + $this->assertContains('CRON_NO_SUCH_TASK', $command_tester->getDisplay()); $this->assertSame(false, $this->task->executed); + $this->assertSame(2, $exit_status); } public function test_arg_valid_verbose() { $command_tester = $this->get_command_tester(); - $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple', '--verbose' => true)); + $exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple', '--verbose' => true)); - $this->assertSame('', $command_tester->getDisplay()); + $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); } public function get_command_tester() From c17a1e92c5d63beb0f7f602a061c33a9eb093639 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 16:59:41 +0200 Subject: [PATCH 17/27] [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(-) 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) From 79bdcdf9887ee4295f1cf2318a6819bd8ec8e1b0 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 17:03:34 +0200 Subject: [PATCH 18/27] [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(-) 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(); From 7508d2b546392c4a1e3ae4ea48cb45ebc502e5e7 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 17:03:34 +0200 Subject: [PATCH 19/27] [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(-) 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(); From 03e0e736ab054d8ad355012f5d34cfccb56c7955 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 17:26:58 +0200 Subject: [PATCH 20/27] [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(-) 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; } } From 2f2e404639bd0164387615a1f5c338cdbf9e2dfe Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 17:40:57 +0200 Subject: [PATCH 21/27] [ticket/12597] Fix test file Fix bug of test_no_task that expected a message where none was supposed to exist. PHPBB3-12597 --- tests/console/cron/run_test.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index e5cd170492..599d089a1f 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -61,6 +61,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $this->assertSame('', $command_tester->getDisplay()); $this->assertSame(true, $this->task->executed); $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); } public function test_verbose_mode() @@ -71,6 +72,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); $this->assertSame(true, $this->task->executed); $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); } public function test_error_lock() @@ -92,8 +94,22 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $command_tester = $this->get_command_tester(); $exit_status = $command_tester->execute(array('command' => $this->command_name)); + $this->assertSame('', $command_tester->getDisplay()); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_no_task_verbose() + { + $tasks = array( + ); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); + $this->assertContains('CRON_NO_TASK', $command_tester->getDisplay()); $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); } public function test_arg_valid() @@ -104,6 +120,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $this->assertSame('', $command_tester->getDisplay()); $this->assertSame(true, $this->task->executed); $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); } public function test_arg_invalid() @@ -114,6 +131,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $this->assertContains('CRON_NO_SUCH_TASK', $command_tester->getDisplay()); $this->assertSame(false, $this->task->executed); $this->assertSame(2, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); } public function test_arg_valid_verbose() @@ -124,6 +142,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); $this->assertSame(true, $this->task->executed); $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); } public function get_command_tester() From fda2cc636cd3df852c7dc7ca0f12b4696ff0553c Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 18:03:23 +0200 Subject: [PATCH 22/27] [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(-) 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; } } From 3b845b189316b341594fe3eeb0b63e42df033d57 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 18:08:02 +0200 Subject: [PATCH 23/27] [ticket/12597] Typo corrections PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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. From 43fbb84cc39385a237e101bf3c915bdd711113de Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 18:09:42 +0200 Subject: [PATCH 24/27] [ticket/12597] Typo correction PHPBB3-12597 --- phpBB/phpbb/console/command/cron/run.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. */ From 01dba249d789dd1548c4c1cdfb97630121ece69a Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 18:25:27 +0200 Subject: [PATCH 25/27] [ticket/12597] Fix wrong global variable name $pathEx changed to $phpEx PHPBB3-12597 --- tests/console/cron/run_test.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index 599d089a1f..8908c536c0 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -34,7 +34,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case public function setUp() { - global $db, $config, $phpbb_root_path, $pathEx; + global $db, $config, $phpbb_root_path, $phpEx; $db = $this->db = $this->new_dbal(); $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); @@ -48,7 +48,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $tasks = array( $this->task, ); - $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phbEx); $this->assertSame('0', $config['cron_lock']); } @@ -90,7 +90,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case { $tasks = array( ); - $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phpEx); $command_tester = $this->get_command_tester(); $exit_status = $command_tester->execute(array('command' => $this->command_name)); @@ -103,7 +103,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case { $tasks = array( ); - $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phpEx); $command_tester = $this->get_command_tester(); $exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); From 9cda850b3aedce7ae929030bcb2f6c77cd363ec1 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Thu, 29 May 2014 20:46:23 +0200 Subject: [PATCH 26/27] [ticket/12597] Modifiying acp message Modifying an acp message in order to include the use of the command PHPBB3-12597 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index b796206261..c7a29f5d22 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -459,7 +459,7 @@ $lang = array_merge($lang, array( 'UPLOAD_ICONS_PATH' => 'Extension group icons storage path', 'UPLOAD_ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/upload_icons.', 'USE_SYSTEM_CRON' => 'Run periodic tasks from system cron', - 'USE_SYSTEM_CRON_EXPLAIN' => 'When off, phpBB will arrange for periodic tasks to be run automatically. When on, phpBB will not schedule any periodic tasks by itself; a system administrator must arrange for cron.php to be invoked by the system cron facility at regular intervals (e.g. every 5 minutes).', + 'USE_SYSTEM_CRON_EXPLAIN' => 'When off, phpBB will arrange for periodic tasks to be run automatically. When on, phpBB will not schedule any periodic tasks by itself; a system administrator must arrange for cron:run command to be run by the system cron facility at regular intervals (e.g. every 5 minutes).', )); // Security Settings From fa3a634ae11af0a89000d5770b1c3fae10486195 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Fri, 30 May 2014 10:55:03 +0200 Subject: [PATCH 27/27] [ticket/12597] Reformating an acp message PHPBB3-12597 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index c7a29f5d22..1585141930 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -459,7 +459,7 @@ $lang = array_merge($lang, array( 'UPLOAD_ICONS_PATH' => 'Extension group icons storage path', 'UPLOAD_ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/upload_icons.', 'USE_SYSTEM_CRON' => 'Run periodic tasks from system cron', - 'USE_SYSTEM_CRON_EXPLAIN' => 'When off, phpBB will arrange for periodic tasks to be run automatically. When on, phpBB will not schedule any periodic tasks by itself; a system administrator must arrange for cron:run command to be run by the system cron facility at regular intervals (e.g. every 5 minutes).', + 'USE_SYSTEM_CRON_EXPLAIN' => 'When off, phpBB will arrange for periodic tasks to be run automatically. When on, phpBB will not schedule any periodic tasks by itself; a system administrator must arrange for cron:run command to be run by the system cron facility at regular intervals (e.g. every 5 minutes).', )); // Security Settings