Decouple extracting core and set build number
There is an unfortunate workflow issue when updating from Build 419 -> Build 420 via the back-end, which seems unavoidable. The first update will fail because there is some logic that occurs after the core zip is extracted, this results in a half 5.1 / half 5.5 version of the app running and it chokes. Refreshing the page and performing the update again fixes it.
This commit is contained in:
parent
3abd61244a
commit
1a365b10b7
|
|
@ -365,11 +365,10 @@ class UpdateManager
|
|||
public function setBuildNumberManually()
|
||||
{
|
||||
$result = $this->requestServerData('ping');
|
||||
|
||||
$build = (int) array_get($result, 'pong', 420);
|
||||
|
||||
Parameter::set([
|
||||
'system::core.build' => $build
|
||||
]);
|
||||
$this->setBuild($build);
|
||||
|
||||
return $build;
|
||||
}
|
||||
|
|
@ -448,17 +447,28 @@ class UpdateManager
|
|||
throw new ApplicationException(Lang::get('system::lang.zip.extract_failed', ['file' => $filePath]));
|
||||
}
|
||||
|
||||
// Database may fall asleep after this long process
|
||||
Db::reconnect();
|
||||
|
||||
Parameter::set([
|
||||
'system::core.hash' => $hash,
|
||||
'system::core.build' => $build
|
||||
]);
|
||||
|
||||
@unlink($filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the build number and hash
|
||||
* @param string $hash
|
||||
* @param string $build
|
||||
* @return void
|
||||
*/
|
||||
public function setBuild($build, $hash = null)
|
||||
{
|
||||
$params = [
|
||||
'system::core.build' => $build
|
||||
];
|
||||
|
||||
if ($hash) {
|
||||
$params['system::core.hash'] = $hash;
|
||||
}
|
||||
|
||||
Parameter::set($params);
|
||||
}
|
||||
|
||||
//
|
||||
// Plugins
|
||||
//
|
||||
|
|
|
|||
|
|
@ -276,6 +276,10 @@ class Updates extends Controller
|
|||
$manager->extractCore(post('hash'), post('build'));
|
||||
break;
|
||||
|
||||
case 'setBuild':
|
||||
$manager->setBuild(post('build'), post('hash'));
|
||||
break;
|
||||
|
||||
case 'downloadPlugin':
|
||||
$manager->downloadPlugin(post('name'), post('hash'));
|
||||
break;
|
||||
|
|
@ -603,6 +607,13 @@ class Updates extends Controller
|
|||
'hash' => $coreHash,
|
||||
'build' => $coreBuild
|
||||
];
|
||||
|
||||
$updateSteps[] = [
|
||||
'code' => 'setBuild',
|
||||
'label' => Lang::get('system::lang.updates.core_set_build'),
|
||||
'hash' => $coreHash,
|
||||
'build' => $coreBuild
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($themes as $name => $hash) {
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ return [
|
|||
'core_build_help' => 'Latest build is available.',
|
||||
'core_downloading' => 'Downloading application files',
|
||||
'core_extracting' => 'Unpacking application files',
|
||||
'core_set_build' => 'Setting build number',
|
||||
'plugins' => 'Plugins',
|
||||
'themes' => 'Themes',
|
||||
'disabled' => 'Disabled',
|
||||
|
|
|
|||
Loading…
Reference in New Issue