瀏覽代碼

Replace ILogger with LoggerInterface in remote share manager

Signed-off-by: Vincent Petry <vincent@nextcloud.com>

Co-authored-by: Carl Schwan <carl@carlschwan.eu>
tags/v23.0.0beta1
Vincent Petry 2 年之前
父節點
當前提交
dac676c14e
No account linked to committer's email address

+ 2
- 1
apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php 查看文件

@@ -59,6 +59,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 {

@@ -251,7 +252,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
\OC::$server->getUserManager(),
$shareWith,
\OC::$server->query(IEventDispatcher::class),
\OC::$server->getLogger()
\OC::$server->get(LoggerInterface::class)
);

try {

+ 2
- 1
apps/files_sharing/lib/AppInfo/Application.php 查看文件

@@ -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)
);
});


+ 10
- 10
apps/files_sharing/lib/External/Manager.php 查看文件

@@ -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 [];
}
}

+ 2
- 1
apps/files_sharing/lib/Hooks.php 查看文件

@@ -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']);

+ 3
- 3
apps/files_sharing/tests/External/ManagerTest.php 查看文件

@@ -44,9 +44,9 @@ use OCP\Http\Client\IResponse;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IURLGenerator;
use OCP\ILogger;
use OCP\IUserManager;
use OCP\Share\IShare;
use Psr\Log\LoggerInterface;
use Test\Traits\UserTrait;

/**
@@ -114,8 +114,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…
取消
儲存