mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Replace ILogger with LoggerInterface in remote share manager
Signed-off-by: Vincent Petry <vincent@nextcloud.com> Co-authored-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
parent
2e76d98e13
commit
33b01187cd
5 changed files with 19 additions and 16 deletions
|
|
@ -60,6 +60,7 @@ use OCP\Share\Exceptions\ShareNotFound;
|
|||
use OCP\Share\IManager;
|
||||
use OCP\Share\IShare;
|
||||
use OCP\Util;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CloudFederationProviderFiles implements ICloudFederationProvider {
|
||||
|
||||
|
|
@ -252,7 +253,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
|
|||
\OC::$server->getUserManager(),
|
||||
$shareWith,
|
||||
\OC::$server->query(IEventDispatcher::class),
|
||||
\OC::$server->getLogger()
|
||||
\OC::$server->get(LoggerInterface::class)
|
||||
);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ use OCP\Share\Events\ShareCreatedEvent;
|
|||
use OCP\Share\IManager;
|
||||
use OCP\Util;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
|
|
@ -99,7 +100,7 @@ class Application extends App {
|
|||
$server->getUserManager(),
|
||||
$uid,
|
||||
$server->query(IEventDispatcher::class),
|
||||
$server->getLogger()
|
||||
$server->get(LoggerInterface::class)
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
20
apps/files_sharing/lib/External/Manager.php
vendored
20
apps/files_sharing/lib/External/Manager.php
vendored
|
|
@ -46,12 +46,12 @@ use OCP\Files\Storage\IStorageFactory;
|
|||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUserManager;
|
||||
use OCP\Notification\IManager;
|
||||
use OCP\OCS\IDiscoveryService;
|
||||
use OCP\Share;
|
||||
use OCP\Share\IShare;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Manager {
|
||||
public const STORAGE = '\OCA\Files_Sharing\External\Storage';
|
||||
|
|
@ -92,7 +92,7 @@ class Manager {
|
|||
/** @var IEventDispatcher */
|
||||
private $eventDispatcher;
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(
|
||||
|
|
@ -108,7 +108,7 @@ class Manager {
|
|||
IUserManager $userManager,
|
||||
?string $uid,
|
||||
IEventDispatcher $eventDispatcher,
|
||||
ILogger $logger
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
$this->connection = $connection;
|
||||
$this->mountManager = $mountManager;
|
||||
|
|
@ -343,7 +343,7 @@ class Manager {
|
|||
$acceptShare->execute([1, $mountPoint, $hash, $subshare['id'], $this->uid]);
|
||||
$result = true;
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->emergency('Could not update share', ['exception' => $e]);
|
||||
$result = false;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -361,7 +361,7 @@ class Manager {
|
|||
$share['share_type']);
|
||||
$result = true;
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->emergency('Could not create share', ['exception' => $e]);
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ class Manager {
|
|||
$this->updateAccepted((int)$subshare['id'], false);
|
||||
$result = true;
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->emergency('Could not update share', ['exception' => $e]);
|
||||
$result = false;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -432,7 +432,7 @@ class Manager {
|
|||
$share['share_type']);
|
||||
$result = true;
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->emergency('Could not create share', ['exception' => $e]);
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -634,7 +634,7 @@ class Manager {
|
|||
|
||||
$this->removeReShares($id);
|
||||
} catch (\Doctrine\DBAL\Exception $ex) {
|
||||
$this->logger->logException($ex);
|
||||
$this->logger->emergency('Could not update share', ['exception' => $ex]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -706,7 +706,7 @@ class Manager {
|
|||
$deleteResult->closeCursor();
|
||||
}
|
||||
} catch (\Doctrine\DBAL\Exception $ex) {
|
||||
$this->logger->logException($ex);
|
||||
$this->logger->emergency('Could not get shares', ['exception' => $ex]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -784,7 +784,7 @@ class Manager {
|
|||
}
|
||||
return array_values($shares);
|
||||
} catch (\Doctrine\DBAL\Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->emergency('Error when retrieving shares', ['exception' => $e]);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ namespace OCA\Files_Sharing;
|
|||
|
||||
use OC\Files\Filesystem;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Hooks {
|
||||
public static function deleteUser($params) {
|
||||
|
|
@ -44,7 +45,7 @@ class Hooks {
|
|||
\OC::$server->getUserManager(),
|
||||
$params['uid'],
|
||||
\OC::$server->query(IEventDispatcher::class),
|
||||
\OC::$server->getLogger()
|
||||
\OC::$server->get(LoggerInterface::class)
|
||||
);
|
||||
|
||||
$manager->removeUserShares($params['uid']);
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ use OCP\Http\Client\IClientService;
|
|||
use OCP\Http\Client\IResponse;
|
||||
use OCP\IGroup;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUserManager;
|
||||
use OCP\Share\IShare;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\Traits\UserTrait;
|
||||
|
||||
/**
|
||||
|
|
@ -113,8 +113,8 @@ class ManagerTest extends TestCase {
|
|||
->method('search')
|
||||
->willReturn([]);
|
||||
|
||||
$logger = $this->createMock(ILogger::class);
|
||||
$logger->expects($this->never())->method('logException');
|
||||
$logger = $this->createMock(LoggerInterface::class);
|
||||
$logger->expects($this->never())->method('emergency');
|
||||
|
||||
$this->manager = $this->getMockBuilder(Manager::class)
|
||||
->setConstructorArgs(
|
||||
|
|
|
|||
Loading…
Reference in a new issue