2828use OCP \Files \Mount \IMountPoint ;
2929use OCP \Files \NotFoundException ;
3030use OCP \Files \ReservedWordException ;
31- use OCP \IL10N ;
3231use OCP \IUser ;
3332use OCP \IUserManager ;
3433use OCP \L10N \IFactory ;
@@ -62,7 +61,6 @@ class View {
6261 private bool $ updaterEnabled = true ;
6362 private UserManager $ userManager ;
6463 private LoggerInterface $ logger ;
65- private IL10N $ l10n ;
6664
6765 /**
6866 * @throws \Exception If $root contains an invalid path
@@ -77,7 +75,6 @@ public function __construct(string $root = '') {
7775 $ this ->lockingEnabled = !($ this ->lockingProvider instanceof \OC \Lock \NoopLockingProvider);
7876 $ this ->userManager = \OC ::$ server ->getUserManager ();
7977 $ this ->logger = \OC ::$ server ->get (LoggerInterface::class);
80- $ this ->l10n = \OC ::$ server ->get (IFactory::class)->get ('files ' );
8178 }
8279
8380 /**
@@ -867,6 +864,7 @@ private function validateMountMove(array $mounts, IMountPoint $sourceMount, IMou
867864 $ targetPath = $ targetMount ->getMountPoint ();
868865 }
869866
867+ $ l = \OC ::$ server ->get (IFactory::class)->get ('files ' );
870868 foreach ($ mounts as $ mount ) {
871869 $ sourcePath = $ this ->getRelativePath ($ mount ->getMountPoint ());
872870 if ($ sourcePath ) {
@@ -876,29 +874,29 @@ private function validateMountMove(array $mounts, IMountPoint $sourceMount, IMou
876874 }
877875
878876 if (!$ mount instanceof MoveableMount) {
879- throw new ForbiddenException ($ this -> l10n ->t ('Storage %s cannot be moved ' , [$ sourcePath ]), false );
877+ throw new ForbiddenException ($ l ->t ('Storage %s cannot be moved ' , [$ sourcePath ]), false );
880878 }
881879
882880 if ($ targetIsShared ) {
883881 if ($ sourceMount instanceof SharedMount) {
884- throw new ForbiddenException ($ this -> l10n ->t ('Moving a share (%s) into a shared folder is not allowed ' , [$ sourcePath ]), false );
882+ throw new ForbiddenException ($ l ->t ('Moving a share (%s) into a shared folder is not allowed ' , [$ sourcePath ]), false );
885883 } else {
886- throw new ForbiddenException ($ this -> l10n ->t ('Moving a storage (%s) into a shared folder is not allowed ' , [$ sourcePath ]), false );
884+ throw new ForbiddenException ($ l ->t ('Moving a storage (%s) into a shared folder is not allowed ' , [$ sourcePath ]), false );
887885 }
888886 }
889887
890888 if ($ sourceMount !== $ targetMount ) {
891889 if ($ sourceMount instanceof SharedMount) {
892890 if ($ targetMount instanceof SharedMount) {
893- throw new ForbiddenException ($ this -> l10n ->t ('Moving a share (%s) into another share (%s) is not allowed ' , [$ sourcePath , $ targetPath ]), false );
891+ throw new ForbiddenException ($ l ->t ('Moving a share (%s) into another share (%s) is not allowed ' , [$ sourcePath , $ targetPath ]), false );
894892 } else {
895- throw new ForbiddenException ($ this -> l10n ->t ('Moving a share (%s) into another storage (%s) is not allowed ' , [$ sourcePath , $ targetPath ]), false );
893+ throw new ForbiddenException ($ l ->t ('Moving a share (%s) into another storage (%s) is not allowed ' , [$ sourcePath , $ targetPath ]), false );
896894 }
897895 } else {
898896 if ($ targetMount instanceof SharedMount) {
899- throw new ForbiddenException ($ this -> l10n ->t ('Moving a storage (%s) into a share (%s) is not allowed ' , [$ sourcePath , $ targetPath ]), false );
897+ throw new ForbiddenException ($ l ->t ('Moving a storage (%s) into a share (%s) is not allowed ' , [$ sourcePath , $ targetPath ]), false );
900898 } else {
901- throw new ForbiddenException ($ this -> l10n ->t ('Moving a storage (%s) into another storage (%s) is not allowed ' , [$ sourcePath , $ targetPath ]), false );
899+ throw new ForbiddenException ($ l ->t ('Moving a storage (%s) into another storage (%s) is not allowed ' , [$ sourcePath , $ targetPath ]), false );
902900 }
903901 }
904902 }
0 commit comments