diff options
author | Mate Bartus <mate.bartus@gmail.com> | 2016-02-12 14:20:04 +0100 |
---|---|---|
committer | Mate Bartus <mate.bartus@gmail.com> | 2016-02-12 14:31:28 +0100 |
commit | 68091561abef2c2f0674e3a461401f10f2ef5a25 (patch) | |
tree | e86834eee8576b7f2a39274414d24663f724356f /phpBB/phpbb/install/module/install_database/task/add_config_settings.php | |
parent | 955b9ede33c5696173a760ea271ec32d79e843b9 (diff) | |
download | forums-68091561abef2c2f0674e3a461401f10f2ef5a25.tar forums-68091561abef2c2f0674e3a461401f10f2ef5a25.tar.gz forums-68091561abef2c2f0674e3a461401f10f2ef5a25.tar.bz2 forums-68091561abef2c2f0674e3a461401f10f2ef5a25.tar.xz forums-68091561abef2c2f0674e3a461401f10f2ef5a25.zip |
[ticket/14462] Refactor tasks to be more modular
PHPBB3-14462
Diffstat (limited to 'phpBB/phpbb/install/module/install_database/task/add_config_settings.php')
-rw-r--r-- | phpBB/phpbb/install/module/install_database/task/add_config_settings.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php index 6fb03ff73d..5fd99638c2 100644 --- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php +++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php @@ -13,6 +13,8 @@ namespace phpbb\install\module\install_database\task; +use phpbb\install\exception\resource_limit_reached_exception; + /** * Create database schema */ @@ -313,6 +315,10 @@ class add_config_settings extends \phpbb\install\task_base WHERE config_name = 'allow_avatar_upload'"; } + $i = $this->install_config->get('add_config_settings_index', 0); + $total = sizeof($sql_ary); + $sql_ary = array_slice($sql_ary, $i); + foreach ($sql_ary as $sql) { if (!$this->db->sql_query($sql)) @@ -320,6 +326,20 @@ class add_config_settings extends \phpbb\install\task_base $error = $this->db->sql_error($this->db->get_sql_error_sql()); $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); } + + $i++; + + // Run until there are available resources + if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) + { + break; + } + } + + if ($i < $total) + { + $this->install_config->set('add_config_settings_index', $i); + throw new resource_limit_reached_exception(); } } |