diff options
author | Mate Bartus <mate.bartus@gmail.com> | 2015-07-24 09:20:50 +0200 |
---|---|---|
committer | Mate Bartus <mate.bartus@gmail.com> | 2015-10-17 23:05:57 +0200 |
commit | 8f5a0ad6f73e7b7757b02c827436384c96069b5a (patch) | |
tree | 87a16ddaa2f645d62728f0b4543199e43995bfeb /phpBB/phpbb/install/helper/config.php | |
parent | f1047ac854baba4d1015cd9a555a523b3860f2c9 (diff) | |
download | forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar.gz forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar.bz2 forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar.xz forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.zip |
[ticket/14039] Revamp updater
PHPBB3-14039
Diffstat (limited to 'phpBB/phpbb/install/helper/config.php')
-rw-r--r-- | phpBB/phpbb/install/helper/config.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/phpBB/phpbb/install/helper/config.php b/phpBB/phpbb/install/helper/config.php index d5653f1924..e73e07208e 100644 --- a/phpBB/phpbb/install/helper/config.php +++ b/phpBB/phpbb/install/helper/config.php @@ -99,6 +99,8 @@ class config 'last_task_name' => '', // Stores the service name of the latest finished task 'max_task_progress' => 0, 'current_task_progress' => 0, + '_restart_points' => array(), + 'use_restart_point' => false, ); $this->install_config_file = $this->phpbb_root_path . 'store/install_config.php'; @@ -240,6 +242,56 @@ class config } /** + * Creates a progress restart point + * + * Restart points can be used to repeat certain tasks periodically. + * You need to call this method from the first task you want to repeat. + * + * @param string $name Name of the restart point + */ + public function create_progress_restart_point($name) + { + $tmp_progress_data = $this->progress_data; + unset($tmp_progress_data['_restart_points']); + + $this->progress_data['_restart_points'][$name] = $tmp_progress_data; + } + + /** + * Set restart point to continue from + * + * @param string $name Name of the restart point + * + * @return bool Returns false if the restart point name is not exist, true otherwise + */ + public function jump_to_restart_point($name) + { + if (!isset($this->progress_data['_restart_points'][$name]) || empty($this->progress_data['_restart_points'][$name])) + { + return false; + } + + foreach ($this->progress_data['_restart_points'][$name] as $key => $value) + { + $this->progress_data[$key] = $value; + } + + return true; + } + + /** + * Returns whether a restart point with a given name exists or not + * + * @param string $name Name of the restart point + * + * @return bool + */ + public function has_restart_point($name) + { + return isset($this->progress_data['_restart_points'][$name]); + } + + /** * Dumps install configuration to disk */ public function save_config() |