From c0ce272e9c3a94ff98081c4f90a31ca611d28323 Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Thu, 8 Feb 2024 15:47:39 +0100 Subject: chore: Migrate away from OC::$server->getLogger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/user_ldap/lib/Configuration.php | 4 +++- apps/user_ldap/lib/GroupPluginManager.php | 3 ++- apps/user_ldap/lib/Mapping/AbstractMapping.php | 3 ++- apps/user_ldap/lib/UserPluginManager.php | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) (limited to 'apps/user_ldap/lib') diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php index b009ba3f480..2791324be5b 100644 --- a/apps/user_ldap/lib/Configuration.php +++ b/apps/user_ldap/lib/Configuration.php @@ -35,6 +35,8 @@ */ namespace OCA\User_LDAP; +use Psr\Log\LoggerInterface; + /** * @property int ldapPagingSize holds an integer * @property string ldapUserAvatarRule @@ -598,7 +600,7 @@ class Configuration { return [strtolower($attribute)]; } if ($value !== self::AVATAR_PREFIX_DEFAULT) { - \OC::$server->getLogger()->warning('Invalid config value to ldapUserAvatarRule; falling back to default.'); + \OCP\Server::get(LoggerInterface::class)->warning('Invalid config value to ldapUserAvatarRule; falling back to default.'); } return $defaultAttributes; } diff --git a/apps/user_ldap/lib/GroupPluginManager.php b/apps/user_ldap/lib/GroupPluginManager.php index d99e17d7673..92bf0cb8888 100644 --- a/apps/user_ldap/lib/GroupPluginManager.php +++ b/apps/user_ldap/lib/GroupPluginManager.php @@ -24,6 +24,7 @@ namespace OCA\User_LDAP; use OCP\GroupInterface; +use Psr\Log\LoggerInterface; class GroupPluginManager { private int $respondToActions = 0; @@ -58,7 +59,7 @@ class GroupPluginManager { foreach ($this->which as $action => $v) { if ((bool)($respondToActions & $action)) { $this->which[$action] = $plugin; - \OC::$server->getLogger()->debug("Registered action ".$action." to plugin ".get_class($plugin), ['app' => 'user_ldap']); + \OCP\Server::get(LoggerInterface::class)->debug("Registered action ".$action." to plugin ".get_class($plugin), ['app' => 'user_ldap']); } } } diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index 3f05091a537..40bc8624c3c 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -30,6 +30,7 @@ use Doctrine\DBAL\Exception; use Doctrine\DBAL\Platforms\SqlitePlatform; use OCP\DB\IPreparedStatement; use OCP\DB\QueryBuilder\IQueryBuilder; +use Psr\Log\LoggerInterface; /** * Class AbstractMapping @@ -351,7 +352,7 @@ abstract class AbstractMapping { */ public function map($fdn, $name, $uuid) { if (mb_strlen($fdn) > 4000) { - \OC::$server->getLogger()->error( + \OCP\Server::get(LoggerInterface::class)->error( 'Cannot map, because the DN exceeds 4000 characters: {dn}', [ 'app' => 'user_ldap', diff --git a/apps/user_ldap/lib/UserPluginManager.php b/apps/user_ldap/lib/UserPluginManager.php index 516338f006b..527c6684103 100644 --- a/apps/user_ldap/lib/UserPluginManager.php +++ b/apps/user_ldap/lib/UserPluginManager.php @@ -26,6 +26,7 @@ namespace OCA\User_LDAP; use OC\User\Backend; +use Psr\Log\LoggerInterface; class UserPluginManager { private int $respondToActions = 0; @@ -62,12 +63,12 @@ class UserPluginManager { foreach ($this->which as $action => $v) { if (is_int($action) && (bool)($respondToActions & $action)) { $this->which[$action] = $plugin; - \OC::$server->getLogger()->debug("Registered action ".$action." to plugin ".get_class($plugin), ['app' => 'user_ldap']); + \OCP\Server::get(LoggerInterface::class)->debug("Registered action ".$action." to plugin ".get_class($plugin), ['app' => 'user_ldap']); } } if (method_exists($plugin, 'deleteUser')) { $this->which['deleteUser'] = $plugin; - \OC::$server->getLogger()->debug("Registered action deleteUser to plugin ".get_class($plugin), ['app' => 'user_ldap']); + \OCP\Server::get(LoggerInterface::class)->debug("Registered action deleteUser to plugin ".get_class($plugin), ['app' => 'user_ldap']); } } -- cgit v1.2.3