From 701b57b81d698a4933d9d04aa1aff85734816dfa Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 14 Jul 2021 14:48:23 +0200 Subject: Remove allmost all deprecation from the files_version app The remaining deprecations are related to Utils::hooks and I will take a look at how EventDispatcher works before working on them. Aside from the deprecations, this patch also does a few minor improvements around type hinting. Signed-off-by: Carl Schwan --- apps/files_versions/lib/Command/Expire.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'apps/files_versions/lib/Command') diff --git a/apps/files_versions/lib/Command/Expire.php b/apps/files_versions/lib/Command/Expire.php index 395ed603813..62b2343a5e0 100644 --- a/apps/files_versions/lib/Command/Expire.php +++ b/apps/files_versions/lib/Command/Expire.php @@ -27,7 +27,8 @@ use OC\Command\FileAccess; use OCA\Files_Versions\Storage; use OCP\Command\ICommand; use OCP\Files\StorageNotAvailableException; -use OCP\ILogger; +use OCP\IUserManager; +use Psr\Log\LoggerInterface; class Expire implements ICommand { use FileAccess; @@ -42,18 +43,14 @@ class Expire implements ICommand { */ private $user; - /** - * @param string $user - * @param string $fileName - */ - public function __construct($user, $fileName) { + public function __construct(string $user, string $fileName) { $this->user = $user; $this->fileName = $fileName; } - public function handle() { - $userManager = \OC::$server->getUserManager(); + /** @var IUserManager $userManager */ + $userManager = \OC::$server->get(IUserManager::class); if (!$userManager->userExists($this->user)) { // User has been deleted already return; @@ -65,11 +62,10 @@ class Expire implements ICommand { // In case of external storage and session credentials, the expiration // fails because the command does not have those credentials - /** @var ILogger $logger */ - $logger = \OC::$server->get(ILogger::class); - - $logger->logException($e, [ - 'level' => ILogger::WARN, + /** @var LoggerInterface */ + $logger = \OC::$server->get(LoggerInterface::class); + $logger->warning($e->getMessage(), [ + 'exception' => $e, 'uid' => $this->user, 'fileName' => $this->fileName, ]); -- cgit v1.2.3