mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-09 18:26:32 +02:00
[ticket/15851] Automatic update downloader
PHPBB3-15851
This commit is contained in:
committed by
Marc Alexander
parent
84ec3dc6c3
commit
d2c402f038
@@ -38,12 +38,32 @@ class acp_update
|
||||
try
|
||||
{
|
||||
$recheck = $request->variable('versioncheck_force', false);
|
||||
$do_update = $request->variable('do_update', false);
|
||||
|
||||
$updates_available = $version_helper->get_update_on_branch($recheck);
|
||||
$upgrades_available = $version_helper->get_suggested_updates();
|
||||
$branch = '';
|
||||
if (!empty($upgrades_available))
|
||||
{
|
||||
$branch = array_key_last($upgrades_available);
|
||||
$upgrades_available = array_pop($upgrades_available);
|
||||
}
|
||||
|
||||
if ($do_update && !empty($updates_available))
|
||||
{
|
||||
$updater = $phpbb_container->get('updater.controller');
|
||||
$current_version = $config['version'];
|
||||
$new_version = $upgrades_available['current'];
|
||||
$download_url = 'https://download.phpbb.com/pub/release/';
|
||||
$download_url .= $branch . '/' . $new_version . '/';
|
||||
$download_url .= 'phpBB-' . $current_version . '_to_' . $new_version . '.zip';
|
||||
$data = $updater->handle(
|
||||
$download_url
|
||||
);
|
||||
|
||||
$response = new \phpbb\json_response();
|
||||
$response->send($data);
|
||||
}
|
||||
}
|
||||
catch (\RuntimeException $e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user