From 3dcaa48850bf823b238391fbf9c3f085092010bc Mon Sep 17 00:00:00 2001 From: CHItA Date: Sat, 13 Jun 2015 15:35:19 +0200 Subject: [ticket/13740] Move installer files to phpbb/install directory PHPBB3-13740 --- phpBB/phpbb/install/module_base.php | 252 ++++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 phpBB/phpbb/install/module_base.php (limited to 'phpBB/phpbb/install/module_base.php') diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php new file mode 100644 index 0000000000..6c0c0e0c30 --- /dev/null +++ b/phpBB/phpbb/install/module_base.php @@ -0,0 +1,252 @@ + + * @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\install; + +use phpbb\install\exception\invalid_service_name_exception; +use phpbb\install\exception\task_not_found_exception; +use phpbb\install\helper\iohandler\iohandler_interface; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use phpbb\install\helper\config; + +/** + * Base class for installer module + */ +abstract class module_base implements module_interface +{ + /** + * @var ContainerInterface + */ + protected $container; + + /** + * @var config + */ + protected $install_config; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var bool + */ + protected $is_essential; + + /** + * Array of tasks for installer module + * + * @var array + */ + protected $task_collection; + + /** + * @var bool + */ + protected $allow_progress_bar; + + /** + * Installer module constructor + * + * @param array $tasks array of installer tasks for installer module + * @param bool $essential flag indicating whether the module is essential or not + * @param bool $allow_progress_bar flag indicating whether or not to send progress information from within the module + */ + public function __construct(array $tasks, $essential = true, $allow_progress_bar = true) + { + $this->task_collection = $tasks; + $this->is_essential = $essential; + $this->allow_progress_bar = $allow_progress_bar; + } + + /** + * Dependency getter + * + * @param ContainerInterface $container + * @param config $config + * @param iohandler_interface $iohandler + */ + public function setup(ContainerInterface $container, config $config, iohandler_interface $iohandler) + { + $this->container = $container; + $this->install_config = $config; + $this->iohandler = $iohandler; + } + + /** + * {@inheritdoc} + */ + public function is_essential() + { + return $this->is_essential; + } + + /** + * {@inheritdoc} + * + * Overwrite this method if your task is non-essential! + */ + public function check_requirements() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Recover install progress + $task_index = $this->recover_progress(); + + // Run until there are available resources + while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) + { + // Check if task exists + if (!isset($this->task_collection[$task_index])) + { + break; + } + + // Recover task to be executed + try + { + /** @var \phpbb\install\task_interface $task */ + $task = $this->container->get($this->task_collection[$task_index]); + } + catch (InvalidArgumentException $e) + { + throw new task_not_found_exception($this->task_collection[$task_index]); + } + + // Send progress information + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + } + + // Iterate to the next task + $task_index++; + + // Check if we can run the task + if (!$task->is_essential() && !$task->check_requirements()) + { + $this->iohandler->add_log_message(array( + 'SKIP_TASK', + $this->task_collection[$task_index], + )); + $class_name = $this->get_class_from_service_name($this->task_collection[$task_index - 1]); + $this->install_config->increment_current_task_progress($class_name::get_step_count()); + continue; + } + + if ($this->allow_progress_bar) + { + $this->install_config->increment_current_task_progress(); + } + + $task->run(); + + // Send progress information + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + } + + $this->iohandler->send_response(); + + // Log install progress + $current_task_index = $task_index - 1; + $this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index); + } + } + + /** + * Returns the next task's index + * + * @return int index of the array element of the next task + */ + protected function recover_progress() + { + $progress_array = $this->install_config->get_progress_data(); + $last_finished_task_name = $progress_array['last_task_name']; + $last_finished_task_index = $progress_array['last_task_index']; + + // Check if the data is relevant to this module + if (isset($this->task_collection[$last_finished_task_index])) + { + if ($this->task_collection[$last_finished_task_index] === $last_finished_task_name) + { + // Return the task index of the next task + return $last_finished_task_index + 1; + } + } + + // As of now if the progress has not been resolved we assume that it is because + // the task progress belongs to the previous module, + // so just default to the first task + // @todo make module aware of it's service name that way this can be improved + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_step_count() + { + $step_count = 0; + + foreach ($this->task_collection as $task_service_name) + { + $class_name = $this->get_class_from_service_name($task_service_name); + $step_count += $class_name::get_step_count(); + } + + return $step_count; + } + + /** + * Returns the name of the class form the service name + * + * @param string $task_service_name Name of the service + * + * @return string Name of the class + * + * @throws invalid_service_name_exception When the service name does not meet the requirements described in task_interface + */ + protected function get_class_from_service_name($task_service_name) + { + $task_service_name_parts = explode('.', $task_service_name); + + if ($task_service_name_parts[0] !== 'installer') + { + throw new invalid_service_name_exception('TASK_SERVICE_INSTALLER_MISSING'); + } + + $class_name = '\\phpbb\\install\\module\\' . $task_service_name_parts[1] . '\\task\\' . $task_service_name_parts[2]; + if (!class_exists($class_name)) + { + throw new invalid_service_name_exception('TASK_CLASS_NOT_FOUND', array($task_service_name, $class_name)); + } + + return $class_name; + } +} -- cgit v1.2.1 From 62103cec300ddadb904862ee2a74d68f71eb32ca Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 15:26:48 +0200 Subject: [ticket/13740] Use service collection instead of array of task names PHPBB3-13740 --- phpBB/phpbb/install/module_base.php | 84 ++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 47 deletions(-) (limited to 'phpBB/phpbb/install/module_base.php') diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index 6c0c0e0c30..6099eb35f8 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -13,12 +13,13 @@ namespace phpbb\install; +use phpbb\di\ordered_service_collection; use phpbb\install\exception\invalid_service_name_exception; -use phpbb\install\exception\task_not_found_exception; +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use phpbb\install\helper\config; /** * Base class for installer module @@ -48,7 +49,7 @@ abstract class module_base implements module_interface /** * Array of tasks for installer module * - * @var array + * @var ordered_service_collection */ protected $task_collection; @@ -60,11 +61,11 @@ abstract class module_base implements module_interface /** * Installer module constructor * - * @param array $tasks array of installer tasks for installer module - * @param bool $essential flag indicating whether the module is essential or not - * @param bool $allow_progress_bar flag indicating whether or not to send progress information from within the module + * @param ordered_service_collection $tasks array of installer tasks for installer module + * @param bool $essential flag indicating whether the module is essential or not + * @param bool $allow_progress_bar flag indicating whether or not to send progress information from within the module */ - public function __construct(array $tasks, $essential = true, $allow_progress_bar = true) + public function __construct(ordered_service_collection $tasks, $essential = true, $allow_progress_bar = true) { $this->task_collection = $tasks; $this->is_essential = $essential; @@ -109,26 +110,30 @@ abstract class module_base implements module_interface public function run() { // Recover install progress - $task_index = $this->recover_progress(); - - // Run until there are available resources - while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) + $task_name = $this->recover_progress(); + $name_found = false; + + /** + * @var string $name ID of the service + * @var \phpbb\install\task_interface $task Task object + */ + foreach ($this->task_collection as $name => $task) { - // Check if task exists - if (!isset($this->task_collection[$task_index])) + // Run until there are available resources + if ($this->install_config->get_time_remaining() <= 0 && $this->install_config->get_memory_remaining() <= 0) { - break; + throw new resource_limit_reached_exception(); } - // Recover task to be executed - try - { - /** @var \phpbb\install\task_interface $task */ - $task = $this->container->get($this->task_collection[$task_index]); - } - catch (InvalidArgumentException $e) + // Skip forward until the next task is reached + if (!empty($task_name) && !$name_found) { - throw new task_not_found_exception($this->task_collection[$task_index]); + if ($name === $task_name) + { + $name_found = true; + } + + continue; } // Send progress information @@ -140,17 +145,15 @@ abstract class module_base implements module_interface ); } - // Iterate to the next task - $task_index++; - // Check if we can run the task if (!$task->is_essential() && !$task->check_requirements()) { $this->iohandler->add_log_message(array( 'SKIP_TASK', - $this->task_collection[$task_index], + $name, )); - $class_name = $this->get_class_from_service_name($this->task_collection[$task_index - 1]); + + $class_name = $this->get_class_from_service_name($name); $this->install_config->increment_current_task_progress($class_name::get_step_count()); continue; } @@ -174,9 +177,11 @@ abstract class module_base implements module_interface $this->iohandler->send_response(); // Log install progress - $current_task_index = $task_index - 1; - $this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index); + $this->install_config->set_finished_task($name); } + + // Module finished, so clear task progress + $this->install_config->set_finished_task(''); } /** @@ -187,24 +192,7 @@ abstract class module_base implements module_interface protected function recover_progress() { $progress_array = $this->install_config->get_progress_data(); - $last_finished_task_name = $progress_array['last_task_name']; - $last_finished_task_index = $progress_array['last_task_index']; - - // Check if the data is relevant to this module - if (isset($this->task_collection[$last_finished_task_index])) - { - if ($this->task_collection[$last_finished_task_index] === $last_finished_task_name) - { - // Return the task index of the next task - return $last_finished_task_index + 1; - } - } - - // As of now if the progress has not been resolved we assume that it is because - // the task progress belongs to the previous module, - // so just default to the first task - // @todo make module aware of it's service name that way this can be improved - return 0; + return $progress_array['last_task_name']; } /** @@ -214,11 +202,13 @@ abstract class module_base implements module_interface { $step_count = 0; + /** @todo: Fix this foreach ($this->task_collection as $task_service_name) { $class_name = $this->get_class_from_service_name($task_service_name); $step_count += $class_name::get_step_count(); } + */ return $step_count; } -- cgit v1.2.1 From e967f3c1a81eab0f14daf314b7fb1b2001e4d220 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 19:08:28 +0200 Subject: [ticket/13740] Fix itteration problems, implement class name aware collections PHPBB3-13740 --- phpBB/phpbb/install/module_base.php | 79 +++++++++++++++---------------------- 1 file changed, 32 insertions(+), 47 deletions(-) (limited to 'phpBB/phpbb/install/module_base.php') diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index 6099eb35f8..e0cb862be9 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -14,7 +14,6 @@ namespace phpbb\install; use phpbb\di\ordered_service_collection; -use phpbb\install\exception\invalid_service_name_exception; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; @@ -53,6 +52,11 @@ abstract class module_base implements module_interface */ protected $task_collection; + /** + * @var array + */ + protected $task_step_count; + /** * @var bool */ @@ -111,7 +115,7 @@ abstract class module_base implements module_interface { // Recover install progress $task_name = $this->recover_progress(); - $name_found = false; + $task_found = false; /** * @var string $name ID of the service @@ -126,14 +130,21 @@ abstract class module_base implements module_interface } // Skip forward until the next task is reached - if (!empty($task_name) && !$name_found) + if (!$task_found) { - if ($name === $task_name) + if ($name === $task_name || empty($task_name)) { - $name_found = true; - } + $task_found = true; - continue; + if ($name === $task_name) + { + continue; + } + } + else + { + continue; + } } // Send progress information @@ -153,18 +164,22 @@ abstract class module_base implements module_interface $name, )); - $class_name = $this->get_class_from_service_name($name); - $this->install_config->increment_current_task_progress($class_name::get_step_count()); + $this->install_config->increment_current_task_progress($this->task_step_count[$name]); continue; } if ($this->allow_progress_bar) { + // Only increment progress by one, as if a task has more than one steps + // then that should be incremented in the task itself $this->install_config->increment_current_task_progress(); } $task->run(); + // Log install progress + $this->install_config->set_finished_task($name); + // Send progress information if ($this->allow_progress_bar) { @@ -175,9 +190,6 @@ abstract class module_base implements module_interface } $this->iohandler->send_response(); - - // Log install progress - $this->install_config->set_finished_task($name); } // Module finished, so clear task progress @@ -187,7 +199,7 @@ abstract class module_base implements module_interface /** * Returns the next task's index * - * @return int index of the array element of the next task + * @return string index of the array element of the next task */ protected function recover_progress() { @@ -200,43 +212,16 @@ abstract class module_base implements module_interface */ public function get_step_count() { - $step_count = 0; - - /** @todo: Fix this - foreach ($this->task_collection as $task_service_name) - { - $class_name = $this->get_class_from_service_name($task_service_name); - $step_count += $class_name::get_step_count(); - } - */ - - return $step_count; - } - - /** - * Returns the name of the class form the service name - * - * @param string $task_service_name Name of the service - * - * @return string Name of the class - * - * @throws invalid_service_name_exception When the service name does not meet the requirements described in task_interface - */ - protected function get_class_from_service_name($task_service_name) - { - $task_service_name_parts = explode('.', $task_service_name); - - if ($task_service_name_parts[0] !== 'installer') - { - throw new invalid_service_name_exception('TASK_SERVICE_INSTALLER_MISSING'); - } + $task_step_count = 0; + $task_class_names = $this->task_collection->get_service_classes(); - $class_name = '\\phpbb\\install\\module\\' . $task_service_name_parts[1] . '\\task\\' . $task_service_name_parts[2]; - if (!class_exists($class_name)) + foreach ($task_class_names as $name => $task_class) { - throw new invalid_service_name_exception('TASK_CLASS_NOT_FOUND', array($task_service_name, $class_name)); + $step_count = $task_class::get_step_count(); + $task_step_count += $step_count; + $this->task_step_count[$name] = $step_count; } - return $class_name; + return $task_step_count; } } -- cgit v1.2.1 From 3309c89b05a46a03d09ffef693ed309699a3f59b Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 19:32:30 +0200 Subject: [ticket/13740] Fix CS PHPBB3-13740 --- phpBB/phpbb/install/module_base.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb/install/module_base.php') diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index e0cb862be9..eb04379f8e 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -18,7 +18,6 @@ use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; /** * Base class for installer module -- cgit v1.2.1 From e46689a0cdbb418673741234f55e843f1bdd8016 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 23:23:40 +0200 Subject: [ticket/13740] Remove service container from modules PHPBB3-13740 --- phpBB/phpbb/install/module_base.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'phpBB/phpbb/install/module_base.php') diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index eb04379f8e..60eaa79139 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -17,7 +17,6 @@ use phpbb\di\ordered_service_collection; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Base class for installer module @@ -78,13 +77,11 @@ abstract class module_base implements module_interface /** * Dependency getter * - * @param ContainerInterface $container * @param config $config * @param iohandler_interface $iohandler */ - public function setup(ContainerInterface $container, config $config, iohandler_interface $iohandler) + public function setup(config $config, iohandler_interface $iohandler) { - $this->container = $container; $this->install_config = $config; $this->iohandler = $iohandler; } @@ -196,9 +193,9 @@ abstract class module_base implements module_interface } /** - * Returns the next task's index + * Returns the next task's name * - * @return string index of the array element of the next task + * @return string Index of the array element of the next task */ protected function recover_progress() { -- cgit v1.2.1 From 59d22eff497ea1107851067aa99eed4c979c0766 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 10 Jul 2015 00:47:28 +0200 Subject: [ticket/13740] Fix CS PHPBB3-13740 --- phpBB/phpbb/install/module_base.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'phpBB/phpbb/install/module_base.php') diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index 60eaa79139..a933d4987c 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -23,11 +23,6 @@ use phpbb\install\helper\iohandler\iohandler_interface; */ abstract class module_base implements module_interface { - /** - * @var ContainerInterface - */ - protected $container; - /** * @var config */ -- cgit v1.2.1 From 8f5a0ad6f73e7b7757b02c827436384c96069b5a Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 24 Jul 2015 09:20:50 +0200 Subject: [ticket/14039] Revamp updater PHPBB3-14039 --- phpBB/phpbb/install/module_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/module_base.php') diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index a933d4987c..fb68c3aca2 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -115,7 +115,7 @@ abstract class module_base implements module_interface foreach ($this->task_collection as $name => $task) { // Run until there are available resources - if ($this->install_config->get_time_remaining() <= 0 && $this->install_config->get_memory_remaining() <= 0) + if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) { throw new resource_limit_reached_exception(); } -- cgit v1.2.1 From 955b9ede33c5696173a760ea271ec32d79e843b9 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 11 Feb 2016 13:18:30 +0100 Subject: [ticket/14462] Further speed improvements - Cache the secondary container - Only initialize tasks/modules that are being used - Add timeout error message in the AJAX UI PHPBB3-14462 --- phpBB/phpbb/install/module_base.php | 97 ++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 51 deletions(-) (limited to 'phpBB/phpbb/install/module_base.php') diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index fb68c3aca2..f75e8cda02 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -105,47 +105,23 @@ abstract class module_base implements module_interface public function run() { // Recover install progress - $task_name = $this->recover_progress(); - $task_found = false; - - /** - * @var string $name ID of the service - * @var \phpbb\install\task_interface $task Task object - */ - foreach ($this->task_collection as $name => $task) - { - // Run until there are available resources - if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) - { - throw new resource_limit_reached_exception(); - } + $task_index = $this->recover_progress(); + $iterator = $this->task_collection->getIterator(); - // Skip forward until the next task is reached - if (!$task_found) - { - if ($name === $task_name || empty($task_name)) - { - $task_found = true; - - if ($name === $task_name) - { - continue; - } - } - else - { - continue; - } - } + if ($task_index < $iterator->count()) + { + $iterator->seek($task_index); + } + else + { + $this->install_config->set_finished_task(0); + return; + } - // Send progress information - if ($this->allow_progress_bar) - { - $this->iohandler->set_progress( - $task->get_task_lang_name(), - $this->install_config->get_current_task_progress() - ); - } + while ($iterator->valid()) + { + $task = $iterator->current(); + $name = $iterator->key(); // Check if we can run the task if (!$task->is_essential() && !$task->check_requirements()) @@ -156,20 +132,33 @@ abstract class module_base implements module_interface )); $this->install_config->increment_current_task_progress($this->task_step_count[$name]); - continue; } - - if ($this->allow_progress_bar) + else { - // Only increment progress by one, as if a task has more than one steps - // then that should be incremented in the task itself - $this->install_config->increment_current_task_progress(); - } + // Send progress information + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); - $task->run(); + $this->iohandler->send_response(); + } - // Log install progress - $this->install_config->set_finished_task($name); + $task->run(); + + if ($this->allow_progress_bar) + { + // Only increment progress by one, as if a task has more than one steps + // then that should be incremented in the task itself + $this->install_config->increment_current_task_progress(); + } + } + + $task_index++; + $this->install_config->set_finished_task($task_index); + $iterator->next(); // Send progress information if ($this->allow_progress_bar) @@ -181,10 +170,16 @@ abstract class module_base implements module_interface } $this->iohandler->send_response(); + + // Run until there are available resources + if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) + { + throw new resource_limit_reached_exception(); + } } // Module finished, so clear task progress - $this->install_config->set_finished_task(''); + $this->install_config->set_finished_task(0); } /** @@ -195,7 +190,7 @@ abstract class module_base implements module_interface protected function recover_progress() { $progress_array = $this->install_config->get_progress_data(); - return $progress_array['last_task_name']; + return $progress_array['last_task_index']; } /** -- cgit v1.2.1 From 2efceffaebd96fd6d092c4be8c854a7bcf032592 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 12 Feb 2016 23:30:32 +0100 Subject: [ticket/14462] Fix comments PHPBB3-14462 --- phpBB/phpbb/install/module_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/module_base.php') diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index f75e8cda02..527447b4a1 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -171,7 +171,7 @@ abstract class module_base implements module_interface $this->iohandler->send_response(); - // Run until there are available resources + // Stop execution if resource limit is reached if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) { throw new resource_limit_reached_exception(); -- cgit v1.2.1 From f41c7bd2b16906293498b4eb4073407e57a3567f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bartus?= Date: Mon, 11 Apr 2016 18:18:09 +0200 Subject: [ticket/14590] Prevent refresh requests after the last tasks in modules PHPBB3-14590 --- phpBB/phpbb/install/module_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/install/module_base.php') diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index 527447b4a1..93c10bd656 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -172,7 +172,7 @@ abstract class module_base implements module_interface $this->iohandler->send_response(); // Stop execution if resource limit is reached - if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) + if ($iterator->valid() && ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)) { throw new resource_limit_reached_exception(); } -- cgit v1.2.1