diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 5a380b89e5cc4..8b3de59eeb0e0 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -67,7 +67,6 @@ use OCP\Files\Mount\IMountPoint; use OCP\Files\NotFoundException; use OCP\Files\ReservedWordException; -use OCP\IL10N; use OCP\IUser; use OCP\L10N\IFactory; use OCP\Lock\ILockingProvider; @@ -100,7 +99,6 @@ class View { private bool $updaterEnabled = true; private UserManager $userManager; private LoggerInterface $logger; - private IL10N $l10n; /** * @throws \Exception If $root contains an invalid path @@ -115,7 +113,6 @@ public function __construct(string $root = '') { $this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider); $this->userManager = \OC::$server->getUserManager(); $this->logger = \OC::$server->get(LoggerInterface::class); - $this->l10n = \OC::$server->get(IFactory::class)->get('files'); } /** @@ -901,6 +898,7 @@ private function validateMountMove(array $mounts, IMountPoint $sourceMount, IMou $targetPath = $targetMount->getMountPoint(); } + $l = \OC::$server->get(IFactory::class)->get('files'); foreach ($mounts as $mount) { $sourcePath = $this->getRelativePath($mount->getMountPoint()); if ($sourcePath) { @@ -910,29 +908,29 @@ private function validateMountMove(array $mounts, IMountPoint $sourceMount, IMou } if (!$mount instanceof MoveableMount) { - throw new ForbiddenException($this->l10n->t('Storage %s cannot be moved', [$sourcePath]), false); + throw new ForbiddenException($l->t('Storage %s cannot be moved', [$sourcePath]), false); } if ($targetIsShared) { if ($sourceMount instanceof SharedMount) { - throw new ForbiddenException($this->l10n->t('Moving a share (%s) into a shared folder is not allowed', [$sourcePath]), false); + throw new ForbiddenException($l->t('Moving a share (%s) into a shared folder is not allowed', [$sourcePath]), false); } else { - throw new ForbiddenException($this->l10n->t('Moving a storage (%s) into a shared folder is not allowed', [$sourcePath]), false); + throw new ForbiddenException($l->t('Moving a storage (%s) into a shared folder is not allowed', [$sourcePath]), false); } } if ($sourceMount !== $targetMount) { if ($sourceMount instanceof SharedMount) { if ($targetMount instanceof SharedMount) { - throw new ForbiddenException($this->l10n->t('Moving a share (%s) into another share (%s) is not allowed', [$sourcePath, $targetPath]), false); + throw new ForbiddenException($l->t('Moving a share (%s) into another share (%s) is not allowed', [$sourcePath, $targetPath]), false); } else { - throw new ForbiddenException($this->l10n->t('Moving a share (%s) into another storage (%s) is not allowed', [$sourcePath, $targetPath]), false); + throw new ForbiddenException($l->t('Moving a share (%s) into another storage (%s) is not allowed', [$sourcePath, $targetPath]), false); } } else { if ($targetMount instanceof SharedMount) { - throw new ForbiddenException($this->l10n->t('Moving a storage (%s) into a share (%s) is not allowed', [$sourcePath, $targetPath]), false); + throw new ForbiddenException($l->t('Moving a storage (%s) into a share (%s) is not allowed', [$sourcePath, $targetPath]), false); } else { - throw new ForbiddenException($this->l10n->t('Moving a storage (%s) into another storage (%s) is not allowed', [$sourcePath, $targetPath]), false); + throw new ForbiddenException($l->t('Moving a storage (%s) into another storage (%s) is not allowed', [$sourcePath, $targetPath]), false); } } }