diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-03-30 10:55:41 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-04-26 16:52:52 +0200 |
commit | 069477e608566c6ea9edbe259b46c591a82bd8af (patch) | |
tree | df1d338e1d61d1c1b2151e1843dfaff7585818d1 /lib/private/Share | |
parent | 0654b245280a904068079b71c5339561537fdf78 (diff) | |
download | nextcloud-server-069477e608566c6ea9edbe259b46c591a82bd8af.tar.gz nextcloud-server-069477e608566c6ea9edbe259b46c591a82bd8af.zip |
Migrate more classes of lib/private to LoggerInterface
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Share')
-rw-r--r-- | lib/private/Share/Share.php | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 47b09982f3a..9018f35ac2a 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -35,8 +35,8 @@ namespace OC\Share; use OCP\DB\QueryBuilder\IQueryBuilder; -use OCP\ILogger; use OCP\Share\IShare; +use Psr\Log\LoggerInterface; /** * This class provides the ability for apps to share their content between users. @@ -80,10 +80,10 @@ class Share extends Constants { ]; return true; } - \OCP\Util::writeLog('OCP\Share', + \OC::$server->get(LoggerInterface::class)->warning( 'Sharing backend '.$class.' not registered, '.self::$backendTypes[$itemType]['class'] .' is already registered for '.$itemType, - ILogger::WARN); + ['app' => 'OCP\Share']); } return false; } @@ -256,6 +256,7 @@ class Share extends Constants { */ public static function getBackend($itemType) { $l = \OC::$server->getL10N('lib'); + $logger = \OC::$server->get(LoggerInterface::class); if (isset(self::$backends[$itemType])) { return self::$backends[$itemType]; } elseif (isset(self::$backendTypes[$itemType]['class'])) { @@ -265,20 +266,20 @@ class Share extends Constants { if (!(self::$backends[$itemType] instanceof \OCP\Share_Backend)) { $message = 'Sharing backend %s must implement the interface OCP\Share_Backend'; $message_t = $l->t('Sharing backend %s must implement the interface OCP\Share_Backend', [$class]); - \OCP\Util::writeLog('OCP\Share', sprintf($message, $class), ILogger::ERROR); + $logger->error(sprintf($message, $class), ['app' => 'OCP\Share']); throw new \Exception($message_t); } return self::$backends[$itemType]; } else { $message = 'Sharing backend %s not found'; $message_t = $l->t('Sharing backend %s not found', [$class]); - \OCP\Util::writeLog('OCP\Share', sprintf($message, $class), ILogger::ERROR); + $logger->error(sprintf($message, $class), ['app' => 'OCP\Share']); throw new \Exception($message_t); } } $message = 'Sharing backend for %s not found'; $message_t = $l->t('Sharing backend for %s not found', [$itemType]); - \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemType), ILogger::ERROR); + $logger->error(sprintf($message, $itemType), ['app' => 'OCP\Share']); throw new \Exception($message_t); } @@ -482,9 +483,9 @@ class Share extends Constants { $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$where, $queryLimit); $result = $query->execute($queryArgs); if ($result === false) { - \OCP\Util::writeLog('OCP\Share', + \OC::$server->get(LoggerInterface::class)->error( \OC_DB::getErrorMessage() . ', select=' . $select . ' where=', - ILogger::ERROR); + ['app' => 'OCP\Share']); } $items = []; $targets = []; @@ -552,9 +553,10 @@ class Share extends Constants { $parentResult->closeCursor(); if ($parentRow === false) { - \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' . + \OC::$server->get(LoggerInterface::class)->error( + 'Can\'t select parent: ' . \OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where, - ILogger::ERROR); + ['app' => 'OCP\Share']); } else { $tmpPath = $parentRow['file_target']; // find the right position where the row path continues from the target path |