Skip to content
Prev Previous commit
Next Next commit
refactor(OC_App): Remove ILogger usage
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Sep 18, 2024
commit 69abd8851b943e646f03ce654b1dae324381fdf0
28 changes: 15 additions & 13 deletions lib/private/legacy/OC_App.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public static function getCurrentApp(): string {
* @deprecated 20.0.0 Please register your alternative login option using the registerAlternativeLogin() on the RegistrationContext in your Application class implementing the OCP\Authentication\IAlternativeLogin interface
*/
public static function registerLogIn(array $entry) {
\OC::$server->getLogger()->debug('OC_App::registerLogIn() is deprecated, please register your alternative login option using the registerAlternativeLogin() on the RegistrationContext in your Application class implementing the OCP\Authentication\IAlternativeLogin interface');
\OCP\Server::get(LoggerInterface::class)->debug('OC_App::registerLogIn() is deprecated, please register your alternative login option using the registerAlternativeLogin() on the RegistrationContext in your Application class implementing the OCP\Authentication\IAlternativeLogin interface');
self::$altLogin[] = $entry;
}

Expand All @@ -401,7 +401,7 @@ public static function getAlternativeLogIns(): array {

foreach ($bootstrapCoordinator->getRegistrationContext()->getAlternativeLogins() as $registration) {
if (!in_array(IAlternativeLogin::class, class_implements($registration->getService()), true)) {
\OC::$server->getLogger()->error('Alternative login option {option} does not implement {interface} and is therefore ignored.', [
\OCP\Server::get(LoggerInterface::class)->error('Alternative login option {option} does not implement {interface} and is therefore ignored.', [
'option' => $registration->getService(),
'interface' => IAlternativeLogin::class,
'app' => $registration->getAppId(),
Expand All @@ -413,11 +413,12 @@ public static function getAlternativeLogIns(): array {
/** @var IAlternativeLogin $provider */
$provider = \OCP\Server::get($registration->getService());
} catch (ContainerExceptionInterface $e) {
\OC::$server->getLogger()->logException($e, [
'message' => 'Alternative login option {option} can not be initialised.',
'option' => $registration->getService(),
'app' => $registration->getAppId(),
]);
\OCP\Server::get(LoggerInterface::class)->error('Alternative login option {option} can not be initialized.',
[
'exception' => $e,
'option' => $registration->getService(),
'app' => $registration->getAppId(),
]);
}

try {
Expand All @@ -429,11 +430,12 @@ public static function getAlternativeLogIns(): array {
'class' => $provider->getClass(),
];
} catch (Throwable $e) {
\OC::$server->getLogger()->logException($e, [
'message' => 'Alternative login option {option} had an error while loading.',
'option' => $registration->getService(),
'app' => $registration->getAppId(),
]);
\OCP\Server::get(LoggerInterface::class)->error('Alternative login option {option} had an error while loading.',
[
'exception' => $e,
'option' => $registration->getService(),
'app' => $registration->getAppId(),
]);
}
}

Expand Down Expand Up @@ -667,7 +669,7 @@ public static function updateApp(string $appId): bool {
}

if (is_file($appPath . '/appinfo/database.xml')) {
\OC::$server->getLogger()->error('The appinfo/database.xml file is not longer supported. Used in ' . $appId);
\OCP\Server::get(LoggerInterface::class)->error('The appinfo/database.xml file is not longer supported. Used in ' . $appId);
return false;
}

Expand Down