Added and improved logging for the update process
This commit is contained in:
parent
a5be6f9276
commit
31638d4742
1 changed files with 8 additions and 2 deletions
|
@ -111,7 +111,7 @@ class Update
|
||||||
if ($stored < $current || $force) {
|
if ($stored < $current || $force) {
|
||||||
DI::config()->load('database');
|
DI::config()->load('database');
|
||||||
|
|
||||||
Logger::info('Update starting.', ['from' => $stored, 'to' => $current]);
|
Logger::notice('Update starting.', ['from' => $stored, 'to' => $current]);
|
||||||
|
|
||||||
// Compare the current structure with the defined structure
|
// Compare the current structure with the defined structure
|
||||||
// If the Lock is acquired, never release it automatically to avoid double updates
|
// If the Lock is acquired, never release it automatically to avoid double updates
|
||||||
|
@ -120,7 +120,7 @@ class Update
|
||||||
// Checks if the build changed during Lock acquiring (so no double update occurs)
|
// Checks if the build changed during Lock acquiring (so no double update occurs)
|
||||||
$retryBuild = DI::config()->get('system', 'build', null, true);
|
$retryBuild = DI::config()->get('system', 'build', null, true);
|
||||||
if ($retryBuild !== $build) {
|
if ($retryBuild !== $build) {
|
||||||
Logger::info('Update already done.', ['from' => $stored, 'to' => $current]);
|
Logger::notice('Update already done.', ['from' => $stored, 'to' => $current]);
|
||||||
DI::lock()->release('dbupdate');
|
DI::lock()->release('dbupdate');
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,7 @@ class Update
|
||||||
for ($x = $stored + 1; $x <= $current; $x++) {
|
for ($x = $stored + 1; $x <= $current; $x++) {
|
||||||
$r = self::runUpdateFunction($x, 'pre_update', $sendMail);
|
$r = self::runUpdateFunction($x, 'pre_update', $sendMail);
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
|
Logger::warning('Pre update failed', ['version' => $x]);
|
||||||
DI::config()->set('system', 'update', Update::FAILED);
|
DI::config()->set('system', 'update', Update::FAILED);
|
||||||
DI::lock()->release('dbupdate');
|
DI::lock()->release('dbupdate');
|
||||||
return $r;
|
return $r;
|
||||||
|
@ -158,6 +159,7 @@ class Update
|
||||||
for ($x = $stored + 1; $x <= $current; $x++) {
|
for ($x = $stored + 1; $x <= $current; $x++) {
|
||||||
$r = self::runUpdateFunction($x, 'update', $sendMail);
|
$r = self::runUpdateFunction($x, 'update', $sendMail);
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
|
Logger::warning('Post update failed', ['version' => $x]);
|
||||||
DI::config()->set('system', 'update', Update::FAILED);
|
DI::config()->set('system', 'update', Update::FAILED);
|
||||||
DI::lock()->release('dbupdate');
|
DI::lock()->release('dbupdate');
|
||||||
return $r;
|
return $r;
|
||||||
|
@ -205,7 +207,9 @@ class Update
|
||||||
if (DI::lock()->acquire('dbupdate_function', 120, Cache\Duration::INFINITE)) {
|
if (DI::lock()->acquire('dbupdate_function', 120, Cache\Duration::INFINITE)) {
|
||||||
|
|
||||||
// call the specific update
|
// call the specific update
|
||||||
|
Logger::info('Pre update function start.', ['function' => $funcname]);
|
||||||
$retval = $funcname();
|
$retval = $funcname();
|
||||||
|
Logger::info('Update function done.', ['function' => $funcname]);
|
||||||
|
|
||||||
if ($retval) {
|
if ($retval) {
|
||||||
if ($sendMail) {
|
if ($sendMail) {
|
||||||
|
@ -230,6 +234,8 @@ class Update
|
||||||
Logger::info('Update function finished.', ['function' => $funcname]);
|
Logger::info('Update function finished.', ['function' => $funcname]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Logger::error('Locking failed.', ['function' => $funcname]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logger::info('Update function skipped.', ['function' => $funcname]);
|
Logger::info('Update function skipped.', ['function' => $funcname]);
|
||||||
|
|
Loading…
Reference in a new issue