mirror of
https://github.com/friendica/friendica
synced 2025-05-08 19:44:10 +02:00
Replace Logger with DI::logger() in Core classes
This commit is contained in:
parent
8c89c37775
commit
e3cf6b9c54
6 changed files with 43 additions and 43 deletions
|
@ -178,7 +178,7 @@ class Update
|
|||
// If the Lock is acquired, never release it automatically to avoid double updates
|
||||
if (DI::lock()->acquire('dbupdate', 0, Cache\Enum\Duration::INFINITE)) {
|
||||
|
||||
Logger::notice('Update starting.', ['from' => $stored, 'to' => $current]);
|
||||
DI::logger()->notice('Update starting.', ['from' => $stored, 'to' => $current]);
|
||||
|
||||
// Checks if the build changed during Lock acquiring (so no double update occurs)
|
||||
$retryBuild = DI::config()->get('system', 'build');
|
||||
|
@ -192,7 +192,7 @@ class Update
|
|||
}
|
||||
|
||||
if ($retryBuild != $build) {
|
||||
Logger::notice('Update already done.', ['from' => $build, 'retry' => $retryBuild, 'to' => $current]);
|
||||
DI::logger()->notice('Update already done.', ['from' => $build, 'retry' => $retryBuild, 'to' => $current]);
|
||||
DI::lock()->release('dbupdate');
|
||||
return '';
|
||||
}
|
||||
|
@ -202,12 +202,12 @@ class Update
|
|||
|
||||
// run the pre_update_nnnn functions in update.php
|
||||
for ($version = $stored + 1; $version <= $current; $version++) {
|
||||
Logger::notice('Execute pre update.', ['version' => $version]);
|
||||
DI::logger()->notice('Execute pre update.', ['version' => $version]);
|
||||
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: executing pre update %d',
|
||||
DateTimeFormat::utcNow() . ' ' . date('e'), $version));
|
||||
$r = self::runUpdateFunction($version, 'pre_update', $sendMail);
|
||||
if (!$r) {
|
||||
Logger::warning('Pre update failed', ['version' => $version]);
|
||||
DI::logger()->warning('Pre update failed', ['version' => $version]);
|
||||
DI::config()->set('system', 'update', Update::FAILED);
|
||||
DI::lock()->release('dbupdate');
|
||||
DI::config()->beginTransaction()
|
||||
|
@ -216,12 +216,12 @@ class Update
|
|||
->commit();
|
||||
return $r;
|
||||
} else {
|
||||
Logger::notice('Pre update executed.', ['version' => $version]);
|
||||
DI::logger()->notice('Pre update executed.', ['version' => $version]);
|
||||
}
|
||||
}
|
||||
|
||||
// update the structure in one call
|
||||
Logger::notice('Execute structure update');
|
||||
DI::logger()->notice('Execute structure update');
|
||||
$retval = DBStructure::performUpdate(false, $verbose);
|
||||
if (!empty($retval)) {
|
||||
if ($sendMail) {
|
||||
|
@ -230,7 +230,7 @@ class Update
|
|||
$retval
|
||||
);
|
||||
}
|
||||
Logger::error('Update ERROR.', ['from' => $stored, 'to' => $current, 'retval' => $retval]);
|
||||
DI::logger()->error('Update ERROR.', ['from' => $stored, 'to' => $current, 'retval' => $retval]);
|
||||
DI::config()->set('system', 'update', Update::FAILED);
|
||||
DI::lock()->release('dbupdate');
|
||||
DI::config()->beginTransaction()
|
||||
|
@ -239,17 +239,17 @@ class Update
|
|||
->commit();
|
||||
return $retval;
|
||||
} else {
|
||||
Logger::notice('Database structure update finished.', ['from' => $stored, 'to' => $current]);
|
||||
DI::logger()->notice('Database structure update finished.', ['from' => $stored, 'to' => $current]);
|
||||
}
|
||||
|
||||
// run the update_nnnn functions in update.php
|
||||
for ($version = $stored + 1; $version <= $current; $version++) {
|
||||
Logger::notice('Execute post update.', ['version' => $version]);
|
||||
DI::logger()->notice('Execute post update.', ['version' => $version]);
|
||||
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: executing post update %d',
|
||||
DateTimeFormat::utcNow() . ' ' . date('e'), $version));
|
||||
$r = self::runUpdateFunction($version, 'update', $sendMail);
|
||||
if (!$r) {
|
||||
Logger::warning('Post update failed', ['version' => $version]);
|
||||
DI::logger()->warning('Post update failed', ['version' => $version]);
|
||||
DI::config()->set('system', 'update', Update::FAILED);
|
||||
DI::lock()->release('dbupdate');
|
||||
DI::config()->beginTransaction()
|
||||
|
@ -259,7 +259,7 @@ class Update
|
|||
return $r;
|
||||
} else {
|
||||
DI::config()->set('system', 'build', $version);
|
||||
Logger::notice('Post update executed.', ['version' => $version]);
|
||||
DI::logger()->notice('Post update executed.', ['version' => $version]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -271,12 +271,12 @@ class Update
|
|||
->delete('system', 'maintenance_reason')
|
||||
->commit();
|
||||
|
||||
Logger::notice('Update success.', ['from' => $stored, 'to' => $current]);
|
||||
DI::logger()->notice('Update success.', ['from' => $stored, 'to' => $current]);
|
||||
if ($sendMail) {
|
||||
self::updateSuccessful($stored, $current);
|
||||
}
|
||||
} else {
|
||||
Logger::warning('Update lock could not be acquired');
|
||||
DI::logger()->warning('Update lock could not be acquired');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ class Update
|
|||
{
|
||||
$funcname = $prefix . '_' . $version;
|
||||
|
||||
Logger::notice('Update function start.', ['function' => $funcname]);
|
||||
DI::logger()->notice('Update function start.', ['function' => $funcname]);
|
||||
|
||||
if (function_exists($funcname)) {
|
||||
// There could be a lot of processes running or about to run.
|
||||
|
@ -310,9 +310,9 @@ class Update
|
|||
if (DI::lock()->acquire('dbupdate_function', 120, Cache\Enum\Duration::INFINITE)) {
|
||||
|
||||
// call the specific update
|
||||
Logger::notice('Pre update function start.', ['function' => $funcname]);
|
||||
DI::logger()->notice('Pre update function start.', ['function' => $funcname]);
|
||||
$retval = $funcname();
|
||||
Logger::notice('Update function done.', ['function' => $funcname]);
|
||||
DI::logger()->notice('Update function done.', ['function' => $funcname]);
|
||||
|
||||
if ($retval) {
|
||||
if ($sendMail) {
|
||||
|
@ -322,20 +322,20 @@ class Update
|
|||
DI::l10n()->t('Update %s failed. See error logs.', $version)
|
||||
);
|
||||
}
|
||||
Logger::error('Update function ERROR.', ['function' => $funcname, 'retval' => $retval]);
|
||||
DI::logger()->error('Update function ERROR.', ['function' => $funcname, 'retval' => $retval]);
|
||||
DI::lock()->release('dbupdate_function');
|
||||
return false;
|
||||
} else {
|
||||
DI::lock()->release('dbupdate_function');
|
||||
Logger::notice('Update function finished.', ['function' => $funcname]);
|
||||
DI::logger()->notice('Update function finished.', ['function' => $funcname]);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
Logger::error('Locking failed.', ['function' => $funcname]);
|
||||
DI::logger()->error('Locking failed.', ['function' => $funcname]);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
Logger::notice('Update function skipped.', ['function' => $funcname]);
|
||||
DI::logger()->notice('Update function skipped.', ['function' => $funcname]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ class Update
|
|||
{
|
||||
$adminEmails = User::getAdminListForEmailing(['uid', 'language', 'email']);
|
||||
if (!$adminEmails) {
|
||||
Logger::warning('Cannot notify administrators .', ['update' => $update_id, 'message' => $error_message]);
|
||||
DI::logger()->warning('Cannot notify administrators .', ['update' => $update_id, 'message' => $error_message]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ class Update
|
|||
DI::emailer()->send($email);
|
||||
}
|
||||
|
||||
Logger::alert('Database structure update failed.', ['error' => $error_message]);
|
||||
DI::logger()->alert('Database structure update failed.', ['error' => $error_message]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -404,6 +404,6 @@ class Update
|
|||
DI::emailer()->send($email);
|
||||
}
|
||||
|
||||
Logger::debug('Database structure update successful.');
|
||||
DI::logger()->debug('Database structure update successful.');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue