aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/install/module
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/install/module')
-rw-r--r--phpBB/phpbb/install/module/requirements/module.php55
1 files changed, 34 insertions, 21 deletions
diff --git a/phpBB/phpbb/install/module/requirements/module.php b/phpBB/phpbb/install/module/requirements/module.php
index 208cb5aad6..794a35bef5 100644
--- a/phpBB/phpbb/install/module/requirements/module.php
+++ b/phpBB/phpbb/install/module/requirements/module.php
@@ -13,6 +13,7 @@
namespace phpbb\install\module\requirements;
+use phpbb\install\exception\resource_limit_reached_exception;
use phpbb\install\exception\user_interaction_required_exception;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
@@ -23,30 +24,38 @@ class module extends \phpbb\install\module_base
$tests_passed = true;
// Recover install progress
- $task_index = 0;
+ $task_name = $this->recover_progress();
+ $task_found = false;
- // Run until there are available resources
- while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0)
+ /**
+ * @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
+ // Skip forward until the next task is reached
+ if (!$task_found)
{
- /** @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]);
- }
+ if ($name === $task_name || empty($task_name))
+ {
+ $task_found = true;
- // Iterate to the next task
- $task_index++;
+ if ($name === $task_name)
+ {
+ continue;
+ }
+ }
+ else
+ {
+ continue;
+ }
+ }
// Check if we can run the task
if (!$task->is_essential() && !$task->check_requirements())
@@ -54,10 +63,18 @@ class module extends \phpbb\install\module_base
continue;
}
+ if ($this->allow_progress_bar)
+ {
+ $this->install_config->increment_current_task_progress();
+ }
+
$test_result = $task->run();
$tests_passed = ($tests_passed) ? $test_result : false;
}
+ // Module finished, so clear task progress
+ $this->install_config->set_finished_task('');
+
// Check if tests have failed
if (!$tests_passed)
{
@@ -74,10 +91,6 @@ class module extends \phpbb\install\module_base
$this->iohandler->send_response();
throw new user_interaction_required_exception();
}
-
- // Log install progress
- $current_task_index = $task_index - 1;
- $this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index);
}
/**