From a0aa67a81ff614fd1b2665b3f3d02b72f93b471d Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Wed, 4 Dec 2024 16:23:15 +0100 Subject: [PATCH] fix[installer]: Remove migration lockfile if existent from a previous attempt to avoid unnecessary delay --- install/includes/core/database_class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/install/includes/core/database_class.php b/install/includes/core/database_class.php index 23d835c79..5795b19cc 100644 --- a/install/includes/core/database_class.php +++ b/install/includes/core/database_class.php @@ -81,7 +81,6 @@ class Database { throw new Exception(__("Unable to create database: ") . $link->error); } - // Wählen Sie die Datenbank aus if (!$link->select_db($data['db_name'])) { throw new Exception(__("Unable to select database: ") . $link->error); } @@ -101,10 +100,19 @@ class Database { } $mysql_version = $version_query['version']; - + // in case of a previous failed installation it can happen that still the migration lockfile is existent + // this would prevent the migration from running or at least would cause a unnecessary delay + // so we delete it here + $lockfile = sys_get_temp_dir() . '/.migration_running'; + if (file_exists($lockfile)) { + log_message('info', 'Removing migration lockfile. Not expected to be present at this point.'); + unlink($lockfile); + } + $link->close(); return $mysql_version; + } catch (Exception $e) { log_message('error', 'Database Check Error: ' . $e->getMessage()); return 'Error: ' . $e->getMessage();