replaced duplicate code with method

This commit is contained in:
Philipp Holzer 2019-03-09 20:41:27 +01:00
parent 7047a13ffa
commit 20498d1d40
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5

View file

@ -24,19 +24,15 @@ class Update
return; return;
} }
$build = Config::get('system', 'build'); $build = self::getBuild();
$current = intval(DB_UPDATE_VERSION);
if (empty($build)) {
Config::set('system', 'build', DB_UPDATE_VERSION - 1);
$build = DB_UPDATE_VERSION - 1;
}
// We don't support upgrading from very old versions anymore // We don't support upgrading from very old versions anymore
if ($build < NEW_UPDATE_ROUTINE_VERSION) { if ($build < NEW_UPDATE_ROUTINE_VERSION) {
die('You try to update from a version prior to database version 1170. The direct upgrade path is not supported. Please update to version 3.5.4 before updating to this version.'); die('You try to update from a version prior to database version 1170. The direct upgrade path is not supported. Please update to version 3.5.4 before updating to this version.');
} }
if ($build < DB_UPDATE_VERSION) { if ($build < $current ) {
if ($via_worker) { if ($via_worker) {
// Calling the database update directly via the worker enables us to perform database changes to the workerqueue table itself. // Calling the database update directly via the worker enables us to perform database changes to the workerqueue table itself.
// This is a fallback, since normally the database update will be performed by a worker job. // This is a fallback, since normally the database update will be performed by a worker job.