mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-19 15:01:33 +02:00
[ticket/14039] Revamp updater
PHPBB3-14039
This commit is contained in:
@@ -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';
|
||||
@@ -239,6 +241,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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user