]> source.dussan.org Git - nextcloud-server.git/commitdiff
chore(apps): Apply new rector configuration to autouse classes
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 10 Oct 2024 10:40:31 +0000 (12:40 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 15 Oct 2024 08:40:25 +0000 (10:40 +0200)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
304 files changed:
apps/admin_audit/lib/Actions/Files.php
apps/admin_audit/lib/AppInfo/Application.php
apps/admin_audit/lib/Listener/FileEventListener.php
apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
apps/comments/tests/Unit/Notification/ListenerTest.php
apps/dashboard/lib/Controller/DashboardController.php
apps/dav/appinfo/v1/caldav.php
apps/dav/appinfo/v1/carddav.php
apps/dav/appinfo/v1/publicwebdav.php
apps/dav/appinfo/v1/webdav.php
apps/dav/appinfo/v2/direct.php
apps/dav/appinfo/v2/publicremote.php
apps/dav/appinfo/v2/remote.php
apps/dav/lib/AppInfo/Application.php
apps/dav/lib/BackgroundJob/EventReminderJob.php
apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php
apps/dav/lib/CalDAV/CalDavBackend.php
apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php
apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php
apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
apps/dav/lib/CalDAV/Schedule/Plugin.php
apps/dav/lib/CalDAV/Search/SearchPlugin.php
apps/dav/lib/CardDAV/ContactsManager.php
apps/dav/lib/CardDAV/PhotoCache.php
apps/dav/lib/CardDAV/UserAddressBooks.php
apps/dav/lib/Comments/CommentsPlugin.php
apps/dav/lib/Connector/LegacyPublicAuth.php
apps/dav/lib/Connector/Sabre/Auth.php
apps/dav/lib/Connector/Sabre/BearerAuth.php
apps/dav/lib/Connector/Sabre/Directory.php
apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
apps/dav/lib/Connector/Sabre/File.php
apps/dav/lib/Connector/Sabre/FilesPlugin.php
apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
apps/dav/lib/Connector/Sabre/Node.php
apps/dav/lib/Connector/Sabre/ObjectTree.php
apps/dav/lib/Connector/Sabre/Principal.php
apps/dav/lib/Connector/Sabre/PublicAuth.php
apps/dav/lib/Connector/Sabre/ServerFactory.php
apps/dav/lib/Connector/Sabre/TagsPlugin.php
apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
apps/dav/lib/Files/FileSearchBackend.php
apps/dav/lib/Files/FilesHome.php
apps/dav/lib/RootCollection.php
apps/dav/lib/Server.php
apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php
apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
apps/dav/tests/unit/Command/ListAddressbooksTest.php
apps/dav/tests/unit/Comments/EntityCollectionTest.php
apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
apps/dav/tests/unit/Comments/RootCollectionTest.php
apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php
apps/dav/tests/unit/Connector/Sabre/AuthTest.php
apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php
apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
apps/dav/tests/unit/Connector/Sabre/FileTest.php
apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
apps/dav/tests/unit/Connector/Sabre/NodeTest.php
apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php
apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php
apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
apps/dav/tests/unit/Upload/AssemblyStreamTest.php
apps/dav/tests/unit/Upload/FutureFileTest.php
apps/encryption/lib/Crypto/DecryptAll.php
apps/encryption/lib/Crypto/Encryption.php
apps/encryption/lib/Hooks/UserHooks.php
apps/encryption/lib/Session.php
apps/encryption/tests/Controller/RecoveryControllerTest.php
apps/encryption/tests/Controller/SettingsControllerTest.php
apps/encryption/tests/Controller/StatusControllerTest.php
apps/encryption/tests/Crypto/CryptTest.php
apps/encryption/tests/Crypto/EncryptAllTest.php
apps/encryption/tests/Crypto/EncryptionTest.php
apps/encryption/tests/HookManagerTest.php
apps/encryption/tests/Hooks/UserHooksTest.php
apps/encryption/tests/KeyManagerTest.php
apps/encryption/tests/RecoveryTest.php
apps/encryption/tests/SessionTest.php
apps/encryption/tests/Users/SetupTest.php
apps/encryption/tests/UtilTest.php
apps/federatedfilesharing/lib/AddressHandler.php
apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
apps/federatedfilesharing/lib/FederatedShareProvider.php
apps/federatedfilesharing/lib/Listeners/LoadAdditionalScriptsListener.php
apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php
apps/federatedfilesharing/tests/AddressHandlerTest.php
apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php
apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
apps/federatedfilesharing/tests/FederatedShareProviderTest.php
apps/federatedfilesharing/tests/Settings/AdminTest.php
apps/federatedfilesharing/tests/TestCase.php
apps/federation/lib/DAV/FedAuth.php
apps/federation/tests/Controller/SettingsControllerTest.php
apps/federation/tests/SyncFederationAddressbooksTest.php
apps/federation/tests/TrustedServersTest.php
apps/files/lib/Command/Scan.php
apps/files/lib/Command/ScanAppData.php
apps/files/lib/Controller/ApiController.php
apps/files/lib/Controller/ViewController.php
apps/files/lib/Helper.php
apps/files/lib/Listener/LoadSearchPluginsListener.php
apps/files/lib/Listener/RenderReferenceEventListener.php
apps/files/lib/Service/OwnershipTransferService.php
apps/files/lib/Settings/PersonalSettings.php
apps/files/tests/Command/DeleteOrphanedFilesTest.php
apps/files/tests/Controller/ApiControllerTest.php
apps/files/tests/Controller/ViewControllerTest.php
apps/files/tests/HelperTest.php
apps/files/tests/Service/TagServiceTest.php
apps/files_external/lib/Command/Verify.php
apps/files_external/lib/Config/ConfigAdapter.php
apps/files_external/lib/Controller/ApiController.php
apps/files_external/lib/Controller/StoragesController.php
apps/files_external/lib/Lib/Storage/AmazonS3.php
apps/files_external/lib/Lib/Storage/OwnCloud.php
apps/files_external/lib/Lib/Storage/SFTP.php
apps/files_external/lib/Lib/Storage/StreamWrapper.php
apps/files_external/lib/Lib/Storage/Swift.php
apps/files_external/lib/Lib/StorageConfig.php
apps/files_external/lib/MountConfig.php
apps/files_external/lib/Service/GlobalStoragesService.php
apps/files_external/lib/Service/LegacyStoragesService.php
apps/files_external/lib/Service/StoragesService.php
apps/files_external/lib/Service/UserStoragesService.php
apps/files_external/lib/Settings/Admin.php
apps/files_external/lib/Settings/Personal.php
apps/files_external/tests/Auth/Password/GlobalAuth.php
apps/files_external/tests/Command/CommandTest.php
apps/files_external/tests/Controller/StoragesControllerTest.php
apps/files_external/tests/OwnCloudFunctionsTest.php
apps/files_external/tests/PersonalMountTest.php
apps/files_external/tests/Service/BackendServiceTest.php
apps/files_external/tests/Service/GlobalStoragesServiceTest.php
apps/files_external/tests/Service/StoragesServiceTest.php
apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
apps/files_external/tests/Service/UserStoragesServiceTest.php
apps/files_external/tests/Settings/AdminTest.php
apps/files_sharing/lib/AppInfo/Application.php
apps/files_sharing/lib/Cache.php
apps/files_sharing/lib/Controller/DeletedShareAPIController.php
apps/files_sharing/lib/Controller/RemoteController.php
apps/files_sharing/lib/Controller/ShareAPIController.php
apps/files_sharing/lib/Controller/ShareController.php
apps/files_sharing/lib/Controller/ShareesAPIController.php
apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php
apps/files_sharing/lib/External/Cache.php
apps/files_sharing/lib/External/Manager.php
apps/files_sharing/lib/External/Scanner.php
apps/files_sharing/lib/External/Storage.php
apps/files_sharing/lib/Helper.php
apps/files_sharing/lib/Hooks.php
apps/files_sharing/lib/MountProvider.php
apps/files_sharing/lib/Scanner.php
apps/files_sharing/lib/ShareBackend/File.php
apps/files_sharing/lib/ShareBackend/Folder.php
apps/files_sharing/lib/SharedMount.php
apps/files_sharing/lib/SharedStorage.php
apps/files_sharing/lib/Updater.php
apps/files_sharing/lib/ViewOnly.php
apps/files_sharing/tests/ApiTest.php
apps/files_sharing/tests/CacheTest.php
apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
apps/files_sharing/tests/Controller/ShareControllerTest.php
apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php
apps/files_sharing/tests/EtagPropagationTest.php
apps/files_sharing/tests/ExpireSharesJobTest.php
apps/files_sharing/tests/External/CacheTest.php
apps/files_sharing/tests/External/ManagerTest.php
apps/files_sharing/tests/External/ScannerTest.php
apps/files_sharing/tests/ExternalStorageTest.php
apps/files_sharing/tests/GroupEtagPropagationTest.php
apps/files_sharing/tests/HelperTest.php
apps/files_sharing/tests/LockingTest.php
apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php
apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php
apps/files_sharing/tests/MountProviderTest.php
apps/files_sharing/tests/PropagationTestCase.php
apps/files_sharing/tests/ShareTest.php
apps/files_sharing/tests/SharedMountTest.php
apps/files_sharing/tests/SharedStorageTest.php
apps/files_sharing/tests/SizePropagationTest.php
apps/files_sharing/tests/TestCase.php
apps/files_sharing/tests/UnshareChildrenTest.php
apps/files_sharing/tests/UpdaterTest.php
apps/files_sharing/tests/WatcherTest.php
apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php
apps/files_trashbin/lib/Command/ExpireTrash.php
apps/files_trashbin/lib/Command/RestoreAllFiles.php
apps/files_trashbin/lib/Controller/PreviewController.php
apps/files_trashbin/lib/Helper.php
apps/files_trashbin/lib/Sabre/TrashRoot.php
apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
apps/files_trashbin/lib/Trashbin.php
apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
apps/files_trashbin/tests/Command/CleanUpTest.php
apps/files_trashbin/tests/StorageTest.php
apps/files_trashbin/tests/TrashbinTest.php
apps/files_versions/lib/BackgroundJob/ExpireVersions.php
apps/files_versions/lib/Command/ExpireVersions.php
apps/files_versions/lib/Storage.php
apps/files_versions/lib/Versions/LegacyVersionsBackend.php
apps/files_versions/tests/Command/CleanupTest.php
apps/files_versions/tests/VersioningTest.php
apps/oauth2/tests/Db/AccessTokenMapperTest.php
apps/oauth2/tests/Db/ClientMapperTest.php
apps/provisioning_api/lib/Controller/UsersController.php
apps/provisioning_api/tests/Controller/AppConfigControllerTest.php
apps/provisioning_api/tests/Controller/AppsControllerTest.php
apps/provisioning_api/tests/Controller/GroupsControllerTest.php
apps/provisioning_api/tests/Controller/UsersControllerTest.php
apps/settings/lib/Controller/AppSettingsController.php
apps/settings/lib/Controller/ChangePasswordController.php
apps/settings/lib/Controller/UsersController.php
apps/settings/lib/Settings/Admin/Mail.php
apps/settings/lib/Settings/Admin/Sharing.php
apps/settings/lib/SetupChecks/MemcacheConfigured.php
apps/settings/lib/UserMigration/AccountMigrator.php
apps/settings/tests/Controller/AdminSettingsControllerTest.php
apps/settings/tests/Mailer/NewUserMailHelperTest.php
apps/settings/tests/Middleware/SubadminMiddlewareTest.php
apps/settings/tests/Settings/Admin/MailTest.php
apps/settings/tests/SetupChecks/SupportedDatabaseTest.php
apps/sharebymail/lib/ShareByMailProvider.php
apps/sharebymail/tests/ShareByMailProviderTest.php
apps/systemtags/lib/AppInfo/Application.php
apps/systemtags/lib/Settings/Admin.php
apps/testing/lib/AlternativeHomeUserBackend.php
apps/theming/lib/Controller/ThemingController.php
apps/theming/lib/Controller/UserThemeController.php
apps/theming/lib/Listener/BeforeTemplateRenderedListener.php
apps/theming/lib/Migration/InitBackgroundImagesMigration.php
apps/theming/lib/Migration/Version2006Date20240905111627.php
apps/theming/lib/Service/BackgroundService.php
apps/theming/tests/Controller/ThemingControllerTest.php
apps/theming/tests/ImageManagerTest.php
apps/theming/tests/Themes/DyslexiaFontTest.php
apps/theming/tests/UtilTest.php
apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php
apps/updatenotification/lib/Controller/ChangelogController.php
apps/updatenotification/lib/Listener/BeforeTemplateRenderedEventListener.php
apps/updatenotification/lib/Migration/Version011901Date20240305120000.php
apps/updatenotification/lib/Notification/Notifier.php
apps/user_ldap/ajax/clearMappings.php
apps/user_ldap/ajax/deleteConfiguration.php
apps/user_ldap/ajax/getConfiguration.php
apps/user_ldap/ajax/getNewServerConfigPrefix.php
apps/user_ldap/ajax/setConfiguration.php
apps/user_ldap/ajax/testConfiguration.php
apps/user_ldap/ajax/wizard.php
apps/user_ldap/appinfo/routes.php
apps/user_ldap/lib/Access.php
apps/user_ldap/lib/AppInfo/Application.php
apps/user_ldap/lib/Configuration.php
apps/user_ldap/lib/FilesystemHelper.php
apps/user_ldap/lib/GroupPluginManager.php
apps/user_ldap/lib/Group_Proxy.php
apps/user_ldap/lib/Jobs/CleanUp.php
apps/user_ldap/lib/LDAP.php
apps/user_ldap/lib/Mapping/AbstractMapping.php
apps/user_ldap/lib/Notification/Notifier.php
apps/user_ldap/lib/User/Manager.php
apps/user_ldap/lib/User/OfflineUser.php
apps/user_ldap/lib/User/User.php
apps/user_ldap/lib/UserPluginManager.php
apps/user_ldap/lib/User_LDAP.php
apps/user_ldap/lib/User_Proxy.php
apps/user_ldap/lib/Wizard.php
apps/user_ldap/tests/AccessTest.php
apps/user_ldap/tests/ConnectionTest.php
apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php
apps/user_ldap/tests/LDAPProviderTest.php
apps/user_ldap/tests/Mapping/AbstractMappingTest.php
apps/user_ldap/tests/Mapping/GroupMappingTest.php
apps/user_ldap/tests/Mapping/UserMappingTest.php
apps/user_ldap/tests/User/UserTest.php
apps/user_ldap/tests/User_LDAPTest.php
apps/user_status/lib/Listener/BeforeTemplateRenderedListener.php
apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php
apps/webhook_listeners/lib/Db/WebhookListener.php
apps/webhook_listeners/tests/Db/WebhookListenerMapperTest.php
apps/workflowengine/tests/Check/AbstractStringCheckTest.php
apps/workflowengine/tests/Check/RequestRemoteAddressTest.php
apps/workflowengine/tests/Check/RequestTimeTest.php
apps/workflowengine/tests/Check/RequestUserAgentTest.php

index 73cfd00b382918a23d08c662a15fb81677537853..3993f1a76ee111caab6377d59d3ba31e2e232454 100644 (file)
@@ -17,6 +17,7 @@ use OCP\Files\Events\Node\NodeRenamedEvent;
 use OCP\Files\Events\Node\NodeWrittenEvent;
 use OCP\Files\InvalidPathException;
 use OCP\Files\NotFoundException;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -39,7 +40,7 @@ class Files extends Action {
                                'path' => mb_substr($node->getInternalPath(), 5),
                        ];
                } catch (InvalidPathException|NotFoundException $e) {
-                       \OCP\Server::get(LoggerInterface::class)->error(
+                       Server::get(LoggerInterface::class)->error(
                                'Exception thrown in file read: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
                        );
                        return;
@@ -59,7 +60,7 @@ class Files extends Action {
                        $source = $event->getSource();
                        $this->renamedNodes[$source->getId()] = $source;
                } catch (InvalidPathException|NotFoundException $e) {
-                       \OCP\Server::get(LoggerInterface::class)->error(
+                       Server::get(LoggerInterface::class)->error(
                                'Exception thrown in file rename: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
                        );
                        return;
@@ -79,7 +80,7 @@ class Files extends Action {
                                'newpath' => mb_substr($target->getInternalPath(), 5),
                        ];
                } catch (InvalidPathException|NotFoundException $e) {
-                       \OCP\Server::get(LoggerInterface::class)->error(
+                       Server::get(LoggerInterface::class)->error(
                                'Exception thrown in file rename: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
                        );
                        return;
@@ -103,7 +104,7 @@ class Files extends Action {
                                'path' => mb_substr($event->getNode()->getInternalPath(), 5),
                        ];
                } catch (InvalidPathException|NotFoundException $e) {
-                       \OCP\Server::get(LoggerInterface::class)->error(
+                       Server::get(LoggerInterface::class)->error(
                                'Exception thrown in file create: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
                        );
                        return;
@@ -130,7 +131,7 @@ class Files extends Action {
                                'newpath' => mb_substr($event->getTarget()->getInternalPath(), 5),
                        ];
                } catch (InvalidPathException|NotFoundException $e) {
-                       \OCP\Server::get(LoggerInterface::class)->error(
+                       Server::get(LoggerInterface::class)->error(
                                'Exception thrown in file copy: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
                        );
                        return;
@@ -153,7 +154,7 @@ class Files extends Action {
                                'path' => mb_substr($node->getInternalPath(), 5),
                        ];
                } catch (InvalidPathException|NotFoundException $e) {
-                       \OCP\Server::get(LoggerInterface::class)->error(
+                       Server::get(LoggerInterface::class)->error(
                                'Exception thrown in file write: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
                        );
                        return;
@@ -179,7 +180,7 @@ class Files extends Action {
                                'path' => mb_substr($event->getNode()->getInternalPath(), 5),
                        ];
                } catch (InvalidPathException|NotFoundException $e) {
-                       \OCP\Server::get(LoggerInterface::class)->error(
+                       Server::get(LoggerInterface::class)->error(
                                'Exception thrown in file delete: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
                        );
                        return;
index 48ee8ebe9d2f8a3ffdace25306f8b3577893379b..de45bb9bcdd16210d604f7397214a81a2263a899 100644 (file)
@@ -56,6 +56,7 @@ use OCP\Preview\BeforePreviewFetchedEvent;
 use OCP\Share;
 use OCP\Share\Events\ShareCreatedEvent;
 use OCP\Share\Events\ShareDeletedEvent;
+use OCP\SystemTag\ManagerEvent;
 use OCP\User\Events\BeforeUserLoggedInEvent;
 use OCP\User\Events\BeforeUserLoggedOutEvent;
 use OCP\User\Events\PasswordUpdatedEvent;
@@ -156,7 +157,7 @@ class Application extends App implements IBootstrap {
 
        private function tagHooks(IAuditLogger $logger,
                IEventDispatcher $eventDispatcher): void {
-               $eventDispatcher->addListener(\OCP\SystemTag\ManagerEvent::EVENT_CREATE, function (\OCP\SystemTag\ManagerEvent $event) use ($logger): void {
+               $eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, function (ManagerEvent $event) use ($logger): void {
                        $tagActions = new TagManagement($logger);
                        $tagActions->createTag($event->getTag());
                });
index 369f97239d7fa304e7b1c75971b26b3e150ef57d..4ea3db6aa7d3ffeeba9b20bdd4e4ac2613d0f507 100644 (file)
@@ -15,6 +15,7 @@ use OCP\EventDispatcher\IEventListener;
 use OCP\Files\InvalidPathException;
 use OCP\Files\NotFoundException;
 use OCP\Preview\BeforePreviewFetchedEvent;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -47,7 +48,7 @@ class FileEventListener extends Action implements IEventListener {
                                array_keys($params)
                        );
                } catch (InvalidPathException|NotFoundException $e) {
-                       \OCP\Server::get(LoggerInterface::class)->error(
+                       Server::get(LoggerInterface::class)->error(
                                'Exception thrown in file preview: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
                        );
                        return;
index 733f02434cd145b50c66b9c40bf7b95aa9b87fdd..4cd668c29a063e224be596d80450b64a97c1de78 100644 (file)
@@ -27,6 +27,7 @@ use OCP\IRequest;
 use OCP\IURLGenerator;
 use OCP\IUserManager;
 use OCP\Share\Exceptions\ShareNotFound;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -276,7 +277,7 @@ class RequestHandlerController extends Controller {
        private function mapUid($uid) {
                // FIXME this should be a method in the user management instead
                $this->logger->debug('shareWith before, ' . $uid, ['app' => $this->appName]);
-               \OCP\Util::emitHook(
+               Util::emitHook(
                        '\OCA\Files_Sharing\API\Server2Server',
                        'preLoginNameUsedAsUserName',
                        ['uid' => &$uid]
index 4cdb5f93b158eb9cccabb8d7ab1779ad7a6bc9f9..a9175b7e203d29ff910305341b60eba18fa5568c 100644 (file)
@@ -33,7 +33,7 @@ class ListenerTest extends TestCase {
                parent::setUp();
 
                $this->notificationManager = $this->createMock(\OCP\Notification\IManager::class);
-               $this->userManager = $this->createMock(\OCP\IUserManager::class);
+               $this->userManager = $this->createMock(IUserManager::class);
 
                $this->listener = new Listener(
                        $this->notificationManager,
index 69ddceadf17d8e0f73d16d76307c592cdce0e8b1..959129cdfa3656c2be6a6bb28847a4d9879312f8 100644 (file)
@@ -10,11 +10,11 @@ namespace OCA\Dashboard\Controller;
 
 use OCA\Dashboard\Service\DashboardService;
 use OCP\AppFramework\Controller;
-use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\Attribute\FrontpageRoute;
 use OCP\AppFramework\Http\Attribute\NoAdminRequired;
 use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
 use OCP\AppFramework\Http\Attribute\OpenAPI;
+use OCP\AppFramework\Http\FeaturePolicy;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\AppFramework\Services\IInitialState;
 use OCP\Dashboard\IIconWidget;
@@ -24,6 +24,7 @@ use OCP\EventDispatcher\IEventDispatcher;
 use OCP\IConfig;
 use OCP\IL10N;
 use OCP\IRequest;
+use OCP\Util;
 
 #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
 class DashboardController extends Controller {
@@ -49,8 +50,8 @@ class DashboardController extends Controller {
        #[NoAdminRequired]
        #[FrontpageRoute(verb: 'GET', url: '/')]
        public function index(): TemplateResponse {
-               \OCP\Util::addStyle('dashboard', 'dashboard');
-               \OCP\Util::addScript('dashboard', 'main', 'theming');
+               Util::addStyle('dashboard', 'dashboard');
+               Util::addScript('dashboard', 'main', 'theming');
 
                $widgets = array_map(function (IWidget $widget) {
                        return [
@@ -76,7 +77,7 @@ class DashboardController extends Controller {
                ]);
 
                // For the weather widget we should allow the geolocation
-               $featurePolicy = new Http\FeaturePolicy();
+               $featurePolicy = new FeaturePolicy();
                $featurePolicy->addAllowedGeoLocationDomain('\'self\'');
                $response->setFeaturePolicy($featurePolicy);
 
index bfa4d6184d51fcc970b669945f4a04a8ceb0c080..ea6d2dcf40606b621c0a367132d5d19d921fba84 100644 (file)
@@ -10,6 +10,8 @@ use OC\KnownUser\KnownUserService;
 use OCA\DAV\CalDAV\CalDavBackend;
 use OCA\DAV\CalDAV\CalendarRoot;
 use OCA\DAV\CalDAV\DefaultCalendarValidator;
+use OCA\DAV\CalDAV\Proxy\ProxyMapper;
+use OCA\DAV\CalDAV\Schedule\IMipPlugin;
 use OCA\DAV\CalDAV\Security\RateLimitingPlugin;
 use OCA\DAV\CalDAV\Validation\CalDavValidatePlugin;
 use OCA\DAV\Connector\LegacyDAVACL;
@@ -18,6 +20,9 @@ use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
 use OCA\DAV\Connector\Sabre\MaintenancePlugin;
 use OCA\DAV\Connector\Sabre\Principal;
 use OCP\Accounts\IAccountManager;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IConfig;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 
 $authBackend = new Auth(
@@ -35,7 +40,7 @@ $principalBackend = new Principal(
        \OC::$server->getShareManager(),
        \OC::$server->getUserSession(),
        \OC::$server->getAppManager(),
-       \OC::$server->query(\OCA\DAV\CalDAV\Proxy\ProxyMapper::class),
+       \OC::$server->query(ProxyMapper::class),
        \OC::$server->get(KnownUserService::class),
        \OC::$server->getConfig(),
        \OC::$server->getL10NFactory(),
@@ -45,8 +50,8 @@ $db = \OC::$server->getDatabaseConnection();
 $userManager = \OC::$server->getUserManager();
 $random = \OC::$server->getSecureRandom();
 $logger = \OC::$server->get(LoggerInterface::class);
-$dispatcher = \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class);
-$config = \OC::$server->get(\OCP\IConfig::class);
+$dispatcher = \OC::$server->get(IEventDispatcher::class);
+$config = \OC::$server->get(IConfig::class);
 
 $calDavBackend = new CalDavBackend(
        $db,
@@ -96,11 +101,11 @@ $server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
 $server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DefaultCalendarValidator::class)));
 
 if ($sendInvitations) {
-       $server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
+       $server->addPlugin(\OC::$server->query(IMipPlugin::class));
 }
 $server->addPlugin(new ExceptionLoggerPlugin('caldav', $logger));
-$server->addPlugin(\OCP\Server::get(RateLimitingPlugin::class));
-$server->addPlugin(\OCP\Server::get(CalDavValidatePlugin::class));
+$server->addPlugin(Server::get(RateLimitingPlugin::class));
+$server->addPlugin(Server::get(CalDavValidatePlugin::class));
 
 // And off we go!
 $server->exec();
index 72be4712705c4c316d1cc8ccb902c3594522e00f..dbcdacc27f0f68d71739ddf24c56f8db8784479d 100644 (file)
@@ -8,8 +8,11 @@
 // Backends
 use OC\KnownUser\KnownUserService;
 use OCA\DAV\AppInfo\PluginManager;
+use OCA\DAV\CalDAV\Proxy\ProxyMapper;
 use OCA\DAV\CardDAV\AddressBookRoot;
 use OCA\DAV\CardDAV\CardDavBackend;
+use OCA\DAV\CardDAV\ImageExportPlugin;
+use OCA\DAV\CardDAV\PhotoCache;
 use OCA\DAV\CardDAV\Security\CardDavRateLimitingPlugin;
 use OCA\DAV\CardDAV\Validation\CardDavValidatePlugin;
 use OCA\DAV\Connector\LegacyDAVACL;
@@ -19,6 +22,9 @@ use OCA\DAV\Connector\Sabre\MaintenancePlugin;
 use OCA\DAV\Connector\Sabre\Principal;
 use OCP\Accounts\IAccountManager;
 use OCP\App\IAppManager;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IGroupManager;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 use Sabre\CardDAV\Plugin;
 
@@ -37,7 +43,7 @@ $principalBackend = new Principal(
        \OC::$server->getShareManager(),
        \OC::$server->getUserSession(),
        \OC::$server->getAppManager(),
-       \OC::$server->query(\OCA\DAV\CalDAV\Proxy\ProxyMapper::class),
+       \OC::$server->query(ProxyMapper::class),
        \OC::$server->get(KnownUserService::class),
        \OC::$server->getConfig(),
        \OC::$server->getL10NFactory(),
@@ -48,7 +54,7 @@ $cardDavBackend = new CardDavBackend(
        $db,
        $principalBackend,
        \OC::$server->getUserManager(),
-       \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class),
+       \OC::$server->get(IEventDispatcher::class),
        \OC::$server->get(\OCA\DAV\CardDAV\Sharing\Backend::class),
 );
 
@@ -59,7 +65,7 @@ $principalCollection = new \Sabre\CalDAV\Principal\Collection($principalBackend)
 $principalCollection->disableListing = !$debugging; // Disable listing
 
 $pluginManager = new PluginManager(\OC::$server, \OC::$server->query(IAppManager::class));
-$addressBookRoot = new AddressBookRoot($principalBackend, $cardDavBackend, $pluginManager, \OC::$server->getUserSession()->getUser(), \OC::$server->get(\OCP\IGroupManager::class));
+$addressBookRoot = new AddressBookRoot($principalBackend, $cardDavBackend, $pluginManager, \OC::$server->getUserSession()->getUser(), \OC::$server->get(IGroupManager::class));
 $addressBookRoot->disableListing = !$debugging; // Disable listing
 
 $nodes = [
@@ -84,13 +90,13 @@ if ($debugging) {
 
 $server->addPlugin(new \Sabre\DAV\Sync\Plugin());
 $server->addPlugin(new \Sabre\CardDAV\VCFExportPlugin());
-$server->addPlugin(new \OCA\DAV\CardDAV\ImageExportPlugin(new \OCA\DAV\CardDAV\PhotoCache(
+$server->addPlugin(new ImageExportPlugin(new PhotoCache(
        \OC::$server->getAppDataDir('dav-photocache'),
        \OC::$server->get(LoggerInterface::class)
 )));
 $server->addPlugin(new ExceptionLoggerPlugin('carddav', \OC::$server->get(LoggerInterface::class)));
-$server->addPlugin(\OCP\Server::get(CardDavRateLimitingPlugin::class));
-$server->addPlugin(\OCP\Server::get(CardDavValidatePlugin::class));
+$server->addPlugin(Server::get(CardDavRateLimitingPlugin::class));
+$server->addPlugin(Server::get(CardDavValidatePlugin::class));
 
 // And off we go!
 $server->exec();
index 38753374150045ef94a2dea48c5cf5c0ebc8b2f0..dc74fe214afbb61a0f460e7aa488ad6874eb7912 100644 (file)
@@ -5,9 +5,20 @@
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  * SPDX-License-Identifier: AGPL-3.0-only
  */
-
+use OC\Files\Filesystem;
+use OC\Files\Storage\Wrapper\PermissionsMask;
+use OC\Files\View;
+use OCA\DAV\Connector\LegacyPublicAuth;
+use OCA\DAV\Connector\Sabre\ServerFactory;
+use OCA\DAV\Files\Sharing\FilesDropPlugin;
+use OCA\DAV\Files\Sharing\PublicLinkCheckPlugin;
+use OCA\DAV\Storage\PublicOwnerWrapper;
+use OCA\FederatedFileSharing\FederatedShareProvider;
 use OCP\BeforeSabrePubliclyLoadedEvent;
+use OCP\Constants;
 use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\IRootFolder;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 
 // load needed apps
@@ -19,7 +30,7 @@ OC_Util::obEnd();
 \OC::$server->getSession()->close();
 
 // Backends
-$authBackend = new OCA\DAV\Connector\LegacyPublicAuth(
+$authBackend = new LegacyPublicAuth(
        \OC::$server->getRequest(),
        \OC::$server->getShareManager(),
        \OC::$server->getSession(),
@@ -30,7 +41,7 @@ $authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend);
 /** @var IEventDispatcher $eventDispatcher */
 $eventDispatcher = \OC::$server->get(IEventDispatcher::class);
 
-$serverFactory = new OCA\DAV\Connector\Sabre\ServerFactory(
+$serverFactory = new ServerFactory(
        \OC::$server->getConfig(),
        \OC::$server->get(LoggerInterface::class),
        \OC::$server->getDatabaseConnection(),
@@ -45,13 +56,13 @@ $serverFactory = new OCA\DAV\Connector\Sabre\ServerFactory(
 
 $requestUri = \OC::$server->getRequest()->getRequestUri();
 
-$linkCheckPlugin = new \OCA\DAV\Files\Sharing\PublicLinkCheckPlugin();
-$filesDropPlugin = new \OCA\DAV\Files\Sharing\FilesDropPlugin();
+$linkCheckPlugin = new PublicLinkCheckPlugin();
+$filesDropPlugin = new FilesDropPlugin();
 
 $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) {
        $isAjax = in_array('XMLHttpRequest', explode(',', $_SERVER['HTTP_X_REQUESTED_WITH'] ?? ''));
-       /** @var \OCA\FederatedFileSharing\FederatedShareProvider $shareProvider */
-       $federatedShareProvider = \OC::$server->query(\OCA\FederatedFileSharing\FederatedShareProvider::class);
+       /** @var FederatedShareProvider $shareProvider */
+       $federatedShareProvider = \OC::$server->query(FederatedShareProvider::class);
        if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false && !$isAjax) {
                // this is what is thrown when trying to access a non-existing share
                throw new \Sabre\DAV\Exception\NotAuthenticated();
@@ -59,20 +70,20 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, funct
 
        $share = $authBackend->getShare();
        $owner = $share->getShareOwner();
-       $isReadable = $share->getPermissions() & \OCP\Constants::PERMISSION_READ;
+       $isReadable = $share->getPermissions() & Constants::PERMISSION_READ;
        $fileId = $share->getNodeId();
 
        // FIXME: should not add storage wrappers outside of preSetup, need to find a better way
-       $previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
-       \OC\Files\Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
-               return new \OC\Files\Storage\Wrapper\PermissionsMask(['storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE]);
+       $previousLog = Filesystem::logWarningWhenAddingStorageWrapper(false);
+       Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
+               return new PermissionsMask(['storage' => $storage, 'mask' => $share->getPermissions() | Constants::PERMISSION_SHARE]);
        });
-       \OC\Files\Filesystem::addStorageWrapper('shareOwner', function ($mountPoint, $storage) use ($share) {
-               return new \OCA\DAV\Storage\PublicOwnerWrapper(['storage' => $storage, 'owner' => $share->getShareOwner()]);
+       Filesystem::addStorageWrapper('shareOwner', function ($mountPoint, $storage) use ($share) {
+               return new PublicOwnerWrapper(['storage' => $storage, 'owner' => $share->getShareOwner()]);
        });
-       \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
+       Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
 
-       $rootFolder = \OCP\Server::get(\OCP\Files\IRootFolder::class);
+       $rootFolder = Server::get(IRootFolder::class);
        $userFolder = $rootFolder->getUserFolder($owner);
        $node = $userFolder->getFirstNodeById($fileId);
        if (!$node) {
@@ -85,7 +96,7 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, funct
                $filesDropPlugin->enable();
        }
 
-       $view = new \OC\Files\View($node->getPath());
+       $view = new View($node->getPath());
        $filesDropPlugin->setView($view);
        $filesDropPlugin->setShare($share);
 
index 1683c29ca80f55c86877deed7fbefc7bf47a89b4..0faed7ccc947f3530b47abe01eff4e660e54f5f0 100644 (file)
@@ -5,6 +5,13 @@
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  * SPDX-License-Identifier: AGPL-3.0-only
  */
+use OC\Files\Filesystem;
+use OCA\DAV\Connector\Sabre\Auth;
+use OCA\DAV\Connector\Sabre\BearerAuth;
+use OCA\DAV\Connector\Sabre\ServerFactory;
+use OCA\DAV\Events\SabrePluginAddEvent;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\SabrePluginEvent;
 use Psr\Log\LoggerInterface;
 
 // no php execution timeout for webdav
@@ -16,9 +23,9 @@ ignore_user_abort(true);
 // Turn off output buffering to prevent memory problems
 \OC_Util::obEnd();
 
-$dispatcher = \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class);
+$dispatcher = \OC::$server->get(IEventDispatcher::class);
 
-$serverFactory = new \OCA\DAV\Connector\Sabre\ServerFactory(
+$serverFactory = new ServerFactory(
        \OC::$server->getConfig(),
        \OC::$server->get(LoggerInterface::class),
        \OC::$server->getDatabaseConnection(),
@@ -32,7 +39,7 @@ $serverFactory = new \OCA\DAV\Connector\Sabre\ServerFactory(
 );
 
 // Backends
-$authBackend = new \OCA\DAV\Connector\Sabre\Auth(
+$authBackend = new Auth(
        \OC::$server->getSession(),
        \OC::$server->getUserSession(),
        \OC::$server->getRequest(),
@@ -41,7 +48,7 @@ $authBackend = new \OCA\DAV\Connector\Sabre\Auth(
        'principals/'
 );
 $authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend);
-$bearerAuthPlugin = new \OCA\DAV\Connector\Sabre\BearerAuth(
+$bearerAuthPlugin = new BearerAuth(
        \OC::$server->getUserSession(),
        \OC::$server->getSession(),
        \OC::$server->getRequest()
@@ -52,13 +59,13 @@ $requestUri = \OC::$server->getRequest()->getRequestUri();
 
 $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function () {
        // use the view for the logged in user
-       return \OC\Files\Filesystem::getView();
+       return Filesystem::getView();
 });
 
 // allow setup of additional plugins
-$event = new \OCP\SabrePluginEvent($server);
+$event = new SabrePluginEvent($server);
 $dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event);
-$event = new \OCA\DAV\Events\SabrePluginAddEvent($server);
+$event = new SabrePluginAddEvent($server);
 $dispatcher->dispatchTyped($event);
 
 // And off we go!
index 46443a60f8a87f969b2cf1bb48839960d51e34f3..5ba9570602acb47215bf66b5ea9809002cfb0f09 100644 (file)
@@ -6,7 +6,9 @@ declare(strict_types=1);
  * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  * SPDX-License-Identifier: AGPL-3.0-or-later
  */
+use OCA\DAV\Db\DirectMapper;
 use OCA\DAV\Direct\ServerFactory;
+use OCP\AppFramework\Utility\ITimeFactory;
 
 // no php execution timeout for webdav
 if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) {
@@ -25,8 +27,8 @@ $server = $serverFactory->createServer(
        $baseuri,
        $requestUri,
        \OC::$server->getRootFolder(),
-       \OC::$server->query(\OCA\DAV\Db\DirectMapper::class),
-       \OC::$server->query(\OCP\AppFramework\Utility\ITimeFactory::class),
+       \OC::$server->query(DirectMapper::class),
+       \OC::$server->query(ITimeFactory::class),
        \OC::$server->getBruteForceThrottler(),
        \OC::$server->getRequest()
 );
index cc2d1ed5bc88f924be302dcfb2e0b57e75ca6fae..91d5a0448eba171d472e9d3ff031c94ebe164e00 100644 (file)
@@ -5,15 +5,20 @@
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  * SPDX-License-Identifier: AGPL-3.0-only
  */
-
 use OC\Files\Filesystem;
 use OC\Files\Storage\Wrapper\PermissionsMask;
 use OC\Files\View;
+use OCA\DAV\Connector\Sabre\PublicAuth;
+use OCA\DAV\Connector\Sabre\ServerFactory;
+use OCA\DAV\Files\Sharing\FilesDropPlugin;
+use OCA\DAV\Files\Sharing\PublicLinkCheckPlugin;
 use OCA\DAV\Storage\PublicOwnerWrapper;
 use OCA\DAV\Storage\PublicShareWrapper;
 use OCA\FederatedFileSharing\FederatedShareProvider;
 use OCP\BeforeSabrePubliclyLoadedEvent;
+use OCP\Constants;
 use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\IRootFolder;
 use OCP\Files\Mount\IMountManager;
 use OCP\IConfig;
 use OCP\IDBConnection;
@@ -24,6 +29,7 @@ use OCP\ITagManager;
 use OCP\IUserSession;
 use OCP\L10N\IFactory;
 use OCP\Security\Bruteforce\IThrottler;
+use OCP\Server;
 use OCP\Share\IManager;
 use Psr\Log\LoggerInterface;
 use Sabre\DAV\Exception\NotAuthenticated;
@@ -34,40 +40,40 @@ $RUNTIME_APPTYPES = ['filesystem', 'authentication', 'logging'];
 OC_App::loadApps($RUNTIME_APPTYPES);
 OC_Util::obEnd();
 
-$session = \OCP\Server::get(ISession::class);
-$request = \OCP\Server::get(IRequest::class);
-$eventDispatcher = \OCP\Server::get(IEventDispatcher::class);
+$session = Server::get(ISession::class);
+$request = Server::get(IRequest::class);
+$eventDispatcher = Server::get(IEventDispatcher::class);
 
 $session->close();
 $requestUri = $request->getRequestUri();
 
 // Backends
-$authBackend = new OCA\DAV\Connector\Sabre\PublicAuth(
+$authBackend = new PublicAuth(
        $request,
-       \OCP\Server::get(IManager::class),
+       Server::get(IManager::class),
        $session,
-       \OCP\Server::get(IThrottler::class),
-       \OCP\Server::get(LoggerInterface::class)
+       Server::get(IThrottler::class),
+       Server::get(LoggerInterface::class)
 );
 $authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend);
 
-$l10nFactory = \OCP\Server::get(IFactory::class);
-$serverFactory = new OCA\DAV\Connector\Sabre\ServerFactory(
-       \OCP\Server::get(IConfig::class),
-       \OCP\Server::get(LoggerInterface::class),
-       \OCP\Server::get(IDBConnection::class),
-       \OCP\Server::get(IUserSession::class),
-       \OCP\Server::get(IMountManager::class),
-       \OCP\Server::get(ITagManager::class),
+$l10nFactory = Server::get(IFactory::class);
+$serverFactory = new ServerFactory(
+       Server::get(IConfig::class),
+       Server::get(LoggerInterface::class),
+       Server::get(IDBConnection::class),
+       Server::get(IUserSession::class),
+       Server::get(IMountManager::class),
+       Server::get(ITagManager::class),
        $request,
-       \OCP\Server::get(IPreview::class),
+       Server::get(IPreview::class),
        $eventDispatcher,
        $l10nFactory->get('dav'),
 );
 
 
-$linkCheckPlugin = new \OCA\DAV\Files\Sharing\PublicLinkCheckPlugin();
-$filesDropPlugin = new \OCA\DAV\Files\Sharing\FilesDropPlugin();
+$linkCheckPlugin = new PublicLinkCheckPlugin();
+$filesDropPlugin = new FilesDropPlugin();
 
 // Define root url with /public.php/dav/files/TOKEN
 /** @var string $baseuri defined in public.php */
@@ -79,7 +85,7 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, funct
        if ($server->httpRequest->getMethod() !== 'GET') {
                // If this is *not* a GET request we only allow access to public DAV from AJAX or when Server2Server is allowed
                $isAjax = in_array('XMLHttpRequest', explode(',', $_SERVER['HTTP_X_REQUESTED_WITH'] ?? ''));
-               $federatedShareProvider = \OCP\Server::get(FederatedShareProvider::class);
+               $federatedShareProvider = Server::get(FederatedShareProvider::class);
                if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false && $isAjax === false) {
                        // this is what is thrown when trying to access a non-existing share
                        throw new NotAuthenticated();
@@ -88,7 +94,7 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, funct
 
        $share = $authBackend->getShare();
        $owner = $share->getShareOwner();
-       $isReadable = $share->getPermissions() & \OCP\Constants::PERMISSION_READ;
+       $isReadable = $share->getPermissions() & Constants::PERMISSION_READ;
        $fileId = $share->getNodeId();
 
        // FIXME: should not add storage wrappers outside of preSetup, need to find a better way
@@ -97,7 +103,7 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, funct
 
        /** @psalm-suppress MissingClosureParamType */
        Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
-               return new PermissionsMask(['storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE]);
+               return new PermissionsMask(['storage' => $storage, 'mask' => $share->getPermissions() | Constants::PERMISSION_SHARE]);
        });
 
        /** @psalm-suppress MissingClosureParamType */
@@ -114,7 +120,7 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, funct
        /** @psalm-suppress InternalMethod */
        Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
 
-       $rootFolder = \OCP\Server::get(\OCP\Files\IRootFolder::class);
+       $rootFolder = Server::get(IRootFolder::class);
        $userFolder = $rootFolder->getUserFolder($owner);
        $node = $userFolder->getFirstNodeById($fileId);
        if (!$node) {
index 73031c0794fd09ac01274dda09c86fba4ae82f0a..28cfe338a9361bb21e7b5ce2d9904e9726c4ee64 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use OCA\DAV\Server;
+
 /**
  * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -15,5 +17,5 @@ ignore_user_abort(true);
 \OC_Util::obEnd();
 
 $request = \OC::$server->getRequest();
-$server = new \OCA\DAV\Server($request, $baseuri);
+$server = new Server($request, $baseuri);
 $server->exec();
index fb6a195aedb3487e7df6019217e716042ea98f30..2325a3c3ba8f2b44d49c602ab638496716f28554 100644 (file)
@@ -19,8 +19,8 @@ use OCA\DAV\CalDAV\Reminder\NotificationProvider\EmailProvider;
 use OCA\DAV\CalDAV\Reminder\NotificationProvider\PushProvider;
 use OCA\DAV\CalDAV\Reminder\NotificationProviderManager;
 use OCA\DAV\CalDAV\Reminder\Notifier;
-
 use OCA\DAV\Capabilities;
+
 use OCA\DAV\CardDAV\ContactsManager;
 use OCA\DAV\CardDAV\PhotoCache;
 use OCA\DAV\CardDAV\SyncService;
@@ -85,6 +85,7 @@ use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Federation\Events\TrustedServerRemovedEvent;
 use OCP\Files\AppData\IAppDataFactory;
 use OCP\IUser;
+use OCP\Server;
 use OCP\User\Events\OutOfOfficeChangedEvent;
 use OCP\User\Events\OutOfOfficeClearedEvent;
 use OCP\User\Events\OutOfOfficeScheduledEvent;
@@ -222,7 +223,7 @@ class Application extends App implements IBootstrap {
 
                $dispatcher->addListener(UserUpdatedEvent::class, function (UserUpdatedEvent $event) use ($container): void {
                        /** @var SyncService $syncService */
-                       $syncService = \OCP\Server::get(SyncService::class);
+                       $syncService = Server::get(SyncService::class);
                        $syncService->updateUser($event->getUser());
                });
 
index 5025919c84ffe156596df08a5d4284a3b9dc1a06..894b347de9f899b412f98fb55dc8017883d305ef 100644 (file)
@@ -8,6 +8,8 @@ declare(strict_types=1);
  */
 namespace OCA\DAV\BackgroundJob;
 
+use OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException;
+use OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException;
 use OCA\DAV\CalDAV\Reminder\ReminderService;
 use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\BackgroundJob\TimedJob;
@@ -34,8 +36,8 @@ class EventReminderJob extends TimedJob {
        }
 
        /**
-        * @throws \OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException
-        * @throws \OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException
+        * @throws ProviderNotAvailableException
+        * @throws NotificationTypeDoesNotExistException
         * @throws \OC\User\NoUserException
         */
        public function run($argument):void {
index 56e91c581f835c69f74ade2dc391e68e08ee276e..3e058a9b6c19bd3d11f7dfe0276bde8692963894 100644 (file)
@@ -9,6 +9,8 @@ declare(strict_types=1);
 
 namespace OCA\DAV\CalDAV\AppCalendar;
 
+use OCA\DAV\CalDAV\CachedSubscriptionImpl;
+use OCA\DAV\CalDAV\CalendarImpl;
 use OCA\DAV\CalDAV\Integration\ExternalCalendar;
 use OCA\DAV\CalDAV\Integration\ICalendarProvider;
 use OCP\Calendar\IManager;
@@ -51,7 +53,7 @@ class AppCalendarPlugin implements ICalendarProvider {
                return array_values(
                        array_filter($this->manager->getCalendarsForPrincipal($principalUri, $calendarUris), function ($c) {
                                // We must not provide a wrapper for DAV calendars
-                               return ! (($c instanceof \OCA\DAV\CalDAV\CalendarImpl) || ($c instanceof \OCA\DAV\CalDAV\CachedSubscriptionImpl));
+                               return ! (($c instanceof CalendarImpl) || ($c instanceof CachedSubscriptionImpl));
                        })
                );
        }
index 101bf36617aab7a59d58445e84b3266e79e221dc..c9d323d27df3136406fa83758d80b3f57736174d 100644 (file)
@@ -3117,7 +3117,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
 
        /**
         * @param boolean $value
-        * @param \OCA\DAV\CalDAV\Calendar $calendar
+        * @param Calendar $calendar
         * @return string|null
         */
        public function setPublishStatus($value, $calendar) {
@@ -3152,7 +3152,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
        }
 
        /**
-        * @param \OCA\DAV\CalDAV\Calendar $calendar
+        * @param Calendar $calendar
         * @return mixed
         */
        public function getPublishStatus($calendar) {
index 6fa94eebc91eaaa9142ee914a9161a53bb50bffd..32a3eb0ae158a7e67ceec7085ea8f62e6757c27b 100644 (file)
@@ -9,15 +9,20 @@ use OCA\DAV\AppInfo\PluginManager;
 use OCA\DAV\CalDAV\Auth\CustomPrincipalPlugin;
 use OCA\DAV\CalDAV\Auth\PublicPrincipalPlugin;
 use OCA\DAV\CalDAV\DefaultCalendarValidator;
+use OCA\DAV\CalDAV\Publishing\PublishPlugin;
 use OCA\DAV\Connector\Sabre\AnonymousOptionsPlugin;
 use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
 use OCA\DAV\Connector\Sabre\CachingTree;
 use OCA\DAV\Connector\Sabre\DavAclPlugin;
+use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
+use OCA\DAV\Connector\Sabre\LockPlugin;
+use OCA\DAV\Connector\Sabre\MaintenancePlugin;
 use OCA\DAV\Events\SabrePluginAuthInitEvent;
 use OCA\DAV\RootCollection;
 use OCA\Theming\ThemingDefaults;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\IConfig;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 use Sabre\VObject\ITip\Message;
 
@@ -30,22 +35,22 @@ class InvitationResponseServer {
         */
        public function __construct(bool $public = true) {
                $baseUri = \OC::$WEBROOT . '/remote.php/dav/';
-               $logger = \OCP\Server::get(LoggerInterface::class);
-               $dispatcher = \OCP\Server::get(IEventDispatcher::class);
+               $logger = Server::get(LoggerInterface::class);
+               $dispatcher = Server::get(IEventDispatcher::class);
 
                $root = new RootCollection();
                $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
 
                // Add maintenance plugin
-               $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig(), \OC::$server->getL10N('dav')));
+               $this->server->addPlugin(new MaintenancePlugin(\OC::$server->getConfig(), \OC::$server->getL10N('dav')));
 
                // Set URL explicitly due to reverse-proxy situations
                $this->server->httpRequest->setUrl($baseUri);
                $this->server->setBaseUri($baseUri);
 
                $this->server->addPlugin(new BlockLegacyClientPlugin(
-                       \OCP\Server::get(IConfig::class),
-                       \OCP\Server::get(ThemingDefaults::class),
+                       Server::get(IConfig::class),
+                       Server::get(ThemingDefaults::class),
                ));
                $this->server->addPlugin(new AnonymousOptionsPlugin());
 
@@ -60,8 +65,8 @@ class InvitationResponseServer {
                $event = new SabrePluginAuthInitEvent($this->server);
                $dispatcher->dispatchTyped($event);
 
-               $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
-               $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
+               $this->server->addPlugin(new ExceptionLoggerPlugin('webdav', $logger));
+               $this->server->addPlugin(new LockPlugin());
                $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
 
                // acl
@@ -78,7 +83,7 @@ class InvitationResponseServer {
                $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
                $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
                //$this->server->addPlugin(new \OCA\DAV\DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
-               $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
+               $this->server->addPlugin(new PublishPlugin(
                        \OC::$server->getConfig(),
                        \OC::$server->getURLGenerator()
                ));
index 59f412c0a7beada5b5eddadc9351350b6e4fe51e..b33b9c61834a2069c340d4e5b442375245f2e984 100644 (file)
@@ -17,6 +17,7 @@ use OCP\L10N\IFactory as L10NFactory;
 use OCP\Mail\Headers\AutoSubmitted;
 use OCP\Mail\IEMailTemplate;
 use OCP\Mail\IMailer;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 use Sabre\VObject;
 use Sabre\VObject\Component\VEvent;
@@ -87,7 +88,7 @@ class EmailProvider extends AbstractProvider {
                                $lang = $fallbackLanguage;
                        }
                        $l10n = $this->getL10NForLang($lang);
-                       $fromEMail = \OCP\Util::getDefaultEmailAddress('reminders-noreply');
+                       $fromEMail = Util::getDefaultEmailAddress('reminders-noreply');
 
                        $template = $this->mailer->createEMailTemplate('dav.calendarReminder');
                        $template->addHeader();
index f64de85c4493f745c99eabe91b16cc87894068ac..21f4f5094d474f0d947a62850ade3b613430c18b 100644 (file)
@@ -8,6 +8,8 @@ declare(strict_types=1);
  */
 namespace OCA\DAV\CalDAV\Reminder;
 
+use OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException;
+
 /**
  * Class NotificationProviderManager
  *
@@ -42,7 +44,7 @@ class NotificationProviderManager {
                        if (isset($this->providers[$type])) {
                                return $this->providers[$type];
                        }
-                       throw new NotificationProvider\ProviderNotAvailableException($type);
+                       throw new ProviderNotAvailableException($type);
                }
                throw new NotificationTypeDoesNotExistException($type);
        }
index e46cd039fd5ee7162eabca1f34476cb3d934db16..beca5cff233d98b1cf4fda22d91f6cb857c67473 100644 (file)
@@ -15,6 +15,8 @@ use OCP\Defaults;
 use OCP\IConfig;
 use OCP\IUserSession;
 use OCP\Mail\IMailer;
+use OCP\Mail\Provider\Address;
+use OCP\Mail\Provider\Attachment;
 use OCP\Mail\Provider\IManager as IMailManager;
 use OCP\Mail\Provider\IMessageSend;
 use OCP\Util;
@@ -277,15 +279,15 @@ class IMipPlugin extends SabreIMipPlugin {
                                // construct mail message and set required parameters
                                $message = $mailService->initiateMessage();
                                $message->setFrom(
-                                       (new \OCP\Mail\Provider\Address($sender, $fromName))
+                                       (new Address($sender, $fromName))
                                );
                                $message->setTo(
-                                       (new \OCP\Mail\Provider\Address($recipient, $recipientName))
+                                       (new Address($recipient, $recipientName))
                                );
                                $message->setSubject($template->renderSubject());
                                $message->setBodyPlain($template->renderText());
                                $message->setBodyHtml($template->renderHtml());
-                               $message->setAttachments((new \OCP\Mail\Provider\Attachment(
+                               $message->setAttachments((new Attachment(
                                        $itip_msg,
                                        'event.ics',
                                        'text/calendar; method=' . $iTipMessage->method,
index 48f4cbf22ef0ad275d63b1274c1139ebe601b5ff..11f0dfbe25170923e3116544611db38bcb72d23a 100644 (file)
@@ -9,6 +9,7 @@ use DateTimeZone;
 use OCA\DAV\CalDAV\CalDavBackend;
 use OCA\DAV\CalDAV\Calendar;
 use OCA\DAV\CalDAV\CalendarHome;
+use OCA\DAV\CalDAV\CalendarObject;
 use OCA\DAV\CalDAV\DefaultCalendarValidator;
 use OCP\IConfig;
 use Psr\Log\LoggerInterface;
@@ -163,7 +164,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
                                return;
                        }
                        
-                       /** @var \OCA\DAV\CalDAV\Calendar $calendarNode */
+                       /** @var Calendar $calendarNode */
                        $calendarNode = $this->server->tree->getNodeForPath($calendarPath);
                        // extract addresses for owner
                        $addresses = $this->getAddressesForPrincipal($calendarNode->getOwner());
@@ -178,7 +179,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
                        // determine if we are updating a calendar event
                        if (!$isNew) {
                                // retrieve current calendar event node
-                               /** @var \OCA\DAV\CalDAV\CalendarObject $currentNode */
+                               /** @var CalendarObject $currentNode */
                                $currentNode = $this->server->tree->getNodeForPath($request->getPath());
                                // convert calendar event string data to VCalendar object
                                /** @var \Sabre\VObject\Component\VCalendar $currentObject */
@@ -561,7 +562,7 @@ EOF;
                $calendarTimeZone = new DateTimeZone('UTC');
 
                $homePath = $result[0][200]['{' . self::NS_CALDAV . '}calendar-home-set']->getHref();
-               /** @var \OCA\DAV\CalDAV\Calendar $node */
+               /** @var Calendar $node */
                foreach ($this->server->tree->getNodeForPath($homePath)->getChildren() as $node) {
                        
                        if (!$node instanceof ICalendar) {
index fb55dec593c8699ac12cf62b6fed8245dcda7d1f..c69537523f299482ed1e42ad0c64e1dac14e8597 100644 (file)
@@ -108,7 +108,7 @@ class SearchPlugin extends ServerPlugin {
         * This report is used by clients to request calendar objects based on
         * complex conditions.
         *
-        * @param Xml\Request\CalendarSearchReport $report
+        * @param CalendarSearchReport $report
         * @return void
         */
        private function calendarSearch($report) {
index 30af37481ab75f5920c95f1b26a6184e8efaf4e8..899396ddc17293f9504135dacbee6cc2b3f1d0e2 100644 (file)
@@ -56,7 +56,7 @@ class ContactsManager {
         */
        private function register(IManager $cm, $addressBooks, $urlGenerator) {
                foreach ($addressBooks as $addressBookInfo) {
-                       $addressBook = new \OCA\DAV\CardDAV\AddressBook($this->backend, $addressBookInfo, $this->l10n);
+                       $addressBook = new AddressBook($this->backend, $addressBookInfo, $this->l10n);
                        $cm->registerAddressBook(
                                new AddressBookImpl(
                                        $addressBook,
index 00989386df76768099b95673094949dad4334bc6..0fb5592142ed21046fc3b6df658b9bc8afa32e17 100644 (file)
@@ -10,6 +10,7 @@ use OCP\Files\NotFoundException;
 use OCP\Files\NotPermittedException;
 use OCP\Files\SimpleFS\ISimpleFile;
 use OCP\Files\SimpleFS\ISimpleFolder;
+use OCP\Image;
 use Psr\Log\LoggerInterface;
 use Sabre\CardDAV\Card;
 use Sabre\VObject\Document;
@@ -109,7 +110,7 @@ class PhotoCache {
                                throw new NotFoundException;
                        }
 
-                       $photo = new \OCP\Image();
+                       $photo = new Image();
                        /** @var ISimpleFile $file */
                        $file = $folder->getFile('photo.' . $ext);
                        $photo->loadFromData($file->getContent());
index e2d3fe4d8c84da5f759f09f722c0f98ad70268d1..aee26af4ed9c79ac0091f0388064c4d0c6353cfe 100644 (file)
@@ -20,6 +20,7 @@ use OCP\IL10N;
 use OCP\IRequest;
 use OCP\IUser;
 use OCP\IUserSession;
+use OCP\Server;
 use Psr\Container\ContainerExceptionInterface;
 use Psr\Container\NotFoundExceptionInterface;
 use Sabre\CardDAV\Backend;
@@ -98,7 +99,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
                                                $addressBook,
                                                $this->l10n,
                                                $this->config,
-                                               \OCP\Server::get(IUserSession::class),
+                                               Server::get(IUserSession::class),
                                                $request,
                                                $trustedServers,
                                                $this->groupManager
index ef0de057ebbe007f1875621d00c85a1080c7b5f3..6cae12d20ab20a904d6ba3d6a3fcf018350d78fa 100644 (file)
@@ -9,6 +9,7 @@ namespace OCA\DAV\Comments;
 
 use OCP\Comments\IComment;
 use OCP\Comments\ICommentsManager;
+use OCP\Comments\MessageTooLongException;
 use OCP\IUserSession;
 use Sabre\DAV\Exception\BadRequest;
 use Sabre\DAV\Exception\NotFound;
@@ -227,9 +228,9 @@ class CommentsPlugin extends ServerPlugin {
                        return $comment;
                } catch (\InvalidArgumentException $e) {
                        throw new BadRequest('Invalid input values', 0, $e);
-               } catch (\OCP\Comments\MessageTooLongException $e) {
+               } catch (MessageTooLongException $e) {
                        $msg = 'Message exceeds allowed character limit of ';
-                       throw new BadRequest($msg . \OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e);
+                       throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e);
                }
        }
 }
index 564eae506ac9a6850056232e010c2de3f7ee7d5a..731654df31a4514541cbb4202f7d4f05bf718111 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\DAV\Connector;
 
 use OCA\DAV\Connector\Sabre\PublicAuth;
+use OCP\Defaults;
 use OCP\IRequest;
 use OCP\ISession;
 use OCP\Security\Bruteforce\IThrottler;
@@ -40,7 +41,7 @@ class LegacyPublicAuth extends AbstractBasic {
                $this->throttler = $throttler;
 
                // setup realm
-               $defaults = new \OCP\Defaults();
+               $defaults = new Defaults();
                $this->realm = $defaults->getName() ?: 'Nextcloud';
        }
 
index 9b67d960107cb7e13784680f491a40b49d28612a..4c6ce557980294a9be4df501eaa79decdbdddd65 100644 (file)
@@ -13,6 +13,7 @@ use OC\Authentication\TwoFactorAuth\Manager;
 use OC\User\Session;
 use OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden;
 use OCA\DAV\Connector\Sabre\Exception\TooManyRequests;
+use OCP\Defaults;
 use OCP\IRequest;
 use OCP\ISession;
 use OCP\Security\Bruteforce\IThrottler;
@@ -48,7 +49,7 @@ class Auth extends AbstractBasic {
                $this->principalPrefix = $principalPrefix;
 
                // setup realm
-               $defaults = new \OCP\Defaults();
+               $defaults = new Defaults();
                $this->realm = $defaults->getName() ?: 'Nextcloud';
        }
 
index 8caae8dced9d27dbac17804f172840d06899b653..d5840848ceff020a2c0fa37bf02a2cef09650ca9 100644 (file)
@@ -5,6 +5,7 @@
  */
 namespace OCA\DAV\Connector\Sabre;
 
+use OCP\Defaults;
 use OCP\IRequest;
 use OCP\ISession;
 use OCP\IUserSession;
@@ -28,7 +29,7 @@ class BearerAuth extends AbstractBearer {
                $this->principalPrefix = $principalPrefix;
 
                // setup realm
-               $defaults = new \OCP\Defaults();
+               $defaults = new Defaults();
                $this->realm = $defaults->getName() ?: 'Nextcloud';
        }
 
index c1b69323a44e4556f792c4a185a568459ac73068..c520a6c5a8495bb70ed4ae8e7f4adfb6c6d38a20 100644 (file)
@@ -13,10 +13,12 @@ use OCA\DAV\AppInfo\Application;
 use OCA\DAV\Connector\Sabre\Exception\FileLocked;
 use OCA\DAV\Connector\Sabre\Exception\Forbidden;
 use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
+use OCP\App\IAppManager;
 use OCP\Files\FileInfo;
 use OCP\Files\Folder;
 use OCP\Files\ForbiddenException;
 use OCP\Files\InvalidPathException;
+use OCP\Files\NotFoundException;
 use OCP\Files\NotPermittedException;
 use OCP\Files\StorageNotAvailableException;
 use OCP\IL10N;
@@ -24,6 +26,7 @@ use OCP\IRequest;
 use OCP\L10N\IFactory;
 use OCP\Lock\ILockingProvider;
 use OCP\Lock\LockedException;
+use OCP\Server;
 use OCP\Share\IManager as IShareManager;
 use Psr\Log\LoggerInterface;
 use Sabre\DAV\Exception\BadRequest;
@@ -33,7 +36,7 @@ use Sabre\DAV\Exception\ServiceUnavailable;
 use Sabre\DAV\IFile;
 use Sabre\DAV\INode;
 
-class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota, \Sabre\DAV\IMoveTarget, \Sabre\DAV\ICopyTarget {
+class Directory extends Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota, \Sabre\DAV\IMoveTarget, \Sabre\DAV\ICopyTarget {
        /**
         * Cached directory content
         * @var \OCP\Files\FileInfo[]
@@ -101,7 +104,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
                                        'type' => FileInfo::TYPE_FILE
                                ], null);
                        }
-                       $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info);
+                       $node = new File($this->fileView, $info);
 
                        // only allow 1 process to upload a file at once but still allow reading the file while writing the part file
                        $node->acquireLock(ILockingProvider::LOCK_SHARED);
@@ -112,7 +115,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
                        $this->fileView->unlockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
                        $node->releaseLock(ILockingProvider::LOCK_SHARED);
                        return $result;
-               } catch (\OCP\Files\StorageNotAvailableException $e) {
+               } catch (StorageNotAvailableException $e) {
                        throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage(), $e->getCode(), $e);
                } catch (InvalidPathException $ex) {
                        throw new InvalidPath($ex->getMessage(), false, $ex);
@@ -143,7 +146,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
                        if (!$this->fileView->mkdir($newPath)) {
                                throw new \Sabre\DAV\Exception\Forbidden('Could not create directory ' . $newPath);
                        }
-               } catch (\OCP\Files\StorageNotAvailableException $e) {
+               } catch (StorageNotAvailableException $e) {
                        throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage(), 0, $e);
                } catch (InvalidPathException $ex) {
                        throw new InvalidPath($ex->getMessage(), false, $ex);
@@ -175,7 +178,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
                        try {
                                $this->fileView->verifyPath($this->path, $name, true);
                                $info = $this->fileView->getFileInfo($path);
-                       } catch (\OCP\Files\StorageNotAvailableException $e) {
+                       } catch (StorageNotAvailableException $e) {
                                throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage(), 0, $e);
                        } catch (InvalidPathException $ex) {
                                throw new InvalidPath($ex->getMessage(), false, $ex);
@@ -191,7 +194,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
                if ($info->getMimeType() === FileInfo::MIMETYPE_FOLDER) {
                        $node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this->tree, $this->shareManager);
                } else {
-                       $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info, $this->shareManager, $request, $l10n);
+                       $node = new File($this->fileView, $info, $this->shareManager, $request, $l10n);
                }
                if ($this->tree) {
                        $this->tree->cacheNode($node);
@@ -204,7 +207,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
         *
         * @return \Sabre\DAV\INode[]
         * @throws \Sabre\DAV\Exception\Locked
-        * @throws \OCA\DAV\Connector\Sabre\Exception\Forbidden
+        * @throws Forbidden
         */
        public function getChildren() {
                if (!is_null($this->dirContent)) {
@@ -214,7 +217,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
                        if (!$this->info->isReadable()) {
                                // return 403 instead of 404 because a 404 would make
                                // the caller believe that the collection itself does not exist
-                               if (\OCP\Server::get(\OCP\App\IAppManager::class)->isInstalled('files_accesscontrol')) {
+                               if (Server::get(IAppManager::class)->isInstalled('files_accesscontrol')) {
                                        throw new Forbidden('No read permissions. This might be caused by files_accesscontrol, check your configured rules');
                                } else {
                                        throw new Forbidden('No read permissions');
@@ -300,8 +303,8 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
 
                try {
                        $storageInfo = \OC_Helper::getStorageInfo($relativePath, $this->info, false);
-                       if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
-                               $free = \OCP\Files\FileInfo::SPACE_UNLIMITED;
+                       if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) {
+                               $free = FileInfo::SPACE_UNLIMITED;
                        } else {
                                $free = $storageInfo['free'];
                        }
@@ -310,10 +313,10 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
                                $free
                        ];
                        return $this->quotaInfo;
-               } catch (\OCP\Files\NotFoundException $e) {
+               } catch (NotFoundException $e) {
                        $this->getLogger()->warning('error while getting quota into', ['exception' => $e]);
                        return [0, 0];
-               } catch (\OCP\Files\StorageNotAvailableException $e) {
+               } catch (StorageNotAvailableException $e) {
                        $this->getLogger()->warning('error while getting quota into', ['exception' => $e]);
                        return [0, 0];
                } catch (NotPermittedException $e) {
index bad4bfa12ab585c1f96c65f5b149a149b8a1130a..38708e945e98636621fee22747b1fcf6495c2abc 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\DAV\Connector\Sabre\Exception;
 
 use Exception;
+use OCP\Files\LockNotAcquiredException;
 
 class FileLocked extends \Sabre\DAV\Exception {
        /**
@@ -15,7 +16,7 @@ class FileLocked extends \Sabre\DAV\Exception {
         * @param int $code
         */
        public function __construct($message = '', $code = 0, ?Exception $previous = null) {
-               if ($previous instanceof \OCP\Files\LockNotAcquiredException) {
+               if ($previous instanceof LockNotAcquiredException) {
                        $message = sprintf('Target file %s is locked by another process.', $previous->path);
                }
                parent::__construct($message, $code, $previous);
index d1769ce6b81b196e169f1334d96a522912734bae..36ac0fcec72181eab5a5959d72b4561408cc2c82 100644 (file)
@@ -18,6 +18,7 @@ use OCA\DAV\Connector\Sabre\Exception\EntityTooLarge;
 use OCA\DAV\Connector\Sabre\Exception\FileLocked;
 use OCA\DAV\Connector\Sabre\Exception\Forbidden as DAVForbiddenException;
 use OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType;
+use OCP\App\IAppManager;
 use OCP\Encryption\Exceptions\GenericEncryptionException;
 use OCP\Files\EntityTooLargeException;
 use OCP\Files\FileInfo;
@@ -35,6 +36,7 @@ use OCP\IRequest;
 use OCP\L10N\IFactory as IL10NFactory;
 use OCP\Lock\ILockingProvider;
 use OCP\Lock\LockedException;
+use OCP\Server;
 use OCP\Share\IManager;
 use Psr\Log\LoggerInterface;
 use Sabre\DAV\Exception;
@@ -123,7 +125,7 @@ class File extends Node implements IFile {
                }
                $needsPartFile = $partStorage->needsPartFile() && (strlen($this->path) > 1);
 
-               $view = \OC\Files\Filesystem::getView();
+               $view = Filesystem::getView();
 
                if ($needsPartFile) {
                        // mark file as partial while uploading (ignored by the scanner)
@@ -402,19 +404,19 @@ class File extends Node implements IFile {
                $run = true;
 
                if (!$exists) {
-                       \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_create, [
-                               \OC\Files\Filesystem::signal_param_path => $hookPath,
-                               \OC\Files\Filesystem::signal_param_run => &$run,
+                       \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_create, [
+                               Filesystem::signal_param_path => $hookPath,
+                               Filesystem::signal_param_run => &$run,
                        ]);
                } else {
-                       \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_update, [
-                               \OC\Files\Filesystem::signal_param_path => $hookPath,
-                               \OC\Files\Filesystem::signal_param_run => &$run,
+                       \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_update, [
+                               Filesystem::signal_param_path => $hookPath,
+                               Filesystem::signal_param_run => &$run,
                        ]);
                }
-               \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_write, [
-                       \OC\Files\Filesystem::signal_param_path => $hookPath,
-                       \OC\Files\Filesystem::signal_param_run => &$run,
+               \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_write, [
+                       Filesystem::signal_param_path => $hookPath,
+                       Filesystem::signal_param_run => &$run,
                ]);
                return $run;
        }
@@ -429,16 +431,16 @@ class File extends Node implements IFile {
                        return;
                }
                if (!$exists) {
-                       \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_create, [
-                               \OC\Files\Filesystem::signal_param_path => $hookPath
+                       \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_create, [
+                               Filesystem::signal_param_path => $hookPath
                        ]);
                } else {
-                       \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_update, [
-                               \OC\Files\Filesystem::signal_param_path => $hookPath
+                       \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_update, [
+                               Filesystem::signal_param_path => $hookPath
                        ]);
                }
-               \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_write, [
-                       \OC\Files\Filesystem::signal_param_path => $hookPath
+               \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_write, [
+                       Filesystem::signal_param_path => $hookPath
                ]);
        }
 
@@ -535,7 +537,7 @@ class File extends Node implements IFile {
         * @return array|bool
         */
        public function getDirectDownload() {
-               if (\OCP\Server::get(\OCP\App\IAppManager::class)->isEnabledForUser('encryption')) {
+               if (Server::get(IAppManager::class)->isEnabledForUser('encryption')) {
                        return [];
                }
                [$storage, $internalPath] = $this->fileView->resolvePath($this->path);
index 07308d4e805d067b8f8fb5f1248aa13e95d90b10..3855f51c65a2d9d002b168c65fb315c5be488330 100644 (file)
@@ -259,7 +259,7 @@ class FilesPlugin extends ServerPlugin {
                        }
                }
 
-               if ($node instanceof \OCA\DAV\Connector\Sabre\File) {
+               if ($node instanceof File) {
                        //Add OC-Checksum header
                        $checksum = $node->getChecksum();
                        if ($checksum !== null && $checksum !== '') {
@@ -279,7 +279,7 @@ class FilesPlugin extends ServerPlugin {
        public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) {
                $httpRequest = $this->server->httpRequest;
 
-               if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
+               if ($node instanceof Node) {
                        /**
                         * This was disabled, because it made dir listing throw an exception,
                         * so users were unable to navigate into folders where one subitem
@@ -415,7 +415,7 @@ class FilesPlugin extends ServerPlugin {
                        });
                }
 
-               if ($node instanceof \OCA\DAV\Connector\Sabre\File) {
+               if ($node instanceof File) {
                        $propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function () use ($node) {
                                try {
                                        $directDownloadUrl = $node->getDirectDownload();
@@ -504,7 +504,7 @@ class FilesPlugin extends ServerPlugin {
         */
        public function handleUpdateProperties($path, PropPatch $propPatch) {
                $node = $this->tree->getNodeForPath($path);
-               if (!($node instanceof \OCA\DAV\Connector\Sabre\Node)) {
+               if (!($node instanceof Node)) {
                        return;
                }
 
@@ -670,7 +670,7 @@ class FilesPlugin extends ServerPlugin {
                        return;
                }
                $node = $this->server->tree->getNodeForPath($filePath);
-               if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
+               if ($node instanceof Node) {
                        $fileId = $node->getFileId();
                        if (!is_null($fileId)) {
                                $this->server->httpResponse->setHeader('OC-FileId', $fileId);
index b82fee957bc243a613611796a0bb36ff9c10eb69..49ceff9118dd5ca8057c27f95cac248fd57a1daa 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\DAV\Connector\Sabre;
 
 use OC\Files\View;
+use OCA\Circles\Api\v1\Circles;
 use OCP\App\IAppManager;
 use OCP\Files\Folder;
 use OCP\Files\Node as INode;
@@ -355,7 +356,7 @@ class FilesReportPlugin extends ServerPlugin {
                if (!$this->appManager->isEnabledForUser('circles') || !class_exists('\OCA\Circles\Api\v1\Circles')) {
                        return [];
                }
-               return \OCA\Circles\Api\v1\Circles::getFilesForCircles($circlesIds);
+               return Circles::getFilesForCircles($circlesIds);
        }
 
 
@@ -419,7 +420,7 @@ class FilesReportPlugin extends ServerPlugin {
                return $results;
        }
 
-       protected function wrapNode(\OCP\Files\Node $node): File|Directory {
+       protected function wrapNode(INode $node): File|Directory {
                if ($node instanceof \OCP\Files\File) {
                        return new File($this->fileView, $node);
                } else {
index ac5514e11e140d3f6ff439ffde588dd0b71a5757..93cf302ff8936d5aab52ebae757af955cf272b2b 100644 (file)
@@ -12,8 +12,10 @@ use OC\Files\Node\File;
 use OC\Files\Node\Folder;
 use OC\Files\View;
 use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
+use OCP\Constants;
 use OCP\Files\DavUtil;
 use OCP\Files\FileInfo;
+use OCP\Files\InvalidPathException;
 use OCP\Files\IRootFolder;
 use OCP\Files\NotFoundException;
 use OCP\Files\Storage\ISharedStorage;
@@ -282,15 +284,15 @@ abstract class Node implements \Sabre\DAV\INode {
                        }
 
                        if (!$mountpoint->getOption('readonly', false) && $mountpointpath === $this->info->getPath()) {
-                               $permissions |= \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_UPDATE;
+                               $permissions |= Constants::PERMISSION_DELETE | Constants::PERMISSION_UPDATE;
                        }
                }
 
                /*
                 * Files can't have create or delete permissions
                 */
-               if ($this->info->getType() === \OCP\Files\FileInfo::TYPE_FILE) {
-                       $permissions &= ~(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_DELETE);
+               if ($this->info->getType() === FileInfo::TYPE_FILE) {
+                       $permissions &= ~(Constants::PERMISSION_CREATE | Constants::PERMISSION_DELETE);
                }
 
                return $permissions;
@@ -358,7 +360,7 @@ abstract class Node implements \Sabre\DAV\INode {
                                dirname($path),
                                basename($path),
                        );
-               } catch (\OCP\Files\InvalidPathException $ex) {
+               } catch (InvalidPathException $ex) {
                        throw new InvalidPath($ex->getMessage());
                }
        }
index 94098b4aca3ba1a7a8a1474b330e9473abcb86c8..6cdd570874385f33b0a8fd96560416eaeb9d3cdb 100644 (file)
@@ -9,10 +9,13 @@ namespace OCA\DAV\Connector\Sabre;
 
 use OC\Files\FileInfo;
 use OC\Files\Storage\FailedStorage;
+use OC\Files\View;
 use OCA\DAV\Connector\Sabre\Exception\FileLocked;
 use OCA\DAV\Connector\Sabre\Exception\Forbidden;
 use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
 use OCP\Files\ForbiddenException;
+use OCP\Files\InvalidPathException;
+use OCP\Files\Mount\IMountManager;
 use OCP\Files\StorageInvalidException;
 use OCP\Files\StorageNotAvailableException;
 use OCP\Lock\LockedException;
@@ -40,7 +43,7 @@ class ObjectTree extends CachingTree {
         * @param \OC\Files\View $view
         * @param \OCP\Files\Mount\IMountManager $mountManager
         */
-       public function init(\Sabre\DAV\INode $rootNode, \OC\Files\View $view, \OCP\Files\Mount\IMountManager $mountManager) {
+       public function init(\Sabre\DAV\INode $rootNode, View $view, IMountManager $mountManager) {
                $this->rootNode = $rootNode;
                $this->fileView = $view;
                $this->mountManager = $mountManager;
@@ -70,7 +73,7 @@ class ObjectTree extends CachingTree {
                if ($path) {
                        try {
                                $this->fileView->verifyPath($path, basename($path));
-                       } catch (\OCP\Files\InvalidPathException $ex) {
+                       } catch (InvalidPathException $ex) {
                                throw new InvalidPath($ex->getMessage());
                        }
                }
@@ -120,9 +123,9 @@ class ObjectTree extends CachingTree {
                }
 
                if ($info->getType() === 'dir') {
-                       $node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this);
+                       $node = new Directory($this->fileView, $info, $this);
                } else {
-                       $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info);
+                       $node = new File($this->fileView, $info);
                }
 
                $this->cache[$path] = $node;
@@ -169,7 +172,7 @@ class ObjectTree extends CachingTree {
                [$destinationDir, $destinationName] = \Sabre\Uri\split($destinationPath);
                try {
                        $this->fileView->verifyPath($destinationDir, $destinationName);
-               } catch (\OCP\Files\InvalidPathException $ex) {
+               } catch (InvalidPathException $ex) {
                        throw new InvalidPath($ex->getMessage());
                }
 
index 029061694ea275e34ccfaa40fb92180029dcfa93..0151bc9cf697cef3f9a906813d11f3538296f87e 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\DAV\Connector\Sabre;
 
 use OC\KnownUser\KnownUserService;
+use OCA\Circles\Api\v1\Circles;
 use OCA\Circles\Exceptions\CircleNotFoundException;
 use OCA\DAV\CalDAV\Proxy\ProxyMapper;
 use OCA\DAV\Traits\PrincipalProxyTrait;
@@ -530,7 +531,7 @@ class Principal implements BackendInterface {
                }
 
                try {
-                       $circle = \OCA\Circles\Api\v1\Circles::detailsCircle($circleUniqueId, true);
+                       $circle = Circles::detailsCircle($circleUniqueId, true);
                } catch (QueryException $ex) {
                        return null;
                } catch (CircleNotFoundException $ex) {
@@ -570,7 +571,7 @@ class Principal implements BackendInterface {
                                throw new Exception('Principal not found');
                        }
 
-                       $circles = \OCA\Circles\Api\v1\Circles::joinedCircles($name, true);
+                       $circles = Circles::joinedCircles($name, true);
 
                        $circles = array_map(function ($circle) {
                                /** @var \OCA\Circles\Model\Circle $circle */
index 3e2cd81a800517d39299940c9841e2a1777582d4..977b3bf304e2702f3df1121bed4936f7bae792d9 100644 (file)
@@ -11,6 +11,7 @@ declare(strict_types=1);
 
 namespace OCA\DAV\Connector\Sabre;
 
+use OCP\Defaults;
 use OCP\IRequest;
 use OCP\ISession;
 use OCP\Security\Bruteforce\IThrottler;
@@ -54,7 +55,7 @@ class PublicAuth extends AbstractBasic {
                $this->logger = $logger;
 
                // setup realm
-               $defaults = new \OCP\Defaults();
+               $defaults = new Defaults();
                $this->realm = $defaults->getName();
        }
 
index 617ba60f80d81f2651101de0a9032a5f446f50dd..967bd0a74b8ec38f5012dfb8716581c4f1c25c09 100644 (file)
@@ -9,6 +9,7 @@ namespace OCA\DAV\Connector\Sabre;
 
 use OCA\DAV\AppInfo\PluginManager;
 use OCA\DAV\CalDAV\DefaultCalendarValidator;
+use OCA\DAV\DAV\CustomPropertiesBackend;
 use OCA\DAV\DAV\ViewOnlyPlugin;
 use OCA\DAV\Files\ErrorPagePlugin;
 use OCA\Theming\ThemingDefaults;
@@ -51,24 +52,24 @@ class ServerFactory {
                Plugin $authPlugin,
                callable $viewCallBack): Server {
                // Fire up server
-               $objectTree = new \OCA\DAV\Connector\Sabre\ObjectTree();
-               $server = new \OCA\DAV\Connector\Sabre\Server($objectTree);
+               $objectTree = new ObjectTree();
+               $server = new Server($objectTree);
                // Set URL explicitly due to reverse-proxy situations
                $server->httpRequest->setUrl($requestUri);
                $server->setBaseUri($baseUri);
 
                // Load plugins
-               $server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config, $this->l10n));
+               $server->addPlugin(new MaintenancePlugin($this->config, $this->l10n));
                $server->addPlugin(new BlockLegacyClientPlugin(
                        $this->config,
                        \OCP\Server::get(ThemingDefaults::class),
                ));
-               $server->addPlugin(new \OCA\DAV\Connector\Sabre\AnonymousOptionsPlugin());
+               $server->addPlugin(new AnonymousOptionsPlugin());
                $server->addPlugin($authPlugin);
                // FIXME: The following line is a workaround for legacy components relying on being able to send a GET to /
-               $server->addPlugin(new \OCA\DAV\Connector\Sabre\DummyGetResponsePlugin());
-               $server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger));
-               $server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
+               $server->addPlugin(new DummyGetResponsePlugin());
+               $server->addPlugin(new ExceptionLoggerPlugin('webdav', $this->logger));
+               $server->addPlugin(new LockPlugin());
 
                $server->addPlugin(new RequestIdHeaderPlugin($this->request));
 
@@ -85,7 +86,7 @@ class ServerFactory {
                        '/OneNote/',
                        '/Microsoft-WebDAV-MiniRedir/',
                ])) {
-                       $server->addPlugin(new \OCA\DAV\Connector\Sabre\FakeLockerPlugin());
+                       $server->addPlugin(new FakeLockerPlugin());
                }
 
                $server->addPlugin(new ErrorPagePlugin($this->request, $this->config));
@@ -105,14 +106,14 @@ class ServerFactory {
 
                        // Create Nextcloud Dir
                        if ($rootInfo->getType() === 'dir') {
-                               $root = new \OCA\DAV\Connector\Sabre\Directory($view, $rootInfo, $objectTree);
+                               $root = new Directory($view, $rootInfo, $objectTree);
                        } else {
-                               $root = new \OCA\DAV\Connector\Sabre\File($view, $rootInfo);
+                               $root = new File($view, $rootInfo);
                        }
                        $objectTree->init($root, $view, $this->mountManager);
 
                        $server->addPlugin(
-                               new \OCA\DAV\Connector\Sabre\FilesPlugin(
+                               new FilesPlugin(
                                        $objectTree,
                                        $this->config,
                                        $this->request,
@@ -123,8 +124,8 @@ class ServerFactory {
                                        !$this->config->getSystemValue('debug', false)
                                )
                        );
-                       $server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view, true));
-                       $server->addPlugin(new \OCA\DAV\Connector\Sabre\ChecksumUpdatePlugin());
+                       $server->addPlugin(new QuotaPlugin($view, true));
+                       $server->addPlugin(new ChecksumUpdatePlugin());
 
                        // Allow view-only plugin for webdav requests
                        $server->addPlugin(new ViewOnlyPlugin(
@@ -132,15 +133,15 @@ class ServerFactory {
                        ));
 
                        if ($this->userSession->isLoggedIn()) {
-                               $server->addPlugin(new \OCA\DAV\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager));
-                               $server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin(
+                               $server->addPlugin(new TagsPlugin($objectTree, $this->tagManager));
+                               $server->addPlugin(new SharesPlugin(
                                        $objectTree,
                                        $this->userSession,
                                        $userFolder,
                                        \OC::$server->getShareManager()
                                ));
-                               $server->addPlugin(new \OCA\DAV\Connector\Sabre\CommentPropertiesPlugin(\OC::$server->getCommentsManager(), $this->userSession));
-                               $server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesReportPlugin(
+                               $server->addPlugin(new CommentPropertiesPlugin(\OC::$server->getCommentsManager(), $this->userSession));
+                               $server->addPlugin(new FilesReportPlugin(
                                        $objectTree,
                                        $view,
                                        \OC::$server->getSystemTagManager(),
@@ -154,7 +155,7 @@ class ServerFactory {
                                // custom properties plugin must be the last one
                                $server->addPlugin(
                                        new \Sabre\DAV\PropertyStorage\Plugin(
-                                               new \OCA\DAV\DAV\CustomPropertiesBackend(
+                                               new CustomPropertiesBackend(
                                                        $server,
                                                        $objectTree,
                                                        $this->databaseConnection,
@@ -164,7 +165,7 @@ class ServerFactory {
                                        )
                                );
                        }
-                       $server->addPlugin(new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin());
+                       $server->addPlugin(new CopyEtagHeaderPlugin());
 
                        // Load dav plugins from apps
                        $event = new SabrePluginEvent($server);
index a3f2847ee1ac03a08845b762be46bf59c06e0de9..c048b79484a60c26f92697aa107636c4a90cad87 100644 (file)
@@ -27,7 +27,7 @@ namespace OCA\DAV\Connector\Sabre;
  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
-
+use OCP\ITagManager;
 use Sabre\DAV\PropFind;
 use Sabre\DAV\PropPatch;
 
@@ -73,7 +73,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin {
         * @param \Sabre\DAV\Tree $tree tree
         * @param \OCP\ITagManager $tagManager tag manager
         */
-       public function __construct(\Sabre\DAV\Tree $tree, \OCP\ITagManager $tagManager) {
+       public function __construct(\Sabre\DAV\Tree $tree, ITagManager $tagManager) {
                $this->tree = $tree;
                $this->tagManager = $tagManager;
                $this->tagger = null;
@@ -191,12 +191,12 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin {
                PropFind $propFind,
                \Sabre\DAV\INode $node,
        ) {
-               if (!($node instanceof \OCA\DAV\Connector\Sabre\Node)) {
+               if (!($node instanceof Node)) {
                        return;
                }
 
                // need prefetch ?
-               if ($node instanceof \OCA\DAV\Connector\Sabre\Directory
+               if ($node instanceof Directory
                        && $propFind->getDepth() !== 0
                        && (!is_null($propFind->getStatus(self::TAGS_PROPERTYNAME))
                        || !is_null($propFind->getStatus(self::FAVORITE_PROPERTYNAME))
@@ -250,7 +250,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin {
         */
        public function handleUpdateProperties($path, PropPatch $propPatch) {
                $node = $this->tree->getNodeForPath($path);
-               if (!($node instanceof \OCA\DAV\Connector\Sabre\Node)) {
+               if (!($node instanceof Node)) {
                        return;
                }
 
index 8484dfa1935a8f25cf9fafcb4f9d262bc5d915bf..7e92dd18c83bd818a340fd9cfb4ae589e969ecc7 100644 (file)
@@ -91,7 +91,7 @@ class ZipFolderPlugin extends ServerPlugin {
         */
        public function handleDownload(Request $request, Response $response): ?bool {
                $node = $this->tree->getNodeForPath($request->getPath());
-               if (!($node instanceof \OCA\DAV\Connector\Sabre\Directory)) {
+               if (!($node instanceof Directory)) {
                        // only handle directories
                        return null;
                }
index 3bc729d6407271ab1107ce617e07ad2f42bf76a2..1b7859621129bdfcdc1acc67608fe33a633f2074 100644 (file)
@@ -13,6 +13,7 @@ use OC\Files\Storage\Wrapper\Jail;
 use OC\Files\View;
 use OCA\DAV\Connector\Sabre\CachingTree;
 use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\File;
 use OCA\DAV\Connector\Sabre\FilesPlugin;
 use OCA\DAV\Connector\Sabre\TagsPlugin;
 use OCP\Files\Cache\ICacheEntry;
@@ -206,9 +207,9 @@ class FileSearchBackend implements ISearchBackend {
                /** @var SearchResult[] $nodes */
                $nodes = array_map(function (Node $node) {
                        if ($node instanceof Folder) {
-                               $davNode = new \OCA\DAV\Connector\Sabre\Directory($this->view, $node, $this->tree, $this->shareManager);
+                               $davNode = new Directory($this->view, $node, $this->tree, $this->shareManager);
                        } else {
-                               $davNode = new \OCA\DAV\Connector\Sabre\File($this->view, $node, $this->shareManager);
+                               $davNode = new File($this->view, $node, $this->shareManager);
                        }
                        $path = $this->getHrefForNode($node);
                        $this->tree->cacheNode($davNode, $path);
index 1c0c531e2f9032f7434259dc8badadbdb32530b3..b865b7c1bb65b75fc68b8d29e478cbfe98ede7c0 100644 (file)
@@ -7,6 +7,7 @@
  */
 namespace OCA\DAV\Files;
 
+use OC\Files\Filesystem;
 use OCA\DAV\Connector\Sabre\Directory;
 use OCP\Files\FileInfo;
 use Sabre\DAV\Exception\Forbidden;
@@ -26,7 +27,7 @@ class FilesHome extends Directory {
         */
        public function __construct($principalInfo, FileInfo $userFolder) {
                $this->principalInfo = $principalInfo;
-               $view = \OC\Files\Filesystem::getView();
+               $view = Filesystem::getView();
                parent::__construct($view, $userFolder);
        }
 
index d9ba4c3e2a6cbc796d76ec071110ad29f4e93bdf..6ede8cb683c177e845845943455f5e15d4c1a796 100644 (file)
@@ -23,6 +23,9 @@ use OCA\DAV\Connector\Sabre\Principal;
 use OCA\DAV\DAV\GroupPrincipalBackend;
 use OCA\DAV\DAV\SystemPrincipalBackend;
 use OCA\DAV\Provisioning\Apple\AppleProvisioningNode;
+use OCA\DAV\SystemTag\SystemTagsByIdCollection;
+use OCA\DAV\SystemTag\SystemTagsInUseCollection;
+use OCA\DAV\SystemTag\SystemTagsRelationsCollection;
 use OCA\DAV\Upload\CleanupService;
 use OCP\Accounts\IAccountManager;
 use OCP\App\IAppManager;
@@ -30,6 +33,7 @@ use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\IRootFolder;
 use OCP\IConfig;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 use Sabre\DAV\SimpleCollection;
 
@@ -46,7 +50,7 @@ class RootCollection extends SimpleCollection {
                $dispatcher = \OC::$server->get(IEventDispatcher::class);
                $config = \OC::$server->get(IConfig::class);
                $proxyMapper = \OC::$server->query(ProxyMapper::class);
-               $rootFolder = \OCP\Server::get(IRootFolder::class);
+               $rootFolder = Server::get(IRootFolder::class);
 
                $userPrincipalBackend = new Principal(
                        $userManager,
@@ -101,12 +105,12 @@ class RootCollection extends SimpleCollection {
 
                $publicCalendarRoot = new PublicCalendarRoot($caldavBackend, $l10n, $config, $logger);
 
-               $systemTagCollection = new SystemTag\SystemTagsByIdCollection(
+               $systemTagCollection = new SystemTagsByIdCollection(
                        \OC::$server->getSystemTagManager(),
                        \OC::$server->getUserSession(),
                        $groupManager
                );
-               $systemTagRelationsCollection = new SystemTag\SystemTagsRelationsCollection(
+               $systemTagRelationsCollection = new SystemTagsRelationsCollection(
                        \OC::$server->getSystemTagManager(),
                        \OC::$server->getSystemTagObjectMapper(),
                        \OC::$server->getUserSession(),
@@ -114,7 +118,7 @@ class RootCollection extends SimpleCollection {
                        $dispatcher,
                        $rootFolder,
                );
-               $systemTagInUseCollection = \OCP\Server::get(SystemTag\SystemTagsInUseCollection::class);
+               $systemTagInUseCollection = Server::get(SystemTagsInUseCollection::class);
                $commentsCollection = new Comments\RootCollection(
                        \OC::$server->getCommentsManager(),
                        $userManager,
index 4bfc80192186f4b8d30cde5c25bf480a28140f03..986f7465051de8a813b020ecff8d46b26e08bd30 100644 (file)
@@ -6,11 +6,17 @@
  */
 namespace OCA\DAV;
 
+use OC\Files\Filesystem;
 use OCA\DAV\AppInfo\PluginManager;
 use OCA\DAV\BulkUpload\BulkUploadPlugin;
+use OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin;
 use OCA\DAV\CalDAV\BirthdayService;
 use OCA\DAV\CalDAV\DefaultCalendarValidator;
+use OCA\DAV\CalDAV\EventComparisonService;
+use OCA\DAV\CalDAV\ICSExportPlugin\ICSExportPlugin;
+use OCA\DAV\CalDAV\Publishing\PublishPlugin;
 use OCA\DAV\CalDAV\Schedule\IMipPlugin;
+use OCA\DAV\CalDAV\Schedule\IMipService;
 use OCA\DAV\CalDAV\Security\RateLimitingPlugin;
 use OCA\DAV\CalDAV\Validation\CalDavValidatePlugin;
 use OCA\DAV\CardDAV\HasPhotoPlugin;
@@ -21,6 +27,7 @@ use OCA\DAV\CardDAV\Security\CardDavRateLimitingPlugin;
 use OCA\DAV\CardDAV\Validation\CardDavValidatePlugin;
 use OCA\DAV\Comments\CommentsPlugin;
 use OCA\DAV\Connector\Sabre\AnonymousOptionsPlugin;
+use OCA\DAV\Connector\Sabre\AppleQuirksPlugin;
 use OCA\DAV\Connector\Sabre\Auth;
 use OCA\DAV\Connector\Sabre\BearerAuth;
 use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
@@ -30,9 +37,12 @@ use OCA\DAV\Connector\Sabre\CommentPropertiesPlugin;
 use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin;
 use OCA\DAV\Connector\Sabre\DavAclPlugin;
 use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
+use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
 use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
 use OCA\DAV\Connector\Sabre\FilesPlugin;
 use OCA\DAV\Connector\Sabre\FilesReportPlugin;
+use OCA\DAV\Connector\Sabre\LockPlugin;
+use OCA\DAV\Connector\Sabre\MaintenancePlugin;
 use OCA\DAV\Connector\Sabre\PropfindCompressionPlugin;
 use OCA\DAV\Connector\Sabre\QuotaPlugin;
 use OCA\DAV\Connector\Sabre\RequestIdHeaderPlugin;
@@ -45,6 +55,7 @@ use OCA\DAV\DAV\ViewOnlyPlugin;
 use OCA\DAV\Events\SabrePluginAddEvent;
 use OCA\DAV\Events\SabrePluginAuthInitEvent;
 use OCA\DAV\Files\ErrorPagePlugin;
+use OCA\DAV\Files\FileSearchBackend;
 use OCA\DAV\Files\LazySearchBackend;
 use OCA\DAV\Profiler\ProfilerPlugin;
 use OCA\DAV\Provisioning\Apple\AppleProvisioningPlugin;
@@ -53,6 +64,8 @@ use OCA\DAV\Upload\ChunkingPlugin;
 use OCA\DAV\Upload\ChunkingV2Plugin;
 use OCA\Theming\ThemingDefaults;
 use OCP\AppFramework\Http\Response;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Defaults;
 use OCP\Diagnostics\IEventLogger;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\IFilenameValidator;
@@ -62,6 +75,7 @@ use OCP\IConfig;
 use OCP\IPreview;
 use OCP\IRequest;
 use OCP\IUserSession;
+use OCP\Mail\IMailer;
 use OCP\Profiler\IProfiler;
 use OCP\SabrePluginEvent;
 use Psr\Log\LoggerInterface;
@@ -94,9 +108,9 @@ class Server {
                $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
 
                // Add maintenance plugin
-               $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig(), \OC::$server->getL10N('dav')));
+               $this->server->addPlugin(new MaintenancePlugin(\OC::$server->getConfig(), \OC::$server->getL10N('dav')));
 
-               $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\AppleQuirksPlugin());
+               $this->server->addPlugin(new AppleQuirksPlugin());
 
                // Backends
                $authBackend = new Auth(
@@ -144,8 +158,8 @@ class Server {
                        $this->server->addPlugin(new DummyGetResponsePlugin());
                }
 
-               $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
-               $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
+               $this->server->addPlugin(new ExceptionLoggerPlugin('webdav', $logger));
+               $this->server->addPlugin(new LockPlugin());
                $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
 
                // acl
@@ -162,7 +176,7 @@ class Server {
                if ($this->requestIsForSubtree(['calendars', 'public-calendars', 'system-calendars', 'principals'])) {
                        $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest(), \OC::$server->getConfig()));
                        $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
-                       $this->server->addPlugin(new \OCA\DAV\CalDAV\ICSExportPlugin\ICSExportPlugin(\OC::$server->getConfig(), $logger));
+                       $this->server->addPlugin(new ICSExportPlugin(\OC::$server->getConfig(), $logger));
                        $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DefaultCalendarValidator::class)));
 
                        $this->server->addPlugin(\OC::$server->get(\OCA\DAV\CalDAV\Trashbin\Plugin::class));
@@ -172,7 +186,7 @@ class Server {
                        }
 
                        $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
-                       $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
+                       $this->server->addPlugin(new PublishPlugin(
                                \OC::$server->getConfig(),
                                \OC::$server->getURLGenerator()
                        ));
@@ -247,7 +261,7 @@ class Server {
                        $userSession = \OC::$server->getUserSession();
                        $user = $userSession->getUser();
                        if ($user !== null) {
-                               $view = \OC\Files\Filesystem::getView();
+                               $view = Filesystem::getView();
                                $config = \OCP\Server::get(IConfig::class);
                                $this->server->addPlugin(
                                        new FilesPlugin(
@@ -299,14 +313,14 @@ class Server {
                                ));
                                if (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') {
                                        $this->server->addPlugin(new IMipPlugin(
-                                               \OC::$server->get(\OCP\IConfig::class),
-                                               \OC::$server->get(\OCP\Mail\IMailer::class),
+                                               \OC::$server->get(IConfig::class),
+                                               \OC::$server->get(IMailer::class),
                                                \OC::$server->get(LoggerInterface::class),
-                                               \OC::$server->get(\OCP\AppFramework\Utility\ITimeFactory::class),
-                                               \OC::$server->get(\OCP\Defaults::class),
+                                               \OC::$server->get(ITimeFactory::class),
+                                               \OC::$server->get(Defaults::class),
                                                $userSession,
-                                               \OC::$server->get(\OCA\DAV\CalDAV\Schedule\IMipService::class),
-                                               \OC::$server->get(\OCA\DAV\CalDAV\EventComparisonService::class),
+                                               \OC::$server->get(IMipService::class),
+                                               \OC::$server->get(EventComparisonService::class),
                                                \OC::$server->get(\OCP\Mail\Provider\IManager::class)
                                        ));
                                }
@@ -323,7 +337,7 @@ class Server {
                                                $userFolder,
                                                \OC::$server->getAppManager()
                                        ));
-                                       $lazySearchBackend->setBackend(new \OCA\DAV\Files\FileSearchBackend(
+                                       $lazySearchBackend->setBackend(new FileSearchBackend(
                                                $this->server->tree,
                                                $user,
                                                \OC::$server->getRootFolder(),
@@ -338,7 +352,7 @@ class Server {
                                                )
                                        );
                                }
-                               $this->server->addPlugin(new \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin(
+                               $this->server->addPlugin(new EnablePlugin(
                                        \OC::$server->getConfig(),
                                        \OC::$server->query(BirthdayService::class),
                                        $user
index 85000aba6d37bd9e98b4b6e7d90643cf5b32b21b..21e999d34be9866952ef8a8b888a9d59750f9d15 100644 (file)
@@ -10,6 +10,7 @@ namespace OCA\DAV\Tests\unit\BackgroundJob;
 
 use OCA\DAV\BackgroundJob\CleanupInvitationTokenJob;
 use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\DB\QueryBuilder\IExpressionBuilder;
 use OCP\DB\QueryBuilder\IQueryBuilder;
 use OCP\IDBConnection;
 use Test\TestCase;
@@ -21,7 +22,7 @@ class CleanupInvitationTokenJobTest extends TestCase {
        /** @var ITimeFactory | \PHPUnit\Framework\MockObject\MockObject */
        private $timeFactory;
 
-       /** @var \OCA\DAV\BackgroundJob\CleanupInvitationTokenJob */
+       /** @var CleanupInvitationTokenJob */
        private $backgroundJob;
 
        protected function setUp(): void {
@@ -41,7 +42,7 @@ class CleanupInvitationTokenJobTest extends TestCase {
                        ->willReturn(1337);
 
                $queryBuilder = $this->createMock(IQueryBuilder::class);
-               $expr = $this->createMock(\OCP\DB\QueryBuilder\IExpressionBuilder::class);
+               $expr = $this->createMock(IExpressionBuilder::class);
                $stmt = $this->createMock(\Doctrine\DBAL\Driver\Statement::class);
 
                $this->dbConnection->expects($this->once())
index 4874e79b9a2561793cd03a05389b3b371ef7d02c..82d2251f17ab7b8ee77fd0be05b6d58476f5a5ba 100644 (file)
@@ -26,7 +26,7 @@ class GenerateBirthdayCalendarBackgroundJobTest extends TestCase {
        /** @var IConfig | MockObject */
        private $config;
 
-       /** @var \OCA\DAV\BackgroundJob\GenerateBirthdayCalendarBackgroundJob */
+       /** @var GenerateBirthdayCalendarBackgroundJob */
        private $backgroundJob;
 
        protected function setUp(): void {
index 89ef73ec134c58874fdb6fbfc44b2fa75f09af94..f895deb7fd1d9764d2d2870739952fa749a4922c 100644 (file)
@@ -27,7 +27,7 @@ class EnablePluginTest extends TestCase {
        /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
        protected $user;
 
-       /** @var \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin $plugin */
+       /** @var EnablePlugin $plugin */
        protected $plugin;
 
        protected $request;
index 708581f9b6df53f31da546921cc6f8b86ccc14fe..42eb0b0faa3232cafe93a3f14052df1562353890 100644 (file)
@@ -14,6 +14,7 @@ use OCP\IUser;
 use OCP\Mail\IEMailTemplate;
 use OCP\Mail\IMailer;
 use OCP\Mail\IMessage;
+use OCP\Util;
 use PHPUnit\Framework\MockObject\MockObject;
 use Sabre\VObject\Component\VCalendar;
 
@@ -350,7 +351,7 @@ class EmailProviderTest extends AbstractNotificationProviderTest {
 
                $message->expects($this->once())
                        ->method('setFrom')
-                       ->with([\OCP\Util::getDefaultEmailAddress('reminders-noreply')])
+                       ->with([Util::getDefaultEmailAddress('reminders-noreply')])
                        ->willReturn($message);
 
                if ($replyTo) {
index 98d49552b0207161a01114a7659c1475baaf558f..bdb318ee32f54efca8d1279f082bc299055eda6b 100644 (file)
@@ -36,7 +36,7 @@ class NotificationProviderManagerTest extends TestCase {
         * @throws NotificationTypeDoesNotExistException
         */
        public function testGetProviderForUnknownType(): void {
-               $this->expectException(\OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException::class);
+               $this->expectException(NotificationTypeDoesNotExistException::class);
                $this->expectExceptionMessage('Type NOT EXISTENT is not an accepted type of notification');
 
                $this->providerManager->getProvider('NOT EXISTENT');
@@ -47,7 +47,7 @@ class NotificationProviderManagerTest extends TestCase {
         * @throws ProviderNotAvailableException
         */
        public function testGetProviderForUnRegisteredType(): void {
-               $this->expectException(\OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException::class);
+               $this->expectException(ProviderNotAvailableException::class);
                $this->expectExceptionMessage('No notification provider for type AUDIO available');
 
                $this->providerManager->getProvider('AUDIO');
index ed39129fa56b47bbbdd161be4f963180a24d8bd1..b2fd9cfb93f18d9d2889d608c0f91eada6b665fd 100644 (file)
@@ -7,6 +7,8 @@ namespace OCA\DAV\Tests\unit\CalDAV\ResourceBooking;
 
 use OCA\DAV\CalDAV\Proxy\Proxy;
 use OCA\DAV\CalDAV\Proxy\ProxyMapper;
+use OCA\DAV\CalDAV\ResourceBooking\ResourcePrincipalBackend;
+use OCA\DAV\CalDAV\ResourceBooking\RoomPrincipalBackend;
 use OCP\IGroupManager;
 use OCP\IUser;
 use OCP\IUserSession;
@@ -15,7 +17,7 @@ use Sabre\DAV\PropPatch;
 use Test\TestCase;
 
 abstract class AbstractPrincipalBackendTest extends TestCase {
-       /** @var \OCA\DAV\CalDAV\ResourceBooking\ResourcePrincipalBackend|\OCA\DAV\CalDAV\ResourceBooking\RoomPrincipalBackend */
+       /** @var ResourcePrincipalBackend|RoomPrincipalBackend */
        protected $principalBackend;
 
        /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
index ae4519e2542ac7472464607f4c3d61de99bf5970..0da971dc36b24eef0a428a05e6d33d9a46b57c9e 100644 (file)
@@ -14,7 +14,7 @@ use Test\TestCase;
 class SearchPluginTest extends TestCase {
        protected $server;
 
-       /** @var \OCA\DAV\CalDAV\Search\SearchPlugin $plugin */
+       /** @var SearchPlugin $plugin */
        protected $plugin;
 
        protected function setUp(): void {
index b6a8c25477c9cc27d2874f6e484149db87f9db02..2c6b15790424972ca0495129a8421227b8df6150 100644 (file)
@@ -21,7 +21,7 @@ use Test\TestCase;
  */
 class ListAddressbooksTest extends TestCase {
 
-       private \OCP\IUserManager|MockObject $userManager;
+       private IUserManager|MockObject $userManager;
        private CardDavBackend|MockObject $cardDavBackend;
        private ListAddressbooks $command;
 
index 0d4adae250ed98faa1a919a6a2a326e2fe2cdb38..6996022b607dd89c3359a10c8243c679d16a7181 100644 (file)
@@ -7,9 +7,11 @@
  */
 namespace OCA\DAV\Tests\unit\Comments;
 
+use OCA\DAV\Comments\CommentNode;
 use OCA\DAV\Comments\EntityCollection;
 use OCP\Comments\IComment;
 use OCP\Comments\ICommentsManager;
+use OCP\Comments\NotFoundException;
 use OCP\IUserManager;
 use OCP\IUserSession;
 use Psr\Log\LoggerInterface;
@@ -43,7 +45,7 @@ class EntityCollectionTest extends \Test\TestCase {
                        ->disableOriginalConstructor()
                        ->getMock();
 
-               $this->collection = new \OCA\DAV\Comments\EntityCollection(
+               $this->collection = new EntityCollection(
                        '19',
                        'files',
                        $this->commentsManager,
@@ -68,7 +70,7 @@ class EntityCollectionTest extends \Test\TestCase {
                        );
 
                $node = $this->collection->getChild('55');
-               $this->assertTrue($node instanceof \OCA\DAV\Comments\CommentNode);
+               $this->assertTrue($node instanceof CommentNode);
        }
 
 
@@ -78,7 +80,7 @@ class EntityCollectionTest extends \Test\TestCase {
                $this->commentsManager->expects($this->once())
                        ->method('get')
                        ->with('55')
-                       ->will($this->throwException(new \OCP\Comments\NotFoundException()));
+                       ->will($this->throwException(new NotFoundException()));
 
                $this->collection->getChild('55');
        }
@@ -96,7 +98,7 @@ class EntityCollectionTest extends \Test\TestCase {
                $result = $this->collection->getChildren();
 
                $this->assertSame(count($result), 1);
-               $this->assertTrue($result[0] instanceof \OCA\DAV\Comments\CommentNode);
+               $this->assertTrue($result[0] instanceof CommentNode);
        }
 
        public function testFindChildren(): void {
@@ -113,7 +115,7 @@ class EntityCollectionTest extends \Test\TestCase {
                $result = $this->collection->findChildren(5, 15, $dt);
 
                $this->assertSame(count($result), 1);
-               $this->assertTrue($result[0] instanceof \OCA\DAV\Comments\CommentNode);
+               $this->assertTrue($result[0] instanceof CommentNode);
        }
 
        public function testChildExistsTrue(): void {
@@ -124,7 +126,7 @@ class EntityCollectionTest extends \Test\TestCase {
                $this->commentsManager->expects($this->once())
                        ->method('get')
                        ->with('44')
-                       ->will($this->throwException(new \OCP\Comments\NotFoundException()));
+                       ->will($this->throwException(new NotFoundException()));
 
                $this->assertFalse($this->collection->childExists('44'));
        }
index 5ab9c38ecd0880042674c8ce42291c4cb9a356e9..15b8073481cbcddba96f8b1b9839c97cf03b59f7 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\DAV\Tests\unit\Comments;
 
 use OCA\DAV\Comments\EntityCollection as EntityCollectionImplemantation;
+use OCA\DAV\Comments\EntityTypeCollection;
 use OCP\Comments\ICommentsManager;
 use OCP\IUserManager;
 use OCP\IUserSession;
@@ -21,7 +22,7 @@ class EntityTypeCollectionTest extends \Test\TestCase {
        protected $userManager;
        /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
        protected $logger;
-       /** @var \OCA\DAV\Comments\EntityTypeCollection */
+       /** @var EntityTypeCollection */
        protected $collection;
        /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
        protected $userSession;
@@ -46,7 +47,7 @@ class EntityTypeCollectionTest extends \Test\TestCase {
 
                $instance = $this;
 
-               $this->collection = new \OCA\DAV\Comments\EntityTypeCollection(
+               $this->collection = new EntityTypeCollection(
                        'files',
                        $this->commentsManager,
                        $this->userManager,
index 6da96be5818a5e85bae0367ce32179b092d4fe35..8f58e5c3c5f0760891fdb211a4d204a84a1ed00b 100644 (file)
@@ -9,6 +9,7 @@ namespace OCA\DAV\Tests\unit\Comments;
 
 use OC\EventDispatcher\EventDispatcher;
 use OCA\DAV\Comments\EntityTypeCollection as EntityTypeCollectionImplementation;
+use OCA\DAV\Comments\RootCollection;
 use OCP\Comments\CommentsEntityEvent;
 use OCP\Comments\ICommentsManager;
 use OCP\EventDispatcher\IEventDispatcher;
@@ -25,7 +26,7 @@ class RootCollectionTest extends \Test\TestCase {
        protected $userManager;
        /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
        protected $logger;
-       /** @var \OCA\DAV\Comments\RootCollection */
+       /** @var RootCollection */
        protected $collection;
        /** @var \OCP\IUserSession|\PHPUnit\Framework\MockObject\MockObject */
        protected $userSession;
@@ -59,7 +60,7 @@ class RootCollectionTest extends \Test\TestCase {
                        $this->logger
                );
 
-               $this->collection = new \OCA\DAV\Comments\RootCollection(
+               $this->collection = new RootCollection(
                        $this->commentsManager,
                        $this->userManager,
                        $this->userSession,
index 4f3581d607180722896d1002e8c1dc9ab014d3fe..2bb683741627e5e06de8d9b82e76f887bc097450 100644 (file)
@@ -7,6 +7,7 @@
  */
 namespace OCA\DAV\Tests\unit\Connector;
 
+use OCA\DAV\Connector\LegacyPublicAuth;
 use OCP\IRequest;
 use OCP\ISession;
 use OCP\Security\Bruteforce\IThrottler;
@@ -29,7 +30,7 @@ class LegacyPublicAuthTest extends \Test\TestCase {
        private $request;
        /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
        private $shareManager;
-       /** @var \OCA\DAV\Connector\LegacyPublicAuth */
+       /** @var LegacyPublicAuth */
        private $auth;
        /** @var IThrottler|\PHPUnit\Framework\MockObject\MockObject */
        private $throttler;
@@ -53,7 +54,7 @@ class LegacyPublicAuthTest extends \Test\TestCase {
                        ->disableOriginalConstructor()
                        ->getMock();
 
-               $this->auth = new \OCA\DAV\Connector\LegacyPublicAuth(
+               $this->auth = new LegacyPublicAuth(
                        $this->request,
                        $this->shareManager,
                        $this->session,
index de258c9aaec5e4ba5479246e77ce56ae72fe6f10..c6d247b395167b01a2e455b5d37b50f42bd552da 100644 (file)
@@ -7,8 +7,11 @@
  */
 namespace OCA\DAV\Tests\unit\Connector\Sabre;
 
+use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
 use OC\Authentication\TwoFactorAuth\Manager;
 use OC\User\Session;
+use OCA\DAV\Connector\Sabre\Auth;
+use OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden;
 use OCP\IRequest;
 use OCP\ISession;
 use OCP\IUser;
@@ -28,7 +31,7 @@ use Test\TestCase;
 class AuthTest extends TestCase {
        /** @var ISession&MockObject */
        private $session;
-       /** @var \OCA\DAV\Connector\Sabre\Auth */
+       /** @var Auth */
        private $auth;
        /** @var Session&MockObject */
        private $userSession;
@@ -53,7 +56,7 @@ class AuthTest extends TestCase {
                $this->throttler = $this->getMockBuilder(IThrottler::class)
                        ->disableOriginalConstructor()
                        ->getMock();
-               $this->auth = new \OCA\DAV\Connector\Sabre\Auth(
+               $this->auth = new Auth(
                        $this->session,
                        $this->userSession,
                        $this->request,
@@ -201,7 +204,7 @@ class AuthTest extends TestCase {
 
 
        public function testValidateUserPassWithPasswordLoginForbidden(): void {
-               $this->expectException(\OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden::class);
+               $this->expectException(PasswordLoginForbidden::class);
 
                $this->userSession
                        ->expects($this->once())
@@ -211,7 +214,7 @@ class AuthTest extends TestCase {
                        ->expects($this->once())
                        ->method('logClientIn')
                        ->with('MyTestUser', 'MyTestPassword')
-                       ->will($this->throwException(new \OC\Authentication\Exceptions\PasswordLoginForbiddenException()));
+                       ->will($this->throwException(new PasswordLoginForbiddenException()));
                $this->session
                        ->expects($this->once())
                        ->method('close');
index 9922dee5e6eff42cc6c1e9ad944da9e022e7b32e..06c070454af8bca32cb50c8f58785e532a4fb2b4 100644 (file)
@@ -5,6 +5,7 @@
  */
 namespace OCA\DAV\Tests\unit\Connector\Sabre;
 
+use OC\User\Session;
 use OCA\DAV\Connector\Sabre\BearerAuth;
 use OCP\IRequest;
 use OCP\ISession;
@@ -30,7 +31,7 @@ class BearerAuthTest extends TestCase {
        protected function setUp(): void {
                parent::setUp();
 
-               $this->userSession = $this->createMock(\OC\User\Session::class);
+               $this->userSession = $this->createMock(Session::class);
                $this->session = $this->createMock(ISession::class);
                $this->request = $this->createMock(IRequest::class);
 
index 7da38afdf3ad15cf06c943cc58111987371774e6..3f134745f869227502f2627e2aaac4c1e64fc1a4 100644 (file)
@@ -10,6 +10,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
 use OCA\DAV\CalDAV\DefaultCalendarValidator;
 use OCA\DAV\Connector\Sabre\Directory;
 use OCA\DAV\Connector\Sabre\File;
+use OCA\DAV\DAV\CustomPropertiesBackend;
 use OCP\IUser;
 use PHPUnit\Framework\MockObject\MockObject;
 use Sabre\DAV\Tree;
@@ -34,7 +35,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
        private $tree;
 
        /**
-        * @var \OCA\DAV\DAV\CustomPropertiesBackend
+        * @var CustomPropertiesBackend
         */
        private $plugin;
 
@@ -64,7 +65,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
 
                $this->defaultCalendarValidator = $this->createMock(DefaultCalendarValidator::class);
 
-               $this->plugin = new \OCA\DAV\DAV\CustomPropertiesBackend(
+               $this->plugin = new CustomPropertiesBackend(
                        $this->server,
                        $this->tree,
                        \OC::$server->getDatabaseConnection(),
index 3490937a543e9f82573a2da2997568fe3f2dbd8d..d659b01d03997d4a57cf4aeddf2fa8b5621668c9 100644 (file)
@@ -13,12 +13,16 @@ use OC\Files\Node\Node;
 use OC\Files\Storage\Wrapper\Quota;
 use OC\Files\View;
 use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\Exception\Forbidden;
+use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
 use OCP\Constants;
 use OCP\Files\ForbiddenException;
+use OCP\Files\InvalidPathException;
 use OCP\Files\Mount\IMountPoint;
+use OCP\Files\StorageNotAvailableException;
 use Test\Traits\UserTrait;
 
-class TestViewDirectory extends \OC\Files\View {
+class TestViewDirectory extends View {
        private $updatables;
        private $deletables;
        private $canRename;
@@ -106,7 +110,7 @@ class DirectoryTest extends \Test\TestCase {
 
 
        public function testDeleteForbidden(): void {
-               $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
+               $this->expectException(Forbidden::class);
 
                // deletion allowed
                $this->info->expects($this->once())
@@ -250,7 +254,7 @@ class DirectoryTest extends \Test\TestCase {
 
                $this->view->expects($this->once())
                        ->method('getFileInfo')
-                       ->willThrowException(new \OCP\Files\StorageNotAvailableException());
+                       ->willThrowException(new StorageNotAvailableException());
 
                $dir = new Directory($this->view, $this->info);
                $dir->getChild('.');
@@ -258,11 +262,11 @@ class DirectoryTest extends \Test\TestCase {
 
 
        public function testGetChildThrowInvalidPath(): void {
-               $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
+               $this->expectException(InvalidPath::class);
 
                $this->view->expects($this->once())
                        ->method('verifyPath')
-                       ->willThrowException(new \OCP\Files\InvalidPathException());
+                       ->willThrowException(new InvalidPathException());
                $this->view->expects($this->never())
                        ->method('getFileInfo');
 
@@ -398,7 +402,7 @@ class DirectoryTest extends \Test\TestCase {
         * @dataProvider moveFailedInvalidCharsProvider
         */
        public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables): void {
-               $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
+               $this->expectException(InvalidPath::class);
 
                $this->moveTest($source, $destination, $updatables, $deletables);
        }
index 55a6783225d8e3cd1ad589dd9e7aea279d3b8a0e..ef02f145375332c355069cfbb400031727fbb08f 100644 (file)
@@ -13,16 +13,29 @@ use OC\Files\Storage\Local;
 use OC\Files\Storage\Temporary;
 use OC\Files\Storage\Wrapper\PermissionsMask;
 use OC\Files\View;
+use OCA\DAV\Connector\Sabre\Exception\FileLocked;
+use OCA\DAV\Connector\Sabre\Exception\Forbidden;
+use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
 use OCA\DAV\Connector\Sabre\File;
 use OCP\Constants;
+use OCP\Encryption\Exceptions\GenericEncryptionException;
+use OCP\Files\EntityTooLargeException;
 use OCP\Files\FileInfo;
 use OCP\Files\ForbiddenException;
+use OCP\Files\InvalidContentException;
+use OCP\Files\InvalidPathException;
+use OCP\Files\LockNotAcquiredException;
+use OCP\Files\NotPermittedException;
 use OCP\Files\Storage\IStorage;
+use OCP\Files\StorageNotAvailableException;
 use OCP\IConfig;
 use OCP\IRequestId;
 use OCP\ITempManager;
 use OCP\IUserManager;
 use OCP\Lock\ILockingProvider;
+use OCP\Lock\LockedException;
+use OCP\Server;
+use OCP\Util;
 use PHPUnit\Framework\MockObject\MockObject;
 use Test\HookHelper;
 use Test\TestCase;
@@ -66,7 +79,7 @@ class FileTest extends TestCase {
        }
 
        protected function tearDown(): void {
-               $userManager = \OCP\Server::get(IUserManager::class);
+               $userManager = Server::get(IUserManager::class);
                $userManager->get($this->user)->delete();
 
                parent::tearDown();
@@ -98,39 +111,39 @@ class FileTest extends TestCase {
                                false
                        ],
                        [
-                               new \OCP\Files\NotPermittedException(),
+                               new NotPermittedException(),
                                'Sabre\DAV\Exception\Forbidden'
                        ],
                        [
-                               new \OCP\Files\EntityTooLargeException(),
+                               new EntityTooLargeException(),
                                'OCA\DAV\Connector\Sabre\Exception\EntityTooLarge'
                        ],
                        [
-                               new \OCP\Files\InvalidContentException(),
+                               new InvalidContentException(),
                                'OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType'
                        ],
                        [
-                               new \OCP\Files\InvalidPathException(),
+                               new InvalidPathException(),
                                'Sabre\DAV\Exception\Forbidden'
                        ],
                        [
-                               new \OCP\Files\ForbiddenException('', true),
+                               new ForbiddenException('', true),
                                'OCA\DAV\Connector\Sabre\Exception\Forbidden'
                        ],
                        [
-                               new \OCP\Files\LockNotAcquiredException('/test.txt', 1),
+                               new LockNotAcquiredException('/test.txt', 1),
                                'OCA\DAV\Connector\Sabre\Exception\FileLocked'
                        ],
                        [
-                               new \OCP\Lock\LockedException('/test.txt'),
+                               new LockedException('/test.txt'),
                                'OCA\DAV\Connector\Sabre\Exception\FileLocked'
                        ],
                        [
-                               new \OCP\Encryption\Exceptions\GenericEncryptionException(),
+                               new GenericEncryptionException(),
                                'Sabre\DAV\Exception\ServiceUnavailable'
                        ],
                        [
-                               new \OCP\Files\StorageNotAvailableException(),
+                               new StorageNotAvailableException(),
                                'Sabre\DAV\Exception\ServiceUnavailable'
                        ],
                        [
@@ -152,9 +165,9 @@ class FileTest extends TestCase {
                // setup
                $storage = $this->getMockBuilder(Local::class)
                        ->onlyMethods(['writeStream'])
-                       ->setConstructorArgs([['datadir' => \OCP\Server::get(ITempManager::class)->getTemporaryFolder()]])
+                       ->setConstructorArgs([['datadir' => Server::get(ITempManager::class)->getTemporaryFolder()]])
                        ->getMock();
-               \OC\Files\Filesystem::mount($storage, [], $this->user . '/');
+               Filesystem::mount($storage, [], $this->user . '/');
                /** @var View | MockObject $view */
                $view = $this->getMockBuilder(View::class)
                        ->onlyMethods(['getRelativePath', 'resolvePath'])
@@ -182,11 +195,11 @@ class FileTest extends TestCase {
                        ->willReturnArgument(0);
 
                $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                // action
                $caughtException = null;
@@ -214,9 +227,9 @@ class FileTest extends TestCase {
         * @return null|string of the PUT operation which is usually the etag
         */
        private function doPut($path, $viewRoot = null, ?Request $request = null) {
-               $view = \OC\Files\Filesystem::getView();
+               $view = Filesystem::getView();
                if (!is_null($viewRoot)) {
-                       $view = new \OC\Files\View($viewRoot);
+                       $view = new View($viewRoot);
                } else {
                        $viewRoot = '/' . $this->user . '/files';
                }
@@ -226,14 +239,14 @@ class FileTest extends TestCase {
                        $this->getMockStorage(),
                        null,
                        [
-                               'permissions' => \OCP\Constants::PERMISSION_ALL,
+                               'permissions' => Constants::PERMISSION_ALL,
                                'type' => FileInfo::TYPE_FOLDER,
                        ],
                        null
                );
 
-               /** @var \OCA\DAV\Connector\Sabre\File | MockObject $file */
-               $file = $this->getMockBuilder(\OCA\DAV\Connector\Sabre\File::class)
+               /** @var File|MockObject $file */
+               $file = $this->getMockBuilder(File::class)
                        ->setConstructorArgs([$view, $info, null, $request])
                        ->onlyMethods(['header'])
                        ->getMock();
@@ -367,7 +380,7 @@ class FileTest extends TestCase {
         * Test that putting a file triggers update hooks
         */
        public function testPutOverwriteFileTriggersHooks(): void {
-               $view = \OC\Files\Filesystem::getView();
+               $view = Filesystem::getView();
                $view->file_put_contents('/foo.txt', 'some content that will be replaced');
 
                HookHelper::setUpHooks();
@@ -403,7 +416,7 @@ class FileTest extends TestCase {
         * where the root is the share root)
         */
        public function testPutSingleFileTriggersHooksDifferentRoot(): void {
-               $view = \OC\Files\Filesystem::getView();
+               $view = Filesystem::getView();
                $view->mkdir('noderoot');
 
                HookHelper::setUpHooks();
@@ -445,7 +458,7 @@ class FileTest extends TestCase {
         * Test put file with cancelled hook
         */
        public function testPutSingleFileCancelPreHook(): void {
-               \OCP\Util::connectHook(
+               Util::connectHook(
                        Filesystem::CLASSNAME,
                        Filesystem::signal_create,
                        '\Test\HookHelper',
@@ -493,11 +506,11 @@ class FileTest extends TestCase {
                ], $this->requestId, $this->config, null);
 
                $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info, null, $request);
+               $file = new File($view, $info, null, $request);
 
                // action
                $thrown = false;
@@ -521,17 +534,17 @@ class FileTest extends TestCase {
         * Test exception during final rename in simple upload mode
         */
        public function testSimplePutFailsMoveFromStorage(): void {
-               $view = new \OC\Files\View('/' . $this->user . '/files');
+               $view = new View('/' . $this->user . '/files');
 
                // simulate situation where the target file is locked
                $view->lockFile('/test.txt', ILockingProvider::LOCK_EXCLUSIVE);
 
                $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                // action
                $thrown = false;
@@ -543,7 +556,7 @@ class FileTest extends TestCase {
 
                        // afterMethod unlocks
                        $view->unlockFile($info->getPath(), ILockingProvider::LOCK_SHARED);
-               } catch (\OCA\DAV\Connector\Sabre\Exception\FileLocked $e) {
+               } catch (FileLocked $e) {
                        $thrown = true;
                }
 
@@ -565,10 +578,10 @@ class FileTest extends TestCase {
                        ->willReturnArgument(0);
 
                $info = new \OC\Files\FileInfo("/i\nvalid", $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                // action
                $thrown = false;
@@ -580,7 +593,7 @@ class FileTest extends TestCase {
 
                        // afterMethod unlocks
                        $view->unlockFile($info->getPath(), ILockingProvider::LOCK_SHARED);
-               } catch (\OCA\DAV\Connector\Sabre\Exception\InvalidPath $e) {
+               } catch (InvalidPath $e) {
                        $thrown = true;
                }
 
@@ -593,7 +606,7 @@ class FileTest extends TestCase {
         *
         */
        public function testSetNameInvalidChars(): void {
-               $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
+               $this->expectException(InvalidPath::class);
 
                // setup
                /** @var View|MockObject */
@@ -606,10 +619,10 @@ class FileTest extends TestCase {
                        ->willReturnArgument(0);
 
                $info = new \OC\Files\FileInfo('/valid', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                $file->setName("/i\nvalid");
        }
@@ -640,11 +653,11 @@ class FileTest extends TestCase {
                ], $this->requestId, $this->config, null);
 
                $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info, null, $request);
+               $file = new File($view, $info, null, $request);
 
                // action
                $thrown = false;
@@ -676,11 +689,11 @@ class FileTest extends TestCase {
                        ->willReturn(true);
 
                $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                // action
                $file->delete();
@@ -700,7 +713,7 @@ class FileTest extends TestCase {
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                // action
                $file->delete();
@@ -721,11 +734,11 @@ class FileTest extends TestCase {
                        ->willReturn(false);
 
                $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                // action
                $file->delete();
@@ -733,7 +746,7 @@ class FileTest extends TestCase {
 
 
        public function testDeleteThrowsWhenDeletionThrows(): void {
-               $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
+               $this->expectException(Forbidden::class);
 
                // setup
                /** @var View|MockObject */
@@ -746,11 +759,11 @@ class FileTest extends TestCase {
                        ->willThrowException(new ForbiddenException('', true));
 
                $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                // action
                $file->delete();
@@ -776,7 +789,7 @@ class FileTest extends TestCase {
         * Test whether locks are set before and after the operation
         */
        public function testPutLocking(): void {
-               $view = new \OC\Files\View('/' . $this->user . '/files/');
+               $view = new View('/' . $this->user . '/files/');
 
                $path = 'test-locking.txt';
                $info = new \OC\Files\FileInfo(
@@ -784,20 +797,20 @@ class FileTest extends TestCase {
                        $this->getMockStorage(),
                        null,
                        [
-                               'permissions' => \OCP\Constants::PERMISSION_ALL,
+                               'permissions' => Constants::PERMISSION_ALL,
                                'type' => FileInfo::TYPE_FOLDER,
                        ],
                        null
                );
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                $this->assertFalse(
-                       $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED),
+                       $this->isFileLocked($view, $path, ILockingProvider::LOCK_SHARED),
                        'File unlocked before put'
                );
                $this->assertFalse(
-                       $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE),
+                       $this->isFileLocked($view, $path, ILockingProvider::LOCK_EXCLUSIVE),
                        'File unlocked before put'
                );
 
@@ -813,26 +826,26 @@ class FileTest extends TestCase {
                        ->method('writeCallback')
                        ->willReturnCallback(
                                function () use ($view, $path, &$wasLockedPre): void {
-                                       $wasLockedPre = $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED);
-                                       $wasLockedPre = $wasLockedPre && !$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE);
+                                       $wasLockedPre = $this->isFileLocked($view, $path, ILockingProvider::LOCK_SHARED);
+                                       $wasLockedPre = $wasLockedPre && !$this->isFileLocked($view, $path, ILockingProvider::LOCK_EXCLUSIVE);
                                }
                        );
                $eventHandler->expects($this->once())
                        ->method('postWriteCallback')
                        ->willReturnCallback(
                                function () use ($view, $path, &$wasLockedPost): void {
-                                       $wasLockedPost = $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED);
-                                       $wasLockedPost = $wasLockedPost && !$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE);
+                                       $wasLockedPost = $this->isFileLocked($view, $path, ILockingProvider::LOCK_SHARED);
+                                       $wasLockedPost = $wasLockedPost && !$this->isFileLocked($view, $path, ILockingProvider::LOCK_EXCLUSIVE);
                                }
                        );
 
-               \OCP\Util::connectHook(
+               Util::connectHook(
                        Filesystem::CLASSNAME,
                        Filesystem::signal_write,
                        $eventHandler,
                        'writeCallback'
                );
-               \OCP\Util::connectHook(
+               Util::connectHook(
                        Filesystem::CLASSNAME,
                        Filesystem::signal_post_write,
                        $eventHandler,
@@ -851,11 +864,11 @@ class FileTest extends TestCase {
                $this->assertTrue($wasLockedPost, 'File was locked during post-hooks');
 
                $this->assertFalse(
-                       $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED),
+                       $this->isFileLocked($view, $path, ILockingProvider::LOCK_SHARED),
                        'File unlocked after put'
                );
                $this->assertFalse(
-                       $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE),
+                       $this->isFileLocked($view, $path, ILockingProvider::LOCK_EXCLUSIVE),
                        'File unlocked after put'
                );
        }
@@ -868,9 +881,9 @@ class FileTest extends TestCase {
         *
         * @return array list of part files
         */
-       private function listPartFiles(?\OC\Files\View $userView = null, $path = '') {
+       private function listPartFiles(?View $userView = null, $path = '') {
                if ($userView === null) {
-                       $userView = \OC\Files\Filesystem::getView();
+                       $userView = Filesystem::getView();
                }
                $files = [];
                [$storage, $internalPath] = $userView->resolvePath($path);
@@ -919,18 +932,18 @@ class FileTest extends TestCase {
                        ->willReturn(false);
 
                $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FILE,
                ], null);
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                $file->get();
        }
 
 
        public function testGetFopenThrows(): void {
-               $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
+               $this->expectException(Forbidden::class);
 
                /** @var View|MockObject */
                $view = $this->getMockBuilder(View::class)
@@ -941,11 +954,11 @@ class FileTest extends TestCase {
                        ->willThrowException(new ForbiddenException('', true));
 
                $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_ALL,
+                       'permissions' => Constants::PERMISSION_ALL,
                        'type' => FileInfo::TYPE_FILE,
                ], null);
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                $file->get();
        }
@@ -962,11 +975,11 @@ class FileTest extends TestCase {
                        ->method('fopen');
 
                $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
-                       'permissions' => \OCP\Constants::PERMISSION_CREATE, // no read perm
+                       'permissions' => Constants::PERMISSION_CREATE, // no read perm
                        'type' => FileInfo::TYPE_FOLDER,
                ], null);
 
-               $file = new  \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new  File($view, $info);
 
                $file->get();
        }
@@ -1003,7 +1016,7 @@ class FileTest extends TestCase {
        }
 
        public function testPutLockExpired(): void {
-               $view = new \OC\Files\View('/' . $this->user . '/files/');
+               $view = new View('/' . $this->user . '/files/');
 
                $path = 'test-locking.txt';
                $info = new \OC\Files\FileInfo(
@@ -1011,13 +1024,13 @@ class FileTest extends TestCase {
                        $this->getMockStorage(),
                        null,
                        [
-                               'permissions' => \OCP\Constants::PERMISSION_ALL,
+                               'permissions' => Constants::PERMISSION_ALL,
                                'type' => FileInfo::TYPE_FOLDER,
                        ],
                        null
                );
 
-               $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $file = new File($view, $info);
 
                // don't lock before the PUT to simulate an expired shared lock
                $this->assertNotEmpty($file->put($this->getStream('test data')));
index 9d8f4e8d4c4f7069084131b685444205a406a391..db07165ebf086dafdca9a081cfc40cb38dd2ef1a 100644 (file)
@@ -123,7 +123,7 @@ class FilesPluginTest extends TestCase {
        }
 
        public function testGetPropertiesForFile(): void {
-               /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */
+               /** @var File|\PHPUnit\Framework\MockObject\MockObject $node */
                $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
 
                $propFind = new PropFind(
@@ -180,7 +180,7 @@ class FilesPluginTest extends TestCase {
        }
 
        public function testGetPropertiesStorageNotAvailable(): void {
-               /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */
+               /** @var File|\PHPUnit\Framework\MockObject\MockObject $node */
                $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
 
                $propFind = new PropFind(
@@ -227,7 +227,7 @@ class FilesPluginTest extends TestCase {
                        0
                );
 
-               /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */
+               /** @var File|\PHPUnit\Framework\MockObject\MockObject $node */
                $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
                $node->expects($this->any())
                        ->method('getDavPermissions')
@@ -242,7 +242,7 @@ class FilesPluginTest extends TestCase {
        }
 
        public function testGetPropertiesForDirectory(): void {
-               /** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit\Framework\MockObject\MockObject $node */
+               /** @var Directory|\PHPUnit\Framework\MockObject\MockObject $node */
                $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
 
                $propFind = new PropFind(
@@ -277,7 +277,7 @@ class FilesPluginTest extends TestCase {
        }
 
        public function testGetPropertiesForRootDirectory(): void {
-               /** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit\Framework\MockObject\MockObject $node */
+               /** @var Directory|\PHPUnit\Framework\MockObject\MockObject $node */
                $node = $this->getMockBuilder(Directory::class)
                        ->disableOriginalConstructor()
                        ->getMock();
@@ -312,8 +312,7 @@ class FilesPluginTest extends TestCase {
                // No read permissions can be caused by files access control.
                // But we still want to load the directory list, so this is okay for us.
                // $this->expectException(\Sabre\DAV\Exception\NotFound::class);
-
-               /** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit\Framework\MockObject\MockObject $node */
+               /** @var Directory|\PHPUnit\Framework\MockObject\MockObject $node */
                $node = $this->getMockBuilder(Directory::class)
                        ->disableOriginalConstructor()
                        ->getMock();
@@ -614,7 +613,7 @@ class FilesPluginTest extends TestCase {
        }
 
        public function testHasPreview(): void {
-               /** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit\Framework\MockObject\MockObject $node */
+               /** @var Directory|\PHPUnit\Framework\MockObject\MockObject $node */
                $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
 
                $propFind = new PropFind(
index 76a70a93e13139abcf087f19e894cdf9b81d3ed6..8b169dcd46fe7ec9b0aeb5a16f5f5b52b039384f 100644 (file)
@@ -9,6 +9,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
 
 use OC\Files\View;
 use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\FilesPlugin;
 use OCA\DAV\Connector\Sabre\FilesReportPlugin as FilesReportPluginImplementation;
 use OCP\App\IAppManager;
 use OCP\Files\File;
@@ -289,7 +290,7 @@ class FilesReportPluginTest extends \Test\TestCase {
                                $filesNode2,
                        );
 
-               /** @var \OCA\DAV\Connector\Sabre\Directory&MockObject $reportTargetNode */
+               /** @var Directory&MockObject $reportTargetNode */
                $result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']);
 
                $this->assertCount(2, $result);
@@ -342,7 +343,7 @@ class FilesReportPluginTest extends \Test\TestCase {
                                $filesNode2,
                        );
 
-               /** @var \OCA\DAV\Connector\Sabre\Directory&MockObject $reportTargetNode */
+               /** @var Directory&MockObject $reportTargetNode */
                $result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']);
 
                $this->assertCount(2, $result);
@@ -390,7 +391,7 @@ class FilesReportPluginTest extends \Test\TestCase {
                $validator = $this->createMock(IFilenameValidator::class);
 
                $this->server->addPlugin(
-                       new \OCA\DAV\Connector\Sabre\FilesPlugin(
+                       new FilesPlugin(
                                $this->tree,
                                $config,
                                $this->createMock(IRequest::class),
index c5e2b03d8b48158ff38eac46f1606625567b67d4..04cd60fbdaa014f5dad1658d0ecd66fb67c00c32 100644 (file)
@@ -13,6 +13,7 @@ use OC\Files\Mount\MountPoint;
 use OC\Files\Node\Folder;
 use OC\Files\View;
 use OC\Share20\ShareAttributes;
+use OCA\DAV\Connector\Sabre\File;
 use OCA\Files_Sharing\SharedMount;
 use OCA\Files_Sharing\SharedStorage;
 use OCP\Constants;
@@ -97,7 +98,7 @@ class NodeTest extends \Test\TestCase {
                        ->disableOriginalConstructor()
                        ->getMock();
 
-               $node = new  \OCA\DAV\Connector\Sabre\File($view, $info);
+               $node = new  File($view, $info);
                $this->assertEquals($expected, $node->getDavPermissions());
        }
 
@@ -180,7 +181,7 @@ class NodeTest extends \Test\TestCase {
                        ->disableOriginalConstructor()
                        ->getMock();
 
-               $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $node = new File($view, $info);
                $this->invokePrivate($node, 'shareManager', [$shareManager]);
                $this->assertEquals($expected, $node->getSharePermissions($user));
        }
@@ -217,7 +218,7 @@ class NodeTest extends \Test\TestCase {
                        ->disableOriginalConstructor()
                        ->getMock();
 
-               $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $node = new File($view, $info);
                $this->invokePrivate($node, 'shareManager', [$shareManager]);
                $this->assertEquals($attributes->toArray(), $node->getShareAttributes());
        }
@@ -243,7 +244,7 @@ class NodeTest extends \Test\TestCase {
                        ->disableOriginalConstructor()
                        ->getMock();
 
-               $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $node = new File($view, $info);
                $this->invokePrivate($node, 'shareManager', [$shareManager]);
                $this->assertEquals([], $node->getShareAttributes());
        }
@@ -266,7 +267,7 @@ class NodeTest extends \Test\TestCase {
                        ->disableOriginalConstructor()
                        ->getMock();
 
-               $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $node = new File($view, $info);
                $result = $this->invokePrivate($node, 'sanitizeMtime', [$mtime]);
                $this->assertEquals($expected, $result);
        }
@@ -290,7 +291,7 @@ class NodeTest extends \Test\TestCase {
                        ->disableOriginalConstructor()
                        ->getMock();
 
-               $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+               $node = new File($view, $info);
                $result = $this->invokePrivate($node, 'sanitizeMtime', [$mtime]);
        }
 }
index 4f2e5174325db9903760f9b62690ef50b5571522..393f3c72c205b97c643b8486ff13d674b271e6f0 100644 (file)
@@ -10,9 +10,12 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
 use OC\Files\FileInfo;
 use OC\Files\Filesystem;
 use OC\Files\Mount\Manager;
+use OC\Files\Storage\Common;
 use OC\Files\Storage\Temporary;
 use OC\Files\View;
 use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
+use OCA\DAV\Connector\Sabre\File;
 use OCA\DAV\Connector\Sabre\ObjectTree;
 use OCP\Files\Mount\IMountManager;
 
@@ -73,7 +76,7 @@ class ObjectTreeTest extends \Test\TestCase {
                        ->with($this->identicalTo($sourcePath))
                        ->willReturn(false);
 
-               /** @var \OCA\DAV\Connector\Sabre\ObjectTree $objectTree */
+               /** @var ObjectTree $objectTree */
                $mountManager = Filesystem::getMountManager();
                $objectTree->init($rootDir, $view, $mountManager);
                $objectTree->copy($sourcePath, $targetPath);
@@ -114,7 +117,7 @@ class ObjectTreeTest extends \Test\TestCase {
                $objectTree->expects($this->never())
                        ->method('getNodeForPath');
 
-               /** @var \OCA\DAV\Connector\Sabre\ObjectTree $objectTree */
+               /** @var ObjectTree $objectTree */
                $mountManager = Filesystem::getMountManager();
                $objectTree->init($rootDir, $view, $mountManager);
                $objectTree->copy($sourcePath, $targetPath);
@@ -146,13 +149,13 @@ class ObjectTreeTest extends \Test\TestCase {
                $fileInfo->method('getName')
                        ->willReturn($outputFileName);
                $fileInfo->method('getStorage')
-                       ->willReturn($this->createMock(\OC\Files\Storage\Common::class));
+                       ->willReturn($this->createMock(Common::class));
 
                $view->method('getFileInfo')
                        ->with($fileInfoQueryPath)
                        ->willReturn($fileInfo);
 
-               $tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
+               $tree = new ObjectTree();
                $tree->init($rootNode, $view, $mountManager);
 
                $node = $tree->getNodeForPath($inputFileName);
@@ -161,9 +164,9 @@ class ObjectTreeTest extends \Test\TestCase {
                $this->assertEquals($outputFileName, $node->getName());
 
                if ($type === 'file') {
-                       $this->assertTrue($node instanceof \OCA\DAV\Connector\Sabre\File);
+                       $this->assertTrue($node instanceof File);
                } else {
-                       $this->assertTrue($node instanceof \OCA\DAV\Connector\Sabre\Directory);
+                       $this->assertTrue($node instanceof Directory);
                }
        }
 
@@ -202,7 +205,7 @@ class ObjectTreeTest extends \Test\TestCase {
 
 
        public function testGetNodeForPathInvalidPath(): void {
-               $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
+               $this->expectException(InvalidPath::class);
 
                $path = '/foo\bar';
 
@@ -223,7 +226,7 @@ class ObjectTreeTest extends \Test\TestCase {
                        ->getMock();
                $mountManager = $this->createMock(IMountManager::class);
 
-               $tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
+               $tree = new ObjectTree();
                $tree->init($rootNode, $view, $mountManager);
 
                $tree->getNodeForPath($path);
@@ -249,7 +252,7 @@ class ObjectTreeTest extends \Test\TestCase {
                        ->getMock();
                $mountManager = $this->createMock(IMountManager::class);
 
-               $tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
+               $tree = new ObjectTree();
                $tree->init($rootNode, $view, $mountManager);
 
                $this->assertInstanceOf('\Sabre\DAV\INode', $tree->getNodeForPath($path));
index b6c91cd7ae505839a40938f3d0f4ef8079210c03..00bddf2e69cd452589e082595d1d362011f2c513 100644 (file)
@@ -7,6 +7,7 @@
  */
 namespace OCA\DAV\Tests\unit\Connector;
 
+use OCA\DAV\Connector\Sabre\PublicAuth;
 use OCP\IRequest;
 use OCP\ISession;
 use OCP\Security\Bruteforce\IThrottler;
@@ -49,7 +50,7 @@ class PublicAuthTest extends \Test\TestCase {
                $this->throttler = $this->createMock(IThrottler::class);
                $this->logger = $this->createMock(LoggerInterface::class);
 
-               $this->auth = new \OCA\DAV\Connector\Sabre\PublicAuth(
+               $this->auth = new PublicAuth(
                        $this->request,
                        $this->shareManager,
                        $this->session,
index 815837799fd245509cb02cdf77064bbfe79e1d4e..c370e0fb0f76282af0a7f0df1d7df0cd44466ba5 100644 (file)
@@ -16,7 +16,7 @@ class QuotaPluginTest extends TestCase {
        /** @var \Sabre\DAV\Server | \PHPUnit\Framework\MockObject\MockObject */
        private $server;
 
-       /** @var \OCA\DAV\Connector\Sabre\QuotaPlugin | \PHPUnit\Framework\MockObject\MockObject */
+       /** @var QuotaPlugin|\PHPUnit\Framework\MockObject\MockObject */
        private $plugin;
 
        private function init($quota, $checkedPath = ''): void {
index 9b20b2f86304aaf66b8c724b201b20e87f61e90b..b1e68f9597b22b6ad933c27015eda3af78866aca 100644 (file)
@@ -7,7 +7,9 @@
  */
 namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
 
-class ExceptionPlugin extends \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin {
+use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
+
+class ExceptionPlugin extends ExceptionLoggerPlugin {
        /**
         * @var \Throwable[]
         */
index 29574d53bca25f1b06b75c4dd71cb2134fbb570a..67c2aa61430a88e9ed4c0f241f47fb7ab8322cda 100644 (file)
@@ -25,7 +25,7 @@ abstract class RequestTestCase extends TestCase {
        use MountProviderTrait;
 
        /**
-        * @var \OCA\DAV\Connector\Sabre\ServerFactory
+        * @var ServerFactory
         */
        protected $serverFactory;
 
index 546be840cd8f9571a6afeb67699d943fffd6bf7e..125fe3959bbde8a4cee2cb74aac68c3dbfe1bd4d 100644 (file)
@@ -10,6 +10,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
 use OCA\DAV\Connector\Sabre\Directory;
 use OCA\DAV\Connector\Sabre\File;
 use OCA\DAV\Connector\Sabre\Node;
+use OCA\DAV\Connector\Sabre\SharesPlugin;
 use OCA\DAV\Upload\UploadFile;
 use OCP\Files\Folder;
 use OCP\IUser;
@@ -19,7 +20,7 @@ use OCP\Share\IShare;
 use Sabre\DAV\Tree;
 
 class SharesPluginTest extends \Test\TestCase {
-       public const SHARETYPES_PROPERTYNAME = \OCA\DAV\Connector\Sabre\SharesPlugin::SHARETYPES_PROPERTYNAME;
+       public const SHARETYPES_PROPERTYNAME = SharesPlugin::SHARETYPES_PROPERTYNAME;
 
        /**
         * @var \Sabre\DAV\Server
@@ -42,7 +43,7 @@ class SharesPluginTest extends \Test\TestCase {
        private $userFolder;
 
        /**
-        * @var \OCA\DAV\Connector\Sabre\SharesPlugin
+        * @var SharesPlugin
         */
        private $plugin;
 
@@ -61,7 +62,7 @@ class SharesPluginTest extends \Test\TestCase {
                        ->willReturn($user);
                $this->userFolder = $this->createMock(Folder::class);
 
-               $this->plugin = new \OCA\DAV\Connector\Sabre\SharesPlugin(
+               $this->plugin = new SharesPlugin(
                        $this->tree,
                        $userSession,
                        $this->userFolder,
index 635f62dac87337aee738c5b702f60fec780dfc8c..59fd1e569634a7827df6e55bea2d882aa05acd54 100644 (file)
@@ -10,15 +10,17 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
 use OCA\DAV\Connector\Sabre\Directory;
 use OCA\DAV\Connector\Sabre\File;
 use OCA\DAV\Connector\Sabre\Node;
+use OCA\DAV\Connector\Sabre\TagList;
+use OCA\DAV\Connector\Sabre\TagsPlugin;
 use OCA\DAV\Upload\UploadFile;
 use OCP\ITagManager;
 use OCP\ITags;
 use Sabre\DAV\Tree;
 
 class TagsPluginTest extends \Test\TestCase {
-       public const TAGS_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::TAGS_PROPERTYNAME;
-       public const FAVORITE_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::FAVORITE_PROPERTYNAME;
-       public const TAG_FAVORITE = \OCA\DAV\Connector\Sabre\TagsPlugin::TAG_FAVORITE;
+       public const TAGS_PROPERTYNAME = TagsPlugin::TAGS_PROPERTYNAME;
+       public const FAVORITE_PROPERTYNAME = TagsPlugin::FAVORITE_PROPERTYNAME;
+       public const TAG_FAVORITE = TagsPlugin::TAG_FAVORITE;
 
        /**
         * @var \Sabre\DAV\Server
@@ -41,7 +43,7 @@ class TagsPluginTest extends \Test\TestCase {
        private $tagger;
 
        /**
-        * @var \OCA\DAV\Connector\Sabre\TagsPlugin
+        * @var TagsPlugin
         */
        private $plugin;
 
@@ -61,7 +63,7 @@ class TagsPluginTest extends \Test\TestCase {
                        ->method('load')
                        ->with('files')
                        ->willReturn($this->tagger);
-               $this->plugin = new \OCA\DAV\Connector\Sabre\TagsPlugin($this->tree, $this->tagManager);
+               $this->plugin = new TagsPlugin($this->tree, $this->tagManager);
                $this->plugin->initialize($this->server);
        }
 
@@ -194,7 +196,7 @@ class TagsPluginTest extends \Test\TestCase {
                                [self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME],
                                [
                                        200 => [
-                                               self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2']),
+                                               self::TAGS_PROPERTYNAME => new TagList(['tag1', 'tag2']),
                                                self::FAVORITE_PROPERTYNAME => true,
                                        ]
                                ]
@@ -205,7 +207,7 @@ class TagsPluginTest extends \Test\TestCase {
                                [self::TAGS_PROPERTYNAME],
                                [
                                        200 => [
-                                               self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2']),
+                                               self::TAGS_PROPERTYNAME => new TagList(['tag1', 'tag2']),
                                        ]
                                ]
                        ],
@@ -233,7 +235,7 @@ class TagsPluginTest extends \Test\TestCase {
                                [self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME],
                                [
                                        200 => [
-                                               self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList([]),
+                                               self::TAGS_PROPERTYNAME => new TagList([]),
                                                self::FAVORITE_PROPERTYNAME => false,
                                        ]
                                ]
@@ -296,7 +298,7 @@ class TagsPluginTest extends \Test\TestCase {
 
                // properties to set
                $propPatch = new \Sabre\DAV\PropPatch([
-                       self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2', 'tagkeep'])
+                       self::TAGS_PROPERTYNAME => new TagList(['tag1', 'tag2', 'tagkeep'])
                ]);
 
                $this->plugin->handleUpdateProperties(
@@ -342,7 +344,7 @@ class TagsPluginTest extends \Test\TestCase {
 
                // properties to set
                $propPatch = new \Sabre\DAV\PropPatch([
-                       self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2'])
+                       self::TAGS_PROPERTYNAME => new TagList(['tag1', 'tag2'])
                ]);
 
                $this->plugin->handleUpdateProperties(
index 308950cef341ff053e11529d275422eec508539f..ed830685b7a8ac9e2584505dcf81c8f2325be3f1 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\DAV\Tests\unit\SystemTag;
 
 use OC\SystemTag\SystemTag;
+use OCA\DAV\SystemTag\SystemTagMappingNode;
 use OCP\IUser;
 use OCP\SystemTag\ISystemTag;
 use OCP\SystemTag\ISystemTagManager;
@@ -34,7 +35,7 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
                if ($tag === null) {
                        $tag = new SystemTag(1, 'Test', true, true);
                }
-               return new \OCA\DAV\SystemTag\SystemTagMappingNode(
+               return new SystemTagMappingNode(
                        $tag,
                        123,
                        'files',
index 82aa81674dfa2e563239e3f3fa6159fb99f6f2df..7ad1d34d94fc3f711964cc7df91fc08b39ec3ca1 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\DAV\Tests\unit\SystemTag;
 
 use OC\SystemTag\SystemTag;
+use OCA\DAV\SystemTag\SystemTagNode;
 use OCP\IUser;
 use OCP\SystemTag\ISystemTag;
 use OCP\SystemTag\ISystemTagManager;
@@ -40,7 +41,7 @@ class SystemTagNodeTest extends \Test\TestCase {
                if ($tag === null) {
                        $tag = new SystemTag(1, 'Test', true, true);
                }
-               return new \OCA\DAV\SystemTag\SystemTagNode(
+               return new SystemTagNode(
                        $tag,
                        $this->user,
                        $isAdmin,
index 67e7afa9c548ac83279e52a39fa2934fc5ac36a2..91dab4ecf1138e1f7c166e1c49086d5e290a83a2 100644 (file)
@@ -9,6 +9,7 @@ namespace OCA\DAV\Tests\unit\SystemTag;
 
 use OC\SystemTag\SystemTag;
 use OCA\DAV\SystemTag\SystemTagNode;
+use OCA\DAV\SystemTag\SystemTagPlugin;
 use OCA\DAV\SystemTag\SystemTagsByIdCollection;
 use OCA\DAV\SystemTag\SystemTagsObjectMappingCollection;
 use OCP\IGroupManager;
@@ -23,12 +24,12 @@ use Sabre\HTTP\RequestInterface;
 use Sabre\HTTP\ResponseInterface;
 
 class SystemTagPluginTest extends \Test\TestCase {
-       public const ID_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::ID_PROPERTYNAME;
-       public const DISPLAYNAME_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::DISPLAYNAME_PROPERTYNAME;
-       public const USERVISIBLE_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::USERVISIBLE_PROPERTYNAME;
-       public const USERASSIGNABLE_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::USERASSIGNABLE_PROPERTYNAME;
-       public const CANASSIGN_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::CANASSIGN_PROPERTYNAME;
-       public const GROUPS_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::GROUPS_PROPERTYNAME;
+       public const ID_PROPERTYNAME = SystemTagPlugin::ID_PROPERTYNAME;
+       public const DISPLAYNAME_PROPERTYNAME = SystemTagPlugin::DISPLAYNAME_PROPERTYNAME;
+       public const USERVISIBLE_PROPERTYNAME = SystemTagPlugin::USERVISIBLE_PROPERTYNAME;
+       public const USERASSIGNABLE_PROPERTYNAME = SystemTagPlugin::USERASSIGNABLE_PROPERTYNAME;
+       public const CANASSIGN_PROPERTYNAME = SystemTagPlugin::CANASSIGN_PROPERTYNAME;
+       public const GROUPS_PROPERTYNAME = SystemTagPlugin::GROUPS_PROPERTYNAME;
 
        /**
         * @var \Sabre\DAV\Server
@@ -61,7 +62,7 @@ class SystemTagPluginTest extends \Test\TestCase {
        private $user;
 
        /**
-        * @var \OCA\DAV\SystemTag\SystemTagPlugin
+        * @var SystemTagPlugin
         */
        private $plugin;
 
@@ -97,7 +98,7 @@ class SystemTagPluginTest extends \Test\TestCase {
                $this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
                        ->getMock();
 
-               $this->plugin = new \OCA\DAV\SystemTag\SystemTagPlugin(
+               $this->plugin = new SystemTagPlugin(
                        $this->tagManager,
                        $this->groupManager,
                        $this->userSession,
index db55d82adc98a0344f184f26e7d71dc7ae0a04bf..2ffbc1cf01fda5cc6c4d480d1a3159314a58118a 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\DAV\Tests\unit\SystemTag;
 
 use OC\SystemTag\SystemTag;
+use OCA\DAV\SystemTag\SystemTagsByIdCollection;
 use OCP\IGroupManager;
 use OCP\IUser;
 use OCP\IUserSession;
@@ -50,7 +51,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
                        ->method('isAdmin')
                        ->with('testuser')
                        ->willReturn($isAdmin);
-               return new \OCA\DAV\SystemTag\SystemTagsByIdCollection(
+               return new SystemTagsByIdCollection(
                        $this->tagManager,
                        $userSession,
                        $groupManager
index c2e62f73828f80086d98f71713fc80d2149aa697..66052847f162da78091e004dac2691db4045c92f 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\DAV\Tests\unit\SystemTag;
 
 use OC\SystemTag\SystemTag;
+use OCA\DAV\SystemTag\SystemTagsObjectMappingCollection;
 use OCP\IUser;
 use OCP\SystemTag\ISystemTagManager;
 use OCP\SystemTag\ISystemTagObjectMapper;
@@ -31,7 +32,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
        }
 
        public function getNode(array $writableNodeIds = []) {
-               return new \OCA\DAV\SystemTag\SystemTagsObjectMappingCollection(
+               return new SystemTagsObjectMappingCollection(
                        111,
                        'files',
                        $this->user,
index b202f340e328ff7e92a6857dc545293423ca9e68..62f6963e2025d555ac30a36a37b3630502868d83 100644 (file)
@@ -7,7 +7,9 @@
  */
 namespace OCA\DAV\Tests\unit\SystemTag;
 
+use OCA\DAV\SystemTag\SystemTagsObjectTypeCollection;
 use OCP\Files\Folder;
+use OCP\Files\Node;
 use OCP\IGroupManager;
 use OCP\IUser;
 use OCP\IUserSession;
@@ -17,7 +19,7 @@ use OCP\SystemTag\ISystemTagObjectMapper;
 class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
 
        /**
-        * @var \OCA\DAV\SystemTag\SystemTagsObjectTypeCollection
+        * @var SystemTagsObjectTypeCollection
         */
        private $node;
 
@@ -79,7 +81,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
                        return false;
                };
 
-               $this->node = new \OCA\DAV\SystemTag\SystemTagsObjectTypeCollection(
+               $this->node = new SystemTagsObjectTypeCollection(
                        'files',
                        $this->tagManager,
                        $this->tagMapper,
@@ -108,7 +110,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
                $this->userFolder->expects($this->once())
                        ->method('getFirstNodeById')
                        ->with('555')
-                       ->willReturn($this->createMock(\OCP\Files\Node::class));
+                       ->willReturn($this->createMock(Node::class));
                $childNode = $this->node->getChild('555');
 
                $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection', $childNode);
@@ -137,7 +139,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
                $this->userFolder->expects($this->once())
                        ->method('getFirstNodeById')
                        ->with('123')
-                       ->willReturn($this->createMock(\OCP\Files\Node::class));
+                       ->willReturn($this->createMock(Node::class));
                $this->assertTrue($this->node->childExists('123'));
        }
 
index a8517bf757c784bcbad86883bdd38c40113e60dc..51c53fb262f25d4e0a8ac5c78c72245845b7b3c6 100644 (file)
@@ -7,6 +7,7 @@
  */
 namespace OCA\DAV\Tests\unit\Upload;
 
+use OCA\DAV\Upload\AssemblyStream;
 use Sabre\DAV\File;
 
 class AssemblyStreamTest extends \Test\TestCase {
@@ -15,7 +16,7 @@ class AssemblyStreamTest extends \Test\TestCase {
         * @dataProvider providesNodes()
         */
        public function testGetContents($expected, $nodes): void {
-               $stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes);
+               $stream = AssemblyStream::wrap($nodes);
                $content = stream_get_contents($stream);
 
                $this->assertEquals($expected, $content);
@@ -25,7 +26,7 @@ class AssemblyStreamTest extends \Test\TestCase {
         * @dataProvider providesNodes()
         */
        public function testGetContentsFread($expected, $nodes): void {
-               $stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes);
+               $stream = AssemblyStream::wrap($nodes);
 
                $content = '';
                while (!feof($stream)) {
@@ -39,7 +40,7 @@ class AssemblyStreamTest extends \Test\TestCase {
         * @dataProvider providesNodes()
         */
        public function testSeek($expected, $nodes): void {
-               $stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes);
+               $stream = AssemblyStream::wrap($nodes);
 
                $offset = floor(strlen($expected) * 0.6);
                if (fseek($stream, $offset) === -1) {
index 9ec455a959503bb13090ab6be259252329e2aa3c..750670992eb8752fd378029c4aa869cc077567b5 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\DAV\Tests\unit\Upload;
 
 use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Upload\FutureFile;
 
 class FutureFileTest extends \Test\TestCase {
        public function testGetContentType(): void {
@@ -50,7 +51,7 @@ class FutureFileTest extends \Test\TestCase {
                $d->expects($this->once())
                        ->method('delete');
 
-               $f = new \OCA\DAV\Upload\FutureFile($d, 'foo.txt');
+               $f = new FutureFile($d, 'foo.txt');
                $f->delete();
        }
 
@@ -71,7 +72,7 @@ class FutureFileTest extends \Test\TestCase {
        }
 
        /**
-        * @return \OCA\DAV\Upload\FutureFile
+        * @return FutureFile
         */
        private function mockFutureFile() {
                $d = $this->getMockBuilder(Directory::class)
@@ -91,6 +92,6 @@ class FutureFileTest extends \Test\TestCase {
                        ->method('getChildren')
                        ->willReturn([]);
 
-               return new \OCA\DAV\Upload\FutureFile($d, 'foo.txt');
+               return new FutureFile($d, 'foo.txt');
        }
 }
index 6aa3ee9ac0716c87051e6e2c39884d8a74ff64f5..c336f2d92a2d400281e97e54234b5ab421496043 100644 (file)
@@ -7,6 +7,7 @@
  */
 namespace OCA\Encryption\Crypto;
 
+use OCA\Encryption\Exceptions\PrivateKeyMissingException;
 use OCA\Encryption\KeyManager;
 use OCA\Encryption\Session;
 use OCA\Encryption\Util;
@@ -118,7 +119,7 @@ class DecryptAll {
         * @param string $user
         * @param string $password
         * @return bool|string
-        * @throws \OCA\Encryption\Exceptions\PrivateKeyMissingException
+        * @throws PrivateKeyMissingException
         */
        protected function getPrivateKey($user, $password) {
                $recoveryKeyId = $this->keyManager->getRecoveryKeyId();
index 5261fea1e1968c8124f1ff00b332b11d8cba0419..68bc7df808d9a8a77d7dd5a20d3055bbcea1c385 100644 (file)
@@ -10,6 +10,7 @@ namespace OCA\Encryption\Crypto;
 use OC\Encryption\Exceptions\DecryptionFailedException;
 use OC\Files\Cache\Scanner;
 use OC\Files\View;
+use OCA\Encryption\Exceptions\MultiKeyEncryptException;
 use OCA\Encryption\Exceptions\PublicKeyMissingException;
 use OCA\Encryption\KeyManager;
 use OCA\Encryption\Session;
@@ -187,7 +188,7 @@ class Encryption implements IEncryptionModule {
         *                of a write operation
         * @throws PublicKeyMissingException
         * @throws \Exception
-        * @throws \OCA\Encryption\Exceptions\MultiKeyEncryptException
+        * @throws MultiKeyEncryptException
         */
        public function end($path, $position = '0') {
                $result = '';
index a17686489d4d43fe0e310b3622a8549984208c7d..e75a1e545d156efcd3918d5a2b51f70c88700f16 100644 (file)
@@ -94,7 +94,7 @@ class UserHooks implements IHook {
         */
        public function login($params) {
                // ensure filesystem is loaded
-               if (!\OC\Files\Filesystem::$loaded) {
+               if (!Filesystem::$loaded) {
                        $this->setupFS($params['uid']);
                }
                if ($this->util->isMasterKeyEnabled() === false) {
index e16396e8fafabef3f5d0c42f41c84870e2e6e547..4b759618eb27381c5c94db0ba47588e87e7e010f 100644 (file)
@@ -68,7 +68,7 @@ class Session {
        public function getPrivateKey() {
                $key = $this->session->get('privateKey');
                if (is_null($key)) {
-                       throw new Exceptions\PrivateKeyMissingException('please try to log-out and log-in again', 0);
+                       throw new PrivateKeyMissingException('please try to log-out and log-in again', 0);
                }
                return $key;
        }
index 8398a22039be430996e83ef87a9d338a91e9a775..57015975cfc3747463eddf3a155101dae0297ec6 100644 (file)
@@ -24,7 +24,7 @@ class RecoveryControllerTest extends TestCase {
        private $configMock;
        /** @var \OCP\IL10N|\PHPUnit\Framework\MockObject\MockObject */
        private $l10nMock;
-       /** @var \OCA\Encryption\Recovery|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Recovery|\PHPUnit\Framework\MockObject\MockObject */
        private $recoveryMock;
 
        public function adminRecoveryProvider() {
index dcad23cd759aa29cbc1ae722f1f3e70d5788e814..830536dc8358d8f6b71cf33a7c2c123b6c95f764 100644 (file)
@@ -39,13 +39,13 @@ class SettingsControllerTest extends TestCase {
        /** @var \OCP\IUserSession|\PHPUnit\Framework\MockObject\MockObject */
        private $userSessionMock;
 
-       /** @var \OCA\Encryption\KeyManager|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var KeyManager|\PHPUnit\Framework\MockObject\MockObject */
        private $keyManagerMock;
 
-       /** @var \OCA\Encryption\Crypto\Crypt|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Crypt|\PHPUnit\Framework\MockObject\MockObject */
        private $cryptMock;
 
-       /** @var \OCA\Encryption\Session|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Session|\PHPUnit\Framework\MockObject\MockObject */
        private $sessionMock;
        /** @var MockObject|IUser */
        private $user;
@@ -53,7 +53,7 @@ class SettingsControllerTest extends TestCase {
        /** @var \OCP\ISession|\PHPUnit\Framework\MockObject\MockObject */
        private $ocSessionMock;
 
-       /** @var \OCA\Encryption\Util|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Util|\PHPUnit\Framework\MockObject\MockObject */
        private $utilMock;
 
        protected function setUp(): void {
index c88b0497abfa4e8233d4bd69ac0082f00750dddd..e52aaba30c10a5652d8a1904d50510f82902d902 100644 (file)
@@ -22,7 +22,7 @@ class StatusControllerTest extends TestCase {
        /** @var \OCP\IL10N|\PHPUnit\Framework\MockObject\MockObject */
        private $l10nMock;
 
-       /** @var \OCA\Encryption\Session | \PHPUnit\Framework\MockObject\MockObject */
+       /** @var Session|\PHPUnit\Framework\MockObject\MockObject */
        protected $sessionMock;
 
        /** @var IManager | \PHPUnit\Framework\MockObject\MockObject */
index 9b6c822708328b313b6600bcb5f6184b2cfe3298..ba0227ec56a45ec95c69e97c0a50f58bfc2b6a21 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\Encryption\Tests\Crypto;
 
 use OCA\Encryption\Crypto\Crypt;
+use OCP\Encryption\Exceptions\GenericEncryptionException;
 use OCP\IConfig;
 use OCP\IL10N;
 use OCP\IUserSession;
@@ -232,7 +233,7 @@ class CryptTest extends TestCase {
         * @dataProvider dataTestHasSignatureFail
         */
        public function testHasSignatureFail($cipher): void {
-               $this->expectException(\OCP\Encryption\Exceptions\GenericEncryptionException::class);
+               $this->expectException(GenericEncryptionException::class);
 
                $data = 'encryptedContent00iv001234567890123456xx';
                $this->invokePrivate($this->crypt, 'hasSignature', [$data, $cipher]);
@@ -377,7 +378,7 @@ class CryptTest extends TestCase {
                                ['encryption.use_legacy_base64_encoding', false])
                        ->willReturnOnConsecutiveCalls(true, false);
 
-               /** @var \OCA\Encryption\Crypto\Crypt | \PHPUnit\Framework\MockObject\MockObject $crypt */
+               /** @var Crypt|\PHPUnit\Framework\MockObject\MockObject $crypt */
                $crypt = $this->getMockBuilder(Crypt::class)
                        ->setConstructorArgs(
                                [
index f58ea2119e68c8053d42d53b7b440836be835c2f..9de4f6c2c67c825f03533cce5f218930bb3cf53b 100644 (file)
@@ -29,16 +29,16 @@ use Test\TestCase;
 
 class EncryptAllTest extends TestCase {
 
-       /** @var \PHPUnit\Framework\MockObject\MockObject | \OCA\Encryption\KeyManager */
+       /** @var \PHPUnit\Framework\MockObject\MockObject|KeyManager */
        protected $keyManager;
 
-       /** @var \PHPUnit\Framework\MockObject\MockObject | \OCA\Encryption\Util */
+       /** @var \PHPUnit\Framework\MockObject\MockObject|Util */
        protected $util;
 
        /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IUserManager */
        protected $userManager;
 
-       /** @var \PHPUnit\Framework\MockObject\MockObject | \OCA\Encryption\Users\Setup */
+       /** @var \PHPUnit\Framework\MockObject\MockObject|Setup */
        protected $setupUser;
 
        /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Files\View */
index 70c9899cf81b504ca2dc790cb12401284f94557e..2390012a97afc47c84ea8ccb40c7570747c95ad1 100644 (file)
@@ -7,6 +7,8 @@
  */
 namespace OCA\Encryption\Tests\Crypto;
 
+use OC\Encryption\Exceptions\DecryptionFailedException;
+use OC\Files\View;
 use OCA\Encryption\Crypto\Crypt;
 use OCA\Encryption\Crypto\DecryptAll;
 use OCA\Encryption\Crypto\EncryptAll;
@@ -27,22 +29,22 @@ class EncryptionTest extends TestCase {
        /** @var Encryption */
        private $instance;
 
-       /** @var \OCA\Encryption\KeyManager|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var KeyManager|\PHPUnit\Framework\MockObject\MockObject */
        private $keyManagerMock;
 
-       /** @var \OCA\Encryption\Crypto\EncryptAll|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var EncryptAll|\PHPUnit\Framework\MockObject\MockObject */
        private $encryptAllMock;
 
-       /** @var \OCA\Encryption\Crypto\DecryptAll|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var DecryptAll|\PHPUnit\Framework\MockObject\MockObject */
        private $decryptAllMock;
 
-       /** @var \OCA\Encryption\Session|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Session|\PHPUnit\Framework\MockObject\MockObject */
        private $sessionMock;
 
-       /** @var \OCA\Encryption\Crypto\Crypt|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Crypt|\PHPUnit\Framework\MockObject\MockObject */
        private $cryptMock;
 
-       /** @var \OCA\Encryption\Util|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Util|\PHPUnit\Framework\MockObject\MockObject */
        private $utilMock;
 
        /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
@@ -120,7 +122,7 @@ class EncryptionTest extends TestCase {
                        ->method('decryptAllModeActivated')
                        ->willReturn(false);
 
-               $this->expectException(\OCA\Encryption\Exceptions\PublicKeyMissingException::class);
+               $this->expectException(PublicKeyMissingException::class);
 
                $this->instance->begin('/foo/bar', 'user2', 'r', [], ['users' => ['user1', 'user2', 'user3']]);
                $this->endTest();
@@ -320,7 +322,7 @@ class EncryptionTest extends TestCase {
                        ->willReturnCallback(function ($path, $version, $view): void {
                                $this->assertSame('path', $path);
                                $this->assertSame(2, $version);
-                               $this->assertTrue($view instanceof \OC\Files\View);
+                               $this->assertTrue($view instanceof View);
                        });
                $this->instance->update('path', 'user1', []);
        }
@@ -403,7 +405,7 @@ class EncryptionTest extends TestCase {
 
 
        public function testDecrypt(): void {
-               $this->expectException(\OC\Encryption\Exceptions\DecryptionFailedException::class);
+               $this->expectException(DecryptionFailedException::class);
                $this->expectExceptionMessage('Cannot decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.');
 
                $this->instance->decrypt('abc');
index ad1fac3407f8c3039e0df2072c0a99816fbe289d..f831690580f1407abf49d11337e15658a23a4f83 100644 (file)
@@ -43,7 +43,7 @@ class HookManagerTest extends TestCase {
        
        public function testRegisterHooksWithInstance(): void {
                $mock = $this->getMockBuilder(IHook::class)->disableOriginalConstructor()->getMock();
-               /** @var \OCA\Encryption\Hooks\Contracts\IHook $mock */
+               /** @var IHook $mock */
                self::$instance->registerHook($mock);
 
                $hookInstances = self::invokePrivate(self::$instance, 'hookInstances');
index f59a2fd8d01b4c38698d21065007010463cee54f..072a20de846d43016a850105dd5d2504d7402043 100644 (file)
@@ -305,7 +305,7 @@ class UserHooksTest extends TestCase {
                                ]
                        )->setMethods(['initMountPoints'])->getMock();
 
-               /** @var \OCA\Encryption\Hooks\UserHooks $userHooks */
+               /** @var UserHooks $userHooks */
                $this->assertNull($userHooks->setPassphrase($this->params));
        }
 
index 869e5e2cf96b56184986a2ff07edaef29f61315c..54c1bc2295a88787f6d6bb7b63fd19f5996848b0 100644 (file)
@@ -10,6 +10,9 @@ namespace OCA\Encryption\Tests;
 use OC\Files\FileInfo;
 use OC\Files\View;
 use OCA\Encryption\Crypto\Crypt;
+use OCA\Encryption\Crypto\Encryption;
+use OCA\Encryption\Exceptions\PrivateKeyMissingException;
+use OCA\Encryption\Exceptions\PublicKeyMissingException;
 use OCA\Encryption\KeyManager;
 use OCA\Encryption\Session;
 use OCA\Encryption\Util;
@@ -40,19 +43,19 @@ class KeyManagerTest extends TestCase {
        /** @var \OCP\Encryption\Keys\IStorage|\PHPUnit\Framework\MockObject\MockObject */
        private $keyStorageMock;
 
-       /** @var \OCA\Encryption\Crypto\Crypt|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Crypt|\PHPUnit\Framework\MockObject\MockObject */
        private $cryptMock;
 
        /** @var \OCP\IUserSession|\PHPUnit\Framework\MockObject\MockObject */
        private $userMock;
 
-       /** @var \OCA\Encryption\Session|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Session|\PHPUnit\Framework\MockObject\MockObject */
        private $sessionMock;
 
        /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
        private $logMock;
 
-       /** @var \OCA\Encryption\Util|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Util|\PHPUnit\Framework\MockObject\MockObject */
        private $utilMock;
 
        /** @var \OCP\IConfig|\PHPUnit\Framework\MockObject\MockObject */
@@ -207,7 +210,7 @@ class KeyManagerTest extends TestCase {
 
 
        public function testUserHasKeysMissingPrivateKey(): void {
-               $this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class);
+               $this->expectException(PrivateKeyMissingException::class);
 
                $this->keyStorageMock->expects($this->exactly(2))
                        ->method('getUserKey')
@@ -223,7 +226,7 @@ class KeyManagerTest extends TestCase {
 
 
        public function testUserHasKeysMissingPublicKey(): void {
-               $this->expectException(\OCA\Encryption\Exceptions\PublicKeyMissingException::class);
+               $this->expectException(PublicKeyMissingException::class);
 
                $this->keyStorageMock->expects($this->exactly(2))
                        ->method('getUserKey')
@@ -243,7 +246,7 @@ class KeyManagerTest extends TestCase {
         * @param bool $useMasterKey
         */
        public function testInit($useMasterKey): void {
-               /** @var \OCA\Encryption\KeyManager|\PHPUnit\Framework\MockObject\MockObject $instance */
+               /** @var KeyManager|\PHPUnit\Framework\MockObject\MockObject $instance */
                $instance = $this->getMockBuilder(KeyManager::class)
                        ->setConstructorArgs(
                                [
@@ -527,7 +530,7 @@ class KeyManagerTest extends TestCase {
 
        public function testGetPublicMasterKey(): void {
                $this->keyStorageMock->expects($this->once())->method('getSystemUserKey')
-                       ->with('systemKeyId.publicKey', \OCA\Encryption\Crypto\Encryption::ID)
+                       ->with('systemKeyId.publicKey', Encryption::ID)
                        ->willReturn(true);
 
                $this->assertTrue(
@@ -560,7 +563,7 @@ class KeyManagerTest extends TestCase {
         * @param $masterKey
         */
        public function testValidateMasterKey($masterKey): void {
-               /** @var \OCA\Encryption\KeyManager | \PHPUnit\Framework\MockObject\MockObject $instance */
+               /** @var KeyManager|\PHPUnit\Framework\MockObject\MockObject $instance */
                $instance = $this->getMockBuilder(KeyManager::class)
                        ->setConstructorArgs(
                                [
@@ -589,7 +592,7 @@ class KeyManagerTest extends TestCase {
                        $this->cryptMock->expects($this->once())->method('createKeyPair')
                                ->willReturn(['publicKey' => 'public', 'privateKey' => 'private']);
                        $this->keyStorageMock->expects($this->once())->method('setSystemUserKey')
-                               ->with('systemKeyId.publicKey', 'public', \OCA\Encryption\Crypto\Encryption::ID);
+                               ->with('systemKeyId.publicKey', 'public', Encryption::ID);
                        $this->cryptMock->expects($this->once())->method('encryptPrivateKey')
                                ->with('private', 'masterKeyPassword', 'systemKeyId')
                                ->willReturn('EncryptedKey');
@@ -608,7 +611,7 @@ class KeyManagerTest extends TestCase {
        }
 
        public function testValidateMasterKeyLocked(): void {
-               /** @var \OCA\Encryption\KeyManager | \PHPUnit_Framework_MockObject_MockObject $instance */
+               /** @var KeyManager|\PHPUnit_Framework_MockObject_MockObject $instance */
                $instance = $this->getMockBuilder(KeyManager::class)
                        ->setConstructorArgs(
                                [
index 4b28d40884469c1f05199ed9bd5d0cdeab9c0428..725e16342e73fd3c82e1ca1f1917309c0ab3b562 100644 (file)
@@ -37,7 +37,7 @@ class RecoveryTest extends TestCase {
         */
        private $user;
        /**
-        * @var \OCA\Encryption\KeyManager|\PHPUnit\Framework\MockObject\MockObject
+        * @var KeyManager|\PHPUnit\Framework\MockObject\MockObject
         */
        private $keyManagerMock;
        /**
@@ -45,7 +45,7 @@ class RecoveryTest extends TestCase {
         */
        private $configMock;
        /**
-        * @var \OCA\Encryption\Crypto\Crypt|\PHPUnit\Framework\MockObject\MockObject
+        * @var Crypt|\PHPUnit\Framework\MockObject\MockObject
         */
        private $cryptMock;
        /**
index 10c699898fce5268006af8f8e33a4069bd1b9cd4..c9486658bcb66ca731c6a0c47baf60133346f859 100644 (file)
@@ -7,6 +7,7 @@
  */
 namespace OCA\Encryption\Tests;
 
+use OCA\Encryption\Exceptions\PrivateKeyMissingException;
 use OCA\Encryption\Session;
 use OCP\ISession;
 use Test\TestCase;
@@ -22,7 +23,7 @@ class SessionTest extends TestCase {
 
 
        public function testThatGetPrivateKeyThrowsExceptionWhenNotSet(): void {
-               $this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class);
+               $this->expectException(PrivateKeyMissingException::class);
                $this->expectExceptionMessage('Private Key missing for user: please try to log-out and log-in again');
 
                $this->instance->getPrivateKey();
@@ -84,7 +85,7 @@ class SessionTest extends TestCase {
         * @expectExceptionMessage 'Please activate decrypt all mode first'
         */
        public function testGetDecryptAllKeyException(): void {
-               $this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class);
+               $this->expectException(PrivateKeyMissingException::class);
 
                $this->instance->getDecryptAllKey();
        }
@@ -93,7 +94,7 @@ class SessionTest extends TestCase {
         * @expectExceptionMessage 'No key found while in decrypt all mode'
         */
        public function testGetDecryptAllKeyException2(): void {
-               $this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class);
+               $this->expectException(PrivateKeyMissingException::class);
 
                $this->instance->prepareDecryptAll('user', null);
                $this->instance->getDecryptAllKey();
index 92f24a0627c3782c1030d4992ae4fd3ed929541d..7a6beaf359498933717fe3a81463f0bc2d284060 100644 (file)
@@ -14,11 +14,11 @@ use Test\TestCase;
 
 class SetupTest extends TestCase {
        /**
-        * @var \OCA\Encryption\KeyManager|\PHPUnit\Framework\MockObject\MockObject
+        * @var KeyManager|\PHPUnit\Framework\MockObject\MockObject
         */
        private $keyManagerMock;
        /**
-        * @var \OCA\Encryption\Crypto\Crypt|\PHPUnit\Framework\MockObject\MockObject
+        * @var Crypt|\PHPUnit\Framework\MockObject\MockObject
         */
        private $cryptMock;
        /**
index f2e6f406c35070b2c8034acff1539df30d873784..5571a9483dbd5b5bffa8b2994eb4b37ac634f5c1 100644 (file)
@@ -64,7 +64,7 @@ class UtilTest extends TestCase {
                $this->filesMock = $this->createMock(View::class);
                $this->userManagerMock = $this->createMock(IUserManager::class);
 
-               /** @var \OCA\Encryption\Crypto\Crypt $cryptMock */
+               /** @var Crypt $cryptMock */
                $cryptMock = $this->getMockBuilder(Crypt::class)
                        ->disableOriginalConstructor()
                        ->getMock();
index d96c956eb1154766561d8cfd4b21fe82f2717a38..a2986618729bdf300bb8bc38dbf34ed47c81e763 100644 (file)
@@ -11,6 +11,7 @@ use OCP\Federation\ICloudIdManager;
 use OCP\HintException;
 use OCP\IL10N;
 use OCP\IURLGenerator;
+use OCP\Util;
 
 /**
  * Class AddressHandler - parse, modify and construct federated sharing addresses
@@ -86,12 +87,12 @@ class AddressHandler {
 
                if (rtrim($normalizedServer1, '/') === rtrim($normalizedServer2, '/')) {
                        // FIXME this should be a method in the user management instead
-                       \OCP\Util::emitHook(
+                       Util::emitHook(
                                '\OCA\Files_Sharing\API\Server2Server',
                                'preLoginNameUsedAsUserName',
                                ['uid' => &$user1]
                        );
-                       \OCP\Util::emitHook(
+                       Util::emitHook(
                                '\OCA\Files_Sharing\API\Server2Server',
                                'preLoginNameUsedAsUserName',
                                ['uid' => &$user2]
index 8d4f6fd3af8571a09915f793a54cdafda5f92552..d19414f3c11a03b0eaa6dc3077d964509bbf5356 100644 (file)
@@ -15,6 +15,7 @@ use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
 use OCP\AppFramework\Http\Attribute\OpenAPI;
 use OCP\AppFramework\Http\Attribute\PublicPage;
+use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\OCS\OCSBadRequestException;
 use OCP\AppFramework\OCS\OCSException;
 use OCP\AppFramework\OCSController;
@@ -29,6 +30,7 @@ use OCP\IDBConnection;
 use OCP\IRequest;
 use OCP\IUserManager;
 use OCP\Log\Audit\CriticalActionPerformedEvent;
+use OCP\Server;
 use OCP\Share;
 use OCP\Share\Exceptions\ShareNotFound;
 use Psr\Log\LoggerInterface;
@@ -170,7 +172,7 @@ class RequestHandlerController extends OCSController {
                        throw new OCSException('internal server error, was not able to add share from ' . $remote, 500);
                }
 
-               return new Http\DataResponse();
+               return new DataResponse();
        }
 
        /**
@@ -206,7 +208,7 @@ class RequestHandlerController extends OCSController {
                try {
                        $provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file');
                        [$newToken, $localId] = $provider->notificationReceived('REQUEST_RESHARE', $id, $notification);
-                       return new Http\DataResponse([
+                       return new DataResponse([
                                'token' => $newToken,
                                'remoteId' => $localId
                        ]);
@@ -254,7 +256,7 @@ class RequestHandlerController extends OCSController {
                        $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage(), ['exception' => $e]);
                }
 
-               return new Http\DataResponse();
+               return new DataResponse();
        }
 
        /**
@@ -287,7 +289,7 @@ class RequestHandlerController extends OCSController {
                        $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage(), ['exception' => $e]);
                }
 
-               return new Http\DataResponse();
+               return new DataResponse();
        }
 
        /**
@@ -316,7 +318,7 @@ class RequestHandlerController extends OCSController {
                        $this->logger->debug('processing unshare notification failed: ' . $e->getMessage(), ['exception' => $e]);
                }
 
-               return new Http\DataResponse();
+               return new DataResponse();
        }
 
        private function cleanupRemote($remote) {
@@ -343,7 +345,7 @@ class RequestHandlerController extends OCSController {
                        $provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file');
                        $notification = ['sharedSecret' => $token];
                        $provider->notificationReceived('RESHARE_UNDO', $id, $notification);
-                       return new Http\DataResponse();
+                       return new DataResponse();
                } catch (\Exception $e) {
                        throw new OCSBadRequestException();
                }
@@ -356,7 +358,7 @@ class RequestHandlerController extends OCSController {
         * @return bool
         */
        private function isS2SEnabled($incoming = false) {
-               $result = \OCP\Server::get(IAppManager::class)->isEnabledForUser('files_sharing');
+               $result = Server::get(IAppManager::class)->isEnabledForUser('files_sharing');
 
                if ($incoming) {
                        $result = $result && $this->federatedShareProvider->isIncomingServer2serverShareEnabled();
@@ -394,7 +396,7 @@ class RequestHandlerController extends OCSController {
                        throw new OCSBadRequestException();
                }
 
-               return new Http\DataResponse();
+               return new DataResponse();
        }
 
        /**
@@ -454,7 +456,7 @@ class RequestHandlerController extends OCSController {
                $affected = $query->executeStatement();
 
                if ($affected > 0) {
-                       return new Http\DataResponse(['remote' => $cloudId->getRemote(), 'owner' => $cloudId->getUser()]);
+                       return new DataResponse(['remote' => $cloudId->getRemote(), 'owner' => $cloudId->getUser()]);
                } else {
                        throw new OCSBadRequestException('Share not found or token invalid');
                }
index 025a4c7d737f87df736a2f24f2a1270ab3bf62c6..f349bb2a6fc361a2ea8c8c0fb88b348a222d219e 100644 (file)
@@ -1043,8 +1043,8 @@ class FederatedShareProvider implements IShareProvider {
                        ->from('share')
                        ->where(
                                $qb->expr()->orX(
-                                       $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share\IShare::TYPE_REMOTE)),
-                                       $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share\IShare::TYPE_REMOTE_GROUP))
+                                       $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_REMOTE)),
+                                       $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_REMOTE_GROUP))
                                )
                        );
 
index 73f0cd34f3fe387a52041aed5f3ff05215612b00..34fbd85db5ac588df9c9538716e45828dfb9abf4 100644 (file)
@@ -14,6 +14,7 @@ use OCP\App\IAppManager;
 use OCP\AppFramework\Services\IInitialState;
 use OCP\EventDispatcher\Event;
 use OCP\EventDispatcher\IEventListener;
+use OCP\Util;
 
 /** @template-implements IEventListener<LoadAdditionalScriptsEvent> */
 class LoadAdditionalScriptsListener implements IEventListener {
@@ -34,7 +35,7 @@ class LoadAdditionalScriptsListener implements IEventListener {
 
                if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled()) {
                        $this->initialState->provideInitialState('notificationsEnabled', $this->appManager->isEnabledForUser('notifications'));
-                       \OCP\Util::addInitScript('federatedfilesharing', 'external');
+                       Util::addInitScript('federatedfilesharing', 'external');
                }
        }
 }
index 8aa8ba67a2a31f45e7bed76b54b840ece24c6b8d..64e8b0e4fa50bff89a2dfd8ce0771e44999b5502 100644 (file)
@@ -11,6 +11,7 @@ use OCA\FederatedFileSharing\AddressHandler;
 use OCA\FederatedFileSharing\FederatedShareProvider;
 use OCA\Files_Sharing\Activity\Providers\RemoteShares;
 use OCA\Files_Sharing\External\Manager;
+use OCA\GlobalSiteSelector\Service\SlaveService;
 use OCP\Activity\IManager as IActivityManager;
 use OCP\App\IAppManager;
 use OCP\Constants;
@@ -734,7 +735,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
                }
 
                try {
-                       $slaveService = Server::get(\OCA\GlobalSiteSelector\Service\SlaveService::class);
+                       $slaveService = Server::get(SlaveService::class);
                } catch (\Throwable $e) {
                        Server::get(LoggerInterface::class)->error(
                                $e->getMessage(),
index e235314e00845c8adf01f2840e43eb151cc37dae..ffb34d965ceacf71ebf07f213a708ee387723947 100644 (file)
@@ -11,6 +11,7 @@ use OC\Federation\CloudIdManager;
 use OCA\FederatedFileSharing\AddressHandler;
 use OCP\Contacts\IManager;
 use OCP\EventDispatcher\IEventDispatcher;
+use OCP\HintException;
 use OCP\ICacheFactory;
 use OCP\IL10N;
 use OCP\IURLGenerator;
@@ -130,7 +131,7 @@ class AddressHandlerTest extends \Test\TestCase {
         * @param string $id
         */
        public function testSplitUserRemoteError($id): void {
-               $this->expectException(\OCP\HintException::class);
+               $this->expectException(HintException::class);
 
                $this->addressHandler->splitUserRemote($id);
        }
index 9caafb35bb3ab38364988b0c6ce3b3bb5b17f06d..8222f25bb49dee5c7203a2b4df881d43ebc743d8 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\FederatedFileSharing\Tests\Controller;
 
 use OC\Federation\CloudIdManager;
+use OC\Share20\Share;
 use OCA\FederatedFileSharing\AddressHandler;
 use OCA\FederatedFileSharing\Controller\MountPublicLinkController;
 use OCA\FederatedFileSharing\FederatedShareProvider;
@@ -83,7 +84,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase {
                        ->disableOriginalConstructor()->getMock();
                $this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->disableOriginalConstructor()->getMock();
                $this->userManager = $this->getMockBuilder(IUserManager::class)->disableOriginalConstructor()->getMock();
-               $this->share = new \OC\Share20\Share($this->rootFolder, $this->userManager);
+               $this->share = new Share($this->rootFolder, $this->userManager);
                $this->session = $this->getMockBuilder(ISession::class)->disableOriginalConstructor()->getMock();
                $this->l10n = $this->getMockBuilder(IL10N::class)->disableOriginalConstructor()->getMock();
                $this->userSession = $this->getMockBuilder(IUserSession::class)->disableOriginalConstructor()->getMock();
index cce1ee8830aa5cc23a70de4b42d0f1123795b9ef..c4c45c1aca5aeb2c2485cf6b96c9d2caf0e6a2b9 100644 (file)
@@ -7,7 +7,10 @@
  */
 namespace OCA\FederatedFileSharing\Tests;
 
+use OCA\FederatedFileSharing\AddressHandler;
 use OCA\FederatedFileSharing\Controller\RequestHandlerController;
+use OCA\FederatedFileSharing\FederatedShareProvider;
+use OCA\FederatedFileSharing\Notifications;
 use OCP\AppFramework\Http\DataResponse;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Federation\ICloudFederationFactory;
@@ -39,13 +42,13 @@ class RequestHandlerControllerTest extends \Test\TestCase {
        /** @var RequestHandlerController */
        private $requestHandler;
 
-       /** @var \OCA\FederatedFileSharing\FederatedShareProvider|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var FederatedShareProvider|\PHPUnit\Framework\MockObject\MockObject */
        private $federatedShareProvider;
 
-       /** @var \OCA\FederatedFileSharing\Notifications|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Notifications|\PHPUnit\Framework\MockObject\MockObject */
        private $notifications;
 
-       /** @var \OCA\FederatedFileSharing\AddressHandler|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var AddressHandler|\PHPUnit\Framework\MockObject\MockObject */
        private $addressHandler;
 
        /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
index 5255a84b46115dfcd1a5293a0919d838d42d8a83..77e10b7a61a5d640dce47a2c24770ffc792e6c3f 100644 (file)
@@ -12,6 +12,7 @@ use OCA\FederatedFileSharing\AddressHandler;
 use OCA\FederatedFileSharing\FederatedShareProvider;
 use OCA\FederatedFileSharing\Notifications;
 use OCA\FederatedFileSharing\TokenHandler;
+use OCP\Constants;
 use OCP\Contacts\IManager as IContactsManager;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Federation\ICloudFederationProviderManager;
@@ -895,7 +896,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
                $share1->setSharedWith('user@server.com')
                        ->setSharedBy($u1->getUID())
                        ->setShareOwner($u1->getUID())
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setShareType(IShare::TYPE_REMOTE)
                        ->setNode($file1);
                $this->provider->create($share1);
@@ -904,7 +905,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
                $share2->setSharedWith('user@server.com')
                        ->setSharedBy($u2->getUID())
                        ->setShareOwner($u1->getUID())
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setShareType(IShare::TYPE_REMOTE)
                        ->setNode($file2);
                $this->provider->create($share2);
@@ -955,7 +956,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
                $share1->setSharedWith('user@server.com')
                        ->setSharedBy($u1->getUID())
                        ->setShareOwner($u1->getUID())
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setShareType(IShare::TYPE_REMOTE)
                        ->setNode($file1);
                $this->provider->create($share1);
@@ -964,7 +965,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
                $share2->setSharedWith('foobar@localhost')
                        ->setSharedBy($u1->getUID())
                        ->setShareOwner($u1->getUID())
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setShareType(IShare::TYPE_REMOTE)
                        ->setNode($file1);
                $this->provider->create($share2);
index 031d19c2cb8cc9a9df70339e6a761000fdced095..d821eee55b0396a324fd7c6b73da7ea8ac6e3cf2 100644 (file)
@@ -17,7 +17,7 @@ use Test\TestCase;
 class AdminTest extends TestCase {
        /** @var Admin */
        private $admin;
-       /** @var \OCA\FederatedFileSharing\FederatedShareProvider */
+       /** @var FederatedShareProvider */
        private $federatedShareProvider;
        /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
        private $gsConfig;
index 9564cb7ec09b6dc6f8671c268acca34da9023a00..a53025c5a6258f05ecaf2a08cae38f8f08f31f84 100644 (file)
@@ -90,7 +90,7 @@ abstract class TestCase extends \Test\TestCase {
 
                \OC_Util::tearDownFS();
                \OC::$server->getUserSession()->setUser(null);
-               \OC\Files\Filesystem::tearDown();
+               Filesystem::tearDown();
                \OC::$server->getUserSession()->login($user, $password);
                \OC::$server->getUserFolder($user);
 
index 7dc63dca2aff854f12dcba31d0ce00735bae5553..09e558cb2ea17fb597d9bb6d655750b648a32341 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\Federation\DAV;
 
 use OCA\Federation\DbHandler;
+use OCP\Defaults;
 use Sabre\DAV\Auth\Backend\AbstractBasic;
 use Sabre\HTTP\RequestInterface;
 use Sabre\HTTP\ResponseInterface;
@@ -27,7 +28,7 @@ class FedAuth extends AbstractBasic {
                $this->principalPrefix = 'principals/system/';
 
                // setup realm
-               $defaults = new \OCP\Defaults();
+               $defaults = new Defaults();
                $this->realm = $defaults->getName();
        }
 
index 0eb15e40d8fd893fc57bad314717c6e57bd380c7..c2156bac3dc945950d933ec4d14a31e800facb2e 100644 (file)
@@ -10,6 +10,7 @@ namespace OCA\Federation\Tests\Controller;
 use OCA\Federation\Controller\SettingsController;
 use OCA\Federation\TrustedServers;
 use OCP\AppFramework\Http\DataResponse;
+use OCP\HintException;
 use OCP\IL10N;
 use OCP\IRequest;
 use Test\TestCase;
@@ -23,7 +24,7 @@ class SettingsControllerTest extends TestCase {
        /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IL10N */
        private $l10n;
 
-       /** @var \PHPUnit\Framework\MockObject\MockObject | \OCA\Federation\TrustedServers */
+       /** @var \PHPUnit\Framework\MockObject\MockObject|TrustedServers */
        private $trustedServers;
 
        protected function setUp(): void {
@@ -67,7 +68,7 @@ class SettingsControllerTest extends TestCase {
         * @dataProvider checkServerFails
         */
        public function testAddServerFail(bool $isTrustedServer, bool $isNextcloud): void {
-               $this->expectException(\OCP\HintException::class);
+               $this->expectException(HintException::class);
 
                $this->trustedServers
                        ->expects($this->any())
@@ -113,7 +114,7 @@ class SettingsControllerTest extends TestCase {
         * @dataProvider checkServerFails
         */
        public function testCheckServerFail(bool $isTrustedServer, bool $isNextcloud): void {
-               $this->expectException(\OCP\HintException::class);
+               $this->expectException(HintException::class);
 
                $this->trustedServers
                        ->expects($this->any())
index b78a98b6ae23c887102f25b36ee85ba58084778c..39274a11ade1d7f16813503d4a30d2b95c1ca3f0 100644 (file)
@@ -8,8 +8,10 @@
 namespace OCA\Federation\Tests;
 
 use OC\OCS\DiscoveryService;
+use OCA\DAV\CardDAV\SyncService;
 use OCA\Federation\DbHandler;
 use OCA\Federation\SyncFederationAddressBooks;
+use OCA\Federation\TrustedServers;
 use PHPUnit\Framework\MockObject\MockObject;
 use Psr\Log\LoggerInterface;
 
@@ -55,7 +57,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
                $syncService->expects($this->once())->method('syncRemoteAddressBook')
                        ->willReturn('1');
 
-               /** @var \OCA\DAV\CardDAV\SyncService $syncService */
+               /** @var SyncService $syncService */
                $s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService, $this->logger);
                $s->syncThemAll(function ($url, $ex): void {
                        $this->callBacks[] = [$url, $ex];
@@ -83,7 +85,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
                $syncService->expects($this->once())->method('syncRemoteAddressBook')
                        ->willThrowException(new \Exception('something did not work out'));
 
-               /** @var \OCA\DAV\CardDAV\SyncService $syncService */
+               /** @var SyncService $syncService */
                $s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService, $this->logger);
                $s->syncThemAll(function ($url, $ex): void {
                        $this->callBacks[] = [$url, $ex];
@@ -105,7 +107,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
                                        'sync_token' => '0'
                                ]
                        ]);
-               $dbHandler->method('getServerStatus')->willReturn(\OCA\Federation\TrustedServers::STATUS_FAILURE);
+               $dbHandler->method('getServerStatus')->willReturn(TrustedServers::STATUS_FAILURE);
                $dbHandler->expects($this->once())->method('setServerStatus')->
                        with('https://cloud.drop.box', 1);
                $syncService = $this->getMockBuilder('OCA\DAV\CardDAV\SyncService')
@@ -114,7 +116,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
                $syncService->expects($this->once())->method('syncRemoteAddressBook')
                        ->willReturn('0');
 
-               /** @var \OCA\DAV\CardDAV\SyncService $syncService */
+               /** @var SyncService $syncService */
                $s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService, $this->logger);
                $s->syncThemAll(function ($url, $ex): void {
                        $this->callBacks[] = [$url, $ex];
index 63ce5899031726c79f92702c16da23d1fb9e06dd..c3f0368858bc3762e270839e93209b66d1293225 100644 (file)
@@ -12,6 +12,8 @@ use OCA\Federation\TrustedServers;
 use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\BackgroundJob\IJobList;
 use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Federation\Events\TrustedServerRemovedEvent;
+use OCP\HintException;
 use OCP\Http\Client\IClient;
 use OCP\Http\Client\IClientService;
 use OCP\Http\Client\IResponse;
@@ -145,7 +147,7 @@ class TrustedServersTest extends TestCase {
                $this->dispatcher->expects($this->once())->method('dispatchTyped')
                        ->willReturnCallback(
                                function ($event): void {
-                                       $this->assertSame(get_class($event), \OCP\Federation\Events\TrustedServerRemovedEvent::class);
+                                       $this->assertSame(get_class($event), TrustedServerRemovedEvent::class);
                                        /** @var \OCP\Federated\Events\TrustedServerRemovedEvent $event */
                                        $this->assertSame('url_hash', $event->getUrlHash());
                                }
@@ -277,7 +279,7 @@ class TrustedServersTest extends TestCase {
         * @dataProvider dataTestCheckNextcloudVersionTooLow
         */
        public function testCheckNextcloudVersionTooLow(string $status): void {
-               $this->expectException(\OCP\HintException::class);
+               $this->expectException(HintException::class);
                $this->expectExceptionMessage('Remote server version is too low. 9.0 is required.');
 
                $this->invokePrivate($this->trustedServers, 'checkNextcloudVersion', [$status]);
index 283ce17cd85706c507a96dc58e741868d5a3f997..cf1cb04b9afe3b64db2081fcdde0b8027cbc2259 100644 (file)
@@ -11,6 +11,7 @@ use OC\Core\Command\Base;
 use OC\Core\Command\InterruptedException;
 use OC\DB\Connection;
 use OC\DB\ConnectionAdapter;
+use OC\Files\Utils\Scanner;
 use OC\FilesMetadata\FilesMetadataManager;
 use OC\ForbiddenException;
 use OCP\EventDispatcher\IEventDispatcher;
@@ -98,7 +99,7 @@ class Scan extends Base {
 
        protected function scanFiles(string $user, string $path, ?string $scanMetadata, OutputInterface $output, bool $backgroundScan = false, bool $recursive = true, bool $homeOnly = false): void {
                $connection = $this->reconnectToDatabase($output);
-               $scanner = new \OC\Files\Utils\Scanner(
+               $scanner = new Scanner(
                        $user,
                        new ConnectionAdapter($connection),
                        \OC::$server->get(IEventDispatcher::class),
index 4d89389fe32b614f052badbfc1a488b5494240ba..4c52297003f62718ec029e99ed953d029ed7987f 100644 (file)
@@ -9,6 +9,7 @@ use OC\Core\Command\Base;
 use OC\Core\Command\InterruptedException;
 use OC\DB\Connection;
 use OC\DB\ConnectionAdapter;
+use OC\Files\Utils\Scanner;
 use OC\ForbiddenException;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\IRootFolder;
@@ -65,7 +66,7 @@ class ScanAppData extends Base {
                }
 
                $connection = $this->reconnectToDatabase($output);
-               $scanner = new \OC\Files\Utils\Scanner(
+               $scanner = new Scanner(
                        null,
                        new ConnectionAdapter($connection),
                        \OC::$server->query(IEventDispatcher::class),
index 0ca4a1efd4b5c6a860c96d1f07f3999b5f9d25a9..118a4fcb9e2ae5ef1175833afca8b61eea92cb3b 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\Files\Controller;
 
 use OC\Files\Node\Node;
+use OCA\Files\Helper;
 use OCA\Files\ResponseDefinitions;
 use OCA\Files\Service\TagService;
 use OCA\Files\Service\UserConfig;
@@ -30,6 +31,7 @@ use OCP\Files\File;
 use OCP\Files\Folder;
 use OCP\Files\IRootFolder;
 use OCP\Files\NotFoundException;
+use OCP\Files\StorageNotAvailableException;
 use OCP\IConfig;
 use OCP\IL10N;
 use OCP\IPreview;
@@ -124,11 +126,11 @@ class ApiController extends Controller {
                if (!is_null($tags)) {
                        try {
                                $this->tagService->updateFileTags($path, $tags);
-                       } catch (\OCP\Files\NotFoundException $e) {
+                       } catch (NotFoundException $e) {
                                return new DataResponse([
                                        'message' => $e->getMessage()
                                ], Http::STATUS_NOT_FOUND);
-                       } catch (\OCP\Files\StorageNotAvailableException $e) {
+                       } catch (StorageNotAvailableException $e) {
                                return new DataResponse([
                                        'message' => $e->getMessage()
                                ], Http::STATUS_SERVICE_UNAVAILABLE);
@@ -150,7 +152,7 @@ class ApiController extends Controller {
                $shareTypesForNodes = $this->getShareTypesForNodes($nodes);
                return array_values(array_map(function (Node $node) use ($shareTypesForNodes) {
                        $shareTypes = $shareTypesForNodes[$node->getId()] ?? [];
-                       $file = \OCA\Files\Helper::formatFileInfo($node->getFileInfo());
+                       $file = Helper::formatFileInfo($node->getFileInfo());
                        $file['hasPreview'] = $this->previewManager->isAvailable($node);
                        $parts = explode('/', dirname($node->getPath()), 4);
                        if (isset($parts[3])) {
index b5c61aaa5f4e421a0aa01d6328a0271053ae4a03..b6aeb079add9b9138056ed1ba2e1703bbbb3e8ab 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\Files\Controller;
 
 use OC\Files\FilenameValidator;
+use OC\Files\Filesystem;
 use OCA\Files\AppInfo\Application;
 use OCA\Files\Event\LoadAdditionalScriptsEvent;
 use OCA\Files\Event\LoadSearchPlugins;
@@ -36,6 +37,7 @@ use OCP\IL10N;
 use OCP\IRequest;
 use OCP\IURLGenerator;
 use OCP\IUserSession;
+use OCP\Util;
 
 /**
  * @package OCA\Files\Controller
@@ -69,7 +71,7 @@ class ViewController extends Controller {
         * @throws \OCP\Files\NotFoundException
         */
        protected function getStorageInfo(string $dir = '/') {
-               $rootInfo = \OC\Files\Filesystem::getFileInfo('/', false);
+               $rootInfo = Filesystem::getFileInfo('/', false);
 
                return \OC_Helper::getStorageInfo($dir, $rootInfo ?: null);
        }
@@ -138,8 +140,8 @@ class ViewController extends Controller {
                }
 
                // Load the files we need
-               \OCP\Util::addInitScript('files', 'init');
-               \OCP\Util::addScript('files', 'main');
+               Util::addInitScript('files', 'init');
+               Util::addScript('files', 'main');
 
                $userId = $this->userSession->getUser()->getUID();
 
index 6126c1270ebad2d3de9db0941794965d02b5e337..4ddab45d44150a010eebd9eedd4b4d02b6d7e96f 100644 (file)
@@ -7,8 +7,10 @@
  */
 namespace OCA\Files;
 
+use OC\Files\Filesystem;
 use OCP\Files\FileInfo;
 use OCP\ITagManager;
+use OCP\Util;
 
 /**
  * Helper class for manipulating file information
@@ -22,9 +24,9 @@ class Helper {
        public static function buildFileStorageStatistics($dir) {
                // information about storage capacities
                $storageInfo = \OC_Helper::getStorageInfo($dir);
-               $l = \OCP\Util::getL10N('files');
-               $maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']);
-               $maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize);
+               $l = Util::getL10N('files');
+               $maxUploadFileSize = Util::maxUploadFilesize($dir, $storageInfo['free']);
+               $maxHumanFileSize = Util::humanFileSize($maxUploadFileSize);
                $maxHumanFileSize = $l->t('Upload (max. %s)', [$maxHumanFileSize]);
 
                return [
@@ -80,7 +82,7 @@ class Helper {
                } elseif ($aType !== 'dir' and $bType === 'dir') {
                        return 1;
                } else {
-                       return \OCP\Util::naturalSortCompare($a->getName(), $b->getName());
+                       return Util::naturalSortCompare($a->getName(), $b->getName());
                }
        }
 
@@ -181,7 +183,7 @@ class Helper {
         * @return \OCP\Files\FileInfo[] files
         */
        public static function getFiles($dir, $sortAttribute = 'name', $sortDescending = false, $mimetypeFilter = '') {
-               $content = \OC\Files\Filesystem::getDirectoryContent($dir, $mimetypeFilter);
+               $content = Filesystem::getDirectoryContent($dir, $mimetypeFilter);
 
                return self::sortFiles($content, $sortAttribute, $sortDescending);
        }
index c9792242b2c4cbd7a363c6f4ef357d8b94a50789..4cc4ca22f831c9901774ef46b88e257703298d47 100644 (file)
@@ -11,6 +11,7 @@ namespace OCA\Files\Listener;
 use OCA\Files\Event\LoadSearchPlugins;
 use OCP\EventDispatcher\Event;
 use OCP\EventDispatcher\IEventListener;
+use OCP\Util;
 
 /** @template-implements IEventListener<LoadSearchPlugins> */
 class LoadSearchPluginsListener implements IEventListener {
@@ -19,6 +20,6 @@ class LoadSearchPluginsListener implements IEventListener {
                        return;
                }
 
-               \OCP\Util::addScript('files', 'search');
+               Util::addScript('files', 'search');
        }
 }
index fc8b4d08aebc6c9df30c22e2a3a34229341336a7..b7470e5acf511ffd61e12bb3aca70b01fb0c3110 100644 (file)
@@ -11,6 +11,7 @@ namespace OCA\Files\Listener;
 use OCP\Collaboration\Reference\RenderReferenceEvent;
 use OCP\EventDispatcher\Event;
 use OCP\EventDispatcher\IEventListener;
+use OCP\Util;
 
 /** @template-implements IEventListener<RenderReferenceEvent> */
 class RenderReferenceEventListener implements IEventListener {
@@ -19,6 +20,6 @@ class RenderReferenceEventListener implements IEventListener {
                        return;
                }
 
-               \OCP\Util::addScript('files', 'reference-files');
+               Util::addScript('files', 'reference-files');
        }
 }
index 5a57fae50758268f2ad370ebb41b42d6cc857473..2b06d18efcfcb5ff248521a6d8f10602cde9364f 100644 (file)
@@ -13,6 +13,7 @@ use Closure;
 use OC\Encryption\Manager as EncryptionManager;
 use OC\Files\Filesystem;
 use OC\Files\View;
+use OCA\Encryption\Util;
 use OCA\Files\Exception\TransferOwnershipException;
 use OCP\Encryption\IManager as IEncryptionManager;
 use OCP\Files\Config\IUserMountCache;
@@ -21,9 +22,11 @@ use OCP\Files\IHomeStorage;
 use OCP\Files\InvalidPathException;
 use OCP\Files\IRootFolder;
 use OCP\Files\Mount\IMountManager;
+use OCP\Files\NotFoundException;
 use OCP\IUser;
 use OCP\IUserManager;
 use OCP\L10N\IFactory;
+use OCP\Server;
 use OCP\Share\IManager as IShareManager;
 use OCP\Share\IShare;
 use Symfony\Component\Console\Helper\ProgressBar;
@@ -227,7 +230,7 @@ class OwnershipTransferService {
                $progress->start();
 
                if ($this->encryptionManager->isEnabled()) {
-                       $masterKeyEnabled = \OCP\Server::get(\OCA\Encryption\Util::class)->isMasterKeyEnabled();
+                       $masterKeyEnabled = Server::get(Util::class)->isMasterKeyEnabled();
                } else {
                        $masterKeyEnabled = false;
                }
@@ -416,7 +419,7 @@ class OwnershipTransferService {
        ):void {
                $output->writeln('Restoring shares ...');
                $progress = new ProgressBar($output, count($shares));
-               $rootFolder = \OCP\Server::get(IRootFolder::class);
+               $rootFolder = Server::get(IRootFolder::class);
 
                foreach ($shares as ['share' => $share, 'suffix' => $suffix]) {
                        try {
@@ -453,7 +456,7 @@ class OwnershipTransferService {
                                                        // Normally the ID is preserved,
                                                        // but for transferes between different storages the ID might change
                                                        $newNodeId = $share->getNode()->getId();
-                                               } catch (\OCP\Files\NotFoundException) {
+                                               } catch (NotFoundException) {
                                                        // ID has changed due to transfer between different storages
                                                        // Try to get the new ID from the target path and suffix of the share
                                                        $node = $rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix));
@@ -465,7 +468,7 @@ class OwnershipTransferService {
                                                $this->shareManager->updateShare($share);
                                        }
                                }
-                       } catch (\OCP\Files\NotFoundException $e) {
+                       } catch (NotFoundException $e) {
                                $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>');
                        } catch (\Throwable $e) {
                                $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getMessage() . ' : ' . $e->getTraceAsString() . '</error>');
@@ -545,7 +548,7 @@ class OwnershipTransferService {
                                        $this->shareManager->moveShare($share, $destinationUid);
                                        continue;
                                }
-                       } catch (\OCP\Files\NotFoundException $e) {
+                       } catch (NotFoundException $e) {
                                $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>');
                        } catch (\Throwable $e) {
                                $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>');
index 484e4bde2b8214007bdb1b8af7f8010cb0cc3469..fe43265bc13d1aca0abb245dadef753dcc35f0f0 100644 (file)
@@ -11,10 +11,11 @@ namespace OCA\Files\Settings;
 use OCA\Files\AppInfo\Application;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\Settings\ISettings;
+use OCP\Util;
 
 class PersonalSettings implements ISettings {
        public function getForm(): TemplateResponse {
-               \OCP\Util::addScript(Application::APP_ID, 'settings-personal');
+               Util::addScript(Application::APP_ID, 'settings-personal');
                return new TemplateResponse(Application::APP_ID, 'settings-personal');
        }
 
index 6e9fbead34e790e3d7b9129372f7d0a9ee3f13c3..e480f7b632ede6121543dfbeea9f06663c11682b 100644 (file)
@@ -12,6 +12,7 @@ use OCA\Files\Command\DeleteOrphanedFiles;
 use OCP\Files\IRootFolder;
 use OCP\Files\StorageNotAvailableException;
 use OCP\IDBConnection;
+use OCP\Server;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 use Test\TestCase;
@@ -32,7 +33,7 @@ class DeleteOrphanedFilesTest extends TestCase {
        protected function setUp(): void {
                parent::setUp();
 
-               $this->connection = \OCP\Server::get(IDBConnection::class);
+               $this->connection = Server::get(IDBConnection::class);
 
                $this->user1 = $this->getUniqueID('user1_');
 
@@ -81,7 +82,7 @@ class DeleteOrphanedFilesTest extends TestCase {
                        ->disableOriginalConstructor()
                        ->getMock();
 
-               $rootFolder = \OCP\Server::get(IRootFolder::class);
+               $rootFolder = Server::get(IRootFolder::class);
 
                // scan home storage so that mounts are properly setup
                $rootFolder->getUserFolder($this->user1)->getStorage()->getScanner()->scan('');
index ad2a6a15b2b44e7cfa2c89dd6a2aeb3d9f8d8fe0..e7f8b962a45944df9c7e3127b4944704e8b9ae9d 100644 (file)
@@ -12,6 +12,8 @@ use OCA\Files\Service\UserConfig;
 use OCA\Files\Service\ViewConfig;
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\Http\FileDisplayResponse;
+use OCP\AppFramework\Http\Response;
 use OCP\Files\File;
 use OCP\Files\Folder;
 use OCP\Files\IRootFolder;
@@ -211,7 +213,7 @@ class ApiControllerTest extends TestCase {
                $ret = $this->apiController->getThumbnail(10, 10, 'known.jpg');
 
                $this->assertEquals(Http::STATUS_OK, $ret->getStatus());
-               $this->assertInstanceOf(Http\FileDisplayResponse::class, $ret);
+               $this->assertInstanceOf(FileDisplayResponse::class, $ret);
        }
 
        public function testShowHiddenFiles(): void {
@@ -221,7 +223,7 @@ class ApiControllerTest extends TestCase {
                        ->method('setUserValue')
                        ->with($this->user->getUID(), 'files', 'show_hidden', '0');
 
-               $expected = new Http\Response();
+               $expected = new Response();
                $actual = $this->apiController->showHiddenFiles($show);
 
                $this->assertEquals($expected, $actual);
@@ -234,7 +236,7 @@ class ApiControllerTest extends TestCase {
                        ->method('setUserValue')
                        ->with($this->user->getUID(), 'files', 'crop_image_previews', '1');
 
-               $expected = new Http\Response();
+               $expected = new Response();
                $actual = $this->apiController->cropImagePreviews($crop);
 
                $this->assertEquals($expected, $actual);
index a6eba1f9eaf483f34d7714fe2cf4a4f4b6566ad9..0c0647cc415bfe476baa164d803c66790bed212a 100644 (file)
@@ -12,7 +12,9 @@ use OCA\Files\Controller\ViewController;
 use OCA\Files\Service\UserConfig;
 use OCA\Files\Service\ViewConfig;
 use OCP\App\IAppManager;
-use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\ContentSecurityPolicy;
+use OCP\AppFramework\Http\RedirectResponse;
+use OCP\AppFramework\Http\TemplateResponse;
 use OCP\AppFramework\Services\IInitialState;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\File;
@@ -133,11 +135,11 @@ class ViewControllerTest extends TestCase {
                        ->method('getAppValue')
                        ->willReturnArgument(2);
 
-               $expected = new Http\TemplateResponse(
+               $expected = new TemplateResponse(
                        'files',
                        'index',
                );
-               $policy = new Http\ContentSecurityPolicy();
+               $policy = new ContentSecurityPolicy();
                $policy->addAllowedWorkerSrcDomain('\'self\'');
                $policy->addAllowedFrameDomain('\'self\'');
                $expected->setContentSecurityPolicy($policy);
@@ -193,7 +195,7 @@ class ViewControllerTest extends TestCase {
                        ->with('files.view.indexViewFileid', ['view' => 'trashbin', 'dir' => '/test.d1462861890/sub', 'fileid' => '123'])
                        ->willReturn('/apps/files/trashbin/123?dir=/test.d1462861890/sub');
 
-               $expected = new Http\RedirectResponse('/apps/files/trashbin/123?dir=/test.d1462861890/sub');
+               $expected = new RedirectResponse('/apps/files/trashbin/123?dir=/test.d1462861890/sub');
                $this->assertEquals($expected, $this->viewController->index('', '', '123'));
        }
 }
index fdcef8f7125c01993860a920e93981f0301fe370..27b1de1322f5561420875fab240f5b402aff11e5 100644 (file)
@@ -1,5 +1,10 @@
 <?php
 
+use OC\Files\FileInfo;
+use OCA\Files\Helper;
+use OCP\ITagManager;
+use OCP\ITags;
+
 /**
  * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -7,7 +12,7 @@
  */
 class HelperTest extends \Test\TestCase {
        private function makeFileInfo($name, $size, $mtime, $isDir = false) {
-               return new \OC\Files\FileInfo(
+               return new FileInfo(
                        '/' . $name,
                        null,
                        '/',
@@ -79,7 +84,7 @@ class HelperTest extends \Test\TestCase {
                        $this->markTestSkipped('Skip mtime sorting on 32bit');
                }
                $files = self::getTestFileList();
-               $files = \OCA\Files\Helper::sortFiles($files, $sort, $sortDescending);
+               $files = Helper::sortFiles($files, $sort, $sortDescending);
                $fileNames = [];
                foreach ($files as $fileInfo) {
                        $fileNames[] = $fileInfo->getName();
@@ -91,8 +96,8 @@ class HelperTest extends \Test\TestCase {
        }
 
        public function testPopulateTags(): void {
-               $tagManager = $this->createMock(\OCP\ITagManager::class);
-               $tagger = $this->createMock(\OCP\ITags::class);
+               $tagManager = $this->createMock(ITagManager::class);
+               $tagger = $this->createMock(ITags::class);
 
                $tagManager->method('load')
                        ->with('files')
@@ -113,7 +118,7 @@ class HelperTest extends \Test\TestCase {
                        ->with([10, 22, 42])
                        ->willReturn($tags);
 
-               $result = \OCA\Files\Helper::populateTags($data, 'id', $tagManager);
+               $result = Helper::populateTags($data, 'id', $tagManager);
 
                $this->assertSame([
                        ['id' => 10, 'tags' => ['tag3']],
index 7922c45a63983c780e6622da243af52f8c0dbd50..0e3ac66ef388ef3332144acc06df55fcd7315fdf 100644 (file)
@@ -10,6 +10,7 @@ namespace OCA\Files\Tests\Service;
 use OCA\Files\Service\TagService;
 use OCP\Activity\IManager;
 use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\NotFoundException;
 use OCP\ITags;
 use OCP\IUser;
 use OCP\IUserSession;
@@ -43,7 +44,7 @@ class TagServiceTest extends \Test\TestCase {
        private $dispatcher;
 
        /**
-        * @var \OCA\Files\Service\TagService|\PHPUnit\Framework\MockObject\MockObject
+        * @var TagService|\PHPUnit\Framework\MockObject\MockObject
         */
        private $tagService;
 
@@ -134,7 +135,7 @@ class TagServiceTest extends \Test\TestCase {
                $caught = false;
                try {
                        $this->tagService->updateFileTags('subdir/unexist.txt', [$tag1]);
-               } catch (\OCP\Files\NotFoundException $e) {
+               } catch (NotFoundException $e) {
                        $caught = true;
                }
                $this->assertTrue($caught);
index 1455e427b77e3726c6ae3c54193b7376957bef99..32c94fc582a6d2945d8f86c67eb2645b96c8e25c 100644 (file)
@@ -9,6 +9,7 @@ namespace OCA\Files_External\Command;
 use OC\Core\Command\Base;
 use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
 use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
 use OCA\Files_External\NotFoundException;
 use OCA\Files_External\Service\GlobalStoragesService;
 use OCP\AppFramework\Http;
@@ -92,7 +93,7 @@ class Verify extends Base {
                        $backend = $storage->getBackend();
                        // update status (can be time-consuming)
                        $storage->setStatus(
-                               \OCA\Files_External\MountConfig::getBackendStatus(
+                               MountConfig::getBackendStatus(
                                        $backend->getStorageClass(),
                                        $storage->getBackendOptions(),
                                        false
index a55406b302ea73bd684de1709af4b69c44d274f9..be435d4de2ffc4533e42743706086b96ebc4dc47 100644 (file)
@@ -6,11 +6,13 @@
  */
 namespace OCA\Files_External\Config;
 
+use OC\Files\Cache\Storage;
 use OC\Files\Storage\FailedStorage;
 use OC\Files\Storage\Wrapper\Availability;
 use OC\Files\Storage\Wrapper\KnownMtime;
 use OCA\Files_External\Lib\PersonalMount;
 use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
 use OCA\Files_External\Service\UserGlobalStoragesService;
 use OCA\Files_External\Service\UserStoragesService;
 use OCP\Files\Config\IMountProvider;
@@ -20,6 +22,7 @@ use OCP\Files\Storage\IStorage;
 use OCP\Files\Storage\IStorageFactory;
 use OCP\Files\StorageNotAvailableException;
 use OCP\IUser;
+use OCP\Server;
 use Psr\Clock\ClockInterface;
 use Psr\Log\LoggerInterface;
 
@@ -41,7 +44,7 @@ class ConfigAdapter implements IMountProvider {
         */
        private function prepareStorageConfig(StorageConfig &$storage, IUser $user): void {
                foreach ($storage->getBackendOptions() as $option => $value) {
-                       $storage->setBackendOption($option, \OCA\Files_External\MountConfig::substitutePlaceholdersInConfig($value, $user->getUID()));
+                       $storage->setBackendOption($option, MountConfig::substitutePlaceholdersInConfig($value, $user->getUID()));
                }
 
                $objectStore = $storage->getBackendOption('objectstore');
@@ -65,7 +68,7 @@ class ConfigAdapter implements IMountProvider {
        private function constructStorage(StorageConfig $storageConfig): IStorage {
                $class = $storageConfig->getBackend()->getStorageClass();
                if (!is_a($class, IConstructableStorage::class, true)) {
-                       \OCP\Server::get(LoggerInterface::class)->warning('Building a storage not implementing IConstructableStorage is deprecated since 31.0.0', ['class' => $class]);
+                       Server::get(LoggerInterface::class)->warning('Building a storage not implementing IConstructableStorage is deprecated since 31.0.0', ['class' => $class]);
                }
                $storage = new $class($storageConfig->getBackendOptions());
 
@@ -98,7 +101,7 @@ class ConfigAdapter implements IMountProvider {
                }, $storageConfigs);
 
 
-               \OC\Files\Cache\Storage::getGlobalCache()->loadForStorageIds(array_map(function (IStorage $storage) {
+               Storage::getGlobalCache()->loadForStorageIds(array_map(function (IStorage $storage) {
                        return $storage->getId();
                }, $storages));
 
index d326e1f7f444b7a793278894877534233e0a5808..cb8d8cbb0ffa9091d7857b514400bfa230a0c831 100644 (file)
@@ -17,6 +17,7 @@ use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\Attribute\NoAdminRequired;
 use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\OCSController;
+use OCP\Constants;
 use OCP\IRequest;
 
 /**
@@ -55,10 +56,10 @@ class ApiController extends OCSController {
 
                $isSystemMount = $mountConfig->getType() === StorageConfig::MOUNT_TYPE_ADMIN;
 
-               $permissions = \OCP\Constants::PERMISSION_READ;
+               $permissions = Constants::PERMISSION_READ;
                // personal mounts can be deleted
                if (!$isSystemMount) {
-                       $permissions |= \OCP\Constants::PERMISSION_DELETE;
+                       $permissions |= Constants::PERMISSION_DELETE;
                }
 
                $entry = [
index fcd3863e658884943abae10b64788b728a65a091..9144b766d5d9d4781eab62f380653cc8bdbf531e 100644 (file)
@@ -10,6 +10,7 @@ use OCA\Files_External\Lib\Auth\AuthMechanism;
 use OCA\Files_External\Lib\Backend\Backend;
 use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
 use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
 use OCA\Files_External\NotFoundException;
 use OCA\Files_External\Service\StoragesService;
 use OCP\AppFramework\Controller;
@@ -220,7 +221,7 @@ abstract class StoragesController extends Controller {
                        $backend = $storage->getBackend();
                        // update status (can be time-consuming)
                        $storage->setStatus(
-                               \OCA\Files_External\MountConfig::getBackendStatus(
+                               MountConfig::getBackendStatus(
                                        $backend->getStorageClass(),
                                        $storage->getBackendOptions(),
                                        false,
index be07314311e6a81ddbd7825d8fb8f31e00487002..63f08dd4131889338951a4a2675f22ff57b9a6de 100644 (file)
@@ -13,6 +13,7 @@ use Icewind\Streams\IteratorDirectory;
 use OC\Files\Cache\CacheEntry;
 use OC\Files\ObjectStore\S3ConnectionTrait;
 use OC\Files\ObjectStore\S3ObjectTrait;
+use OC\Files\Storage\Common;
 use OCP\Cache\CappedMemoryCache;
 use OCP\Constants;
 use OCP\Files\FileInfo;
@@ -22,7 +23,7 @@ use OCP\ICacheFactory;
 use OCP\Server;
 use Psr\Log\LoggerInterface;
 
-class AmazonS3 extends \OC\Files\Storage\Common {
+class AmazonS3 extends Common {
        use S3ConnectionTrait;
        use S3ObjectTrait;
 
index 5de708afb047b7d654b375d5d9ceabc0c370286f..ff519c60e2dc70480bdb6282fb7119bd01c4aea9 100644 (file)
@@ -6,6 +6,7 @@
  */
 namespace OCA\Files_External\Lib\Storage;
 
+use OC\Files\Storage\DAV;
 use OCP\Files\Storage\IDisableEncryptionStorage;
 use Sabre\DAV\Client;
 
@@ -16,7 +17,7 @@ use Sabre\DAV\Client;
  * http://%host/%context/remote.php/webdav/%root
  *
  */
-class OwnCloud extends \OC\Files\Storage\DAV implements IDisableEncryptionStorage {
+class OwnCloud extends DAV implements IDisableEncryptionStorage {
        public const OC_URL_SUFFIX = 'remote.php/webdav';
 
        public function __construct($params) {
index e5188db9bccc2b4c0329c062aab054c67f015c2c..c430cc2b5fd9f8316f1a200e43a67678f9a29870 100644 (file)
@@ -10,6 +10,7 @@ use Icewind\Streams\CountWrapper;
 use Icewind\Streams\IteratorDirectory;
 use Icewind\Streams\RetryWrapper;
 use OC\Files\Storage\Common;
+use OC\Files\View;
 use OCP\Constants;
 use OCP\Files\FileInfo;
 use OCP\Files\IMimeTypeDetector;
@@ -174,7 +175,7 @@ class SFTP extends Common {
                                return false;
                        }
 
-                       $view = new \OC\Files\View('/' . $userId . '/files_external');
+                       $view = new View('/' . $userId . '/files_external');
 
                        return $view->getLocalFile('ssh_hostKeys');
                } catch (\Exception $e) {
index 8d90161323d9e60acb298429b4c3e4b135ef83c7..0490acc98e15f5d92060cef230dbebac8e04a2ba 100644 (file)
@@ -6,7 +6,9 @@
  */
 namespace OCA\Files_External\Lib\Storage;
 
-abstract class StreamWrapper extends \OC\Files\Storage\Common {
+use OC\Files\Storage\Common;
+
+abstract class StreamWrapper extends Common {
 
        abstract public function constructUrl(string $path): ?string;
 
index 0dd6e64bc65cbcc8dacba0bfdf908763ab061dbe..985d51dccd814c05594826a9d79b10ac4591985e 100644 (file)
@@ -12,7 +12,10 @@ namespace OCA\Files_External\Lib\Storage;
 use GuzzleHttp\Psr7\Uri;
 use Icewind\Streams\CallbackWrapper;
 use Icewind\Streams\IteratorDirectory;
+use OC\Files\Filesystem;
 use OC\Files\ObjectStore\SwiftFactory;
+use OC\Files\Storage\Common;
+use OCP\Cache\CappedMemoryCache;
 use OCP\Files\IMimeTypeDetector;
 use OCP\Files\StorageBadConfigException;
 use OpenStack\Common\Error\BadResponseError;
@@ -20,7 +23,7 @@ use OpenStack\ObjectStore\v1\Models\Container;
 use OpenStack\ObjectStore\v1\Models\StorageObject;
 use Psr\Log\LoggerInterface;
 
-class Swift extends \OC\Files\Storage\Common {
+class Swift extends Common {
        /** @var SwiftFactory */
        private $connectionFactory;
        /**
@@ -155,7 +158,7 @@ class Swift extends \OC\Files\Storage\Common {
 
                $this->params = $params;
                // FIXME: private class...
-               $this->objectCache = new \OCP\Cache\CappedMemoryCache();
+               $this->objectCache = new CappedMemoryCache();
                $this->connectionFactory = new SwiftFactory(
                        \OC::$server->getMemCacheFactory()->createDistributed('swift/'),
                        $this->params,
@@ -216,7 +219,7 @@ class Swift extends \OC\Files\Storage\Common {
 
                $dh = $this->opendir($path);
                while (($file = readdir($dh)) !== false) {
-                       if (\OC\Files\Filesystem::isIgnoredDir($file)) {
+                       if (Filesystem::isIgnoredDir($file)) {
                                continue;
                        }
 
@@ -482,7 +485,7 @@ class Swift extends \OC\Files\Storage\Common {
 
                        $dh = $this->opendir($source);
                        while (($file = readdir($dh)) !== false) {
-                               if (\OC\Files\Filesystem::isIgnoredDir($file)) {
+                               if (Filesystem::isIgnoredDir($file)) {
                                        continue;
                                }
 
index 682516c73bae377d3b7a36f7ffb973ff58694cf3..12523937071b392b4e5a938d6bc37b70b39fb3c8 100644 (file)
@@ -6,6 +6,7 @@
  */
 namespace OCA\Files_External\Lib;
 
+use OC\Files\Filesystem;
 use OCA\Files_External\Lib\Auth\AuthMechanism;
 use OCA\Files_External\Lib\Auth\IUserProvided;
 use OCA\Files_External\Lib\Backend\Backend;
@@ -152,7 +153,7 @@ class StorageConfig implements \JsonSerializable {
         * @param string $mountPoint path
         */
        public function setMountPoint($mountPoint) {
-               $this->mountPoint = \OC\Files\Filesystem::normalizePath($mountPoint);
+               $this->mountPoint = Filesystem::normalizePath($mountPoint);
        }
 
        /**
@@ -203,7 +204,7 @@ class StorageConfig implements \JsonSerializable {
                        foreach ($backendOptions as $key => $value) {
                                if (isset($parameters[$key])) {
                                        switch ($parameters[$key]->getType()) {
-                                               case \OCA\Files_External\Lib\DefinitionParameter::VALUE_BOOLEAN:
+                                               case DefinitionParameter::VALUE_BOOLEAN:
                                                        $value = (bool)$value;
                                                        break;
                                        }
index 1cbd6e14ebea20501c02d4561bbb38e835abb60c..744bdcacef339b8d56e85582814c51aaf1df01e5 100644 (file)
@@ -14,6 +14,8 @@ use OCA\Files_External\Service\GlobalStoragesService;
 use OCA\Files_External\Service\UserGlobalStoragesService;
 use OCA\Files_External\Service\UserStoragesService;
 use OCP\Files\StorageNotAvailableException;
+use OCP\IL10N;
+use OCP\Util;
 use phpseclib\Crypt\AES;
 use Psr\Log\LoggerInterface;
 
@@ -119,7 +121,7 @@ class MountConfig {
         * @param Backend[] $backends
         */
        public static function dependencyMessage(array $backends): string {
-               $l = \OCP\Util::getL10N('files_external');
+               $l = Util::getL10N('files_external');
                $message = '';
                $dependencyGroups = [];
 
@@ -147,7 +149,7 @@ class MountConfig {
        /**
         * Returns a dependency missing message
         */
-       private static function getSingleDependencyMessage(\OCP\IL10N $l, string $module, string $backend): string {
+       private static function getSingleDependencyMessage(IL10N $l, string $module, string $backend): string {
                switch (strtolower($module)) {
                        case 'curl':
                                return $l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]);
index c799007cc6dd48d2953663ad9035763ae5f399fb..92961d732287e1487e0994741c0bc3a193ed0d5d 100644 (file)
@@ -8,6 +8,7 @@ namespace OCA\Files_External\Service;
 
 use OC\Files\Filesystem;
 use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
 
 /**
  * Service class to manage global external storage
@@ -29,7 +30,7 @@ class GlobalStoragesService extends StoragesService {
                        $this->triggerApplicableHooks(
                                $signal,
                                $storage->getMountPoint(),
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                               MountConfig::MOUNT_TYPE_USER,
                                ['all']
                        );
                        return;
@@ -38,13 +39,13 @@ class GlobalStoragesService extends StoragesService {
                $this->triggerApplicableHooks(
                        $signal,
                        $storage->getMountPoint(),
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                       MountConfig::MOUNT_TYPE_USER,
                        $applicableUsers
                );
                $this->triggerApplicableHooks(
                        $signal,
                        $storage->getMountPoint(),
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                       MountConfig::MOUNT_TYPE_GROUP,
                        $applicableGroups
                );
        }
@@ -78,7 +79,7 @@ class GlobalStoragesService extends StoragesService {
                        $this->triggerApplicableHooks(
                                Filesystem::signal_delete_mount,
                                $oldStorage->getMountPoint(),
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                               MountConfig::MOUNT_TYPE_USER,
                                ['all']
                        );
                }
@@ -87,7 +88,7 @@ class GlobalStoragesService extends StoragesService {
                $this->triggerApplicableHooks(
                        Filesystem::signal_delete_mount,
                        $oldStorage->getMountPoint(),
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                       MountConfig::MOUNT_TYPE_USER,
                        $userDeletions
                );
 
@@ -95,7 +96,7 @@ class GlobalStoragesService extends StoragesService {
                $this->triggerApplicableHooks(
                        Filesystem::signal_delete_mount,
                        $oldStorage->getMountPoint(),
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                       MountConfig::MOUNT_TYPE_GROUP,
                        $groupDeletions
                );
 
@@ -103,7 +104,7 @@ class GlobalStoragesService extends StoragesService {
                $this->triggerApplicableHooks(
                        Filesystem::signal_create_mount,
                        $newStorage->getMountPoint(),
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                       MountConfig::MOUNT_TYPE_USER,
                        $userAdditions
                );
 
@@ -111,7 +112,7 @@ class GlobalStoragesService extends StoragesService {
                $this->triggerApplicableHooks(
                        Filesystem::signal_create_mount,
                        $newStorage->getMountPoint(),
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                       MountConfig::MOUNT_TYPE_GROUP,
                        $groupAdditions
                );
 
@@ -123,7 +124,7 @@ class GlobalStoragesService extends StoragesService {
                        $this->triggerApplicableHooks(
                                Filesystem::signal_create_mount,
                                $newStorage->getMountPoint(),
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                               MountConfig::MOUNT_TYPE_USER,
                                ['all']
                        );
                }
index 1f5cf8cdf2881528c0a0eb35e5e770a01bf4e724..20a26a07e8b1932f0fb24f88c43cdf1f19c624fb 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\Files_External\Service;
 
 use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -62,13 +63,13 @@ abstract class LegacyStoragesService {
                        $storageOptions['priority'] = $backend->getPriority();
                }
                $storageConfig->setPriority($storageOptions['priority']);
-               if ($mountType === \OCA\Files_External\MountConfig::MOUNT_TYPE_USER) {
+               if ($mountType === MountConfig::MOUNT_TYPE_USER) {
                        $applicableUsers = $storageConfig->getApplicableUsers();
                        if ($applicable !== 'all') {
                                $applicableUsers[] = $applicable;
                                $storageConfig->setApplicableUsers($applicableUsers);
                        }
-               } elseif ($mountType === \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP) {
+               } elseif ($mountType === MountConfig::MOUNT_TYPE_GROUP) {
                        $applicableGroups = $storageConfig->getApplicableGroups();
                        $applicableGroups[] = $applicable;
                        $storageConfig->setApplicableGroups($applicableGroups);
@@ -129,7 +130,7 @@ abstract class LegacyStoragesService {
                                        $relativeMountPath = rtrim($parts[2], '/');
                                        // note: we cannot do this after the loop because the decrypted config
                                        // options might be needed for the config hash
-                                       $storageOptions['options'] = \OCA\Files_External\MountConfig::decryptPasswords($storageOptions['options']);
+                                       $storageOptions['options'] = MountConfig::decryptPasswords($storageOptions['options']);
                                        if (!isset($storageOptions['backend'])) {
                                                $storageOptions['backend'] = $storageOptions['class']; // legacy compat
                                        }
@@ -147,7 +148,7 @@ abstract class LegacyStoragesService {
                                                // but at this point we don't know the max-id, so use
                                                // first group it by config hash
                                                $storageOptions['mountpoint'] = $rootMountPath;
-                                               $configId = \OCA\Files_External\MountConfig::makeConfigHash($storageOptions);
+                                               $configId = MountConfig::makeConfigHash($storageOptions);
                                                if (isset($storagesWithConfigHash[$configId])) {
                                                        $currentStorage = $storagesWithConfigHash[$configId];
                                                }
index 40bf5bfe1a80a981c4fc9238be150e3369e2a09c..12bf074a0958fa11a2e3ea23d2bd69e426f49c94 100644 (file)
@@ -6,6 +6,7 @@
  */
 namespace OCA\Files_External\Service;
 
+use OC\Files\Cache\Storage;
 use OC\Files\Filesystem;
 use OCA\Files_External\Lib\Auth\AuthMechanism;
 use OCA\Files_External\Lib\Auth\InvalidAuth;
@@ -18,6 +19,7 @@ use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\Config\IUserMountCache;
 use OCP\Files\Events\InvalidateMountCacheEvent;
 use OCP\Files\StorageNotAvailableException;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -324,7 +326,7 @@ abstract class StoragesService {
        protected function triggerApplicableHooks($signal, $mountPoint, $mountType, $applicableArray): void {
                $this->eventDispatcher->dispatchTyped(new InvalidateMountCacheEvent(null));
                foreach ($applicableArray as $applicable) {
-                       \OCP\Util::emitHook(
+                       Util::emitHook(
                                Filesystem::CLASSNAME,
                                $signal,
                                [
@@ -463,7 +465,7 @@ abstract class StoragesService {
                $this->triggerHooks($deletedStorage, Filesystem::signal_delete_mount);
 
                // delete oc_storages entries and oc_filecache
-               \OC\Files\Cache\Storage::cleanByMountId($id);
+               Storage::cleanByMountId($id);
        }
 
        /**
index b461451389b389536dbe3324dc2b71b161c06828..defa97451cd87442fc4578c90d9e30e5d09ce847 100644 (file)
@@ -8,6 +8,7 @@ namespace OCA\Files_External\Service;
 
 use OC\Files\Filesystem;
 use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
 use OCA\Files_External\NotFoundException;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\Config\IUserMountCache;
@@ -58,7 +59,7 @@ class UserStoragesService extends StoragesService {
                $this->triggerApplicableHooks(
                        $signal,
                        $storage->getMountPoint(),
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                       MountConfig::MOUNT_TYPE_USER,
                        [$user]
                );
        }
index 707f7704702c3f7bcd743333041dc9e7dfa692e3..41f2c43b5f1b3e30f83173b8c3ceaa30d5e84b66 100644 (file)
@@ -6,6 +6,7 @@
 namespace OCA\Files_External\Settings;
 
 use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
+use OCA\Files_External\MountConfig;
 use OCA\Files_External\Service\BackendService;
 use OCA\Files_External\Service\GlobalStoragesService;
 use OCP\AppFramework\Http\TemplateResponse;
@@ -48,7 +49,7 @@ class Admin implements ISettings {
                        'storages' => $this->globalStoragesService->getStorages(),
                        'backends' => $this->backendService->getAvailableBackends(),
                        'authMechanisms' => $this->backendService->getAuthMechanisms(),
-                       'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
+                       'dependencies' => MountConfig::dependencyMessage($this->backendService->getBackends()),
                        'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
                        'globalCredentials' => $this->globalAuth->getAuth(''),
                        'globalCredentialsUid' => '',
index f84051626a2221471bb99f5dfb5eeb7045d366ce..186b2638e1fa79adbc49b7c4d76ff01a8bee232b 100644 (file)
@@ -6,6 +6,7 @@
 namespace OCA\Files_External\Settings;
 
 use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
+use OCA\Files_External\MountConfig;
 use OCA\Files_External\Service\BackendService;
 use OCA\Files_External\Service\UserGlobalStoragesService;
 use OCP\AppFramework\Http\TemplateResponse;
@@ -56,7 +57,7 @@ class Personal implements ISettings {
                        'storages' => $this->userGlobalStoragesService->getStorages(),
                        'backends' => $this->backendService->getAvailableBackends(),
                        'authMechanisms' => $this->backendService->getAuthMechanisms(),
-                       'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
+                       'dependencies' => MountConfig::dependencyMessage($this->backendService->getBackends()),
                        'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
                        'globalCredentials' => $this->globalAuth->getAuth($uid),
                        'globalCredentialsUid' => $uid,
index 823b66702ab9c389abc3632597c5d8bdbdbaa785..aa28083e09ea77017a7f2f332590ba4fc3af64c9 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\Files_External\Tests\Auth\Password;
 
 use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
+use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
 use OCA\Files_external\Lib\StorageConfig;
 use OCP\IL10N;
 use OCP\Security\ICredentialsManager;
@@ -90,7 +91,7 @@ class GlobalAuthTest extends TestCase {
 
 
        public function testNoCredentialsPersonal(): void {
-               $this->expectException(\OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException::class);
+               $this->expectException(InsufficientDataForMeaningfulAnswerException::class);
 
                $this->credentialsManager->expects($this->never())
                        ->method('retrieve');
index eb47fe08ac4dc14828df22f0337e1e0afe65a910..ed991fd784df0f9965d5ae19679d30d98012432d 100644 (file)
@@ -8,6 +8,7 @@ namespace OCA\Files_External\Tests\Command;
 
 use OCA\Files_External\Lib\StorageConfig;
 use OCA\Files_External\NotFoundException;
+use OCA\Files_External\Service\GlobalStoragesService;
 use Symfony\Component\Console\Command\Command;
 use Symfony\Component\Console\Input\ArrayInput;
 use Symfony\Component\Console\Input\Input;
@@ -17,7 +18,7 @@ use Test\TestCase;
 abstract class CommandTest extends TestCase {
        /**
         * @param StorageConfig[] $mounts
-        * @return \OCA\Files_External\Service\GlobalStoragesService|\PHPUnit\Framework\MockObject\MockObject
+        * @return GlobalStoragesService|\PHPUnit\Framework\MockObject\MockObject
         */
        protected function getGlobalStorageService(array $mounts = []) {
                $mock = $this->getMockBuilder('OCA\Files_External\Service\GlobalStoragesService')
index 94512c56cadc813d48a6ef67403b16527e984b5e..0d604ff2d47a42a42d29020f1a85491802992321 100644 (file)
@@ -9,8 +9,9 @@ namespace OCA\Files_External\Tests\Controller;
 use OCA\Files_External\Controller\GlobalStoragesController;
 use OCA\Files_External\Lib\Auth\AuthMechanism;
 use OCA\Files_External\Lib\Backend\Backend;
-
 use OCA\Files_External\Lib\StorageConfig;
+
+use OCA\Files_External\MountConfig;
 use OCA\Files_External\NotFoundException;
 use OCA\Files_External\Service\GlobalStoragesService;
 use OCA\Files_External\Service\UserStoragesService;
@@ -30,11 +31,11 @@ abstract class StoragesControllerTest extends \Test\TestCase {
        protected $service;
 
        protected function setUp(): void {
-               \OCA\Files_External\MountConfig::$skipTest = true;
+               MountConfig::$skipTest = true;
        }
 
        protected function tearDown(): void {
-               \OCA\Files_External\MountConfig::$skipTest = false;
+               MountConfig::$skipTest = false;
        }
 
        /**
@@ -54,7 +55,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
        }
 
        /**
-        * @return \OCA\Files_External\Lib\Auth\AuthMechanism|MockObject
+        * @return AuthMechanism|MockObject
         */
        protected function getAuthMechMock($scheme = 'null', $class = '\OCA\Files_External\Lib\Auth\NullMechanism') {
                $authMech = $this->getMockBuilder(AuthMechanism::class)
index 99cb0cf94dee2cd610b69d1c40779ff2eb2170d8..3488195d3e87aa4344480c5b45ffae38a8a55aa6 100644 (file)
@@ -6,6 +6,8 @@
  */
 namespace OCA\Files_External\Tests;
 
+use OCA\Files_External\Lib\Storage\OwnCloud;
+
 /**
  * Class OwnCloudFunctions
  *
@@ -89,7 +91,7 @@ class OwnCloudFunctionsTest extends \Test\TestCase {
        public function testConfig($config, $expectedUri): void {
                $config['user'] = 'someuser';
                $config['password'] = 'somepassword';
-               $instance = new \OCA\Files_External\Lib\Storage\OwnCloud($config);
+               $instance = new OwnCloud($config);
                $this->assertEquals($expectedUri, $instance->createBaseUri());
        }
 }
index 2d8f41c3e5004179537b4f2c6fb75596f3753bda..b268d3b51428a68b62d2de0ce8be04282c162b72 100644 (file)
@@ -10,12 +10,13 @@ use OC\Files\Mount\Manager;
 use OC\Files\SetupManagerFactory;
 use OCA\Files_External\Lib\PersonalMount;
 use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\Service\UserStoragesService;
 use Test\TestCase;
 
 class PersonalMountTest extends TestCase {
        public function testFindByStorageId(): void {
                $storageConfig = $this->createMock(StorageConfig::class);
-               /** @var \OCA\Files_External\Service\UserStoragesService $storageService */
+               /** @var UserStoragesService $storageService */
                $storageService = $this->getMockBuilder('\OCA\Files_External\Service\UserStoragesService')
                        ->disableOriginalConstructor()
                        ->getMock();
index 74a4b223a96d2ea0289d67986bee18d4b6d8f210..59907b07d6a8265797218b2aa6490c3c3387080d 100644 (file)
@@ -40,7 +40,7 @@ class BackendServiceTest extends \Test\TestCase {
        /**
         * @param string $class
         *
-        * @return \OCA\Files_External\Lib\Auth\AuthMechanism|\PHPUnit\Framework\MockObject\MockObject
+        * @return AuthMechanism|\PHPUnit\Framework\MockObject\MockObject
         */
        protected function getAuthMechanismMock($class) {
                $backend = $this->getMockBuilder(AuthMechanism::class)
index 0c9df2e858bb2f07230e770ea796a0bc277c8d39..b4907f7f00f8e72b08225cf8961edbafe054d626 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\Files_External\Tests\Service;
 
 use OC\Files\Filesystem;
+use OCA\Files_External\MountConfig;
 
 use OCA\Files_External\Service\GlobalStoragesService;
 
@@ -181,7 +182,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'all'
                                        ],
                                ],
@@ -194,7 +195,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user1',
                                        ],
                                ],
@@ -207,7 +208,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group1',
                                        ],
                                ],
@@ -219,12 +220,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user1',
                                        ],
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user2',
                                        ],
                                ],
@@ -237,12 +238,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group1'
                                        ],
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group2'
                                        ],
                                ],
@@ -255,22 +256,22 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user1',
                                        ],
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user2',
                                        ],
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group1'
                                        ],
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group2'
                                        ],
                                ],
@@ -313,27 +314,27 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                        // delete the "all entry"
                                        [
                                                Filesystem::signal_delete_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'all',
                                        ],
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user1',
                                        ],
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user2',
                                        ],
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group1'
                                        ],
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group2'
                                        ],
                                ],
@@ -348,12 +349,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user2',
                                        ],
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group2'
                                        ],
                                ],
@@ -368,12 +369,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_delete_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user2',
                                        ],
                                        [
                                                Filesystem::signal_delete_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group2'
                                        ],
                                ],
@@ -388,18 +389,18 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_delete_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user1',
                                        ],
                                        [
                                                Filesystem::signal_delete_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group1'
                                        ],
                                        // create the "all" entry
                                        [
                                                Filesystem::signal_create_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'all'
                                        ],
                                ],
@@ -470,50 +471,50 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                        [
                                Filesystem::signal_delete_mount,
                                '/mountpoint',
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                               MountConfig::MOUNT_TYPE_USER,
                                'user1',
                        ],
                        [
                                Filesystem::signal_delete_mount,
                                '/mountpoint',
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                               MountConfig::MOUNT_TYPE_USER,
                                'user2',
                        ],
                        [
                                Filesystem::signal_delete_mount,
                                '/mountpoint',
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                               MountConfig::MOUNT_TYPE_GROUP,
                                'group1',
                        ],
                        [
                                Filesystem::signal_delete_mount,
                                '/mountpoint',
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                               MountConfig::MOUNT_TYPE_GROUP,
                                'group2',
                        ],
                        // creates new one
                        [
                                Filesystem::signal_create_mount,
                                '/renamedMountpoint',
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                               MountConfig::MOUNT_TYPE_USER,
                                'user1',
                        ],
                        [
                                Filesystem::signal_create_mount,
                                '/renamedMountpoint',
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                               MountConfig::MOUNT_TYPE_USER,
                                'user2',
                        ],
                        [
                                Filesystem::signal_create_mount,
                                '/renamedMountpoint',
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                               MountConfig::MOUNT_TYPE_GROUP,
                                'group1',
                        ],
                        [
                                Filesystem::signal_create_mount,
                                '/renamedMountpoint',
-                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                               MountConfig::MOUNT_TYPE_GROUP,
                                'group2',
                        ],
                ];
@@ -540,22 +541,22 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_delete_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user1',
                                        ],
                                        [
                                                Filesystem::signal_delete_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'user2',
                                        ],
                                        [
                                                Filesystem::signal_delete_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group1'
                                        ],
                                        [
                                                Filesystem::signal_delete_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+                                               MountConfig::MOUNT_TYPE_GROUP,
                                                'group2'
                                        ],
                                ],
@@ -567,7 +568,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
                                [
                                        [
                                                Filesystem::signal_delete_mount,
-                                               \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                                               MountConfig::MOUNT_TYPE_USER,
                                                'all',
                                        ],
                                ],
index 40cba73a74fe2876ebf114e6920ad613cb622fe8..a4e823ab6f010eb4c1b7b27241fed9599ce862b0 100644 (file)
@@ -6,13 +6,15 @@
  */
 namespace OCA\Files_External\Tests\Service;
 
+use OC\Files\Cache\Storage;
 use OC\Files\Filesystem;
-
 use OCA\Files_External\Lib\Auth\AuthMechanism;
 use OCA\Files_External\Lib\Auth\InvalidAuth;
+
 use OCA\Files_External\Lib\Backend\Backend;
 use OCA\Files_External\Lib\Backend\InvalidBackend;
 use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
 use OCA\Files_External\NotFoundException;
 use OCA\Files_External\Service\BackendService;
 use OCA\Files_External\Service\DBConfigService;
@@ -26,6 +28,7 @@ use OCP\Files\Storage\IStorage;
 use OCP\IDBConnection;
 use OCP\IUser;
 use OCP\Server;
+use OCP\Util;
 
 class CleaningDBConfig extends DBConfigService {
        private $mountIds = [];
@@ -91,7 +94,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
                        'datadirectory',
                        \OC::$SERVERROOT . '/data/'
                );
-               \OCA\Files_External\MountConfig::$skipTest = true;
+               MountConfig::$skipTest = true;
 
                $this->mountCache = $this->createMock(IUserMountCache::class);
                $this->eventDispatcher = $this->createMock(IEventDispatcher::class);
@@ -143,11 +146,11 @@ abstract class StoragesServiceTest extends \Test\TestCase {
                        ->willReturn($backends);
                $this->overwriteService(BackendService::class, $this->backendService);
 
-               \OCP\Util::connectHook(
+               Util::connectHook(
                        Filesystem::CLASSNAME,
                        Filesystem::signal_create_mount,
                        get_class($this), 'createHookCallback');
-               \OCP\Util::connectHook(
+               Util::connectHook(
                        Filesystem::CLASSNAME,
                        Filesystem::signal_delete_mount,
                        get_class($this), 'deleteHookCallback');
@@ -162,7 +165,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
        }
 
        protected function tearDown(): void {
-               \OCA\Files_External\MountConfig::$skipTest = false;
+               MountConfig::$skipTest = false;
                self::$hookCalls = [];
                if ($this->dbConfig) {
                        $this->dbConfig->clean();
@@ -249,7 +252,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
        }
 
        public function testNonExistingStorage(): void {
-               $this->expectException(\OCA\Files_External\NotFoundException::class);
+               $this->expectException(NotFoundException::class);
 
                $this->ActualNonExistingStorageTest();
        }
@@ -295,7 +298,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
 
                // manually trigger storage entry because normally it happens on first
                // access, which isn't possible within this test
-               $storageCache = new \OC\Files\Cache\Storage($rustyStorageId, true, Server::get(IDBConnection::class));
+               $storageCache = new Storage($rustyStorageId, true, Server::get(IDBConnection::class));
 
                /** @var IUserMountCache $mountCache */
                $mountCache = \OC::$server->get(IUserMountCache::class);
@@ -353,7 +356,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
        }
 
        public function testDeleteUnexistingStorage(): void {
-               $this->expectException(\OCA\Files_External\NotFoundException::class);
+               $this->expectException(NotFoundException::class);
 
                $this->actualDeletedUnexistingStorageTest();
        }
index ff8d5f4e49492505ed9ab9af2f4ab64860712cc9..7aef65cebee3e364208c8492c435a69735e19889 100644 (file)
@@ -6,6 +6,7 @@
  */
 namespace OCA\Files_External\Tests\Service;
 
+use OC\User\User;
 use OCA\Files_External\Lib\StorageConfig;
 use OCA\Files_External\NotFoundException;
 use OCA\Files_External\Service\StoragesService;
@@ -46,7 +47,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
 
                $this->globalStoragesService = $this->service;
 
-               $this->user = new \OC\User\User(self::USER_ID, null, \OC::$server->get(IEventDispatcher::class));
+               $this->user = new User(self::USER_ID, null, \OC::$server->get(IEventDispatcher::class));
                /** @var \OCP\IUserSession|\PHPUnit\Framework\MockObject\MockObject $userSession */
                $userSession = $this->createMock(IUserSession::class);
                $userSession
index cb7abfaf7251da12c8560e0a9a5a33975f2a1299..4a4404839a468ae30e98c37fb38a96c9a3993561 100644 (file)
@@ -7,8 +7,10 @@
 namespace OCA\Files_External\Tests\Service;
 
 use OC\Files\Filesystem;
-
 use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
+
+use OCA\Files_External\NotFoundException;
 use OCA\Files_External\Service\GlobalStoragesService;
 use OCA\Files_External\Service\StoragesService;
 use OCA\Files_External\Service\UserStoragesService;
@@ -85,7 +87,7 @@ class UserStoragesServiceTest extends StoragesServiceTest {
                        current(self::$hookCalls),
                        Filesystem::signal_create_mount,
                        $storage->getMountPoint(),
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                       MountConfig::MOUNT_TYPE_USER,
                        $this->userId
                );
 
@@ -136,7 +138,7 @@ class UserStoragesServiceTest extends StoragesServiceTest {
                        self::$hookCalls[1],
                        Filesystem::signal_delete_mount,
                        '/mountpoint',
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                       MountConfig::MOUNT_TYPE_USER,
                        $this->userId
                );
        }
@@ -157,21 +159,21 @@ class UserStoragesServiceTest extends StoragesServiceTest {
                        self::$hookCalls[0],
                        Filesystem::signal_delete_mount,
                        '/mountpoint',
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                       MountConfig::MOUNT_TYPE_USER,
                        $this->userId
                );
                $this->assertHookCall(
                        self::$hookCalls[1],
                        Filesystem::signal_create_mount,
                        '/renamedMountpoint',
-                       \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+                       MountConfig::MOUNT_TYPE_USER,
                        $this->userId
                );
        }
 
 
        public function testGetAdminStorage(): void {
-               $this->expectException(\OCA\Files_External\NotFoundException::class);
+               $this->expectException(NotFoundException::class);
 
                $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB');
                $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism');
index 602e0124950ec31f29f2431e10793d7a6dc42fcf..aceb8d2e915bd0a3256bed588db3103d0420b3ed 100644 (file)
@@ -6,6 +6,7 @@
 namespace OCA\Files_External\Tests\Settings;
 
 use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
+use OCA\Files_External\MountConfig;
 use OCA\Files_External\Service\BackendService;
 use OCA\Files_External\Service\GlobalStoragesService;
 use OCA\Files_External\Settings\Admin;
@@ -76,7 +77,7 @@ class AdminTest extends TestCase {
                        'storages' => ['a', 'b', 'c'],
                        'backends' => ['d', 'e', 'f'],
                        'authMechanisms' => ['g', 'h', 'i'],
-                       'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
+                       'dependencies' => MountConfig::dependencyMessage($this->backendService->getBackends()),
                        'allowUserMounting' => true,
                        'globalCredentials' => 'asdf:asdf',
                        'globalCredentialsUid' => '',
index e95723a7b11f25cf56cf6c73b51a6c8a54cfdeed..6c0d5ca078148811fdd7f06d429c3b02b56929d5 100644 (file)
@@ -120,9 +120,9 @@ class Application extends App implements IBootstrap {
 
        public function registerEventsScripts(IEventDispatcher $dispatcher): void {
                $dispatcher->addListener(ResourcesLoadAdditionalScriptsEvent::class, function (): void {
-                       \OCP\Util::addScript('files_sharing', 'collaboration');
+                       Util::addScript('files_sharing', 'collaboration');
                });
-               $dispatcher->addListener(\OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent::class, function (): void {
+               $dispatcher->addListener(BeforeTemplateRenderedEvent::class, function (): void {
                        /**
                         * Always add main sharing script
                         */
index 94427f7a97974aecd882730f66d8cdbfe77f1b58..ac44ae7c6ccf02c6413ed9c692c3fc9d614e8d51 100644 (file)
@@ -122,7 +122,7 @@ class Cache extends CacheJail {
                parent::remove($file);
        }
 
-       public function moveFromCache(\OCP\Files\Cache\ICache $sourceCache, $sourcePath, $targetPath) {
+       public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
                $this->rootUnchanged = false;
                return parent::moveFromCache($sourceCache, $sourcePath, $targetPath);
        }
index b61f9995c02f1a8c69f10d295cb584e7af6ca72e..ce30cf373ec0c89278196ef347ff0f27076947e5 100644 (file)
@@ -17,6 +17,7 @@ use OCP\AppFramework\OCS\OCSException;
 use OCP\AppFramework\OCS\OCSNotFoundException;
 use OCP\AppFramework\OCSController;
 use OCP\AppFramework\QueryException;
+use OCP\Files\Folder;
 use OCP\Files\IRootFolder;
 use OCP\Files\NotFoundException;
 use OCP\IGroupManager;
@@ -105,7 +106,7 @@ class DeletedShareAPIController extends OCSController {
                }
 
                $result['path'] = $userFolder->getRelativePath($node->getPath());
-               if ($node instanceof \OCP\Files\Folder) {
+               if ($node instanceof Folder) {
                        $result['item_type'] = 'folder';
                } else {
                        $result['item_type'] = 'file';
index fd3bdf15613a76564518d3363dbe478b001c78dd..cdac35e0d9ccb88e0b847bd1dcb2e069fe90f452 100644 (file)
@@ -6,6 +6,7 @@
  */
 namespace OCA\Files_Sharing\Controller;
 
+use OC\Files\View;
 use OCA\Files_Sharing\External\Manager;
 use OCA\Files_Sharing\ResponseDefinitions;
 use OCP\AppFramework\Http;
@@ -96,7 +97,7 @@ class RemoteController extends OCSController {
         * @return array enriched share info with data from the filecache
         */
        private static function extendShareInfo($share) {
-               $view = new \OC\Files\View('/' . \OC_User::getUser() . '/files/');
+               $view = new View('/' . \OC_User::getUser() . '/files/');
                $info = $view->getFileInfo($share['mountpoint']);
 
                if ($info === false) {
index cf8358746772467d49df1a5e716e5265725add81..4cff998724207d9891dc1e7764c6645bcc018ca7 100644 (file)
@@ -12,11 +12,13 @@ namespace OCA\Files_Sharing\Controller;
 use Exception;
 use OC\Files\FileInfo;
 use OC\Files\Storage\Wrapper\Wrapper;
+use OCA\Circles\Api\v1\Circles;
 use OCA\Files\Helper;
 use OCA\Files_Sharing\Exceptions\SharingRightsException;
 use OCA\Files_Sharing\External\Storage;
 use OCA\Files_Sharing\ResponseDefinitions;
 use OCA\Files_Sharing\SharedStorage;
+use OCA\GlobalSiteSelector\Service\SlaveService;
 use OCP\App\IAppManager;
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\Attribute\NoAdminRequired;
@@ -29,6 +31,7 @@ use OCP\AppFramework\OCS\OCSNotFoundException;
 use OCP\AppFramework\OCSController;
 use OCP\AppFramework\QueryException;
 use OCP\Constants;
+use OCP\Files\File;
 use OCP\Files\Folder;
 use OCP\Files\InvalidPathException;
 use OCP\Files\IRootFolder;
@@ -410,7 +413,7 @@ class ShareAPIController extends OCSController {
                }
 
                try {
-                       $slaveService = Server::get(\OCA\GlobalSiteSelector\Service\SlaveService::class);
+                       $slaveService = Server::get(SlaveService::class);
                } catch (\Throwable $e) {
                        $this->logger->error(
                                $e->getMessage(),
@@ -619,7 +622,7 @@ class ShareAPIController extends OCSController {
                        $permissions |= Constants::PERMISSION_READ;
                }
 
-               if ($node instanceof \OCP\Files\File) {
+               if ($node instanceof File) {
                        // Single file shares should never have delete or create permissions
                        $permissions &= ~Constants::PERMISSION_DELETE;
                        $permissions &= ~Constants::PERMISSION_CREATE;
@@ -695,7 +698,7 @@ class ShareAPIController extends OCSController {
                                }
 
                                // Public upload can only be set for folders
-                               if ($node instanceof \OCP\Files\File) {
+                               if ($node instanceof File) {
                                        throw new OCSNotFoundException($this->l->t('Public upload is only possible for publicly shared folders'));
                                }
 
@@ -766,7 +769,7 @@ class ShareAPIController extends OCSController {
                                throw new OCSNotFoundException($this->l->t('You cannot share to a Team if the app is not enabled'));
                        }
 
-                       $circle = \OCA\Circles\Api\v1\Circles::detailsCircle($shareWith);
+                       $circle = Circles::detailsCircle($shareWith);
 
                        // Valid team is required to share
                        if ($circle === null) {
@@ -864,7 +867,7 @@ class ShareAPIController extends OCSController {
         * @throws NotFoundException
         */
        private function getSharesInDir(Node $folder): array {
-               if (!($folder instanceof \OCP\Files\Folder)) {
+               if (!($folder instanceof Folder)) {
                        throw new OCSBadRequestException($this->l->t('Not a directory'));
                }
 
@@ -1066,7 +1069,7 @@ class ShareAPIController extends OCSController {
                try {
                        $node = $userFolder->get($path);
                        $this->lock($node);
-               } catch (\OCP\Files\NotFoundException $e) {
+               } catch (NotFoundException $e) {
                        throw new OCSNotFoundException($this->l->t('Wrong path, file/folder does not exist'));
                } catch (LockedException $e) {
                        throw new OCSNotFoundException($this->l->t('Could not lock path'));
@@ -1287,7 +1290,7 @@ class ShareAPIController extends OCSController {
                                        throw new OCSForbiddenException($this->l->t('Public upload disabled by the administrator'));
                                }
 
-                               if (!($share->getNode() instanceof \OCP\Files\Folder)) {
+                               if (!($share->getNode() instanceof Folder)) {
                                        throw new OCSBadRequestException($this->l->t('Public upload is only possible for publicly shared folders'));
                                }
 
@@ -1458,7 +1461,7 @@ class ShareAPIController extends OCSController {
         *
         * @suppress PhanUndeclaredClassMethod
         */
-       protected function canAccessShare(\OCP\Share\IShare $share, bool $checkGroups = true): bool {
+       protected function canAccessShare(IShare $share, bool $checkGroups = true): bool {
                // A file with permissions 0 can't be accessed by us. So Don't show it
                if ($share->getPermissions() === 0) {
                        return false;
@@ -1531,7 +1534,7 @@ class ShareAPIController extends OCSController {
         * @param \OCP\Share\IShare $share the share to check
         * @return boolean
         */
-       protected function canEditShare(\OCP\Share\IShare $share): bool {
+       protected function canEditShare(IShare $share): bool {
                // A file with permissions 0 can't be accessed by us. So Don't show it
                if ($share->getPermissions() === 0) {
                        return false;
@@ -1558,7 +1561,7 @@ class ShareAPIController extends OCSController {
         * @param \OCP\Share\IShare $share the share to check
         * @return boolean
         */
-       protected function canDeleteShare(\OCP\Share\IShare $share): bool {
+       protected function canDeleteShare(IShare $share): bool {
                // A file with permissions 0 can't be accessed by us. So Don't show it
                if ($share->getPermissions() === 0) {
                        return false;
@@ -1595,7 +1598,7 @@ class ShareAPIController extends OCSController {
         *
         * @suppress PhanUndeclaredClassMethod
         */
-       protected function canDeleteShareFromSelf(\OCP\Share\IShare $share): bool {
+       protected function canDeleteShareFromSelf(IShare $share): bool {
                if ($share->getShareType() !== IShare::TYPE_GROUP &&
                        $share->getShareType() !== IShare::TYPE_ROOM &&
                        $share->getShareType() !== IShare::TYPE_DECK &&
@@ -1746,7 +1749,7 @@ class ShareAPIController extends OCSController {
         * @param \OCP\Files\Node $node
         * @throws LockedException
         */
-       private function lock(\OCP\Files\Node $node) {
+       private function lock(Node $node) {
                $node->lock(ILockingProvider::LOCK_SHARED);
                $this->lockedNode = $node;
        }
@@ -1923,7 +1926,7 @@ class ShareAPIController extends OCSController {
                        return true;
                }
 
-               if ((\OCP\Constants::PERMISSION_SHARE & $share->getPermissions()) === 0) {
+               if ((Constants::PERMISSION_SHARE & $share->getPermissions()) === 0) {
                        return false;
                }
 
@@ -1946,7 +1949,7 @@ class ShareAPIController extends OCSController {
                                $sharedWith = substr($share->getSharedWith(), $shareWithStart, $shareWithLength);
                        }
                        try {
-                               $member = \OCA\Circles\Api\v1\Circles::getMember($sharedWith, $userId, 1);
+                               $member = Circles::getMember($sharedWith, $userId, 1);
                                if ($member->getLevel() >= 4) {
                                        return true;
                                }
@@ -2065,7 +2068,7 @@ class ShareAPIController extends OCSController {
                        } else {
                                throw new \RuntimeException('Should not happen, instanceOfStorage but not a wrapper');
                        }
-                       /** @var \OCA\Files_Sharing\SharedStorage $storage */
+                       /** @var SharedStorage $storage */
                        $inheritedAttributes = $storage->getShare()->getAttributes();
                        if ($inheritedAttributes !== null && $inheritedAttributes->getAttribute('permissions', 'download') === false) {
                                $share->setHideDownload(true);
index e2b607f8eb2f4136cb646dc3f5ac552806085932..5b2a2af49920e9a2727f4ce5484dbed27b226971 100644 (file)
@@ -17,13 +17,17 @@ use OCP\AppFramework\AuthPublicShareController;
 use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
 use OCP\AppFramework\Http\Attribute\OpenAPI;
 use OCP\AppFramework\Http\Attribute\PublicPage;
+use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\Http\NotFoundResponse;
 use OCP\AppFramework\Http\RedirectResponse;
 use OCP\AppFramework\Http\TemplateResponse;
+use OCP\Constants;
 use OCP\Defaults;
 use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\File;
 use OCP\Files\Folder;
 use OCP\Files\IRootFolder;
+use OCP\Files\Node;
 use OCP\Files\NotFoundException;
 use OCP\IConfig;
 use OCP\IL10N;
@@ -46,7 +50,7 @@ use OCP\Share\IShare;
  */
 #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
 class ShareController extends AuthPublicShareController {
-       protected ?Share\IShare $share = null;
+       protected ?IShare $share = null;
 
        public const SHARE_ACCESS = 'access';
        public const SHARE_AUTH = 'auth';
@@ -217,7 +221,7 @@ class ShareController extends AuthPublicShareController {
                $itemType = $itemSource = $uidOwner = '';
                $token = $share;
                $exception = null;
-               if ($share instanceof \OCP\Share\IShare) {
+               if ($share instanceof IShare) {
                        try {
                                $token = $share->getToken();
                                $uidOwner = $share->getSharedBy();
@@ -261,7 +265,7 @@ class ShareController extends AuthPublicShareController {
         * @param Share\IShare $share
         * @return bool
         */
-       private function validateShare(\OCP\Share\IShare $share) {
+       private function validateShare(IShare $share) {
                // If the owner is disabled no access to the link is granted
                $owner = $this->userManager->get($share->getShareOwner());
                if ($owner === null || !$owner->isEnabled()) {
@@ -314,7 +318,7 @@ class ShareController extends AuthPublicShareController {
 
                // We can't get the path of a file share
                try {
-                       if ($shareNode instanceof \OCP\Files\File && $path !== '') {
+                       if ($shareNode instanceof File && $path !== '') {
                                $this->emitAccessShareHook($share, 404, 'Share not found');
                                $this->emitShareAccessEvent($share, self::SHARE_ACCESS, 404, 'Share not found');
                                throw new NotFoundException($this->l10n->t('This share does not exist or is no longer available'));
@@ -349,8 +353,8 @@ class ShareController extends AuthPublicShareController {
 
                $share = $this->shareManager->getShareByToken($token);
 
-               if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
-                       return new \OCP\AppFramework\Http\DataResponse('Share has no read permission');
+               if (!($share->getPermissions() & Constants::PERMISSION_READ)) {
+                       return new DataResponse('Share has no read permission');
                }
 
                if (!$this->validateShare($share)) {
@@ -358,7 +362,7 @@ class ShareController extends AuthPublicShareController {
                }
 
                // Single file share
-               if ($share->getNode() instanceof \OCP\Files\File) {
+               if ($share->getNode() instanceof File) {
                        // Single file download
                        $this->singleFileDownloaded($share, $share->getNode());
                }
@@ -378,7 +382,7 @@ class ShareController extends AuthPublicShareController {
                                }
                        }
 
-                       if ($node instanceof \OCP\Files\Folder) {
+                       if ($node instanceof Folder) {
                                if ($files === null || $files === '') {
                                        // The folder is downloaded
                                        $this->singleFileDownloaded($share, $share->getNode());
@@ -415,7 +419,7 @@ class ShareController extends AuthPublicShareController {
         * @param Share\IShare $share
         * @throws NotFoundException when trying to download a folder of a "hide download" share
         */
-       protected function singleFileDownloaded(Share\IShare $share, \OCP\Files\Node $node) {
+       protected function singleFileDownloaded(IShare $share, Node $node) {
                if ($share->getHideDownload() && $node instanceof Folder) {
                        throw new NotFoundException('Downloading a folder');
                }
@@ -435,14 +439,14 @@ class ShareController extends AuthPublicShareController {
                $parameters = [$userPath];
 
                if ($share->getShareType() === IShare::TYPE_EMAIL) {
-                       if ($node instanceof \OCP\Files\File) {
+                       if ($node instanceof File) {
                                $subject = Downloads::SUBJECT_SHARED_FILE_BY_EMAIL_DOWNLOADED;
                        } else {
                                $subject = Downloads::SUBJECT_SHARED_FOLDER_BY_EMAIL_DOWNLOADED;
                        }
                        $parameters[] = $share->getSharedWith();
                } else {
-                       if ($node instanceof \OCP\Files\File) {
+                       if ($node instanceof File) {
                                $subject = Downloads::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED;
                                $parameters[] = $remoteAddressHash;
                        } else {
index f177cb9d1ee3a8a82c04ecb695b193dbbe3c7cf5..606a3d11de6dd61b49ba2498d7cb0606b30f7206 100644 (file)
@@ -10,6 +10,7 @@ namespace OCA\Files_Sharing\Controller;
 
 use Generator;
 use OC\Collaboration\Collaborators\SearchResult;
+use OC\Share\Share;
 use OCA\Files_Sharing\ResponseDefinitions;
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\Attribute\NoAdminRequired;
@@ -362,7 +363,7 @@ class ShareesAPIController extends OCSController {
        protected function isRemoteSharingAllowed(string $itemType): bool {
                try {
                        // FIXME: static foo makes unit testing unnecessarily difficult
-                       $backend = \OC\Share\Share::getBackend($itemType);
+                       $backend = Share::getBackend($itemType);
                        return $backend->isShareTypeAllowed(IShare::TYPE_REMOTE);
                } catch (\Exception $e) {
                        return false;
@@ -372,7 +373,7 @@ class ShareesAPIController extends OCSController {
        protected function isRemoteGroupSharingAllowed(string $itemType): bool {
                try {
                        // FIXME: static foo makes unit testing unnecessarily difficult
-                       $backend = \OC\Share\Share::getBackend($itemType);
+                       $backend = Share::getBackend($itemType);
                        return $backend->isShareTypeAllowed(IShare::TYPE_REMOTE_GROUP);
                } catch (\Exception $e) {
                        return false;
index bea48f28dee0f460335f5cea8192f79597540f2b..dad1f3324588bae0073b2224eb2a2d3485d337b3 100644 (file)
@@ -20,6 +20,7 @@ use OCP\AppFramework\Http\Template\PublicTemplateResponse;
 use OCP\AppFramework\Http\Template\SimpleMenuAction;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\AppFramework\Services\IInitialState;
+use OCP\Constants;
 use OCP\Defaults;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\File;
@@ -78,8 +79,8 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider
                if ($shareNode instanceof File) {
                        $view = 'public-file-share';
                        $this->initialState->provideInitialState('fileId', $shareNode->getId());
-               } elseif (($share->getPermissions() & \OCP\Constants::PERMISSION_CREATE)
-                       && !($share->getPermissions() & \OCP\Constants::PERMISSION_READ)
+               } elseif (($share->getPermissions() & Constants::PERMISSION_CREATE)
+                       && !($share->getPermissions() & Constants::PERMISSION_READ)
                ) {
                        // share is a folder with create but no read permissions -> file drop only
                        $view = 'public-file-drop';
@@ -97,10 +98,10 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider
                $this->initialState->provideInitialState('view', $view);
 
                // Load scripts and styles for UI
-               \OCP\Util::addInitScript('files', 'init');
-               \OCP\Util::addInitScript(Application::APP_ID, 'init');
-               \OCP\Util::addInitScript(Application::APP_ID, 'init-public');
-               \OCP\Util::addScript('files', 'main');
+               Util::addInitScript('files', 'init');
+               Util::addInitScript(Application::APP_ID, 'init');
+               Util::addInitScript(Application::APP_ID, 'init-public');
+               Util::addScript('files', 'main');
 
                // Add file-request script if needed
                $attributes = $share->getAttributes();
@@ -171,7 +172,7 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider
                if ($shareNode->getMimePart() === 'image') {
                        // If this is a file and especially an image directly point to the image preview
                        $directLink = $this->urlGenerator->linkToRouteAbsolute('files_sharing.publicpreview.directLink', ['token' => $token]);
-               } elseif (($share->getPermissions() & \OCP\Constants::PERMISSION_READ) && !$share->getHideDownload()) {
+               } elseif (($share->getPermissions() & Constants::PERMISSION_READ) && !$share->getHideDownload()) {
                        // Can read and no download restriction, so just download it
                        $directLink = $downloadUrl ?? $shareUrl;
                }
index 7fad71b9084cc171e91531dcd3d2484c8ec9e3e8..deef16c0f1a7ea285a92b163b24b988f2cb6de6e 100644 (file)
@@ -16,7 +16,7 @@ class Cache extends \OC\Files\Cache\Cache {
        private $storage;
 
        /**
-        * @param \OCA\Files_Sharing\External\Storage $storage
+        * @param Storage $storage
         * @param ICloudId $cloudId
         */
        public function __construct($storage, ICloudId $cloudId) {
index 86c9ae830e4ab23c03a56bd7c7f1bb99fa4f2a38..58e24a96338bbfcd383b1c0b8ba2dc19dcc6f528 100644 (file)
@@ -16,6 +16,7 @@ use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Federation\ICloudFederationFactory;
 use OCP\Federation\ICloudFederationProviderManager;
 use OCP\Files;
+use OCP\Files\Events\InvalidateMountCacheEvent;
 use OCP\Files\NotFoundException;
 use OCP\Files\Storage\IStorageFactory;
 use OCP\Http\Client\IClientService;
@@ -347,7 +348,7 @@ class Manager {
                                $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'accept');
                                $event = new FederatedShareAddedEvent($share['remote']);
                                $this->eventDispatcher->dispatchTyped($event);
-                               $this->eventDispatcher->dispatchTyped(new Files\Events\InvalidateMountCacheEvent($this->userManager->get($this->uid)));
+                               $this->eventDispatcher->dispatchTyped(new InvalidateMountCacheEvent($this->userManager->get($this->uid)));
                                $result = true;
                        }
                }
@@ -567,7 +568,7 @@ class Manager {
                ');
                $result = (bool)$query->execute([$target, $targetHash, $sourceHash, $this->uid]);
 
-               $this->eventDispatcher->dispatchTyped(new Files\Events\InvalidateMountCacheEvent($this->userManager->get($this->uid)));
+               $this->eventDispatcher->dispatchTyped(new InvalidateMountCacheEvent($this->userManager->get($this->uid)));
 
                return $result;
        }
index 63757d44f46188e1b8f199eaa5563d137c495db8..d3b54e0f0f6fce54d130111fbd3feef1c4a18a7a 100644 (file)
@@ -12,7 +12,7 @@ use OCP\Files\StorageInvalidException;
 use OCP\Files\StorageNotAvailableException;
 
 class Scanner extends \OC\Files\Cache\Scanner {
-       /** @var \OCA\Files_Sharing\External\Storage */
+       /** @var Storage */
        protected $storage;
 
        public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
index 39e907cffff247c8e0a09619c21f648af9da597b..629e5c2c268b74f2ccb34b25fc29d717a2c5cb26 100644 (file)
@@ -13,6 +13,7 @@ use GuzzleHttp\Exception\ConnectException;
 use GuzzleHttp\Exception\RequestException;
 use OC\Files\Storage\DAV;
 use OC\ForbiddenException;
+use OC\Share\Share;
 use OCA\Files_Sharing\External\Manager as ExternalShareManager;
 use OCA\Files_Sharing\ISharedStorage;
 use OCP\AppFramework\Http;
@@ -35,6 +36,7 @@ use OCP\OCM\Exceptions\OCMArgumentException;
 use OCP\OCM\Exceptions\OCMProviderException;
 use OCP\OCM\IOCMDiscoveryService;
 use OCP\Server;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, IReliableEtagStorage {
@@ -144,7 +146,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage,
                if (!isset($this->scanner)) {
                        $this->scanner = new Scanner($storage);
                }
-               /** @var \OCA\Files_Sharing\External\Scanner */
+               /** @var Scanner */
                return $this->scanner;
        }
 
@@ -328,7 +330,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage,
        }
 
        public function isSharable(string $path): bool {
-               if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) {
+               if (Util::isSharingDisabledForUser() || !Share::isResharingAllowed()) {
                        return false;
                }
                return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE);
index 8efcb7cae7b5b3e39e1d4451016cff5c05f7f37e..538e37fa88e6f07187a931f8fb9134c1e1c7aa0f 100644 (file)
@@ -9,13 +9,14 @@ namespace OCA\Files_Sharing;
 use OC\Files\Filesystem;
 use OC\Files\View;
 use OCA\Files_Sharing\AppInfo\Application;
+use OCP\Util;
 
 class Helper {
        public static function registerHooks() {
-               \OCP\Util::connectHook('OC_Filesystem', 'post_rename', '\OCA\Files_Sharing\Updater', 'renameHook');
-               \OCP\Util::connectHook('OC_Filesystem', 'post_delete', '\OCA\Files_Sharing\Hooks', 'unshareChildren');
+               Util::connectHook('OC_Filesystem', 'post_rename', '\OCA\Files_Sharing\Updater', 'renameHook');
+               Util::connectHook('OC_Filesystem', 'post_delete', '\OCA\Files_Sharing\Hooks', 'unshareChildren');
 
-               \OCP\Util::connectHook('OC_User', 'post_deleteUser', '\OCA\Files_Sharing\Hooks', 'deleteUser');
+               Util::connectHook('OC_User', 'post_deleteUser', '\OCA\Files_Sharing\Hooks', 'deleteUser');
        }
 
        /**
index a6ab3f16f29d77524029bef20f8be9f5cd2e1960..6a297f1e87589e9fe24fb9b827d058f550653d93 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\Files_Sharing;
 
 use OC\Files\Filesystem;
+use OC\Files\View;
 
 class Hooks {
        public static function deleteUser($params) {
@@ -17,10 +18,10 @@ class Hooks {
 
        public static function unshareChildren($params) {
                $path = Filesystem::getView()->getAbsolutePath($params['path']);
-               $view = new \OC\Files\View('/');
+               $view = new View('/');
 
                // find share mount points within $path and unmount them
-               $mountManager = \OC\Files\Filesystem::getMountManager();
+               $mountManager = Filesystem::getMountManager();
                $mountedShares = $mountManager->findIn($path);
                foreach ($mountedShares as $mount) {
                        if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
index 5313f40ff6bbe696c3d3cc11ddde63fcf85d2470..06e3ed1e147e21a04a82dbb1f397e692df66bcd2 100644 (file)
@@ -51,7 +51,7 @@ class MountProvider implements IMountProvider {
 
 
                // filter out excluded shares and group shares that includes self
-               $shares = array_filter($shares, function (\OCP\Share\IShare $share) use ($user) {
+               $shares = array_filter($shares, function (IShare $share) use ($user) {
                        return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID();
                });
 
@@ -165,7 +165,7 @@ class MountProvider implements IMountProvider {
         * @param \OCP\IUser $user user
         * @return array Tuple of [superShare, groupedShares]
         */
-       private function buildSuperShares(array $allShares, \OCP\IUser $user) {
+       private function buildSuperShares(array $allShares, IUser $user) {
                $result = [];
 
                $groupedShares = $this->groupShares($allShares);
index 1ff1046bce77867e21efef4a815a41af9f820b26..ec0959088ce6b4aa7379227858d70886e7f4dc99 100644 (file)
@@ -14,7 +14,7 @@ use OC\Files\ObjectStore\ObjectStoreScanner;
  */
 class Scanner extends \OC\Files\Cache\Scanner {
        /**
-        * @var \OCA\Files_Sharing\SharedStorage $storage
+        * @var SharedStorage $storage
         */
        protected $storage;
 
index 4d93232b6389eabde4fe61937976bb51e84f64d2..0b7ec58aef33de88aa79cd24fd6852af7de91df7 100644 (file)
@@ -6,11 +6,17 @@
  */
 namespace OCA\Files_Sharing\ShareBackend;
 
+use OC\Files\Filesystem;
+use OC\Files\View;
 use OCA\FederatedFileSharing\FederatedShareProvider;
+use OCA\Files_Sharing\Helper;
+use OCP\Files\NotFoundException;
+use OCP\Server;
 use OCP\Share\IShare;
+use OCP\Share_Backend_File_Dependent;
 use Psr\Log\LoggerInterface;
 
-class File implements \OCP\Share_Backend_File_Dependent {
+class File implements Share_Backend_File_Dependent {
        public const FORMAT_SHARED_STORAGE = 0;
        public const FORMAT_GET_FOLDER_CONTENTS = 1;
        public const FORMAT_FILE_APP_ROOT = 2;
@@ -34,13 +40,13 @@ class File implements \OCP\Share_Backend_File_Dependent {
 
        public function isValidSource($itemSource, $uidOwner) {
                try {
-                       $path = \OC\Files\Filesystem::getPath($itemSource);
+                       $path = Filesystem::getPath($itemSource);
                        // FIXME: attributes should not be set here,
                        // keeping this pattern for now to avoid unexpected
                        // regressions
-                       $this->path = \OC\Files\Filesystem::normalizePath(basename($path));
+                       $this->path = Filesystem::normalizePath(basename($path));
                        return true;
-               } catch (\OCP\Files\NotFoundException $e) {
+               } catch (NotFoundException $e) {
                        return false;
                }
        }
@@ -52,9 +58,9 @@ class File implements \OCP\Share_Backend_File_Dependent {
                        return $path;
                } else {
                        try {
-                               $path = \OC\Files\Filesystem::getPath($itemSource);
+                               $path = Filesystem::getPath($itemSource);
                                return $path;
-                       } catch (\OCP\Files\NotFoundException $e) {
+                       } catch (NotFoundException $e) {
                                return false;
                        }
                }
@@ -68,11 +74,11 @@ class File implements \OCP\Share_Backend_File_Dependent {
         * @return string
         */
        public function generateTarget($itemSource, $shareWith) {
-               $shareFolder = \OCA\Files_Sharing\Helper::getShareFolder();
-               $target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($itemSource));
+               $shareFolder = Helper::getShareFolder();
+               $target = Filesystem::normalizePath($shareFolder . '/' . basename($itemSource));
 
-               \OC\Files\Filesystem::initMountPoints($shareWith);
-               $view = new \OC\Files\View('/' . $shareWith . '/files');
+               Filesystem::initMountPoints($shareWith);
+               $view = new View('/' . $shareWith . '/files');
 
                if (!$view->is_dir($shareFolder)) {
                        $dir = '';
@@ -85,7 +91,7 @@ class File implements \OCP\Share_Backend_File_Dependent {
                        }
                }
 
-               return \OCA\Files_Sharing\Helper::generateUniqueTarget($target, $view);
+               return Helper::generateUniqueTarget($target, $view);
        }
 
        public function formatItems($items, $format, $parameters = null) {
@@ -116,7 +122,7 @@ class File implements \OCP\Share_Backend_File_Dependent {
                                $file['uid_owner'] = $item['uid_owner'];
                                $file['displayname_owner'] = $item['displayname_owner'];
 
-                               $storage = \OC\Files\Filesystem::getStorage('/');
+                               $storage = Filesystem::getStorage('/');
                                $cache = $storage->getCache();
                                $file['size'] = $item['size'];
                                $files[] = $file;
@@ -199,7 +205,7 @@ class File implements \OCP\Share_Backend_File_Dependent {
                if (isset($fileOwner)) {
                        $source['fileOwner'] = $fileOwner;
                } else {
-                       \OCP\Server::get(LoggerInterface::class)->error('No owner found for reshare', ['app' => 'files_sharing']);
+                       Server::get(LoggerInterface::class)->error('No owner found for reshare', ['app' => 'files_sharing']);
                }
 
                return $source;
index f64d44faefceeeb1552ee959eafabd5e94011afa..fefdd7f667ce8a4e227b4f54b08e99549cff20bd 100644 (file)
@@ -6,7 +6,9 @@
  */
 namespace OCA\Files_Sharing\ShareBackend;
 
-class Folder extends File implements \OCP\Share_Backend_Collection {
+use OCP\Share_Backend_Collection;
+
+class Folder extends File implements Share_Backend_Collection {
        public function getChildren($itemSource) {
                $children = [];
                $parents = [$itemSource];
index ddd6af3845da6616bf9f3aed9f2c3865fc852873..420de6889bf366ee5df428cd43f06990be4d3bb7 100644 (file)
@@ -11,13 +11,16 @@ use OC\Files\Filesystem;
 use OC\Files\Mount\MountPoint;
 use OC\Files\Mount\MoveableMount;
 use OC\Files\View;
+use OCA\Files_Sharing\Exceptions\BrokenPath;
 use OCP\Cache\CappedMemoryCache;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\Events\InvalidateMountCacheEvent;
 use OCP\Files\Storage\IStorageFactory;
 use OCP\ICache;
 use OCP\IUser;
+use OCP\Server;
 use OCP\Share\Events\VerifyMountPointEvent;
+use OCP\Share\IShare;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -25,7 +28,7 @@ use Psr\Log\LoggerInterface;
  */
 class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint {
        /**
-        * @var \OCA\Files_Sharing\SharedStorage $storage
+        * @var SharedStorage $storage
         */
        protected $storage = null;
 
@@ -79,7 +82,7 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
         * @return string
         */
        private function verifyMountPoint(
-               \OCP\Share\IShare $share,
+               IShare $share,
                array $mountpoints,
                CappedMemoryCache $folderExistCache,
        ) {
@@ -108,7 +111,7 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
                }
 
                $newMountPoint = $this->generateUniqueTarget(
-                       \OC\Files\Filesystem::normalizePath($parent . '/' . $mountPoint),
+                       Filesystem::normalizePath($parent . '/' . $mountPoint),
                        $this->recipientView,
                        $mountpoints
                );
@@ -169,7 +172,7 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
         *
         * @param string $path the absolute path
         * @return string e.g. turns '/admin/files/test.txt' into '/test.txt'
-        * @throws \OCA\Files_Sharing\Exceptions\BrokenPath
+        * @throws BrokenPath
         */
        protected function stripUserFilesPath($path) {
                $trimmed = ltrim($path, '/');
@@ -177,8 +180,8 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
 
                // it is not a file relative to data/user/files
                if (count($split) < 3 || $split[1] !== 'files') {
-                       \OCP\Server::get(LoggerInterface::class)->error('Can not strip userid and "files/" from path: ' . $path, ['app' => 'files_sharing']);
-                       throw new \OCA\Files_Sharing\Exceptions\BrokenPath('Path does not start with /user/files', 10);
+                       Server::get(LoggerInterface::class)->error('Can not strip userid and "files/" from path: ' . $path, ['app' => 'files_sharing']);
+                       throw new BrokenPath('Path does not start with /user/files', 10);
                }
 
                // skip 'user' and 'files'
@@ -205,7 +208,7 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
                        $this->setMountPoint($target);
                        $this->storage->setMountPoint($relTargetPath);
                } catch (\Exception $e) {
-                       \OCP\Server::get(LoggerInterface::class)->error(
+                       Server::get(LoggerInterface::class)->error(
                                'Could not rename mount point for shared folder "' . $this->getMountPoint() . '" to "' . $target . '"',
                                [
                                        'app' => 'files_sharing',
@@ -223,8 +226,8 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
         * @return bool
         */
        public function removeMount() {
-               $mountManager = \OC\Files\Filesystem::getMountManager();
-               /** @var \OCA\Files_Sharing\SharedStorage $storage */
+               $mountManager = Filesystem::getMountManager();
+               /** @var SharedStorage $storage */
                $storage = $this->getStorage();
                $result = $storage->unshareStorage();
                $mountManager->removeMount($this->mountPoint);
index 63c5fa9017d5f827fd482f991c26d3b9e8a80f30..630eae0634e90bad22223f5638a1ea62fb046765 100644 (file)
@@ -14,8 +14,10 @@ use OC\Files\Storage\Common;
 use OC\Files\Storage\FailedStorage;
 use OC\Files\Storage\Home;
 use OC\Files\Storage\Storage;
+use OC\Files\Storage\Wrapper\Jail;
 use OC\Files\Storage\Wrapper\PermissionsMask;
 use OC\Files\Storage\Wrapper\Wrapper;
+use OC\Share\Share;
 use OC\User\NoUserException;
 use OCA\Files_External\Config\ConfigAdapter;
 use OCA\Files_Sharing\ISharedStorage as LegacyISharedStorage;
@@ -35,12 +37,13 @@ use OCP\Files\Storage\ISharedStorage;
 use OCP\Files\Storage\IStorage;
 use OCP\Lock\ILockingProvider;
 use OCP\Share\IShare;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 /**
  * Convert target path to source path and pass the function call to the correct storage provider
  */
-class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISharedStorage, ISharedStorage, IDisableEncryptionStorage {
+class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage, IDisableEncryptionStorage {
        /** @var \OCP\Share\IShare */
        private $superShare;
 
@@ -242,18 +245,18 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
 
                // part files and the mount point always have delete permissions
                if ($path === '' || pathinfo($path, PATHINFO_EXTENSION) === 'part') {
-                       $permissions |= \OCP\Constants::PERMISSION_DELETE;
+                       $permissions |= Constants::PERMISSION_DELETE;
                }
 
                if ($this->sharingDisabledForUser) {
-                       $permissions &= ~\OCP\Constants::PERMISSION_SHARE;
+                       $permissions &= ~Constants::PERMISSION_SHARE;
                }
 
                return $permissions;
        }
 
        public function isCreatable(string $path): bool {
-               return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_CREATE);
+               return (bool)($this->getPermissions($path) & Constants::PERMISSION_CREATE);
        }
 
        public function isReadable(string $path): bool {
@@ -270,18 +273,18 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
        }
 
        public function isUpdatable(string $path): bool {
-               return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_UPDATE);
+               return (bool)($this->getPermissions($path) & Constants::PERMISSION_UPDATE);
        }
 
        public function isDeletable(string $path): bool {
-               return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_DELETE);
+               return (bool)($this->getPermissions($path) & Constants::PERMISSION_DELETE);
        }
 
        public function isSharable(string $path): bool {
-               if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) {
+               if (Util::isSharingDisabledForUser() || !Share::isResharingAllowed()) {
                        return false;
                }
-               return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);
+               return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE);
        }
 
        public function fopen(string $path, string $mode) {
@@ -332,7 +335,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
                        'source' => $source,
                        'mode' => $mode,
                ];
-               \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'fopen', $info);
+               Util::emitHook('\OC\Files\Storage\Shared', 'fopen', $info);
                return $this->nonMaskedStorage->fopen($this->getUnjailedPath($path), $mode);
        }
 
@@ -406,7 +409,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
                        return new FailedCache();
                }
 
-               $this->cache = new \OCA\Files_Sharing\Cache(
+               $this->cache = new Cache(
                        $storage,
                        $sourceRoot,
                        \OC::$server->get(CacheDependencies::class),
@@ -419,7 +422,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
                if (!$storage) {
                        $storage = $this;
                }
-               return new \OCA\Files_Sharing\Scanner($storage);
+               return new Scanner($storage);
        }
 
        public function getOwner(string $path): string|false {
@@ -529,7 +532,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
                        'target' => $this->getMountPoint() . '/' . $path,
                        'source' => $this->getUnjailedPath($path),
                ];
-               \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_get_contents', $info);
+               Util::emitHook('\OC\Files\Storage\Shared', 'file_get_contents', $info);
                return parent::file_get_contents($path);
        }
 
@@ -538,7 +541,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
                        'target' => $this->getMountPoint() . '/' . $path,
                        'source' => $this->getUnjailedPath($path),
                ];
-               \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_put_contents', $info);
+               Util::emitHook('\OC\Files\Storage\Shared', 'file_put_contents', $info);
                return parent::file_put_contents($path, $data);
        }
 
index 3a3813287b906e8c1c04df449083645345db3e88..82075fb9ba5ca7f3beffdff6741e8da519b737df 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\Files_Sharing;
 
 use OC\Files\Cache\FileAccess;
+use OC\Files\Filesystem;
 use OC\Files\Mount\MountPoint;
 use OCP\Constants;
 use OCP\Files\Folder;
@@ -96,7 +97,7 @@ class Updater {
                                continue;
                        }
 
-                       if ($dstMount instanceof \OCA\Files_Sharing\SharedMount) {
+                       if ($dstMount instanceof SharedMount) {
                                if (!($dstMount->getShare()->getPermissions() & Constants::PERMISSION_SHARE)) {
                                        $shareManager->deleteShare($share);
                                        continue;
@@ -121,10 +122,10 @@ class Updater {
         * @param string $newPath new path relative to data/user/files
         */
        private static function renameChildren($oldPath, $newPath) {
-               $absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OC_User::getUser() . '/files/' . $newPath);
-               $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OC_User::getUser() . '/files/' . $oldPath);
+               $absNewPath = Filesystem::normalizePath('/' . \OC_User::getUser() . '/files/' . $newPath);
+               $absOldPath = Filesystem::normalizePath('/' . \OC_User::getUser() . '/files/' . $oldPath);
 
-               $mountManager = \OC\Files\Filesystem::getMountManager();
+               $mountManager = Filesystem::getMountManager();
                $mountedShares = $mountManager->findIn('/' . \OC_User::getUser() . '/files/' . $oldPath);
                foreach ($mountedShares as $mount) {
                        /** @var MountPoint $mount */
index 7b52d79f4d0473f60452e615ead12e9421628b13..2a837b627af8412b6912c0d896cbb8729f8c76d2 100644 (file)
@@ -88,7 +88,7 @@ class ViewOnly {
                }
 
                // Extract extra permissions
-               /** @var \OCA\Files_Sharing\SharedStorage $storage */
+               /** @var SharedStorage $storage */
                $share = $storage->getShare();
 
                $canDownload = true;
index 4d50fb4065ebaea3e63ce1a35fc9402a85005859..d549d441df4ec96ce5bdd6c35212d0403a6c6238 100644 (file)
@@ -7,13 +7,17 @@
 namespace OCA\Files_Sharing\Tests;
 
 use OC\Files\Cache\Scanner;
+use OC\Files\FileInfo;
 use OC\Files\Filesystem;
+use OC\Files\Storage\Temporary;
+use OC\Files\View;
 use OCA\Files_Sharing\Controller\ShareAPIController;
 use OCP\App\IAppManager;
 use OCP\AppFramework\OCS\OCSBadRequestException;
 use OCP\AppFramework\OCS\OCSException;
 use OCP\AppFramework\OCS\OCSForbiddenException;
 use OCP\AppFramework\OCS\OCSNotFoundException;
+use OCP\Constants;
 use OCP\IConfig;
 use OCP\IDateTimeZone;
 use OCP\IL10N;
@@ -72,7 +76,7 @@ class ApiTest extends TestCase {
        }
 
        protected function tearDown(): void {
-               if ($this->view instanceof \OC\Files\View) {
+               if ($this->view instanceof View) {
                        $this->view->unlink($this->filename);
                        $this->view->deleteAll($this->folder);
                }
@@ -84,7 +88,7 @@ class ApiTest extends TestCase {
 
        /**
         * @param string $userId The userId of the caller
-        * @return \OCA\Files_Sharing\Controller\ShareAPIController
+        * @return ShareAPIController
         */
        private function createOCS($userId) {
                $l = $this->getMockBuilder(IL10N::class)->getMock();
@@ -128,7 +132,7 @@ class ApiTest extends TestCase {
        public function testCreateShareUserFile(): void {
                $this->setUp(); // for some reasons phpunit refuses to do this for us only for this test
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
+               $result = $ocs->createShare($this->filename, Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
                $ocs->cleanup();
 
                $data = $result->getData();
@@ -145,7 +149,7 @@ class ApiTest extends TestCase {
 
        public function testCreateShareUserFolder(): void {
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
+               $result = $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
                $ocs->cleanup();
 
                $data = $result->getData();
@@ -162,7 +166,7 @@ class ApiTest extends TestCase {
 
        public function testCreateShareGroupFile(): void {
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1);
+               $result = $ocs->createShare($this->filename, Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1);
                $ocs->cleanup();
 
                $data = $result->getData();
@@ -178,7 +182,7 @@ class ApiTest extends TestCase {
 
        public function testCreateShareGroupFolder(): void {
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1);
+               $result = $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1);
                $ocs->cleanup();
 
                $data = $result->getData();
@@ -197,11 +201,11 @@ class ApiTest extends TestCase {
         */
        public function testCreateShareLink(): void {
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK);
+               $result = $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_LINK);
                $ocs->cleanup();
 
                $data = $result->getData();
-               $this->assertEquals(\OCP\Constants::PERMISSION_ALL,
+               $this->assertEquals(Constants::PERMISSION_ALL,
                        $data['permissions']);
                $this->assertEmpty($data['expiration']);
                $this->assertTrue(is_string($data['token']));
@@ -222,16 +226,16 @@ class ApiTest extends TestCase {
         */
        public function testCreateShareLinkPublicUpload(): void {
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true');
+               $result = $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true');
                $ocs->cleanup();
 
                $data = $result->getData();
                $this->assertEquals(
-                       \OCP\Constants::PERMISSION_READ |
-                       \OCP\Constants::PERMISSION_CREATE |
-                       \OCP\Constants::PERMISSION_UPDATE |
-                       \OCP\Constants::PERMISSION_DELETE |
-                       \OCP\Constants::PERMISSION_SHARE,
+                       Constants::PERMISSION_READ |
+                       Constants::PERMISSION_CREATE |
+                       Constants::PERMISSION_UPDATE |
+                       Constants::PERMISSION_DELETE |
+                       Constants::PERMISSION_SHARE,
                        $data['permissions']
                );
                $this->assertEmpty($data['expiration']);
@@ -255,7 +259,7 @@ class ApiTest extends TestCase {
 
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
                try {
-                       $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK);
+                       $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_LINK);
                        $this->fail();
                } catch (OCSForbiddenException $e) {
                }
@@ -263,7 +267,7 @@ class ApiTest extends TestCase {
 
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
                try {
-                       $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '');
+                       $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '');
                        $this->fail();
                } catch (OCSForbiddenException $e) {
                }
@@ -271,7 +275,7 @@ class ApiTest extends TestCase {
 
                // share with password should succeed
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', $password);
+               $result = $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', $password);
                $ocs->cleanup();
 
                $data = $result->getData();
@@ -308,7 +312,7 @@ class ApiTest extends TestCase {
                \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no');
 
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
+               $result = $ocs->createShare($this->filename, Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
                $ocs->cleanup();
 
                $data = $result->getData();
@@ -324,7 +328,7 @@ class ApiTest extends TestCase {
                \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups_list', 'admin,group1,group2');
 
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
+               $result = $ocs->createShare($this->filename, Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
                $ocs->cleanup();
 
                $data = $result->getData();
@@ -339,7 +343,7 @@ class ApiTest extends TestCase {
                \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups_list', 'admin,group');
 
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
+               $ocs->createShare($this->filename, Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
                $ocs->cleanup();
 
                // cleanup
@@ -416,7 +420,7 @@ class ApiTest extends TestCase {
         */
        public function testPublicLinkUrl(): void {
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK);
+               $result = $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_LINK);
                $ocs->cleanup();
 
                $data = $result->getData();
@@ -1008,11 +1012,11 @@ class ApiTest extends TestCase {
 
                $share1 = $this->shareManager->getShareById($share1->getFullId());
                $this->assertEquals(
-                       \OCP\Constants::PERMISSION_READ |
-                       \OCP\Constants::PERMISSION_CREATE |
-                       \OCP\Constants::PERMISSION_UPDATE |
-                       \OCP\Constants::PERMISSION_DELETE |
-                       \OCP\Constants::PERMISSION_SHARE,
+                       Constants::PERMISSION_READ |
+                       Constants::PERMISSION_CREATE |
+                       Constants::PERMISSION_UPDATE |
+                       Constants::PERMISSION_DELETE |
+                       Constants::PERMISSION_SHARE,
                        $share1->getPermissions()
                );
 
@@ -1172,7 +1176,7 @@ class ApiTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
@@ -1180,7 +1184,7 @@ class ApiTest extends TestCase {
                // user2 shares a file from the folder as link
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               $view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $view = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
                $view->mkdir('localDir');
 
                // move mount point to the folder "localDir"
@@ -1190,7 +1194,7 @@ class ApiTest extends TestCase {
                // try to share "localDir"
                $fileInfo2 = $view->getFileInfo('localDir');
 
-               $this->assertTrue($fileInfo2 instanceof \OC\Files\FileInfo);
+               $this->assertTrue($fileInfo2 instanceof FileInfo);
 
                $pass = true;
                try {
@@ -1199,7 +1203,7 @@ class ApiTest extends TestCase {
                                'localDir',
                                self::TEST_FILES_SHARING_API_USER2,
                                self::TEST_FILES_SHARING_API_USER3,
-                               \OCP\Constants::PERMISSION_ALL
+                               Constants::PERMISSION_ALL
                        );
                } catch (\Exception $e) {
                        $pass = false;
@@ -1223,7 +1227,7 @@ class ApiTest extends TestCase {
         */
        public static function initTestMountPointsHook($data) {
                if ($data['user'] === self::TEST_FILES_SHARING_API_USER1) {
-                       \OC\Files\Filesystem::mount(self::$tempStorage, [], '/' . self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME);
+                       Filesystem::mount(self::$tempStorage, [], '/' . self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME);
                }
        }
 
@@ -1231,7 +1235,7 @@ class ApiTest extends TestCase {
         * Tests mounting a folder that is an external storage mount point.
         */
        public function testShareStorageMountPoint(): void {
-               $tempStorage = new \OC\Files\Storage\Temporary([]);
+               $tempStorage = new Temporary([]);
                $tempStorage->file_put_contents('test.txt', 'abcdef');
                $tempStorage->getScanner()->scan('');
 
@@ -1246,7 +1250,7 @@ class ApiTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
@@ -1254,7 +1258,7 @@ class ApiTest extends TestCase {
                // user2: check that mount point name appears correctly
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               $view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $view = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
 
                $this->assertTrue($view->file_exists($this->folder));
                $this->assertTrue($view->file_exists($this->folder . '/test.txt'));
@@ -1290,7 +1294,7 @@ class ApiTest extends TestCase {
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
 
                try {
-                       $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date);
+                       $result = $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date);
                        $this->assertTrue($valid);
                } catch (OCSNotFoundException $e) {
                        $this->assertFalse($valid);
@@ -1329,7 +1333,7 @@ class ApiTest extends TestCase {
                $date->add(new \DateInterval('P5D'));
 
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d'));
+               $result = $ocs->createShare($this->filename, Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d'));
                $ocs->cleanup();
 
                $data = $result->getData();
@@ -1363,7 +1367,7 @@ class ApiTest extends TestCase {
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
 
                try {
-                       $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d'));
+                       $ocs->createShare($this->filename, Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d'));
                        $this->fail();
                } catch (OCSException $e) {
                        $this->assertEquals(404, $e->getCode());
@@ -1384,7 +1388,7 @@ class ApiTest extends TestCase {
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
 
                try {
-                       $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d'));
+                       $ocs->createShare($this->filename, Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d'));
                        $this->fail();
                } catch (OCSException $e) {
                        $this->assertEquals(404, $e->getCode());
@@ -1403,7 +1407,7 @@ class ApiTest extends TestCase {
        public function testInvisibleSharesUser(): void {
                // simulate a post request
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
+               $result = $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
                $ocs->cleanup();
                $data = $result->getData();
 
@@ -1414,7 +1418,7 @@ class ApiTest extends TestCase {
                $ocs->cleanup();
 
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
-               $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK);
+               $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_LINK);
                $ocs->cleanup();
 
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
@@ -1435,7 +1439,7 @@ class ApiTest extends TestCase {
        public function testInvisibleSharesGroup(): void {
                // simulate a post request
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
-               $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1);
+               $result = $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1);
                $ocs->cleanup();
                $data = $result->getData();
 
@@ -1448,7 +1452,7 @@ class ApiTest extends TestCase {
                \OC_Util::tearDownFS();
 
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
-               $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK);
+               $ocs->createShare($this->folder, Constants::PERMISSION_ALL, IShare::TYPE_LINK);
                $ocs->cleanup();
 
                $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
index ebcfc43edadae9d980a1696edf0f3c21c79dd995..1d622e6a14a9e716fdd579dc3d7c391a1ba4a7d7 100644 (file)
@@ -6,9 +6,12 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OC\Files\Filesystem;
 use OC\Files\Storage\Temporary;
 use OC\Files\Storage\Wrapper\Jail;
+use OC\Files\View;
 use OCA\Files_Sharing\SharedStorage;
+use OCP\Constants;
 use OCP\Share\IShare;
 
 /**
@@ -50,7 +53,7 @@ class CacheTest extends TestCase {
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
 
-               $this->user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $this->user2View = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
 
                // prepare user1's dir structure
                $this->view->mkdir('container');
@@ -80,7 +83,7 @@ class CacheTest extends TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $this->shareManager->createShare($share);
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
@@ -91,7 +94,7 @@ class CacheTest extends TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL & ~(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_DELETE));
+                       ->setPermissions(Constants::PERMISSION_ALL & ~(Constants::PERMISSION_CREATE | Constants::PERMISSION_DELETE));
                $share = $this->shareManager->createShare($share);
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
@@ -100,7 +103,7 @@ class CacheTest extends TestCase {
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
                // retrieve the shared storage
-               $secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
+               $secondView = new View('/' . self::TEST_FILES_SHARING_API_USER2);
                [$this->sharedStorage,] = $secondView->resolvePath('files/shareddir');
                $this->sharedCache = $this->sharedStorage->getCache();
        }
@@ -297,7 +300,7 @@ class CacheTest extends TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER3)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ);
+                       ->setPermissions(Constants::PERMISSION_READ);
                $share = $this->shareManager->createShare($share);
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
@@ -326,14 +329,14 @@ class CacheTest extends TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER3)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $this->shareManager->createShare($share);
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
 
-               $thirdView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER3 . '/files');
+               $thirdView = new View('/' . self::TEST_FILES_SHARING_API_USER3 . '/files');
                $results = $thirdView->getDirectoryContent('/subdir');
 
                $this->verifyFiles(
@@ -402,8 +405,8 @@ class CacheTest extends TestCase {
 
        public function testGetPathByIdDirectShare(): void {
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
-               \OC\Files\Filesystem::file_put_contents('test.txt', 'foo');
-               $info = \OC\Files\Filesystem::getFileInfo('test.txt');
+               Filesystem::file_put_contents('test.txt', 'foo');
+               $info = Filesystem::getFileInfo('test.txt');
 
                $rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
                $node = $rootFolder->get('test.txt');
@@ -412,7 +415,7 @@ class CacheTest extends TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE);
+                       ->setPermissions(Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE);
                $share = $this->shareManager->createShare($share);
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
@@ -420,23 +423,22 @@ class CacheTest extends TestCase {
                \OC_Util::tearDownFS();
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $this->assertTrue(\OC\Files\Filesystem::file_exists('/test.txt'));
-               [$sharedStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test.txt');
+               $this->assertTrue(Filesystem::file_exists('/test.txt'));
+               [$sharedStorage] = Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test.txt');
                /**
-                * @var \OCA\Files_Sharing\SharedStorage $sharedStorage
+                * @var SharedStorage $sharedStorage
                 */
-
                $sharedCache = $sharedStorage->getCache();
                $this->assertEquals('', $sharedCache->getPathById($info->getId()));
        }
 
        public function testGetPathByIdShareSubFolder(): void {
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
-               \OC\Files\Filesystem::mkdir('foo');
-               \OC\Files\Filesystem::mkdir('foo/bar');
-               \OC\Files\Filesystem::touch('foo/bar/test.txt');
-               $folderInfo = \OC\Files\Filesystem::getFileInfo('foo');
-               $fileInfo = \OC\Files\Filesystem::getFileInfo('foo/bar/test.txt');
+               Filesystem::mkdir('foo');
+               Filesystem::mkdir('foo/bar');
+               Filesystem::touch('foo/bar/test.txt');
+               $folderInfo = Filesystem::getFileInfo('foo');
+               $fileInfo = Filesystem::getFileInfo('foo/bar/test.txt');
 
                $rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
                $node = $rootFolder->get('foo');
@@ -445,19 +447,18 @@ class CacheTest extends TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $this->shareManager->createShare($share);
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
                \OC_Util::tearDownFS();
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $this->assertTrue(\OC\Files\Filesystem::file_exists('/foo'));
-               [$sharedStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');
+               $this->assertTrue(Filesystem::file_exists('/foo'));
+               [$sharedStorage] = Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');
                /**
-                * @var \OCA\Files_Sharing\SharedStorage $sharedStorage
+                * @var SharedStorage $sharedStorage
                 */
-
                $sharedCache = $sharedStorage->getCache();
                $this->assertEquals('', $sharedCache->getPathById($folderInfo->getId()));
                $this->assertEquals('bar/test.txt', $sharedCache->getPathById($fileInfo->getId()));
@@ -465,7 +466,7 @@ class CacheTest extends TestCase {
 
        public function testNumericStorageId(): void {
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
-               \OC\Files\Filesystem::mkdir('foo');
+               Filesystem::mkdir('foo');
 
                $rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
                $node = $rootFolder->get('foo');
@@ -474,18 +475,18 @@ class CacheTest extends TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $this->shareManager->createShare($share);
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
                \OC_Util::tearDownFS();
 
-               [$sourceStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER1 . '/files/foo');
+               [$sourceStorage] = Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER1 . '/files/foo');
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $this->assertTrue(\OC\Files\Filesystem::file_exists('/foo'));
+               $this->assertTrue(Filesystem::file_exists('/foo'));
                /** @var SharedStorage $sharedStorage */
-               [$sharedStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');
+               [$sharedStorage] = Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');
 
                $this->assertEquals($sourceStorage->getCache()->getNumericStorageId(), $sharedStorage->getCache()->getNumericStorageId());
        }
@@ -511,18 +512,18 @@ class CacheTest extends TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $this->shareManager->createShare($share);
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
                \OC_Util::tearDownFS();
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $this->assertEquals('foo', \OC\Files\Filesystem::file_get_contents('/sub/foo.txt'));
+               $this->assertEquals('foo', Filesystem::file_get_contents('/sub/foo.txt'));
 
-               \OC\Files\Filesystem::file_put_contents('/sub/bar.txt', 'bar');
+               Filesystem::file_put_contents('/sub/bar.txt', 'bar');
                /** @var SharedStorage $sharedStorage */
-               [$sharedStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/sub');
+               [$sharedStorage] = Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/sub');
 
                $this->assertTrue($sharedStorage->getCache()->inCache('bar.txt'));
 
@@ -550,7 +551,7 @@ class CacheTest extends TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $this->shareManager->createShare($share);
                $share->setStatus(IShare::STATUS_ACCEPTED);
                $this->shareManager->updateShare($share);
@@ -559,7 +560,7 @@ class CacheTest extends TestCase {
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
                /** @var SharedStorage $sharedStorage */
-               [$sharedStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/sub');
+               [$sharedStorage] = Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/sub');
 
                $results = $sharedStorage->getCache()->search('foo.txt');
                $this->assertCount(1, $results);
index b45e17eefdc51ebedd047d9c4421ad03682f19fe..84234660665f8903cd51781213539ff9ecd99b2b 100644 (file)
@@ -9,8 +9,11 @@ namespace OCA\Files_Sharing\Tests\Controller;
 use OCA\Files_Sharing\Controller\ShareAPIController;
 use OCP\App\IAppManager;
 use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\OCS\OCSBadRequestException;
 use OCP\AppFramework\OCS\OCSException;
+use OCP\AppFramework\OCS\OCSForbiddenException;
 use OCP\AppFramework\OCS\OCSNotFoundException;
+use OCP\Constants;
 use OCP\Files\File;
 use OCP\Files\Folder;
 use OCP\Files\IRootFolder;
@@ -27,9 +30,11 @@ use OCP\IRequest;
 use OCP\IURLGenerator;
 use OCP\IUser;
 use OCP\IUserManager;
+use OCP\Lock\ILockingProvider;
 use OCP\Lock\LockedException;
 use OCP\Mail\IMailer;
 use OCP\Share\Exceptions\GenericShareException;
+use OCP\Share\Exceptions\ShareNotFound;
 use OCP\Share\IAttributes as IShareAttributes;
 use OCP\Share\IManager;
 use OCP\Share\IProviderFactory;
@@ -175,7 +180,7 @@ class ShareAPIControllerTest extends TestCase {
        }
 
        public function testDeleteShareShareNotFound(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Wrong share ID, share does not exist');
 
                $this->shareManager
@@ -183,7 +188,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->method('getShareById')
                        ->willReturnCallback(function ($id): void {
                                if ($id === 'ocinternal:42' || $id === 'ocRoomShare:42' || $id === 'ocFederatedSharing:42' || $id === 'ocCircleShare:42' || $id === 'ocMailShare:42' || $id === 'deck:42' || $id === 'sciencemesh:42') {
-                                       throw new \OCP\Share\Exceptions\ShareNotFound();
+                                       throw new ShareNotFound();
                                } else {
                                        throw new \Exception();
                                }
@@ -212,7 +217,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $expected = new DataResponse();
                $result = $this->ocs->deleteShare(42);
@@ -223,7 +228,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testDeleteShareLocked(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Could not delete share');
 
                $node = $this->getMockBuilder(File::class)->getMock();
@@ -244,7 +249,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED)
+                       ->with(ILockingProvider::LOCK_SHARED)
                        ->will($this->throwException(new LockedException('mypath')));
 
                $this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteFromSelf', [$share]));
@@ -277,7 +282,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteFromSelf', [$share]));
                $this->assertTrue($this->invokePrivate($this->ocs, 'canDeleteShare', [$share]));
@@ -308,7 +313,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteFromSelf', [$share]));
                $this->assertTrue($this->invokePrivate($this->ocs, 'canDeleteShare', [$share]));
@@ -341,7 +346,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteFromSelf', [$share]));
                $this->assertTrue($this->invokePrivate($this->ocs, 'canDeleteShare', [$share]));
@@ -385,7 +390,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $userFolder = $this->getMockBuilder(Folder::class)->getMock();
                $this->rootFolder->method('getUserFolder')
@@ -414,7 +419,7 @@ class ShareAPIControllerTest extends TestCase {
         * in the group the share is shared with
         */
        public function testDeleteSharedWithGroupIDontBelongTo(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Wrong share ID, share does not exist');
 
                $node = $this->getMockBuilder(File::class)->getMock();
@@ -448,7 +453,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $userFolder = $this->getMockBuilder(Folder::class)->getMock();
                $this->rootFolder->method('getUserFolder')
@@ -743,7 +748,7 @@ class ShareAPIControllerTest extends TestCase {
        /**
         * @dataProvider dataGetShare
         */
-       public function testGetShare(\OCP\Share\IShare $share, array $result): void {
+       public function testGetShare(IShare $share, array $result): void {
                /** @var ShareAPIController|\PHPUnit\Framework\MockObject\MockObject $ocs */
                $ocs = $this->getMockBuilder(ShareAPIController::class)
                        ->setConstructorArgs([
@@ -833,7 +838,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testGetShareInvalidNode(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Wrong share ID, share does not exist');
 
                $share = \OC::$server->getShareManager()->newShare();
@@ -872,7 +877,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(4);
 
@@ -886,7 +891,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('currentUser')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(8);
 
@@ -900,7 +905,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('currentUser')
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(15);
 
@@ -914,7 +919,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(16);
 
@@ -928,7 +933,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(23);
 
@@ -942,7 +947,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('currentUserGroup')
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(42);
 
@@ -956,7 +961,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(108);
 
@@ -965,7 +970,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(415);
 
@@ -979,7 +984,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(416);
 
@@ -993,7 +998,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(423);
 
@@ -1007,7 +1012,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1)
                        ->setId(442);
 
@@ -1021,7 +1026,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setExpirationDate(new \DateTime('2000-01-01T01:02:03'))
                        ->setNode($file1)
                        ->setId(815);
@@ -1036,7 +1041,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setExpirationDate(new \DateTime('2000-01-02T01:02:03'))
                        ->setNode($file1)
                        ->setId(816);
@@ -1051,7 +1056,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file2)
                        ->setId(823);
 
@@ -1378,7 +1383,7 @@ class ShareAPIControllerTest extends TestCase {
         * @dataProvider dataGetShares
         */
        public function testGetShares(array $getSharesParameters, array $shares, array $extraShareTypes, array $expected): void {
-               /** @var \OCA\Files_Sharing\Controller\ShareAPIController $ocs */
+               /** @var ShareAPIController $ocs */
                $ocs = $this->getMockBuilder(ShareAPIController::class)
                        ->setConstructorArgs([
                                $this->appName,
@@ -1484,7 +1489,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn($file);
 
                $file->method('getPermissions')
-                       ->will($this->onConsecutiveCalls(\OCP\Constants::PERMISSION_SHARE, \OCP\Constants::PERMISSION_READ));
+                       ->will($this->onConsecutiveCalls(Constants::PERMISSION_SHARE, Constants::PERMISSION_READ));
 
                // getPermissions -> share
                $share = $this->getMockBuilder(IShare::class)->getMock();
@@ -1569,7 +1574,7 @@ class ShareAPIControllerTest extends TestCase {
         * @param bool helperAvailable
         * @param bool canAccessShareByHelper
         */
-       public function testCanAccessRoomShare(bool $expected, \OCP\Share\IShare $share, bool $helperAvailable, bool $canAccessShareByHelper): void {
+       public function testCanAccessRoomShare(bool $expected, IShare $share, bool $helperAvailable, bool $canAccessShareByHelper): void {
                $userFolder = $this->getMockBuilder(Folder::class)->getMock();
                $this->rootFolder->method('getUserFolder')
                        ->with($this->currentUser)
@@ -1605,7 +1610,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testCreateShareNoPath(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Please specify a file or folder path');
 
                $this->ocs->createShare();
@@ -1613,7 +1618,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testCreateShareInvalidPath(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Wrong path, file/folder does not exist');
 
                $userFolder = $this->getMockBuilder(Folder::class)->getMock();
@@ -1625,14 +1630,14 @@ class ShareAPIControllerTest extends TestCase {
                $userFolder->expects($this->once())
                        ->method('get')
                        ->with('invalid-path')
-                       ->will($this->throwException(new \OCP\Files\NotFoundException()));
+                       ->will($this->throwException(new NotFoundException()));
 
                $this->ocs->createShare('invalid-path');
        }
 
 
        public function testCreateShareInvalidPermissions(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Invalid permissions');
 
                $share = $this->newShare();
@@ -1654,14 +1659,14 @@ class ShareAPIControllerTest extends TestCase {
 
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->ocs->createShare('valid-path', 32);
        }
 
 
        public function testCreateShareUserNoShareWith(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Please specify a valid account to share with');
 
                $share = $this->newShare();
@@ -1682,14 +1687,14 @@ class ShareAPIControllerTest extends TestCase {
 
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
-               $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER);
+               $this->ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_USER);
        }
 
 
        public function testCreateShareUserNoValidShareWith(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Please specify a valid account to share with');
 
                $share = $this->newShare();
@@ -1709,19 +1714,19 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn([]);
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
                $this->userManager->method('userExists')
                        ->with('invalidUser')
                        ->willReturn(false);
 
-               $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, 'invalidUser');
+               $this->ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_USER, 'invalidUser');
        }
 
        public function testCreateShareUser(): void {
                $share = $this->newShare();
                $this->shareManager->method('newShare')->willReturn($share);
 
-               /** @var \OCA\Files_Sharing\Controller\ShareAPIController $ocs */
+               /** @var ShareAPIController $ocs */
                $ocs = $this->getMockBuilder(ShareAPIController::class)
                        ->setConstructorArgs([
                                $this->appName,
@@ -1762,15 +1767,15 @@ class ShareAPIControllerTest extends TestCase {
 
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('createShare')
-                       ->with($this->callback(function (\OCP\Share\IShare $share) use ($path) {
+                       ->with($this->callback(function (IShare $share) use ($path) {
                                return $share->getNode() === $path &&
                                        $share->getPermissions() === (
-                                               \OCP\Constants::PERMISSION_ALL &
-                                               ~\OCP\Constants::PERMISSION_DELETE &
-                                               ~\OCP\Constants::PERMISSION_CREATE
+                                               Constants::PERMISSION_ALL &
+                                               ~Constants::PERMISSION_DELETE &
+                                               ~Constants::PERMISSION_CREATE
                                        ) &&
                                        $share->getShareType() === IShare::TYPE_USER &&
                                        $share->getSharedWith() === 'validUser' &&
@@ -1779,7 +1784,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturnArgument(0);
 
                $expected = new DataResponse([]);
-               $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, 'validUser');
+               $result = $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_USER, 'validUser');
 
                $this->assertInstanceOf(get_class($expected), $result);
                $this->assertEquals($expected->getData(), $result->getData());
@@ -1787,7 +1792,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testCreateShareGroupNoValidShareWith(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Please specify a valid group');
 
                $share = $this->newShare();
@@ -1810,9 +1815,9 @@ class ShareAPIControllerTest extends TestCase {
 
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
-               $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'invalidGroup');
+               $this->ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'invalidGroup');
        }
 
        public function testCreateShareGroup(): void {
@@ -1847,7 +1852,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->method('getParam')
                        ->willReturnMap([
                                ['path', null, 'valid-path'],
-                               ['permissions', null, \OCP\Constants::PERMISSION_ALL],
+                               ['permissions', null, Constants::PERMISSION_ALL],
                                ['shareType', '-1', IShare::TYPE_GROUP],
                                ['shareWith', null, 'validGroup'],
                        ]);
@@ -1873,12 +1878,12 @@ class ShareAPIControllerTest extends TestCase {
 
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('createShare')
-                       ->with($this->callback(function (\OCP\Share\IShare $share) use ($path) {
+                       ->with($this->callback(function (IShare $share) use ($path) {
                                return $share->getNode() === $path &&
-                               $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
+                               $share->getPermissions() === Constants::PERMISSION_ALL &&
                                $share->getShareType() === IShare::TYPE_GROUP &&
                                $share->getSharedWith() === 'validGroup' &&
                                $share->getSharedBy() === 'currentUser';
@@ -1886,7 +1891,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturnArgument(0);
 
                $expected = new DataResponse([]);
-               $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'validGroup');
+               $result = $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'validGroup');
 
                $this->assertInstanceOf(get_class($expected), $result);
                $this->assertEquals($expected->getData(), $result->getData());
@@ -1894,7 +1899,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testCreateShareGroupNotAllowed(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Group sharing is disabled by the administrator');
 
                $share = $this->newShare();
@@ -1919,12 +1924,12 @@ class ShareAPIControllerTest extends TestCase {
                        ->method('allowGroupSharing')
                        ->willReturn(false);
 
-               $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'invalidGroup');
+               $this->ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'invalidGroup');
        }
 
 
        public function testCreateShareLinkNoLinksAllowed(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Public link sharing is disabled by the administrator');
 
                $this->request
@@ -1950,12 +1955,12 @@ class ShareAPIControllerTest extends TestCase {
 
                $this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
 
-               $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK);
+               $this->ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_LINK);
        }
 
 
        public function testCreateShareLinkNoPublicUpload(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class);
+               $this->expectException(OCSForbiddenException::class);
                $this->expectExceptionMessage('Public upload disabled by the administrator');
 
                $path = $this->getMockBuilder(Folder::class)->getMock();
@@ -1975,12 +1980,12 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
                $this->shareManager->method('shareApiAllowLinks')->willReturn(true);
 
-               $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true');
+               $this->ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true');
        }
 
 
        public function testCreateShareLinkPublicUploadFile(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Public upload is only possible for publicly shared folders');
 
                $path = $this->getMockBuilder(File::class)->getMock();
@@ -2001,7 +2006,7 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('shareApiAllowLinks')->willReturn(true);
                $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
 
-               $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true');
+               $this->ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true');
        }
 
        public function testCreateShareLinkPublicUploadFolder(): void {
@@ -2026,10 +2031,10 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('createShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($path) {
+                       $this->callback(function (IShare $share) use ($path) {
                                return $share->getNode() === $path &&
                                        $share->getShareType() === IShare::TYPE_LINK &&
-                                       $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) &&
+                                       $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) &&
                                        $share->getSharedBy() === 'currentUser' &&
                                        $share->getPassword() === null &&
                                        $share->getExpirationDate() === null;
@@ -2037,7 +2042,7 @@ class ShareAPIControllerTest extends TestCase {
                )->willReturnArgument(0);
 
                $expected = new DataResponse([]);
-               $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true', '', null, '');
+               $result = $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true', '', null, '');
 
                $this->assertInstanceOf(get_class($expected), $result);
                $this->assertEquals($expected->getData(), $result->getData());
@@ -2065,10 +2070,10 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('createShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($path) {
+                       $this->callback(function (IShare $share) use ($path) {
                                return $share->getNode() === $path &&
                                $share->getShareType() === IShare::TYPE_LINK &&
-                               $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
+                               $share->getPermissions() === Constants::PERMISSION_ALL &&
                                $share->getSharedBy() === 'currentUser' &&
                                $share->getPassword() === 'password' &&
                                $share->getExpirationDate() === null;
@@ -2076,7 +2081,7 @@ class ShareAPIControllerTest extends TestCase {
                )->willReturnArgument(0);
 
                $expected = new DataResponse([]);
-               $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', null, '');
+               $result = $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', null, '');
 
                $this->assertInstanceOf(get_class($expected), $result);
                $this->assertEquals($expected->getData(), $result->getData());
@@ -2106,10 +2111,10 @@ class ShareAPIControllerTest extends TestCase {
                $this->appManager->method('isEnabledForUser')->with('spreed')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('createShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($path) {
+                       $this->callback(function (IShare $share) use ($path) {
                                return $share->getNode() === $path &&
                                $share->getShareType() === IShare::TYPE_LINK &&
-                               $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
+                               $share->getPermissions() === Constants::PERMISSION_ALL &&
                                $share->getSharedBy() === 'currentUser' &&
                                $share->getPassword() === 'password' &&
                                $share->getSendPasswordByTalk() === true &&
@@ -2118,7 +2123,7 @@ class ShareAPIControllerTest extends TestCase {
                )->willReturnArgument(0);
 
                $expected = new DataResponse([]);
-               $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', 'true', '');
+               $result = $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', 'true', '');
 
                $this->assertInstanceOf(get_class($expected), $result);
                $this->assertEquals($expected->getData(), $result->getData());
@@ -2126,7 +2131,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testCreateShareLinkSendPasswordByTalkWithTalkDisabled(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class);
+               $this->expectException(OCSForbiddenException::class);
                $this->expectExceptionMessage('Sharing valid-path sending the password by Nextcloud Talk failed because Nextcloud Talk is not enabled');
 
                $ocs = $this->mockFormatShare();
@@ -2154,7 +2159,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $this->shareManager->expects($this->never())->method('createShare');
 
-               $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', 'true', '');
+               $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', 'true', '');
        }
 
        public function testCreateShareValidExpireDate(): void {
@@ -2189,13 +2194,13 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('createShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($path) {
+                       $this->callback(function (IShare $share) use ($path) {
                                $date = new \DateTime('2000-01-01');
                                $date->setTime(0, 0, 0);
 
                                return $share->getNode() === $path &&
                                $share->getShareType() === IShare::TYPE_LINK &&
-                               $share->getPermissions() === \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE &&
+                               $share->getPermissions() === Constants::PERMISSION_READ | Constants::PERMISSION_SHARE &&
                                $share->getSharedBy() === 'currentUser' &&
                                $share->getPassword() === null &&
                                $share->getExpirationDate() == $date;
@@ -2211,7 +2216,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testCreateShareInvalidExpireDate(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Invalid date, date format must be YYYY-MM-DD');
 
                $ocs = $this->mockFormatShare();
@@ -2234,14 +2239,14 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('shareApiAllowLinks')->willReturn(true);
                $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
 
-               $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, 'a1b2d3');
+               $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, 'a1b2d3');
        }
 
        public function testCreateShareRemote(): void {
                $share = $this->newShare();
                $this->shareManager->method('newShare')->willReturn($share);
 
-               /** @var \OCA\Files_Sharing\Controller\ShareAPIController $ocs */
+               /** @var ShareAPIController $ocs */
                $ocs = $this->getMockBuilder(ShareAPIController::class)
                        ->setConstructorArgs([
                                $this->appName,
@@ -2282,15 +2287,15 @@ class ShareAPIControllerTest extends TestCase {
 
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('createShare')
-                       ->with($this->callback(function (\OCP\Share\IShare $share) use ($path) {
+                       ->with($this->callback(function (IShare $share) use ($path) {
                                return $share->getNode() === $path &&
                                        $share->getPermissions() === (
-                                               \OCP\Constants::PERMISSION_ALL &
-                                               ~\OCP\Constants::PERMISSION_DELETE &
-                                               ~\OCP\Constants::PERMISSION_CREATE
+                                               Constants::PERMISSION_ALL &
+                                               ~Constants::PERMISSION_DELETE &
+                                               ~Constants::PERMISSION_CREATE
                                        ) &&
                                        $share->getShareType() === IShare::TYPE_REMOTE &&
                                        $share->getSharedWith() === 'user@example.org' &&
@@ -2301,7 +2306,7 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('outgoingServer2ServerSharesAllowed')->willReturn(true);
 
                $expected = new DataResponse([]);
-               $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_REMOTE, 'user@example.org');
+               $result = $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_REMOTE, 'user@example.org');
 
                $this->assertInstanceOf(get_class($expected), $result);
                $this->assertEquals($expected->getData(), $result->getData());
@@ -2311,7 +2316,7 @@ class ShareAPIControllerTest extends TestCase {
                $share = $this->newShare();
                $this->shareManager->method('newShare')->willReturn($share);
 
-               /** @var \OCA\Files_Sharing\Controller\ShareAPIController $ocs */
+               /** @var ShareAPIController $ocs */
                $ocs = $this->getMockBuilder(ShareAPIController::class)
                        ->setConstructorArgs([
                                $this->appName,
@@ -2352,15 +2357,15 @@ class ShareAPIControllerTest extends TestCase {
 
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('createShare')
-                       ->with($this->callback(function (\OCP\Share\IShare $share) use ($path) {
+                       ->with($this->callback(function (IShare $share) use ($path) {
                                return $share->getNode() === $path &&
                                        $share->getPermissions() === (
-                                               \OCP\Constants::PERMISSION_ALL &
-                                               ~\OCP\Constants::PERMISSION_DELETE &
-                                               ~\OCP\Constants::PERMISSION_CREATE
+                                               Constants::PERMISSION_ALL &
+                                               ~Constants::PERMISSION_DELETE &
+                                               ~Constants::PERMISSION_CREATE
                                        ) &&
                                        $share->getShareType() === IShare::TYPE_REMOTE_GROUP &&
                                        $share->getSharedWith() === 'group@example.org' &&
@@ -2371,7 +2376,7 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('outgoingServer2ServerGroupSharesAllowed')->willReturn(true);
 
                $expected = new DataResponse([]);
-               $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_REMOTE_GROUP, 'group@example.org');
+               $result = $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_REMOTE_GROUP, 'group@example.org');
 
                $this->assertInstanceOf(get_class($expected), $result);
                $this->assertEquals($expected->getData(), $result->getData());
@@ -2398,7 +2403,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->appManager->method('isEnabledForUser')
                        ->with('spreed')
@@ -2411,17 +2416,17 @@ class ShareAPIControllerTest extends TestCase {
                        ->with(
                                $share,
                                'recipientRoom',
-                               \OCP\Constants::PERMISSION_ALL &
-                               ~\OCP\Constants::PERMISSION_DELETE &
-                               ~\OCP\Constants::PERMISSION_CREATE,
+                               Constants::PERMISSION_ALL &
+                               ~Constants::PERMISSION_DELETE &
+                               ~Constants::PERMISSION_CREATE,
                                ''
                        )->willReturnCallback(
                                function ($share): void {
                                        $share->setSharedWith('recipientRoom');
                                        $share->setPermissions(
-                                               \OCP\Constants::PERMISSION_ALL &
-                                               ~\OCP\Constants::PERMISSION_DELETE &
-                                               ~\OCP\Constants::PERMISSION_CREATE
+                                               Constants::PERMISSION_ALL &
+                                               ~Constants::PERMISSION_DELETE &
+                                               ~Constants::PERMISSION_CREATE
                                        );
                                }
                        );
@@ -2431,12 +2436,12 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn($helper);
 
                $this->shareManager->method('createShare')
-                       ->with($this->callback(function (\OCP\Share\IShare $share) use ($path) {
+                       ->with($this->callback(function (IShare $share) use ($path) {
                                return $share->getNode() === $path &&
                                        $share->getPermissions() === (
-                                               \OCP\Constants::PERMISSION_ALL &
-                                               ~\OCP\Constants::PERMISSION_DELETE &
-                                               ~\OCP\Constants::PERMISSION_CREATE
+                                               Constants::PERMISSION_ALL &
+                                               ~Constants::PERMISSION_DELETE &
+                                               ~Constants::PERMISSION_CREATE
                                        ) &&
                                        $share->getShareType() === IShare::TYPE_ROOM &&
                                        $share->getSharedWith() === 'recipientRoom' &&
@@ -2445,7 +2450,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturnArgument(0);
 
                $expected = new DataResponse([]);
-               $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_ROOM, 'recipientRoom');
+               $result = $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_ROOM, 'recipientRoom');
 
                $this->assertInstanceOf(get_class($expected), $result);
                $this->assertEquals($expected->getData(), $result->getData());
@@ -2453,7 +2458,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testCreateShareRoomHelperNotAvailable(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class);
+               $this->expectException(OCSForbiddenException::class);
                $this->expectExceptionMessage('Sharing valid-path failed because the back end does not support room shares');
 
                $ocs = $this->mockFormatShare();
@@ -2477,7 +2482,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->appManager->method('isEnabledForUser')
                        ->with('spreed')
@@ -2485,12 +2490,12 @@ class ShareAPIControllerTest extends TestCase {
 
                $this->shareManager->expects($this->never())->method('createShare');
 
-               $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_ROOM, 'recipientRoom');
+               $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_ROOM, 'recipientRoom');
        }
 
 
        public function testCreateShareRoomHelperThrowException(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Exception thrown by the helper');
 
                $ocs = $this->mockFormatShare();
@@ -2514,7 +2519,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $path->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->appManager->method('isEnabledForUser')
                        ->with('spreed')
@@ -2527,9 +2532,9 @@ class ShareAPIControllerTest extends TestCase {
                        ->with(
                                $share,
                                'recipientRoom',
-                               \OCP\Constants::PERMISSION_ALL &
-                               ~\OCP\Constants::PERMISSION_DELETE &
-                               ~\OCP\Constants::PERMISSION_CREATE,
+                               Constants::PERMISSION_ALL &
+                               ~Constants::PERMISSION_DELETE &
+                               ~Constants::PERMISSION_CREATE,
                                ''
                        )->willReturnCallback(
                                function ($share): void {
@@ -2543,7 +2548,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $this->shareManager->expects($this->never())->method('createShare');
 
-               $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_ROOM, 'recipientRoom');
+               $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_ROOM, 'recipientRoom');
        }
 
        /**
@@ -2596,7 +2601,7 @@ class ShareAPIControllerTest extends TestCase {
                $userFolder->method('getStorage')->willReturn($storage);
                $path->method('getStorage')->willReturn($storage);
 
-               $path->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
+               $path->method('getPermissions')->willReturn(Constants::PERMISSION_READ);
                $userFolder->expects($this->once())
                        ->method('get')
                        ->with('valid-path')
@@ -2609,17 +2614,17 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager
                        ->expects($this->once())
                        ->method('createShare')
-                       ->with($this->callback(function (\OCP\Share\IShare $share) {
-                               return $share->getPermissions() === \OCP\Constants::PERMISSION_READ;
+                       ->with($this->callback(function (IShare $share) {
+                               return $share->getPermissions() === Constants::PERMISSION_READ;
                        }))
                        ->willReturnArgument(0);
 
-               $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, 'validUser');
+               $ocs->createShare('valid-path', Constants::PERMISSION_ALL, IShare::TYPE_USER, 'validUser');
        }
 
 
        public function testUpdateShareCantAccess(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class);
+               $this->expectException(OCSNotFoundException::class);
                $this->expectExceptionMessage('Wrong share ID, share does not exist');
 
                [$userFolder, $node] = $this->getNonSharedUserFolder();
@@ -2628,7 +2633,7 @@ class ShareAPIControllerTest extends TestCase {
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
 
@@ -2645,19 +2650,19 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testUpdateNoParametersLink(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
+               $this->expectException(OCSBadRequestException::class);
                $this->expectExceptionMessage('Wrong or no update parameter given');
 
                $node = $this->getMockBuilder(Folder::class)->getMock();
                $share = $this->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setNode($node);
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
 
@@ -2666,19 +2671,19 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testUpdateNoParametersOther(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
+               $this->expectException(OCSBadRequestException::class);
                $this->expectExceptionMessage('Wrong or no update parameter given');
 
                $node = $this->getMockBuilder(Folder::class)->getMock();
                $share = $this->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_GROUP)
                        ->setNode($node);
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
 
@@ -2692,7 +2697,7 @@ class ShareAPIControllerTest extends TestCase {
                $node->method('getId')
                        ->willReturn(42);
                $share = $this->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -2700,18 +2705,18 @@ class ShareAPIControllerTest extends TestCase {
                        ->setNote('note')
                        ->setLabel('label')
                        ->setHideDownload(true)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL)
+                       ->setPermissions(Constants::PERMISSION_ALL)
                        ->setNode($node);
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) {
-                               return $share->getPermissions() === \OCP\Constants::PERMISSION_READ &&
+                       $this->callback(function (IShare $share) {
+                               return $share->getPermissions() === Constants::PERMISSION_READ &&
                                $share->getPassword() === null &&
                                $share->getExpirationDate() === null &&
                                // Once set a note or a label are never back to null, only to an
@@ -2754,7 +2759,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn(42);
 
                $share = \OC::$server->getShareManager()->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setNode($folder);
@@ -2763,11 +2768,11 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) {
+                       $this->callback(function (IShare $share) {
                                $date = new \DateTime('2000-01-01');
                                $date->setTime(0, 0, 0);
 
-                               return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) &&
+                               return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) &&
                                $share->getPassword() === 'password' &&
                                $share->getExpirationDate() == $date &&
                                $share->getNote() === 'note' &&
@@ -2811,7 +2816,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn(42);
 
                $share = \OC::$server->getShareManager()->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -2822,8 +2827,8 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('getSharedWith')->willReturn([]);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) {
-                               return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) &&
+                       $this->callback(function (IShare $share) {
+                               return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) &&
                                $share->getPassword() === 'password' &&
                                $share->getExpirationDate() === null;
                        })
@@ -2853,11 +2858,11 @@ class ShareAPIControllerTest extends TestCase {
 
        public function publicLinkValidPermissionsProvider() {
                return [
-                       [\OCP\Constants::PERMISSION_CREATE],
-                       [\OCP\Constants::PERMISSION_READ],
-                       [\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE],
-                       [\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE],
-                       [\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE],
+                       [Constants::PERMISSION_CREATE],
+                       [Constants::PERMISSION_READ],
+                       [Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE],
+                       [Constants::PERMISSION_READ | Constants::PERMISSION_DELETE],
+                       [Constants::PERMISSION_READ | Constants::PERMISSION_CREATE],
                ];
        }
 
@@ -2872,7 +2877,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn(42);
 
                $share = \OC::$server->getShareManager()->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -2910,9 +2915,9 @@ class ShareAPIControllerTest extends TestCase {
 
        public function publicLinkInvalidPermissionsProvider1() {
                return [
-                       [\OCP\Constants::PERMISSION_DELETE],
-                       [\OCP\Constants::PERMISSION_UPDATE],
-                       [\OCP\Constants::PERMISSION_SHARE],
+                       [Constants::PERMISSION_DELETE],
+                       [Constants::PERMISSION_UPDATE],
+                       [Constants::PERMISSION_SHARE],
                ];
        }
 
@@ -2920,7 +2925,7 @@ class ShareAPIControllerTest extends TestCase {
         * @dataProvider publicLinkInvalidPermissionsProvider1
         */
        public function testUpdateLinkShareSetInvalidCRUDPermissions1($permissions): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
+               $this->expectException(OCSBadRequestException::class);
                $this->expectExceptionMessage('Share must at least have READ or CREATE permissions');
 
                $this->testUpdateLinkShareSetCRUDPermissions($permissions);
@@ -2928,8 +2933,8 @@ class ShareAPIControllerTest extends TestCase {
 
        public function publicLinkInvalidPermissionsProvider2() {
                return [
-                       [\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_DELETE],
-                       [\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE],
+                       [Constants::PERMISSION_CREATE | Constants::PERMISSION_DELETE],
+                       [Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE],
                ];
        }
 
@@ -2937,14 +2942,14 @@ class ShareAPIControllerTest extends TestCase {
         * @dataProvider publicLinkInvalidPermissionsProvider2
         */
        public function testUpdateLinkShareSetInvalidCRUDPermissions2($permissions): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
+               $this->expectException(OCSBadRequestException::class);
                $this->expectExceptionMessage('Share must have READ permission if UPDATE or DELETE permission is set');
 
                $this->testUpdateLinkShareSetCRUDPermissions($permissions);
        }
 
        public function testUpdateLinkShareInvalidDate(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
+               $this->expectException(OCSBadRequestException::class);
                $this->expectExceptionMessage('Invalid date. Format must be YYYY-MM-DD');
 
                $ocs = $this->mockFormatShare();
@@ -2960,7 +2965,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn(42);
 
                $share = \OC::$server->getShareManager()->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setNode($folder);
@@ -2976,12 +2981,12 @@ class ShareAPIControllerTest extends TestCase {
                        [null, 'true', null, 'password'],
                        // legacy had no delete
                        [
-                               \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE,
+                               Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE,
                                'true', null, 'password'
                        ],
                        // correct
                        [
-                               \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE,
+                               Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE,
                                null, null, 'password'
                        ],
                ];
@@ -2991,7 +2996,7 @@ class ShareAPIControllerTest extends TestCase {
         * @dataProvider publicUploadParamsProvider
         */
        public function testUpdateLinkSharePublicUploadNotAllowed($permissions, $publicUpload, $expireDate, $password): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class);
+               $this->expectException(OCSForbiddenException::class);
                $this->expectExceptionMessage('Public upload disabled by the administrator');
 
                $ocs = $this->mockFormatShare();
@@ -3006,7 +3011,7 @@ class ShareAPIControllerTest extends TestCase {
                $folder->method('getId')->willReturn(42);
 
                $share = \OC::$server->getShareManager()->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setNode($folder);
@@ -3019,7 +3024,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testUpdateLinkSharePublicUploadOnFile(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
+               $this->expectException(OCSBadRequestException::class);
                $this->expectExceptionMessage('Public upload is only possible for publicly shared folders');
 
                $ocs = $this->mockFormatShare();
@@ -3036,7 +3041,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn($userFolder);
 
                $share = \OC::$server->getShareManager()->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setNode($file);
@@ -3062,7 +3067,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->with($this->currentUser)
                        ->willReturn($userFolder);
                $share = $this->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -3071,18 +3076,18 @@ class ShareAPIControllerTest extends TestCase {
                        ->setNote('note')
                        ->setLabel('label')
                        ->setHideDownload(true)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL)
+                       ->setPermissions(Constants::PERMISSION_ALL)
                        ->setNode($node);
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($date) {
-                               return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
+                       $this->callback(function (IShare $share) use ($date) {
+                               return $share->getPermissions() === Constants::PERMISSION_ALL &&
                                $share->getPassword() === 'newpassword' &&
                                $share->getSendPasswordByTalk() === true &&
                                $share->getExpirationDate() === $date &&
@@ -3114,7 +3119,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn($userFolder);
                $node->method('getId')->willReturn(42);
                $share = $this->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -3123,20 +3128,20 @@ class ShareAPIControllerTest extends TestCase {
                        ->setNote('note')
                        ->setLabel('label')
                        ->setHideDownload(true)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL)
+                       ->setPermissions(Constants::PERMISSION_ALL)
                        ->setNode($node);
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
 
                $this->appManager->method('isEnabledForUser')->with('spreed')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($date) {
-                               return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
+                       $this->callback(function (IShare $share) use ($date) {
+                               return $share->getPermissions() === Constants::PERMISSION_ALL &&
                                $share->getPassword() === 'password' &&
                                $share->getSendPasswordByTalk() === true &&
                                $share->getExpirationDate() === $date &&
@@ -3155,7 +3160,7 @@ class ShareAPIControllerTest extends TestCase {
 
 
        public function testUpdateLinkShareSendPasswordByTalkWithTalkDisabledDoesNotChangeOther(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class);
+               $this->expectException(OCSForbiddenException::class);
                $this->expectExceptionMessage('"Sending the password by Nextcloud Talk" for sharing a file or folder failed because Nextcloud Talk is not enabled.');
 
                $ocs = $this->mockFormatShare();
@@ -3172,7 +3177,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn($userFolder);
                $node->method('getId')->willReturn(42);
                $share = $this->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -3181,12 +3186,12 @@ class ShareAPIControllerTest extends TestCase {
                        ->setNote('note')
                        ->setLabel('label')
                        ->setHideDownload(true)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL)
+                       ->setPermissions(Constants::PERMISSION_ALL)
                        ->setNode($node);
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
 
@@ -3212,7 +3217,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn($userFolder);
                $node->method('getId')->willReturn(42);
                $share = $this->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -3221,20 +3226,20 @@ class ShareAPIControllerTest extends TestCase {
                        ->setNote('note')
                        ->setLabel('label')
                        ->setHideDownload(true)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL)
+                       ->setPermissions(Constants::PERMISSION_ALL)
                        ->setNode($node);
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
 
                $this->appManager->method('isEnabledForUser')->with('spreed')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($date) {
-                               return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
+                       $this->callback(function (IShare $share) use ($date) {
+                               return $share->getPermissions() === Constants::PERMISSION_ALL &&
                                $share->getPassword() === 'password' &&
                                $share->getSendPasswordByTalk() === false &&
                                $share->getExpirationDate() === $date &&
@@ -3262,7 +3267,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn(42);
 
                $share = $this->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -3271,20 +3276,20 @@ class ShareAPIControllerTest extends TestCase {
                        ->setNote('note')
                        ->setLabel('label')
                        ->setHideDownload(true)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL)
+                       ->setPermissions(Constants::PERMISSION_ALL)
                        ->setNode($node);
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
 
                $this->appManager->method('isEnabledForUser')->with('spreed')->willReturn(false);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($date) {
-                               return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
+                       $this->callback(function (IShare $share) use ($date) {
+                               return $share->getPermissions() === Constants::PERMISSION_ALL &&
                                $share->getPassword() === 'password' &&
                                $share->getSendPasswordByTalk() === false &&
                                $share->getExpirationDate() === $date &&
@@ -3329,7 +3334,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn(42);
 
                $share = $this->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -3338,21 +3343,21 @@ class ShareAPIControllerTest extends TestCase {
                        ->setNote('note')
                        ->setLabel('label')
                        ->setHideDownload(true)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL)
+                       ->setPermissions(Constants::PERMISSION_ALL)
                        ->setNode($node);
 
                $node->expects($this->once())
                        ->method('lock')
-                       ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
+                       ->with(ILockingProvider::LOCK_SHARED);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) {
+                       $this->callback(function (IShare $share) {
                                $date = new \DateTime('2010-12-23');
                                $date->setTime(0, 0, 0);
 
-                               return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
+                               return $share->getPermissions() === Constants::PERMISSION_ALL &&
                                $share->getPassword() === 'password' &&
                                $share->getSendPasswordByTalk() === true &&
                                $share->getExpirationDate() == $date &&
@@ -3393,7 +3398,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn(42);
 
                $share = \OC::$server->getShareManager()->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -3402,15 +3407,15 @@ class ShareAPIControllerTest extends TestCase {
                        ->setNote('note')
                        ->setLabel('label')
                        ->setHideDownload(true)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL)
+                       ->setPermissions(Constants::PERMISSION_ALL)
                        ->setNode($folder);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
                $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($date) {
-                               return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) &&
+                       $this->callback(function (IShare $share) use ($date) {
+                               return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) &&
                                $share->getPassword() === 'password' &&
                                $share->getSendPasswordByTalk() === true &&
                                $share->getExpirationDate() === $date &&
@@ -3454,7 +3459,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn(42);
 
                $share = \OC::$server->getShareManager()->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -3463,15 +3468,15 @@ class ShareAPIControllerTest extends TestCase {
                        ->setNote('note')
                        ->setLabel('label')
                        ->setHideDownload(true)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL)
+                       ->setPermissions(Constants::PERMISSION_ALL)
                        ->setNode($folder);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
                $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($date): bool {
-                               return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) &&
+                       $this->callback(function (IShare $share) use ($date): bool {
+                               return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) &&
                                $share->getPassword() === 'password' &&
                                $share->getSendPasswordByTalk() === true &&
                                $share->getExpirationDate() === $date &&
@@ -3514,7 +3519,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn(42);
 
                $share = \OC::$server->getShareManager()->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_LINK)
                        ->setPassword('password')
@@ -3523,15 +3528,15 @@ class ShareAPIControllerTest extends TestCase {
                        ->setNote('note')
                        ->setLabel('label')
                        ->setHideDownload(true)
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
                $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) use ($date) {
-                               return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) &&
+                       $this->callback(function (IShare $share) use ($date) {
+                               return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) &&
                                        $share->getPassword() === 'password' &&
                                        $share->getSendPasswordByTalk() === true &&
                                        $share->getExpirationDate() === $date &&
@@ -3572,7 +3577,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->willReturn(42);
 
                $share = \OC::$server->getShareManager()->newShare();
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL)
+               $share->setPermissions(Constants::PERMISSION_ALL)
                        ->setSharedBy($this->currentUser)
                        ->setShareType(IShare::TYPE_USER)
                        ->setNode($file);
@@ -3581,8 +3586,8 @@ class ShareAPIControllerTest extends TestCase {
                $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
 
                $this->shareManager->expects($this->once())->method('updateShare')->with(
-                       $this->callback(function (\OCP\Share\IShare $share) {
-                               return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL;
+                       $this->callback(function (IShare $share) {
+                               return $share->getPermissions() === Constants::PERMISSION_ALL;
                        })
                )->willReturnArgument(0);
 
@@ -3624,7 +3629,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setShareOwner('anotheruser')
                        ->setShareType(IShare::TYPE_GROUP)
                        ->setSharedWith('group1')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder);
 
                // note: updateShare will modify the received instance but getSharedWith will reread from the database,
@@ -3636,7 +3641,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setShareOwner('anotheruser')
                        ->setShareType(IShare::TYPE_GROUP)
                        ->setSharedWith('group1')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder);
 
                $this->request
@@ -3696,7 +3701,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setShareOwner($this->currentUser)
                        ->setShareType(IShare::TYPE_GROUP)
                        ->setSharedWith('group1')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder);
 
                // note: updateShare will modify the received instance but getSharedWith will reread from the database,
@@ -3708,7 +3713,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setShareOwner($this->currentUser)
                        ->setShareType(IShare::TYPE_GROUP)
                        ->setSharedWith('group1')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder);
 
                $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
@@ -3811,7 +3816,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setAttributes($shareAttributes)
                        ->setNode($file)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
@@ -3913,7 +3918,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -3967,7 +3972,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4023,7 +4028,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipientGroup')
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4077,7 +4082,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipientGroup2')
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4127,7 +4132,7 @@ class ShareAPIControllerTest extends TestCase {
                $share->setShareType(IShare::TYPE_LINK)
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4186,7 +4191,7 @@ class ShareAPIControllerTest extends TestCase {
                $share->setShareType(IShare::TYPE_LINK)
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4246,7 +4251,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedBy('initiator')
                        ->setSharedWith('user@server.com')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setExpirationDate(new \DateTime('2001-02-03T04:05:06'))
@@ -4299,7 +4304,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedBy('initiator')
                        ->setSharedWith('user@server.com')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setExpirationDate(new \DateTime('2001-02-03T04:05:06'))
@@ -4355,7 +4360,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWithDisplayName('The display name')
                        ->setSharedWithAvatar('path/to/the/avatar')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4409,7 +4414,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedBy('initiator')
                        ->setSharedWith('Circle (Public circle, circleOwner) [4815162342]')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4462,7 +4467,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedBy('initiator')
                        ->setSharedWith('Circle (Public circle, circleOwner)')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4514,7 +4519,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedBy('initiator')
                        ->setSharedWith('recipient')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
                        ->setNote('personal note')
@@ -4529,7 +4534,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedBy('initiator')
                        ->setSharedWith('user@server.com')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4584,7 +4589,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedBy('initiator')
                        ->setSharedWith('user@server.com')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4641,7 +4646,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipient')
                        ->setSharedBy('initiator')
                        ->setShareOwner('currentUser')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($fileWithPreview)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4700,7 +4705,7 @@ class ShareAPIControllerTest extends TestCase {
         * @param array $users
         * @param $exception
         */
-       public function testFormatShare(array $expects, \OCP\Share\IShare $share, array $users, $exception): void {
+       public function testFormatShare(array $expects, IShare $share, array $users, $exception): void {
                $this->userManager->method('get')->willReturnMap($users);
 
                $recipientGroup = $this->createMock(IGroup::class);
@@ -4807,7 +4812,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipientRoom')
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4859,7 +4864,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setSharedWith('recipientRoom')
                        ->setSharedBy('initiator')
                        ->setShareOwner('owner')
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file)
                        ->setShareTime(new \DateTime('2000-01-01T00:01:02'))
                        ->setTarget('myTarget')
@@ -4919,7 +4924,7 @@ class ShareAPIControllerTest extends TestCase {
         * @param bool $helperAvailable
         * @param array $formatShareByHelper
         */
-       public function testFormatRoomShare(array $expects, \OCP\Share\IShare $share, bool $helperAvailable, array $formatShareByHelper): void {
+       public function testFormatRoomShare(array $expects, IShare $share, bool $helperAvailable, array $formatShareByHelper): void {
                $this->rootFolder->method('getUserFolder')
                        ->with($this->currentUser)
                        ->willReturnSelf();
index 45c0d54c9186fa56d2cc60b8db13d1a538b1de1a..5d962dff4c008e140dc44030fbc0d1299b000a72 100644 (file)
@@ -17,6 +17,7 @@ use OCP\Accounts\IAccount;
 use OCP\Accounts\IAccountManager;
 use OCP\Accounts\IAccountProperty;
 use OCP\Activity\IManager;
+use OCP\AppFramework\Http\ContentSecurityPolicy;
 use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\Http\Template\ExternalShareMenuAction;
 use OCP\AppFramework\Http\Template\LinkMenuAction;
@@ -39,6 +40,7 @@ use OCP\IURLGenerator;
 use OCP\IUser;
 use OCP\IUserManager;
 use OCP\Security\ISecureRandom;
+use OCP\Server;
 use OCP\Share\Exceptions\ShareNotFound;
 use OCP\Share\IPublicShareTemplateFactory;
 use OCP\Share\IShare;
@@ -115,7 +117,7 @@ class ShareControllerTest extends \Test\TestCase {
                                )
                        );
 
-               $this->shareController = new \OCA\Files_Sharing\Controller\ShareController(
+               $this->shareController = new ShareController(
                        $this->appName,
                        $this->createMock(IRequest::class),
                        $this->config,
@@ -236,7 +238,7 @@ class ShareControllerTest extends \Test\TestCase {
                        ->willReturn($account);
 
                /** @var Manager */
-               $manager = \OCP\Server::get(Manager::class);
+               $manager = Server::get(Manager::class);
                $share = $manager->newShare();
                $share->setId(42)
                        ->setPermissions(Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE)
@@ -333,7 +335,7 @@ class ShareControllerTest extends \Test\TestCase {
 
                $this->assertEquals($expectedInitialState, $initialState);
 
-               $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
+               $csp = new ContentSecurityPolicy();
                $csp->addAllowedFrameDomain('\'self\'');
                $expectedResponse = new PublicTemplateResponse('files', 'index');
                $expectedResponse->setContentSecurityPolicy($csp);
@@ -382,7 +384,7 @@ class ShareControllerTest extends \Test\TestCase {
                        ->willReturn($account);
 
                /** @var Manager */
-               $manager = \OCP\Server::get(Manager::class);
+               $manager = Server::get(Manager::class);
                $share = $manager->newShare();
                $share->setId(42)
                        ->setPermissions(Constants::PERMISSION_CREATE)
@@ -472,7 +474,7 @@ class ShareControllerTest extends \Test\TestCase {
 
                $this->assertEquals($expectedInitialState, $initialState);
 
-               $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
+               $csp = new ContentSecurityPolicy();
                $csp->addAllowedFrameDomain('\'self\'');
                $expectedResponse = new PublicTemplateResponse('files', 'index');
                $expectedResponse->setContentSecurityPolicy($csp);
@@ -522,7 +524,7 @@ class ShareControllerTest extends \Test\TestCase {
                        ->willReturn($account);
 
                /** @var IShare */
-               $share = \OCP\Server::get(Manager::class)->newShare();
+               $share = Server::get(Manager::class)->newShare();
                $share->setId(42);
                $share->setPassword('password')
                        ->setShareOwner('ownerUID')
@@ -530,7 +532,7 @@ class ShareControllerTest extends \Test\TestCase {
                        ->setNode($file)
                        ->setNote($note)
                        ->setToken('token')
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL & ~\OCP\Constants::PERMISSION_SHARE)
+                       ->setPermissions(Constants::PERMISSION_ALL & ~Constants::PERMISSION_SHARE)
                        ->setTarget("/$filename");
 
                $this->session->method('exists')->with('public_link_authenticated')->willReturn(true);
@@ -599,7 +601,7 @@ class ShareControllerTest extends \Test\TestCase {
 
                $response = $this->shareController->showShare();
 
-               $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
+               $csp = new ContentSecurityPolicy();
                $csp->addAllowedFrameDomain('\'self\'');
                $expectedResponse = new PublicTemplateResponse('files', 'index');
                $expectedResponse->setContentSecurityPolicy($csp);
@@ -616,7 +618,7 @@ class ShareControllerTest extends \Test\TestCase {
 
 
        public function testShowShareInvalid(): void {
-               $this->expectException(\OCP\Files\NotFoundException::class);
+               $this->expectException(NotFoundException::class);
 
                $filename = 'file1.txt';
                $this->shareController->setToken('token');
@@ -671,7 +673,7 @@ class ShareControllerTest extends \Test\TestCase {
                $share
                        ->expects($this->once())
                        ->method('getPermissions')
-                       ->willReturn(\OCP\Constants::PERMISSION_CREATE);
+                       ->willReturn(Constants::PERMISSION_CREATE);
 
                $this->shareManager
                        ->expects($this->once())
index bf02e8114df89006ee969d1cde8c82781b68af67..b3b395da8c059d80f41ba7ff513215d60d678de9 100644 (file)
@@ -8,7 +8,6 @@ namespace OCA\Files_Sharing\Tests\Controller;
 
 use OCA\Files_Sharing\Controller\ShareesAPIController;
 use OCA\Files_Sharing\Tests\TestCase;
-use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\OCS\OCSBadRequestException;
 use OCP\Collaboration\Collaborators\ISearch;
@@ -298,7 +297,7 @@ class ShareesAPIControllerTest extends TestCase {
                                }
                        });
 
-               $this->assertInstanceOf(Http\DataResponse::class, $sharees->search($search, $itemType, $page, $perPage, $shareType));
+               $this->assertInstanceOf(DataResponse::class, $sharees->search($search, $itemType, $page, $perPage, $shareType));
        }
 
        public function dataSearchInvalid(): array {
@@ -413,7 +412,7 @@ class ShareesAPIControllerTest extends TestCase {
        }
 
        public function testSearchNoItemType(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
+               $this->expectException(OCSBadRequestException::class);
                $this->expectExceptionMessage('Missing itemType');
 
                $this->sharees->search('', null, 1, 10, [], false);
index e0d2d67d45f1a822fe60479eeb7156e80c79cf2f..a35642b0793aef2a1d852bbc8d3ba4077af61a9b 100644 (file)
@@ -6,7 +6,10 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OC\Files\Filesystem;
 use OCA\Files_Sharing\DeleteOrphanedSharesJob;
+use OCP\Constants;
+use OCP\Server;
 use OCP\Share\IShare;
 
 /**
@@ -48,7 +51,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase {
                $appManager->disableApp('files_trashbin');
 
                // just in case...
-               \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
+               Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
        }
 
        public static function tearDownAfterClass(): void {
@@ -73,7 +76,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase {
 
                \OC::registerShareHooks(\OC::$server->getSystemConfig());
 
-               $this->job = \OCP\Server::get(DeleteOrphanedSharesJob::class);
+               $this->job = Server::get(DeleteOrphanedSharesJob::class);
        }
 
        protected function tearDown(): void {
@@ -119,7 +122,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase {
 
                $share->setNode($testSubFolder)
                        ->setShareType(IShare::TYPE_USER)
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setSharedWith($this->user2)
                        ->setSharedBy($this->user1);
 
index 5a65b1b5389abba7561dc7c9bf11684e2c1ac98a..2b6d45561ba89691859b42cf505d43acd0afae77 100644 (file)
@@ -8,6 +8,7 @@ namespace OCA\Files_Sharing\Tests;
 
 use OC\Files\Filesystem;
 use OC\Files\View;
+use OCP\Constants;
 use OCP\Share\IShare;
 
 /**
@@ -56,7 +57,7 @@ class EtagPropagationTest extends PropagationTestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE);
+                       ->setPermissions(Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE);
                $share = $shareManager->createShare($share);
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
                $node = $rootFolder->getUserFolder(self::TEST_FILES_SHARING_API_USER1)
@@ -67,7 +68,7 @@ class EtagPropagationTest extends PropagationTestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $shareManager->createShare($share);
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
 
@@ -76,7 +77,7 @@ class EtagPropagationTest extends PropagationTestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER3)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $shareManager->createShare($share);
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER3);
 
@@ -90,7 +91,7 @@ class EtagPropagationTest extends PropagationTestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $shareManager->createShare($share);
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
 
@@ -117,7 +118,7 @@ class EtagPropagationTest extends PropagationTestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER4)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER2)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $shareManager->createShare($share);
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER4);
 
@@ -131,7 +132,7 @@ class EtagPropagationTest extends PropagationTestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedWith(self::TEST_FILES_SHARING_API_USER4)
                        ->setSharedBy(self::TEST_FILES_SHARING_API_USER2)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = $shareManager->createShare($share);
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER4);
 
@@ -437,13 +438,13 @@ class EtagPropagationTest extends PropagationTestCase {
 
                $shares = $this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, IShare::TYPE_USER, $node);
                /** @var \OCP\Share\IShare[] $shares */
-               $shares = array_filter($shares, function (\OCP\Share\IShare $share) {
+               $shares = array_filter($shares, function (IShare $share) {
                        return $share->getSharedWith() === self::TEST_FILES_SHARING_API_USER2;
                });
                $this->assertCount(1, $shares);
 
                $share = $shares[0];
-               $share->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE);
+               $share->setPermissions(Constants::PERMISSION_READ | Constants::PERMISSION_SHARE);
                $this->shareManager->updateShare($share);
 
                $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER2]);
index cf7be7b20a0bae602ccde9600b904a7806c308ba..c3b81591ebc5d5541b7f242a0ccaf6d116b6ea45 100644 (file)
@@ -8,6 +8,7 @@ namespace OCA\Files_Sharing\Tests;
 
 use OCA\Files_Sharing\ExpireSharesJob;
 use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Constants;
 use OCP\Share\IManager;
 use OCP\Share\IShare;
 
@@ -118,7 +119,7 @@ class ExpireSharesJobTest extends \Test\TestCase {
 
                $share->setNode($testFolder)
                        ->setShareType(IShare::TYPE_LINK)
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setSharedBy($this->user1);
 
                $shareManager->createShare($share);
@@ -175,7 +176,7 @@ class ExpireSharesJobTest extends \Test\TestCase {
 
                $share->setNode($testFolder)
                        ->setShareType(IShare::TYPE_USER)
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setSharedBy($this->user1)
                        ->setSharedWith($this->user2);
 
index 139227134c6845856aa345b6bc14487dabcef6db..0f5c204f79e7144f5f3535f45086d906bc14168a 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\Files_Sharing\Tests\External;
 
 use OC\Federation\CloudIdManager;
+use OCA\Files_Sharing\External\Cache;
 use OCA\Files_Sharing\Tests\TestCase;
 use OCP\Contacts\IManager;
 use OCP\EventDispatcher\IEventDispatcher;
@@ -33,7 +34,7 @@ class CacheTest extends TestCase {
        private $storage;
 
        /**
-        * @var \OCA\Files_Sharing\External\Cache
+        * @var Cache
         */
        private $cache;
 
@@ -71,7 +72,7 @@ class CacheTest extends TestCase {
                        ->method('search')
                        ->willReturn([]);
 
-               $this->cache = new \OCA\Files_Sharing\External\Cache(
+               $this->cache = new Cache(
                        $this->storage,
                        $this->cloudIdManager->getCloudId($this->remoteUser, 'http://example.com/owncloud')
                );
index 7302fd307f211a242fcf0f17908aed697af52ee7..282467c4e28c01a6021cdfff621df4c952e7737e 100644 (file)
@@ -28,6 +28,7 @@ use OCP\IURLGenerator;
 use OCP\IUser;
 use OCP\IUserManager;
 use OCP\IUserSession;
+use OCP\OCS\IDiscoveryService;
 use OCP\Share\IShare;
 use Psr\Log\LoggerInterface;
 use Test\Traits\UserTrait;
@@ -156,7 +157,7 @@ class ManagerTest extends TestCase {
                                        new StorageFactory(),
                                        $this->clientService,
                                        \OC::$server->getNotificationManager(),
-                                       \OC::$server->query(\OCP\OCS\IDiscoveryService::class),
+                                       \OC::$server->query(IDiscoveryService::class),
                                        $this->cloudFederationProviderManager,
                                        $this->cloudFederationFactory,
                                        $this->groupManager,
index 7daa5f229d2e0dec82d77a66dd399ffb7b007e8c..3966fe9f71f17bd70735d7e2fff9d8aff219ceee 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\Files_Sharing\Tests\External;
 
 use OCA\Files_Sharing\External\Scanner;
+use OCA\Files_Sharing\External\Storage;
 use Test\TestCase;
 
 /**
@@ -14,7 +15,7 @@ use Test\TestCase;
  */
 class ScannerTest extends TestCase {
        protected Scanner $scanner;
-       /** @var \OCA\Files_Sharing\External\Storage|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var Storage|\PHPUnit\Framework\MockObject\MockObject */
        protected $storage;
        /** @var \OC\Files\Cache\Cache|\PHPUnit\Framework\MockObject\MockObject */
        protected $cache;
index 7abb726515303418569621f2af591be88ac3da00..ef69e85d71b98cf4d44e6d461548f9d90a43e36c 100644 (file)
@@ -8,6 +8,7 @@ namespace OCA\Files_Sharing\Tests;
 
 use OC\Federation\CloudId;
 use OCA\Files_Sharing\External\Manager as ExternalShareManager;
+use OCA\Files_Sharing\External\Storage;
 use OCP\Http\Client\IClient;
 use OCP\Http\Client\IClientService;
 use OCP\Http\Client\IResponse;
@@ -104,7 +105,7 @@ class ExternalStorageTest extends \Test\TestCase {
 /**
  * Dummy subclass to make it possible to access private members
  */
-class TestSharingExternalStorage extends \OCA\Files_Sharing\External\Storage {
+class TestSharingExternalStorage extends Storage {
        public function getBaseUri() {
                return $this->createBaseUri();
        }
index 9b2b63b01815482fd64db8705b189d44d75a9612..f2c747896976ae94d4f17cf37bc66784892a8569 100644 (file)
@@ -8,6 +8,7 @@ namespace OCA\Files_Sharing\Tests;
 
 use OC\Files\Filesystem;
 use OC\Files\View;
+use OCP\Constants;
 use OCP\Share\IShare;
 
 /**
@@ -38,7 +39,7 @@ class GroupEtagPropagationTest extends PropagationTestCase {
                        '/test',
                        self::TEST_FILES_SHARING_API_USER1,
                        'group1',
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
                $this->fileIds[self::TEST_FILES_SHARING_API_USER1][''] = $view1->getFileInfo('')->getId();
@@ -53,7 +54,7 @@ class GroupEtagPropagationTest extends PropagationTestCase {
                        '/test',
                        self::TEST_FILES_SHARING_API_USER2,
                        'group2',
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER3);
                $share = $this->share(
@@ -61,7 +62,7 @@ class GroupEtagPropagationTest extends PropagationTestCase {
                        '/test/sub',
                        self::TEST_FILES_SHARING_API_USER2,
                        'group3',
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER4);
 
index d72afc4d4aa03a0a228043c8188a2032144f9efe..fcbfc41b603e588de7c1855497746ed6f9afcd19 100644 (file)
@@ -6,6 +6,9 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OC\Files\Filesystem;
+use OCA\Files_Sharing\Helper;
+
 /**
  * Class HelperTest
  *
@@ -17,13 +20,13 @@ class HelperTest extends TestCase {
         * test set and get share folder
         */
        public function testSetGetShareFolder(): void {
-               $this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder());
+               $this->assertSame('/', Helper::getShareFolder());
 
-               \OCA\Files_Sharing\Helper::setShareFolder('/Shared/Folder');
+               Helper::setShareFolder('/Shared/Folder');
 
-               $sharedFolder = \OCA\Files_Sharing\Helper::getShareFolder();
-               $this->assertSame('/Shared/Folder', \OCA\Files_Sharing\Helper::getShareFolder());
-               $this->assertTrue(\OC\Files\Filesystem::is_dir($sharedFolder));
+               $sharedFolder = Helper::getShareFolder();
+               $this->assertSame('/Shared/Folder', Helper::getShareFolder());
+               $this->assertTrue(Filesystem::is_dir($sharedFolder));
 
                // cleanup
                \OC::$server->getConfig()->deleteSystemValue('share_folder');
index c69cf99f185b6cd38f98e9466f715a871885c8e4..1e822d6339ea8e9a82fe56c6b7bbec27e775685b 100644 (file)
@@ -8,7 +8,9 @@ namespace OCA\Files_Sharing\Tests;
 
 use OC\Files\Filesystem;
 use OC\Files\View;
+use OCP\Constants;
 use OCP\Lock\ILockingProvider;
+use OCP\Lock\LockedException;
 use OCP\Share\IShare;
 
 /**
@@ -48,7 +50,7 @@ class LockingTest extends TestCase {
                        '/foo/bar.txt',
                        $this->ownerUid,
                        $this->recipientUid,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE
                );
 
                $this->loginAsUser($this->recipientUid);
@@ -62,7 +64,7 @@ class LockingTest extends TestCase {
 
 
        public function testLockAsRecipient(): void {
-               $this->expectException(\OCP\Lock\LockedException::class);
+               $this->expectException(LockedException::class);
 
                $this->loginAsUser($this->ownerUid);
 
index 88fa56a9bcb1f0fa51ad716456bead7abb377a5b..44ef3bebdc89623f76f2f559bee0de425a876812 100644 (file)
@@ -11,6 +11,7 @@ use OCA\Files_Sharing\Middleware\ShareInfoMiddleware;
 use OCP\AppFramework\Controller;
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\JSONResponse;
+use OCP\AppFramework\Http\Response;
 use OCP\Share\IManager as ShareManager;
 use Test\TestCase;
 
@@ -86,7 +87,7 @@ class ShareInfoMiddlewareTest extends TestCase {
        }
 
        public function testAfterControllerNoShareInfo(): void {
-               $response = $this->createMock(Http\Response::class);
+               $response = $this->createMock(Response::class);
 
                $this->assertEquals(
                        $response,
@@ -95,7 +96,7 @@ class ShareInfoMiddlewareTest extends TestCase {
        }
 
        public function testAfterControllerNoJSON(): void {
-               $response = $this->createMock(Http\Response::class);
+               $response = $this->createMock(Response::class);
 
                $this->assertEquals(
                        $response,
index 99fcb4eaea07cd6644b22cc92a3226e3b2b9374d..5b4f4de33d7ddb626e304e01aebbf2d7079d0d3b 100644 (file)
@@ -178,7 +178,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase {
 
 
        public function testBeforeControllerWithSharingDisabled(): void {
-               $this->expectException(\OCP\Files\NotFoundException::class);
+               $this->expectException(NotFoundException::class);
                $this->expectExceptionMessage('Sharing is disabled.');
 
                $this->appManager
index 2dc5365ae2b012311707f751d2bee208152cbfff..1f67bdd01fab3afcb44a89cb13c1d7a8403724d4 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\Files_Sharing\Tests;
 
 use OC\Memcache\NullCache;
+use OC\Share20\Share;
 use OCA\Files_Sharing\MountProvider;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\IRootFolder;
@@ -165,7 +166,7 @@ class MountProviderTest extends \Test\TestCase {
                $this->shareManager->expects($this->any())
                        ->method('newShare')
                        ->willReturnCallback(function () use ($rootFolder, $userManager) {
-                               return new \OC\Share20\Share($rootFolder, $userManager);
+                               return new Share($rootFolder, $userManager);
                        });
                $mounts = $this->provider->getMountsForUser($this->user, $this->loader);
                $this->assertCount(4, $mounts);
@@ -386,7 +387,7 @@ class MountProviderTest extends \Test\TestCase {
                $this->shareManager->expects($this->any())
                        ->method('newShare')
                        ->willReturnCallback(function () use ($rootFolder, $userManager) {
-                               return new \OC\Share20\Share($rootFolder, $userManager);
+                               return new Share($rootFolder, $userManager);
                        });
 
                if ($moveFails) {
index dee056f0658fd517b87fc4d9854a2d078360bbe9..78ff394bb80c3423971b51a4f1e39b2284880193 100644 (file)
@@ -6,6 +6,8 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OCA\Files_Sharing\Helper;
+
 abstract class PropagationTestCase extends TestCase {
        /**
         * @var \OC\Files\View
@@ -16,7 +18,7 @@ abstract class PropagationTestCase extends TestCase {
 
        public static function setUpBeforeClass(): void {
                parent::setUpBeforeClass();
-               \OCA\Files_Sharing\Helper::registerHooks();
+               Helper::registerHooks();
        }
 
        protected function setUp(): void {
index 6956093a0c16cdf1d9977738b5adc97ba743239d..2a3800dec196a0a19129d924dad394de56763b50 100644 (file)
@@ -6,6 +6,9 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OC\Files\Filesystem;
+use OCA\Files_Sharing\Helper;
+use OCP\Constants;
 use OCP\Share\IShare;
 
 /**
@@ -63,7 +66,7 @@ class ShareTest extends TestCase {
                        $this->filename,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE
                );
 
                $share2 = $this->share(
@@ -71,26 +74,26 @@ class ShareTest extends TestCase {
                        $this->filename,
                        self::TEST_FILES_SHARING_API_USER1,
                        'testGroup',
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE
                );
                $this->shareManager->acceptShare($share2, self::TEST_FILES_SHARING_API_USER2);
                $this->shareManager->acceptShare($share2, self::TEST_FILES_SHARING_API_USER3);
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
+               $this->assertTrue(Filesystem::file_exists($this->filename));
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
+               $this->assertTrue(Filesystem::file_exists($this->filename));
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               \OC\Files\Filesystem::unlink($this->filename);
+               Filesystem::unlink($this->filename);
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
                // both group share and user share should be gone
-               $this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename));
+               $this->assertFalse(Filesystem::file_exists($this->filename));
 
                // for user3 nothing should change
                self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
+               $this->assertTrue(Filesystem::file_exists($this->filename));
 
                $this->shareManager->deleteShare($share1);
                $this->shareManager->deleteShare($share2);
@@ -117,23 +120,23 @@ class ShareTest extends TestCase {
                        $this->filename,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE
                );
 
-               \OCA\Files_Sharing\Helper::setShareFolder('/Shared/subfolder');
+               Helper::setShareFolder('/Shared/subfolder');
 
                $share = $this->share(
                        IShare::TYPE_USER,
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
-               $this->assertTrue(\OC\Files\Filesystem::file_exists('/Shared/subfolder/' . $this->folder));
+               $this->assertTrue(Filesystem::file_exists($this->filename));
+               $this->assertTrue(Filesystem::file_exists('/Shared/subfolder/' . $this->folder));
 
                //cleanup
                \OC::$server->getConfig()->deleteSystemValue('share_folder');
@@ -143,14 +146,14 @@ class ShareTest extends TestCase {
                $this->markTestSkipped('TODO: Disable because fails on drone');
 
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER1);
-               \OC\Files\Filesystem::file_put_contents('test.txt', 'test');
+               Filesystem::file_put_contents('test.txt', 'test');
 
                $share = $this->share(
                        IShare::TYPE_GROUP,
                        'test.txt',
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_GROUP1,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE
                );
 
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -160,14 +163,14 @@ class ShareTest extends TestCase {
                $this->assertSame('/test.txt', $share->getTarget());
                $this->assertSame(19, $share->getPermissions());
 
-               \OC\Files\Filesystem::rename('test.txt', 'new test.txt');
+               Filesystem::rename('test.txt', 'new test.txt');
 
                $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_GROUP);
                $share = $shares[0];
                $this->assertSame('/new test.txt', $share->getTarget());
                $this->assertSame(19, $share->getPermissions());
 
-               $share->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE);
+               $share->setPermissions(Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE);
                $this->shareManager->updateShare($share);
 
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -200,11 +203,11 @@ class ShareTest extends TestCase {
        }
 
        public function dataProviderTestFileSharePermissions() {
-               $permission1 = \OCP\Constants::PERMISSION_ALL;
-               $permission3 = \OCP\Constants::PERMISSION_READ;
-               $permission4 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE;
-               $permission5 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE;
-               $permission6 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE;
+               $permission1 = Constants::PERMISSION_ALL;
+               $permission3 = Constants::PERMISSION_READ;
+               $permission4 = Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE;
+               $permission5 = Constants::PERMISSION_READ | Constants::PERMISSION_DELETE;
+               $permission6 = Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE;
 
                return [
                        [$permission1, false],
@@ -221,12 +224,12 @@ class ShareTest extends TestCase {
                        $this->filename,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ
+                       Constants::PERMISSION_READ
                );
 
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               $info = \OC\Files\Filesystem::getFileInfo($this->filename);
+               $info = Filesystem::getFileInfo($this->filename);
 
                $this->assertSame(self::TEST_FILES_SHARING_API_USER1, $info->getOwner()->getUID());
        }
index 82c0770440d0013c563147c7d5b5d8614ba7d066..241b708f07e0fe4aff0d79c9d5e22678c4371e6f 100644 (file)
@@ -6,11 +6,16 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OC\Files\Filesystem;
+use OC\Files\View;
 use OC\Memcache\ArrayCache;
 use OCA\Files_Sharing\MountProvider;
+use OCA\Files_Sharing\SharedMount;
+use OCP\Constants;
 use OCP\ICacheFactory;
 use OCP\IGroupManager;
 use OCP\IUserManager;
+use OCP\Server;
 use OCP\Share\IShare;
 
 /**
@@ -73,7 +78,7 @@ class SharedMountTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL);
+                       Constants::PERMISSION_ALL);
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
 
                $share->setTarget('/foo/bar' . $this->folder);
@@ -104,11 +109,11 @@ class SharedMountTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $user2View = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
                $this->assertTrue($user2View->file_exists($this->folder));
 
                // create a local folder
@@ -143,25 +148,25 @@ class SharedMountTest extends TestCase {
                        $this->filename,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               \OC\Files\Filesystem::rename($this->filename, $this->filename . '_renamed');
+               Filesystem::rename($this->filename, $this->filename . '_renamed');
 
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename . '_renamed'));
-               $this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename));
+               $this->assertTrue(Filesystem::file_exists($this->filename . '_renamed'));
+               $this->assertFalse(Filesystem::file_exists($this->filename));
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
-               $this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename . '_renamed'));
+               $this->assertTrue(Filesystem::file_exists($this->filename));
+               $this->assertFalse(Filesystem::file_exists($this->filename . '_renamed'));
 
                // rename back to original name
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               \OC\Files\Filesystem::rename($this->filename . '_renamed', $this->filename);
-               $this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename . '_renamed'));
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
+               Filesystem::rename($this->filename . '_renamed', $this->filename);
+               $this->assertFalse(Filesystem::file_exists($this->filename . '_renamed'));
+               $this->assertTrue(Filesystem::file_exists($this->filename));
 
                //cleanup
                $this->shareManager->deleteShare($share);
@@ -186,7 +191,7 @@ class SharedMountTest extends TestCase {
                        $this->filename,
                        self::TEST_FILES_SHARING_API_USER1,
                        'testGroup',
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE
                );
                $this->shareManager->acceptShare($share, $user1->getUID());
                $this->shareManager->acceptShare($share, $user2->getUID());
@@ -194,20 +199,20 @@ class SharedMountTest extends TestCase {
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
+               $this->assertTrue(Filesystem::file_exists($this->filename));
 
-               \OC\Files\Filesystem::rename($this->filename, 'newFileName');
+               Filesystem::rename($this->filename, 'newFileName');
 
-               $this->assertTrue(\OC\Files\Filesystem::file_exists('newFileName'));
-               $this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename));
+               $this->assertTrue(Filesystem::file_exists('newFileName'));
+               $this->assertFalse(Filesystem::file_exists($this->filename));
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
-               $this->assertFalse(\OC\Files\Filesystem::file_exists('newFileName'));
+               $this->assertTrue(Filesystem::file_exists($this->filename));
+               $this->assertFalse(Filesystem::file_exists('newFileName'));
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
-               $this->assertFalse(\OC\Files\Filesystem::file_exists('newFileName'));
+               $this->assertTrue(Filesystem::file_exists($this->filename));
+               $this->assertFalse(Filesystem::file_exists('newFileName'));
 
                //cleanup
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
@@ -270,7 +275,7 @@ class SharedMountTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        'testGroup',
-                       \OCP\Constants::PERMISSION_READ
+                       Constants::PERMISSION_READ
                );
                $this->shareManager->acceptShare($share, $user1->getUID());
                $this->shareManager->acceptShare($share, $user2->getUID());
@@ -278,14 +283,14 @@ class SharedMountTest extends TestCase {
 
                // Login as user 2 and verify the item exists
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->folder));
+               $this->assertTrue(Filesystem::file_exists($this->folder));
                $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2);
                $this->assertNotEmpty($result);
-               $this->assertEquals(\OCP\Constants::PERMISSION_READ, $result->getPermissions());
+               $this->assertEquals(Constants::PERMISSION_READ, $result->getPermissions());
 
                // Delete the share
-               $this->assertTrue(\OC\Files\Filesystem::rmdir($this->folder));
-               $this->assertFalse(\OC\Files\Filesystem::file_exists($this->folder));
+               $this->assertTrue(Filesystem::rmdir($this->folder));
+               $this->assertFalse(Filesystem::file_exists($this->folder));
 
                // Verify we do not get a share
                $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2);
@@ -293,12 +298,12 @@ class SharedMountTest extends TestCase {
 
                // Login as user 1 again and change permissions
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
-               $share->setPermissions(\OCP\Constants::PERMISSION_ALL);
+               $share->setPermissions(Constants::PERMISSION_ALL);
                $share = $this->shareManager->updateShare($share);
 
                // Login as user 2 and verify
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $this->assertFalse(\OC\Files\Filesystem::file_exists($this->folder));
+               $this->assertFalse(Filesystem::file_exists($this->folder));
                $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2);
                $this->assertEquals(0, $result->getPermissions());
 
@@ -326,7 +331,7 @@ class SharedMountTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL);
+                       Constants::PERMISSION_ALL);
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
 
                $share->setTarget('/bar');
@@ -369,7 +374,7 @@ class SharedMountTest extends TestCase {
                        });
 
                // hack to overwrite the cache factory, we can't use the proper "overwriteService" since the mount provider is created before this test is called
-               $mountProvider = \OCP\Server::get(MountProvider::class);
+               $mountProvider = Server::get(MountProvider::class);
                $reflectionClass = new \ReflectionClass($mountProvider);
                $reflectionCacheFactory = $reflectionClass->getProperty('cacheFactory');
                $reflectionCacheFactory->setAccessible(true);
@@ -381,7 +386,7 @@ class SharedMountTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL);
+                       Constants::PERMISSION_ALL);
                $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
 
                $share->setTarget('/foobar');
@@ -394,7 +399,7 @@ class SharedMountTest extends TestCase {
                        $this->folder2,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL);
+                       Constants::PERMISSION_ALL);
                $this->shareManager->acceptShare($share2, self::TEST_FILES_SHARING_API_USER2);
 
                $share2->setTarget('/foobar');
@@ -418,7 +423,7 @@ class SharedMountTest extends TestCase {
        }
 }
 
-class DummyTestClassSharedMount extends \OCA\Files_Sharing\SharedMount {
+class DummyTestClassSharedMount extends SharedMount {
        public function __construct($storage, $mountpoint, $arguments = null, $loader = null) {
                // noop
        }
index 430dd158bc394cbe923c7ff28450c38fcc305898..2aa4f38c0da9b4a33c457f844643b06972a75c9e 100644 (file)
@@ -6,10 +6,15 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OC\Files\Cache\FailedCache;
+use OC\Files\Filesystem;
+use OC\Files\Storage\FailedStorage;
+use OC\Files\Storage\Temporary;
 use OC\Files\View;
 use OCA\Files_Sharing\SharedStorage;
 use OCA\Files_Trashbin\AppInfo\Application;
 use OCP\AppFramework\Bootstrap\IBootContext;
+use OCP\Constants;
 use OCP\Files\NotFoundException;
 use OCP\Share\IShare;
 
@@ -46,7 +51,7 @@ class SharedStorageTest extends TestCase {
                        }
                }
 
-               \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
+               Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
 
                parent::tearDown();
        }
@@ -64,11 +69,11 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $user2View = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
                $this->assertTrue($user2View->file_exists($this->folder));
 
                // create a local folder
@@ -84,7 +89,7 @@ class SharedStorageTest extends TestCase {
 
                // delete the local folder
                /** @var \OC\Files\Storage\Storage $storage */
-               [$storage, $internalPath] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/localfolder');
+               [$storage, $internalPath] = Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/localfolder');
                $storage->rmdir($internalPath);
 
                //enforce reload of the mount points
@@ -109,12 +114,12 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $user2View = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
 
                $this->assertTrue($user2View->file_exists($this->folder));
 
@@ -149,7 +154,7 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                $share2 = $this->share(
@@ -157,16 +162,16 @@ class SharedStorageTest extends TestCase {
                        $this->filename,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE
                );
 
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
                // compare file size between user1 and user2, should always be the same
-               $this->assertSame($folderSize, \OC\Files\Filesystem::filesize($this->folder));
-               $this->assertSame($file1Size, \OC\Files\Filesystem::filesize($this->folder . $this->filename));
-               $this->assertSame($file2Size, \OC\Files\Filesystem::filesize($this->filename));
+               $this->assertSame($folderSize, Filesystem::filesize($this->folder));
+               $this->assertSame($file1Size, Filesystem::filesize($this->folder . $this->filename));
+               $this->assertSame($file2Size, Filesystem::filesize($this->filename));
 
                //cleanup
                $this->shareManager->deleteShare($share1);
@@ -179,23 +184,23 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ
+                       Constants::PERMISSION_READ
                );
 
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               $this->assertTrue(\OC\Files\Filesystem::is_dir($this->folder));
+               $this->assertTrue(Filesystem::is_dir($this->folder));
 
                // for the share root we expect:
                // the read permissions (1)
                // the delete permission (8), to enable unshare
-               $rootInfo = \OC\Files\Filesystem::getFileInfo($this->folder);
+               $rootInfo = Filesystem::getFileInfo($this->folder);
                $this->assertSame(9, $rootInfo->getPermissions());
 
                // for the file within the shared folder we expect:
                // the read permissions (1)
-               $subfileInfo = \OC\Files\Filesystem::getFileInfo($this->folder . $this->filename);
+               $subfileInfo = Filesystem::getFileInfo($this->folder . $this->filename);
                $this->assertSame(1, $subfileInfo->getPermissions());
 
 
@@ -211,11 +216,11 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ
+                       Constants::PERMISSION_READ
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $user2View = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
 
                // part file should be forbidden
                $handle = $user2View->fopen($this->folder . '/test.txt.part', 'w');
@@ -244,11 +249,11 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_CREATE
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $user2View = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
 
                // create part file allowed
                $handle = $user2View->fopen($this->folder . '/test.txt.part', 'w');
@@ -290,11 +295,11 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $user2View = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
 
                // create part file allowed
                $handle = $user2View->fopen($this->folder . '/test.txt.part', 'w');
@@ -336,11 +341,11 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_DELETE
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $user2View = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
 
                // part file should be forbidden
                $handle = $user2View->fopen($this->folder . '/test.txt.part', 'w');
@@ -361,7 +366,7 @@ class SharedStorageTest extends TestCase {
        }
 
        public function testMountSharesOtherUser(): void {
-               $rootView = new \OC\Files\View('');
+               $rootView = new View('');
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
 
                // share 2 different files with 2 different users
@@ -370,14 +375,14 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                $share2 = $this->share(
                        IShare::TYPE_USER,
                        $this->filename,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER3,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -385,7 +390,7 @@ class SharedStorageTest extends TestCase {
 
                $mountConfigManager = \OC::$server->getMountProviderCollection();
                $mounts = $mountConfigManager->getMountsForUser(\OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER3));
-               array_walk($mounts, [\OC\Files\Filesystem::getMountManager(), 'addMount']);
+               array_walk($mounts, [Filesystem::getMountManager(), 'addMount']);
 
                $this->assertTrue($rootView->file_exists('/' . self::TEST_FILES_SHARING_API_USER3 . '/files/' . $this->filename));
 
@@ -409,17 +414,17 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $view = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
                $this->assertTrue($view->file_exists($this->folder));
 
                [$sharedStorage,] = $view->resolvePath($this->folder);
                $this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage'));
 
-               $sourceStorage = new \OC\Files\Storage\Temporary([]);
+               $sourceStorage = new Temporary([]);
                $sourceStorage->file_put_contents('foo.txt', 'asd');
 
                $sharedStorage->copyFromStorage($sourceStorage, 'foo.txt', 'bar.txt');
@@ -439,17 +444,17 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $view = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
                $this->assertTrue($view->file_exists($this->folder));
 
                [$sharedStorage,] = $view->resolvePath($this->folder);
                $this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage'));
 
-               $sourceStorage = new \OC\Files\Storage\Temporary([]);
+               $sourceStorage = new Temporary([]);
                $sourceStorage->file_put_contents('foo.txt', 'asd');
                $sourceStorage->getScanner()->scan('');
 
@@ -464,11 +469,11 @@ class SharedStorageTest extends TestCase {
 
        public function testNameConflict(): void {
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
-               $view1 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
+               $view1 = new View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
                $view1->mkdir('foo');
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
-               $view3 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER3 . '/files');
+               $view3 = new View('/' . self::TEST_FILES_SHARING_API_USER3 . '/files');
                $view3->mkdir('foo');
 
                // share a folder with the same name from two different users to the same user
@@ -479,7 +484,7 @@ class SharedStorageTest extends TestCase {
                        'foo',
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_GROUP1,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                $this->shareManager->acceptShare($share1, self::TEST_FILES_SHARING_API_USER2);
 
@@ -492,19 +497,19 @@ class SharedStorageTest extends TestCase {
                        'foo',
                        self::TEST_FILES_SHARING_API_USER3,
                        self::TEST_FILES_SHARING_API_GROUP1,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                $this->shareManager->acceptShare($share2, self::TEST_FILES_SHARING_API_USER2);
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $view2 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $view2 = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
 
                $this->assertTrue($view2->file_exists('/foo'));
                $this->assertTrue($view2->file_exists('/foo (2)'));
 
                $mount = $view2->getMount('/foo');
                $this->assertInstanceOf('\OCA\Files_Sharing\SharedMount', $mount);
-               /** @var \OCA\Files_Sharing\SharedStorage $storage */
+               /** @var SharedStorage $storage */
                $storage = $mount->getStorage();
 
                $this->assertEquals(self::TEST_FILES_SHARING_API_USER1, $storage->getOwner(''));
@@ -521,11 +526,11 @@ class SharedStorageTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE
+                       Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $view = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
                $this->assertTrue($view->file_exists($this->folder));
 
                $view->file_put_contents($this->folder . '/newfile.txt', 'asd');
@@ -533,7 +538,7 @@ class SharedStorageTest extends TestCase {
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
 
                $this->assertTrue($this->view->file_exists($this->folder . '/newfile.txt'));
-               $this->assertEquals(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE,
+               $this->assertEquals(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE,
                        $this->view->getFileInfo($this->folder . '/newfile.txt')->getPermissions());
 
                $this->view->unlink($this->folder);
@@ -552,8 +557,8 @@ class SharedStorageTest extends TestCase {
                ]);
 
                // trigger init
-               $this->assertInstanceOf(\OC\Files\Storage\FailedStorage::class, $storage->getSourceStorage());
-               $this->assertInstanceOf(\OC\Files\Cache\FailedCache::class, $storage->getCache());
+               $this->assertInstanceOf(FailedStorage::class, $storage->getSourceStorage());
+               $this->assertInstanceOf(FailedCache::class, $storage->getCache());
        }
 
        public function testInitWithNotFoundSource(): void {
@@ -570,7 +575,7 @@ class SharedStorageTest extends TestCase {
                ]);
 
                // trigger init
-               $this->assertInstanceOf(\OC\Files\Storage\FailedStorage::class, $storage->getSourceStorage());
-               $this->assertInstanceOf(\OC\Files\Cache\FailedCache::class, $storage->getCache());
+               $this->assertInstanceOf(FailedStorage::class, $storage->getSourceStorage());
+               $this->assertInstanceOf(FailedCache::class, $storage->getCache());
        }
 }
index de830c508cdd99f550d0aae3633738f16952f675..2c6eda0fb8e204d79261061770b0f78a361c030e 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\Files_Sharing\Tests;
 
 use OC\Files\View;
+use OCP\Constants;
 use OCP\Share\IShare;
 use Test\Traits\UserTrait;
 
@@ -40,7 +41,7 @@ class SizePropagationTest extends TestCase {
                        '/sharedfolder',
                        self::TEST_FILES_SHARING_API_USER2,
                        self::TEST_FILES_SHARING_API_USER1,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                $ownerRootInfo = $ownerView->getFileInfo('', false);
 
@@ -75,7 +76,7 @@ class SizePropagationTest extends TestCase {
                        '/sharedfolder',
                        self::TEST_FILES_SHARING_API_USER2,
                        self::TEST_FILES_SHARING_API_USER1,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                $ownerRootInfo = $ownerView->getFileInfo('', false);
 
index 4545e67be3219f09a4d02101b6eede015d8e03cd..473b7cb72272960cc9b5b1b028cb775589348186 100644 (file)
@@ -6,7 +6,10 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OC\Files\Cache\Storage;
 use OC\Files\Filesystem;
+use OC\Files\View;
+use OC\Group\Database;
 use OC\User\DisplayNameCache;
 use OCA\Files_Sharing\AppInfo\Application;
 use OCA\Files_Sharing\External\MountProvider as ExternalMountProvider;
@@ -101,8 +104,8 @@ abstract class TestCase extends \Test\TestCase {
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
 
                $this->data = 'foobar';
-               $this->view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
-               $this->view2 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $this->view = new View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
+               $this->view2 = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
 
                $this->shareManager = \OC::$server->getShareManager();
                $this->rootFolder = \OC::$server->getRootFolder();
@@ -153,7 +156,7 @@ abstract class TestCase extends \Test\TestCase {
                \OC_User::clearBackends();
                \OC_User::useBackend('database');
                \OC::$server->getGroupManager()->clearBackends();
-               \OC::$server->getGroupManager()->addBackend(new \OC\Group\Database());
+               \OC::$server->getGroupManager()->addBackend(new Database());
 
                parent::tearDownAfterClass();
        }
@@ -181,9 +184,9 @@ abstract class TestCase extends \Test\TestCase {
                }
 
                \OC_Util::tearDownFS();
-               \OC\Files\Cache\Storage::getGlobalCache()->clearCache();
+               Storage::getGlobalCache()->clearCache();
                \OC::$server->getUserSession()->setUser(null);
-               \OC\Files\Filesystem::tearDown();
+               Filesystem::tearDown();
                \OC::$server->getUserSession()->login($user, $password);
                \OC::$server->getUserFolder($user);
 
index e95c1c68ecb2b7634e560452c0f75d6716f9b4d8..61c4aa94213c5e08ddad159c03dadfb28e8a06b6 100644 (file)
@@ -6,7 +6,10 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OC\Files\Filesystem;
+use OCP\Constants;
 use OCP\Share\IShare;
+use OCP\Util;
 
 /**
  * Class UnshareChildrenTest
@@ -25,7 +28,7 @@ class UnshareChildrenTest extends TestCase {
        protected function setUp(): void {
                parent::setUp();
 
-               \OCP\Util::connectHook('OC_Filesystem', 'post_delete', '\OCA\Files_Sharing\Hooks', 'unshareChildren');
+               Util::connectHook('OC_Filesystem', 'post_delete', '\OCA\Files_Sharing\Hooks', 'unshareChildren');
 
                $this->folder = self::TEST_FOLDER_NAME;
                $this->subfolder = '/subfolder_share_api_test';
@@ -55,14 +58,14 @@ class UnshareChildrenTest extends TestCase {
         * @medium
         */
        public function testUnshareChildren(): void {
-               $fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder);
+               $fileInfo2 = Filesystem::getFileInfo($this->folder);
 
                $this->share(
                        IShare::TYPE_USER,
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -72,11 +75,11 @@ class UnshareChildrenTest extends TestCase {
                $this->assertCount(1, $shares);
 
                // move shared folder to 'localDir'
-               \OC\Files\Filesystem::mkdir('localDir');
-               $result = \OC\Files\Filesystem::rename($this->folder, '/localDir/' . $this->folder);
+               Filesystem::mkdir('localDir');
+               $result = Filesystem::rename($this->folder, '/localDir/' . $this->folder);
                $this->assertTrue($result);
 
-               \OC\Files\Filesystem::unlink('localDir');
+               Filesystem::unlink('localDir');
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
@@ -87,6 +90,6 @@ class UnshareChildrenTest extends TestCase {
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
 
                // the folder for the owner should still exists
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->folder));
+               $this->assertTrue(Filesystem::file_exists($this->folder));
        }
 }
index 8aee8d7ddfc6a7916465776059f5cae4e871b0ad..62dd731559199a8b804a406db04bbcfb71b22de3 100644 (file)
@@ -6,8 +6,13 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OC\Files\FileInfo;
+use OC\Files\Filesystem;
+use OC\Files\View;
+use OCA\Files_Sharing\Helper;
 use OCA\Files_Trashbin\AppInfo\Application;
 use OCP\AppFramework\Bootstrap\IBootContext;
+use OCP\Constants;
 use OCP\Share\IShare;
 
 /**
@@ -20,7 +25,7 @@ class UpdaterTest extends TestCase {
 
        public static function setUpBeforeClass(): void {
                parent::setUpBeforeClass();
-               \OCA\Files_Sharing\Helper::registerHooks();
+               Helper::registerHooks();
        }
 
        protected function setUp(): void {
@@ -58,19 +63,19 @@ class UpdaterTest extends TestCase {
                $trashbinApp = new Application();
                $trashbinApp->boot($this->createMock(IBootContext::class));
 
-               $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder);
-               $this->assertTrue($fileinfo instanceof \OC\Files\FileInfo);
+               $fileinfo = Filesystem::getFileInfo($this->folder);
+               $this->assertTrue($fileinfo instanceof FileInfo);
 
                $this->share(
                        IShare::TYPE_USER,
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $view = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
 
                // check if user2 can see the shared folder
                $this->assertTrue($view->file_exists($this->folder));
@@ -96,7 +101,7 @@ class UpdaterTest extends TestCase {
                $this->assertCount(0, $foldersShared);
 
                // trashbin should contain the local file but not the mount point
-               $rootView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
+               $rootView = new View('/' . self::TEST_FILES_SHARING_API_USER2);
                $trashContent = \OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_FILES_SHARING_API_USER2);
                $this->assertSame(1, count($trashContent));
                $firstElement = reset($trashContent);
@@ -111,7 +116,7 @@ class UpdaterTest extends TestCase {
                        \OC::$server->getAppManager()->disableApp('files_trashbin');
                }
 
-               \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
+               Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
        }
 
        public function shareFolderProvider() {
@@ -135,12 +140,12 @@ class UpdaterTest extends TestCase {
 
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               $beforeShareRoot = \OC\Files\Filesystem::getFileInfo('');
+               $beforeShareRoot = Filesystem::getFileInfo('');
                $etagBeforeShareRoot = $beforeShareRoot->getEtag();
 
-               \OC\Files\Filesystem::mkdir($shareFolder);
+               Filesystem::mkdir($shareFolder);
 
-               $beforeShareDir = \OC\Files\Filesystem::getFileInfo($shareFolder);
+               $beforeShareDir = Filesystem::getFileInfo($shareFolder);
                $etagBeforeShareDir = $beforeShareDir->getEtag();
 
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER1);
@@ -150,15 +155,15 @@ class UpdaterTest extends TestCase {
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               $afterShareRoot = \OC\Files\Filesystem::getFileInfo('');
+               $afterShareRoot = Filesystem::getFileInfo('');
                $etagAfterShareRoot = $afterShareRoot->getEtag();
 
-               $afterShareDir = \OC\Files\Filesystem::getFileInfo($shareFolder);
+               $afterShareDir = Filesystem::getFileInfo($shareFolder);
                $etagAfterShareDir = $afterShareDir->getEtag();
 
                $this->assertTrue(is_string($etagBeforeShareRoot));
@@ -179,36 +184,36 @@ class UpdaterTest extends TestCase {
         * if a folder gets renamed all children mount points should be renamed too
         */
        public function testRename(): void {
-               $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder);
+               $fileinfo = Filesystem::getFileInfo($this->folder);
 
                $share = $this->share(
                        IShare::TYPE_USER,
                        $this->folder,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
                // make sure that the shared folder exists
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($this->folder));
+               $this->assertTrue(Filesystem::file_exists($this->folder));
 
-               \OC\Files\Filesystem::mkdir('oldTarget');
-               \OC\Files\Filesystem::mkdir('oldTarget/subfolder');
-               \OC\Files\Filesystem::mkdir('newTarget');
+               Filesystem::mkdir('oldTarget');
+               Filesystem::mkdir('oldTarget/subfolder');
+               Filesystem::mkdir('newTarget');
 
-               \OC\Files\Filesystem::rename($this->folder, 'oldTarget/subfolder/' . $this->folder);
+               Filesystem::rename($this->folder, 'oldTarget/subfolder/' . $this->folder);
 
                // re-login to make sure that the new mount points are initialized
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               \OC\Files\Filesystem::rename('/oldTarget', '/newTarget/oldTarget');
+               Filesystem::rename('/oldTarget', '/newTarget/oldTarget');
 
                // re-login to make sure that the new mount points are initialized
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
-               $this->assertTrue(\OC\Files\Filesystem::file_exists('/newTarget/oldTarget/subfolder/' . $this->folder));
+               $this->assertTrue(Filesystem::file_exists('/newTarget/oldTarget/subfolder/' . $this->folder));
 
                // cleanup
                $this->shareManager->deleteShare($share);
@@ -229,7 +234,7 @@ class UpdaterTest extends TestCase {
                $this->markTestSkipped('Skipped because this is failing with S3 as primary as file id are change when moved.');
 
                // user1 creates folder1
-               $viewUser1 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
+               $viewUser1 = new View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
                $folder1 = 'folder1';
                $viewUser1->mkdir($folder1);
 
@@ -239,11 +244,11 @@ class UpdaterTest extends TestCase {
                        $folder1,
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_SHARE
                );
 
                $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
-               $viewUser2 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+               $viewUser2 = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
                // Create user2 files
                $folder2 = 'folder2';
                $viewUser2->mkdir($folder2);
@@ -262,7 +267,7 @@ class UpdaterTest extends TestCase {
                        $folder2,
                        self::TEST_FILES_SHARING_API_USER2,
                        self::TEST_FILES_SHARING_API_USER3,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                // user2 shares folder2/file1 to user3
                $file1Share = $this->share(
@@ -270,7 +275,7 @@ class UpdaterTest extends TestCase {
                        $file1,
                        self::TEST_FILES_SHARING_API_USER2,
                        self::TEST_FILES_SHARING_API_USER3,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_SHARE
                );
                // user2 shares subfolder1 to user3
                $subfolder1Share = $this->share(
@@ -278,7 +283,7 @@ class UpdaterTest extends TestCase {
                        $subfolder1,
                        self::TEST_FILES_SHARING_API_USER2,
                        self::TEST_FILES_SHARING_API_USER3,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
                // user2 shares subfolder2/file2.txt to user3
                $file2Share = $this->share(
@@ -286,7 +291,7 @@ class UpdaterTest extends TestCase {
                        $file2,
                        self::TEST_FILES_SHARING_API_USER2,
                        self::TEST_FILES_SHARING_API_USER3,
-                       \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE
+                       Constants::PERMISSION_READ | Constants::PERMISSION_SHARE
                );
 
                // user2 moves folder2 into folder1
@@ -302,10 +307,10 @@ class UpdaterTest extends TestCase {
                $this->assertEquals(self::TEST_FILES_SHARING_API_USER1, $subfolder1Share->getShareOwner());
                $this->assertEquals(self::TEST_FILES_SHARING_API_USER1, $file2Share->getShareOwner());
                // Expect permissions to be limited by the permissions of the destination share
-               $this->assertEquals(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE, $folder2Share->getPermissions());
-               $this->assertEquals(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE, $file1Share->getPermissions());
-               $this->assertEquals(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE, $subfolder1Share->getPermissions());
-               $this->assertEquals(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE, $file2Share->getPermissions());
+               $this->assertEquals(Constants::PERMISSION_READ | Constants::PERMISSION_SHARE, $folder2Share->getPermissions());
+               $this->assertEquals(Constants::PERMISSION_READ | Constants::PERMISSION_SHARE, $file1Share->getPermissions());
+               $this->assertEquals(Constants::PERMISSION_READ | Constants::PERMISSION_SHARE, $subfolder1Share->getPermissions());
+               $this->assertEquals(Constants::PERMISSION_READ | Constants::PERMISSION_SHARE, $file2Share->getPermissions());
 
                // user2 moves folder2 out of folder1
                $viewUser2->rename($folder1 . '/' . $folder2, $folder2);
@@ -320,10 +325,10 @@ class UpdaterTest extends TestCase {
                $this->assertEquals(self::TEST_FILES_SHARING_API_USER2, $subfolder1Share->getShareOwner());
                $this->assertEquals(self::TEST_FILES_SHARING_API_USER2, $file2Share->getShareOwner());
                // Expect permissions to not change
-               $this->assertEquals(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE, $folder2Share->getPermissions());
-               $this->assertEquals(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE, $file1Share->getPermissions());
-               $this->assertEquals(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE, $subfolder1Share->getPermissions());
-               $this->assertEquals(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE, $file2Share->getPermissions());
+               $this->assertEquals(Constants::PERMISSION_READ | Constants::PERMISSION_SHARE, $folder2Share->getPermissions());
+               $this->assertEquals(Constants::PERMISSION_READ | Constants::PERMISSION_SHARE, $file1Share->getPermissions());
+               $this->assertEquals(Constants::PERMISSION_READ | Constants::PERMISSION_SHARE, $subfolder1Share->getPermissions());
+               $this->assertEquals(Constants::PERMISSION_READ | Constants::PERMISSION_SHARE, $file2Share->getPermissions());
 
                // cleanup
                $this->shareManager->deleteShare($folder1Share);
index 012acdcd691286dd8fa4f71ae079d52d2f318cc9..cddba7db7359efdda8efd55e9f94ec6ce8eb2cb2 100644 (file)
@@ -6,6 +6,8 @@
  */
 namespace OCA\Files_Sharing\Tests;
 
+use OC\Files\View;
+use OCP\Constants;
 use OCP\Share\IShare;
 
 /**
@@ -50,7 +52,7 @@ class WatcherTest extends TestCase {
                        'container/shareddir',
                        self::TEST_FILES_SHARING_API_USER1,
                        self::TEST_FILES_SHARING_API_USER2,
-                       \OCP\Constants::PERMISSION_ALL
+                       Constants::PERMISSION_ALL
                );
 
                $this->_share->setStatus(IShare::STATUS_ACCEPTED);
@@ -60,7 +62,7 @@ class WatcherTest extends TestCase {
                self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
 
                // retrieve the shared storage
-               $secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
+               $secondView = new View('/' . self::TEST_FILES_SHARING_API_USER2);
                [$this->sharedStorage, $internalPath] = $secondView->resolvePath('files/shareddir');
                $this->sharedCache = $this->sharedStorage->getCache();
        }
index 651f5035c1cb53cbff26ef69fb823bcda508a87b..b5980b27c0af48ed1f3c1623a4079aa865b8ecc1 100644 (file)
@@ -6,6 +6,7 @@
  */
 namespace OCA\Files_Trashbin\BackgroundJob;
 
+use OC\Files\View;
 use OCA\Files_Trashbin\Expiration;
 use OCA\Files_Trashbin\Helper;
 use OCA\Files_Trashbin\Trashbin;
@@ -70,7 +71,7 @@ class ExpireTrash extends TimedJob {
                \OC_Util::setupFS($user);
 
                // Check if this user has a trashbin directory
-               $view = new \OC\Files\View('/' . $user);
+               $view = new View('/' . $user);
                if (!$view->is_dir('/files_trashbin/files')) {
                        return false;
                }
index 33a5ac83dbf41db58573957c4e07a9566e56b2f7..c27d74c0c26fa78dd61867b28eb8f5ca32f396bc 100644 (file)
@@ -6,6 +6,7 @@
  */
 namespace OCA\Files_Trashbin\Command;
 
+use OC\Files\View;
 use OCA\Files_Trashbin\Expiration;
 use OCA\Files_Trashbin\Helper;
 use OCA\Files_Trashbin\Trashbin;
@@ -103,7 +104,7 @@ class ExpireTrash extends Command {
                \OC_Util::setupFS($user);
 
                // Check if this user has a trashbin directory
-               $view = new \OC\Files\View('/' . $user);
+               $view = new View('/' . $user);
                if (!$view->is_dir('/files_trashbin/files')) {
                        return false;
                }
index 969791379c1536da82da01d25b4736f66ee7c61e..81b59543a4e7ccc408f37b732fdfd3ec28ceed90 100644 (file)
@@ -7,6 +7,7 @@ namespace OCA\Files_Trashbin\Command;
 
 use OC\Core\Command\Base;
 use OCA\Files_Trashbin\Trash\ITrashManager;
+use OCA\Files_Trashbin\Trash\TrashItem;
 use OCP\Files\IRootFolder;
 use OCP\IDBConnection;
 use OCP\IL10N;
@@ -246,7 +247,7 @@ class RestoreAllFiles extends Base {
                        $trashItemClass = get_class($trashItem);
 
                        // Check scope with exact class name for locally deleted files
-                       if ($scope === self::SCOPE_USER && $trashItemClass !== \OCA\Files_Trashbin\Trash\TrashItem::class) {
+                       if ($scope === self::SCOPE_USER && $trashItemClass !== TrashItem::class) {
                                $output->writeln('Skipping <info>' . $trashItem->getName() . '</info> because it is not a user trash item', OutputInterface::VERBOSITY_VERBOSE);
                                continue;
                        }
index b006ba5e5aca4a1775ec0baacfbd09cd215e8e24..78d501b68d4c687974e2a7f091119436ab97b6f4 100644 (file)
@@ -14,6 +14,7 @@ use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\Attribute\NoAdminRequired;
 use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
 use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\Http\FileDisplayResponse;
 use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\Files\Folder;
 use OCP\Files\IMimeTypeDetector;
@@ -111,7 +112,7 @@ class PreviewController extends Controller {
                        }
 
                        $f = $this->previewManager->getPreview($file, $x, $y, !$a, IPreview::MODE_FILL, $mimeType);
-                       $response = new Http\FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]);
+                       $response = new FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]);
 
                        // Cache previews for 24H
                        $response->cacheFor(3600 * 24);
index 2e7916d9c6d0563b63d5b2f8bb5bd9ece96a8f32..7aeb737a56c40db5670bcd00a51e522f1955d738 100644 (file)
@@ -7,6 +7,7 @@
 namespace OCA\Files_Trashbin;
 
 use OC\Files\FileInfo;
+use OC\Files\View;
 use OCP\Constants;
 use OCP\Files\Cache\ICacheEntry;
 
@@ -25,7 +26,7 @@ class Helper {
                $result = [];
                $timestamp = null;
 
-               $view = new \OC\Files\View('/' . $user . '/files_trashbin/files');
+               $view = new View('/' . $user . '/files_trashbin/files');
 
                if (ltrim($dir, '/') !== '' && !$view->is_dir($dir)) {
                        throw new \Exception('Directory does not exists');
@@ -36,7 +37,7 @@ class Helper {
                $absoluteDir = $view->getAbsolutePath($dir);
                $internalPath = $mount->getInternalPath($absoluteDir);
 
-               $extraData = \OCA\Files_Trashbin\Trashbin::getExtraData($user);
+               $extraData = Trashbin::getExtraData($user);
                $dirContent = $storage->getCache()->getFolderContents($mount->getInternalPath($view->getAbsolutePath($dir)));
                foreach ($dirContent as $entry) {
                        $entryName = $entry->getName();
@@ -98,7 +99,7 @@ class Helper {
                        $entry = \OCA\Files\Helper::formatFileInfo($i);
                        $entry['id'] = $i->getId();
                        $entry['etag'] = $entry['mtime']; // add fake etag, it is only needed to identify the preview image
-                       $entry['permissions'] = \OCP\Constants::PERMISSION_READ;
+                       $entry['permissions'] = Constants::PERMISSION_READ;
                        $files[] = $entry;
                }
                return $files;
index 3421a56bd5acd2fc9a2c903870de295892b72735..e2661ccdec72dca0ce4b5e4a3e99cf25b3d17425 100644 (file)
@@ -10,6 +10,7 @@ namespace OCA\Files_Trashbin\Sabre;
 
 use OCA\Files_Trashbin\Trash\ITrashItem;
 use OCA\Files_Trashbin\Trash\ITrashManager;
+use OCA\Files_Trashbin\Trashbin;
 use OCP\Files\FileInfo;
 use OCP\IUser;
 use Sabre\DAV\Exception\Forbidden;
@@ -30,7 +31,7 @@ class TrashRoot implements ICollection {
        }
 
        public function delete() {
-               \OCA\Files_Trashbin\Trashbin::deleteAll();
+               Trashbin::deleteAll();
                foreach ($this->trashManager->listTrashRoot($this->user) as $trashItem) {
                        $this->trashManager->removeItem($trashItem);
                }
index 862c746c23914a44493abba296f2354f0d1e010b..0fd370a6cf13766fb83928b83b762062f5589c1c 100644 (file)
@@ -92,7 +92,7 @@ class LegacyTrashBackend implements ITrashBackend {
                        $this->deletedFiles[$normalized] = $normalized;
                        if ($filesPath = $view->getRelativePath($normalized)) {
                                $filesPath = trim($filesPath, '/');
-                               $result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath);
+                               $result = Trashbin::move2trash($filesPath);
                        } else {
                                $result = false;
                        }
index a30ba0ce0551c72bfd5f755138b1c844f1daf168..f6e5a3830ad9692e01264b1131a97df35e256c3b 100644 (file)
@@ -19,6 +19,8 @@ use OCA\Files_Trashbin\AppInfo\Application;
 use OCA\Files_Trashbin\Command\Expire;
 use OCA\Files_Trashbin\Events\BeforeNodeRestoredEvent;
 use OCA\Files_Trashbin\Events\NodeRestoredEvent;
+use OCA\Files_Trashbin\Exceptions\CopyRecursiveException;
+use OCA\Files_Versions\Storage;
 use OCP\App\IAppManager;
 use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\EventDispatcher\Event;
@@ -39,6 +41,7 @@ use OCP\IDBConnection;
 use OCP\Lock\ILockingProvider;
 use OCP\Lock\LockedException;
 use OCP\Server;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 /** @template-implements IEventListener<BeforeNodeDeletedEvent> */
@@ -293,7 +296,7 @@ class Trashbin implements IEventListener {
                        if ($sourceStorage->getCache()->inCache($sourceInternalPath)) {
                                $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
                        }
-               } catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) {
+               } catch (CopyRecursiveException $e) {
                        $moveSuccessful = false;
                        if ($trashStorage->file_exists($trashInternalPath)) {
                                $trashStorage->unlink($trashInternalPath);
@@ -329,7 +332,7 @@ class Trashbin implements IEventListener {
                        if (!$result) {
                                \OC::$server->get(LoggerInterface::class)->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']);
                        }
-                       \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path),
+                       Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path),
                                'trashPath' => Filesystem::normalizePath(static::getTrashFilename($filename, $timestamp))]);
 
                        self::retainVersions($filename, $owner, $ownerPath, $timestamp);
@@ -356,11 +359,11 @@ class Trashbin implements IEventListener {
                $config = \OC::$server->get(IConfig::class);
                $userTrashbinSize = $config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1');
                if (is_numeric($userTrashbinSize) && ($userTrashbinSize > -1)) {
-                       return \OCP\Util::numericToNumber($userTrashbinSize);
+                       return Util::numericToNumber($userTrashbinSize);
                }
                $systemTrashbinSize = $config->getAppValue('files_trashbin', 'trashbin_size', '-1');
                if (is_numeric($systemTrashbinSize)) {
-                       return \OCP\Util::numericToNumber($systemTrashbinSize);
+                       return Util::numericToNumber($systemTrashbinSize);
                }
                return -1;
        }
@@ -374,7 +377,7 @@ class Trashbin implements IEventListener {
         * @param int $timestamp when the file was deleted
         */
        private static function retainVersions($filename, $owner, $ownerPath, $timestamp) {
-               if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions') && !empty($ownerPath)) {
+               if (Server::get(IAppManager::class)->isEnabledForUser('files_versions') && !empty($ownerPath)) {
                        $user = OC_User::getUser();
                        $rootView = new View('/');
 
@@ -383,7 +386,7 @@ class Trashbin implements IEventListener {
                                        self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . static::getTrashFilename(basename($ownerPath), $timestamp), $rootView);
                                }
                                self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . static::getTrashFilename($filename, $timestamp));
-                       } elseif ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) {
+                       } elseif ($versions = Storage::getVersions($owner, $ownerPath)) {
                                foreach ($versions as $v) {
                                        if ($owner !== $user) {
                                                self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . static::getTrashFilename($v['name'] . '.v' . $v['version'], $timestamp));
@@ -505,7 +508,7 @@ class Trashbin implements IEventListener {
                        $view->chroot('/' . $user . '/files');
                        $view->touch('/' . $location . '/' . $uniqueFilename, $mtime);
                        $view->chroot($fakeRoot);
-                       \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => $targetPath, 'trashPath' => $sourcePath]);
+                       Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => $targetPath, 'trashPath' => $sourcePath]);
 
                        $sourceNode = self::getNodeForPath($sourcePath);
                        $targetNode = self::getNodeForPath($targetPath);
@@ -542,7 +545,7 @@ class Trashbin implements IEventListener {
         * @return false|null
         */
        private static function restoreVersions(View $view, $file, $filename, $uniqueFilename, $location, $timestamp) {
-               if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions')) {
+               if (Server::get(IAppManager::class)->isEnabledForUser('files_versions')) {
                        $user = OC_User::getUser();
                        $rootView = new View('/');
 
@@ -700,7 +703,7 @@ class Trashbin implements IEventListener {
         */
        private static function deleteVersions(View $view, $file, $filename, $timestamp, string $user): int|float {
                $size = 0;
-               if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions')) {
+               if (Server::get(IAppManager::class)->isEnabledForUser('files_versions')) {
                        if ($view->is_dir('files_trashbin/versions/' . $file)) {
                                $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file));
                                $view->unlink('files_trashbin/versions/' . $file);
@@ -778,7 +781,7 @@ class Trashbin implements IEventListener {
                                $quota = PHP_INT_MAX;
                        }
                } else {
-                       $quota = \OCP\Util::computerFileSize($quota);
+                       $quota = Util::computerFileSize($quota);
                        // invalid quota
                        if ($quota === false) {
                                $quota = PHP_INT_MAX;
@@ -802,7 +805,7 @@ class Trashbin implements IEventListener {
                        $availableSpace = $quota;
                }
 
-               return \OCP\Util::numericToNumber($availableSpace);
+               return Util::numericToNumber($availableSpace);
        }
 
        /**
@@ -902,7 +905,7 @@ class Trashbin implements IEventListener {
                                try {
                                        $size += self::delete($filename, $user, $timestamp);
                                        $count++;
-                               } catch (\OCP\Files\NotPermittedException $e) {
+                               } catch (NotPermittedException $e) {
                                        \OC::$server->get(LoggerInterface::class)->warning('Removing "' . $filename . '" from trashbin failed.',
                                                [
                                                        'exception' => $e,
@@ -944,7 +947,7 @@ class Trashbin implements IEventListener {
                                        $size += $view->filesize($pathDir);
                                        $result = $view->copy($pathDir, $destination . '/' . $i['name']);
                                        if (!$result) {
-                                               throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException();
+                                               throw new CopyRecursiveException();
                                        }
                                        $view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir));
                                }
@@ -953,7 +956,7 @@ class Trashbin implements IEventListener {
                        $size += $view->filesize($source);
                        $result = $view->copy($source, $destination);
                        if (!$result) {
-                               throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException();
+                               throw new CopyRecursiveException();
                        }
                        $view->touch($destination, $view->filemtime($source));
                }
@@ -1033,7 +1036,7 @@ class Trashbin implements IEventListener {
        private static function getUniqueFilename($location, $filename, View $view) {
                $ext = pathinfo($filename, PATHINFO_EXTENSION);
                $name = pathinfo($filename, PATHINFO_FILENAME);
-               $l = \OCP\Util::getL10N('files_trashbin');
+               $l = Util::getL10N('files_trashbin');
 
                $location = '/' . trim($location, '/');
 
index 87c8647450fb463f73fc971d1bdabc25c171fb01..b58efbb38a63a1dc3d91ae3b2a323ec2bb5475f8 100644 (file)
@@ -10,6 +10,7 @@ declare(strict_types=1);
 namespace OCA\Files_Trashbin\UserMigration;
 
 use OCA\Files_Trashbin\AppInfo\Application;
+use OCA\Files_Trashbin\Trashbin;
 use OCP\Files\Folder;
 use OCP\Files\IRootFolder;
 use OCP\Files\NotFoundException;
@@ -81,7 +82,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator {
                        $exportDestination->copyFolder($trashbinFolder, static::PATH_FILES_FOLDER);
                        $originalLocations = [];
                        // TODO Export all extra data and bump migrator to v2
-                       foreach (\OCA\Files_Trashbin\Trashbin::getExtraData($uid) as $filename => $extraData) {
+                       foreach (Trashbin::getExtraData($uid) as $filename => $extraData) {
                                $locationData = [];
                                foreach ($extraData as $timestamp => ['location' => $location]) {
                                        $locationData[$timestamp] = $location;
index b071fa8ecdd1f896a725784c1db023ce634c6db7..fef57f44f24e8576029db0ed37d8add13a08e5dc 100644 (file)
@@ -10,6 +10,7 @@ use OC\User\Manager;
 use OCA\Files_Trashbin\Command\CleanUp;
 use OCP\Files\IRootFolder;
 use OCP\IDBConnection;
+use OCP\UserInterface;
 use Symfony\Component\Console\Exception\InvalidOptionException;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\NullOutput;
@@ -175,7 +176,7 @@ class CleanUpTest extends TestCase {
                        ->setMethods(['removeDeletedFiles'])
                        ->setConstructorArgs([$this->rootFolder, $this->userManager, $this->dbConnection])
                        ->getMock();
-               $backend = $this->createMock(\OCP\UserInterface::class);
+               $backend = $this->createMock(UserInterface::class);
                $backend->method('getUsers')
                        ->with('', 500, 0)
                        ->willReturn($backendUsers);
index 8271109037ca16e64cf3283c19f5c15cc49f8676..0d56ecf0a7194512aa3ca786d3d0d1bedccf569b 100644 (file)
@@ -9,12 +9,14 @@ namespace OCA\Files_Trashbin\Tests;
 use OC\Files\Filesystem;
 use OC\Files\Storage\Common;
 use OC\Files\Storage\Temporary;
+use OC\Files\View;
 use OCA\Files_Trashbin\AppInfo\Application;
 use OCA\Files_Trashbin\Events\MoveToTrashEvent;
 use OCA\Files_Trashbin\Storage;
 use OCA\Files_Trashbin\Trash\ITrashManager;
 use OCP\AppFramework\Bootstrap\IBootContext;
 use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Constants;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\Cache\ICache;
 use OCP\Files\Folder;
@@ -83,10 +85,10 @@ class StorageTest extends \Test\TestCase {
                // this will setup the FS
                $this->loginAsUser($this->user);
 
-               \OCA\Files_Trashbin\Storage::setupStorage();
+               Storage::setupStorage();
 
-               $this->rootView = new \OC\Files\View('/');
-               $this->userView = new \OC\Files\View('/' . $this->user . '/files/');
+               $this->rootView = new View('/');
+               $this->userView = new View('/' . $this->user . '/files/');
                $this->userView->file_put_contents('test.txt', 'foo');
                $this->userView->file_put_contents(static::LONG_FILENAME, 'foo');
                $this->userView->file_put_contents(static::MAX_FILENAME, 'foo');
@@ -96,7 +98,7 @@ class StorageTest extends \Test\TestCase {
        }
 
        protected function tearDown(): void {
-               \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
+               Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
                $this->logout();
                $user = \OC::$server->getUserManager()->get($this->user);
                if ($user !== null) {
@@ -191,7 +193,7 @@ class StorageTest extends \Test\TestCase {
         */
        public function testCrossStorageDeleteFile(): void {
                $storage2 = new Temporary([]);
-               \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage');
+               Filesystem::mount($storage2, [], $this->user . '/files/substorage');
 
                $this->userView->file_put_contents('substorage/subfile.txt', 'foo');
                $storage2->getScanner()->scan('');
@@ -217,7 +219,7 @@ class StorageTest extends \Test\TestCase {
         */
        public function testCrossStorageDeleteFolder(): void {
                $storage2 = new Temporary([]);
-               \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage');
+               Filesystem::mount($storage2, [], $this->user . '/files/substorage');
 
                $this->userView->mkdir('substorage/folder');
                $this->userView->file_put_contents('substorage/folder/subfile.txt', 'bar');
@@ -322,14 +324,14 @@ class StorageTest extends \Test\TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedBy($this->user)
                        ->setSharedWith($recipientUser)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = \OC::$server->getShareManager()->createShare($share);
                \OC::$server->getShareManager()->acceptShare($share, $recipientUser);
 
                $this->loginAsUser($recipientUser);
 
                // delete as recipient
-               $recipientView = new \OC\Files\View('/' . $recipientUser . '/files');
+               $recipientView = new View('/' . $recipientUser . '/files');
                $recipientView->unlink('share/test.txt');
 
                // rescan trash storage for both users
@@ -374,14 +376,14 @@ class StorageTest extends \Test\TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedBy($this->user)
                        ->setSharedWith($recipientUser)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = \OC::$server->getShareManager()->createShare($share);
                \OC::$server->getShareManager()->acceptShare($share, $recipientUser);
 
                $this->loginAsUser($recipientUser);
 
                // delete as recipient
-               $recipientView = new \OC\Files\View('/' . $recipientUser . '/files');
+               $recipientView = new View('/' . $recipientUser . '/files');
                $recipientView->rmdir('share/folder');
 
                // rescan trash storage
@@ -424,7 +426,7 @@ class StorageTest extends \Test\TestCase {
         */
        public function testKeepFileAndVersionsWhenMovingFileBetweenStorages(): void {
                $storage2 = new Temporary([]);
-               \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage');
+               Filesystem::mount($storage2, [], $this->user . '/files/substorage');
 
                // trigger a version (multiple would not work because of the expire logic)
                $this->userView->file_put_contents('test.txt', 'v1');
@@ -463,7 +465,7 @@ class StorageTest extends \Test\TestCase {
         */
        public function testKeepFileAndVersionsWhenMovingFolderBetweenStorages(): void {
                $storage2 = new Temporary([]);
-               \OC\Files\Filesystem::mount($storage2, [], $this->user . '/files/substorage');
+               Filesystem::mount($storage2, [], $this->user . '/files/substorage');
 
                // trigger a version (multiple would not work because of the expire logic)
                $this->userView->file_put_contents('folder/inside.txt', 'v1');
index 11501891c779ab0f23c9bd4bff01903726e3a378..72aa9b280e8488a2aed89999e59c1506fd791e95 100644 (file)
@@ -4,10 +4,21 @@
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  * SPDX-License-Identifier: AGPL-3.0-only
  */
+use OC\AllConfig;
 use OC\AppFramework\Bootstrap\BootContext;
 use OC\AppFramework\DependencyInjection\DIContainer;
+use OC\Files\Cache\Watcher;
+use OC\Files\Filesystem;
+use OC\Files\Storage\Local;
+use OC\Files\View;
 use OCA\Files_Sharing\AppInfo\Application;
 use OCA\Files_Trashbin\AppInfo\Application as TrashbinApplication;
+use OCA\Files_Trashbin\Expiration;
+use OCA\Files_Trashbin\Helper;
+use OCA\Files_Trashbin\Trashbin;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Constants;
+use OCP\IConfig;
 use OCP\Share\IShare;
 
 /**
@@ -56,9 +67,9 @@ class TrashbinTest extends \Test\TestCase {
 
                $config = \OC::$server->getConfig();
                //configure trashbin
-               self::$rememberRetentionObligation = $config->getSystemValue('trashbin_retention_obligation', \OCA\Files_Trashbin\Expiration::DEFAULT_RETENTION_OBLIGATION);
-               /** @var \OCA\Files_Trashbin\Expiration $expiration */
-               $expiration = \OC::$server->query(\OCA\Files_Trashbin\Expiration::class);
+               self::$rememberRetentionObligation = $config->getSystemValue('trashbin_retention_obligation', Expiration::DEFAULT_RETENTION_OBLIGATION);
+               /** @var Expiration $expiration */
+               $expiration = \OC::$server->query(Expiration::class);
                $expiration->setRetentionObligation('auto, 2');
 
                // register trashbin hooks
@@ -78,13 +89,13 @@ class TrashbinTest extends \Test\TestCase {
                        $user->delete();
                }
 
-               /** @var \OCA\Files_Trashbin\Expiration $expiration */
-               $expiration = \OC::$server->query(\OCA\Files_Trashbin\Expiration::class);
+               /** @var Expiration $expiration */
+               $expiration = \OC::$server->query(Expiration::class);
                $expiration->setRetentionObligation(self::$rememberRetentionObligation);
 
                \OC_Hook::clear();
 
-               \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
+               Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
 
                if (self::$trashBinStatus) {
                        \OC::$server->getAppManager()->enableApp('files_trashbin');
@@ -98,12 +109,12 @@ class TrashbinTest extends \Test\TestCase {
 
                \OC::$server->getAppManager()->enableApp('files_trashbin');
                $config = \OC::$server->getConfig();
-               $mockConfig = $this->createMock(\OCP\IConfig::class);
+               $mockConfig = $this->createMock(IConfig::class);
                $mockConfig
                        ->method('getSystemValue')
                        ->willReturnCallback(static function ($key, $default) use ($config) {
                                if ($key === 'filesystem_check_changes') {
-                                       return \OC\Files\Cache\Watcher::CHECK_ONCE;
+                                       return Watcher::CHECK_ONCE;
                                } else {
                                        return $config->getSystemValue($key, $default);
                                }
@@ -118,16 +129,16 @@ class TrashbinTest extends \Test\TestCase {
                        ->willReturnCallback(static function ($appName, $key, $default = '') use ($config) {
                                return $config->getAppValue($appName, $key, $default);
                        });
-               $this->overwriteService(\OC\AllConfig::class, $mockConfig);
+               $this->overwriteService(AllConfig::class, $mockConfig);
 
                $this->trashRoot1 = '/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin';
                $this->trashRoot2 = '/' . self::TEST_TRASHBIN_USER2 . '/files_trashbin';
-               $this->rootView = new \OC\Files\View();
+               $this->rootView = new View();
                self::loginHelper(self::TEST_TRASHBIN_USER1);
        }
 
        protected function tearDown(): void {
-               $this->restoreService(\OC\AllConfig::class);
+               $this->restoreService(AllConfig::class);
                // disable trashbin to be able to properly clean up
                \OC::$server->getAppManager()->disableApp('files_trashbin');
 
@@ -149,23 +160,23 @@ class TrashbinTest extends \Test\TestCase {
        public function testExpireOldFiles(): void {
 
                /** @var \OCP\AppFramework\Utility\ITimeFactory $time */
-               $time = \OC::$server->query(\OCP\AppFramework\Utility\ITimeFactory::class);
+               $time = \OC::$server->query(ITimeFactory::class);
                $currentTime = $time->getTime();
                $expireAt = $currentTime - 2 * 24 * 60 * 60;
                $expiredDate = $currentTime - 3 * 24 * 60 * 60;
 
                // create some files
-               \OC\Files\Filesystem::file_put_contents('file1.txt', 'file1');
-               \OC\Files\Filesystem::file_put_contents('file2.txt', 'file2');
-               \OC\Files\Filesystem::file_put_contents('file3.txt', 'file3');
+               Filesystem::file_put_contents('file1.txt', 'file1');
+               Filesystem::file_put_contents('file2.txt', 'file2');
+               Filesystem::file_put_contents('file3.txt', 'file3');
 
                // delete them so that they end up in the trash bin
-               \OC\Files\Filesystem::unlink('file1.txt');
-               \OC\Files\Filesystem::unlink('file2.txt');
-               \OC\Files\Filesystem::unlink('file3.txt');
+               Filesystem::unlink('file1.txt');
+               Filesystem::unlink('file2.txt');
+               Filesystem::unlink('file3.txt');
 
                //make sure that files are in the trash bin
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'name');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'name');
                $this->assertSame(3, count($filesInTrash));
 
                // every second file will get a date in the past so that it will get expired
@@ -185,7 +196,7 @@ class TrashbinTest extends \Test\TestCase {
                #$this->assertSame('file2.txt', $remainingFile['name']);
 
                // check that file1.txt and file3.txt was really deleted
-               $newTrashContent = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1);
+               $newTrashContent = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1);
                $this->assertSame(1, count($newTrashContent));
                $element = reset($newTrashContent);
                // TODO: failing test
@@ -204,11 +215,11 @@ class TrashbinTest extends \Test\TestCase {
                $expiredDate = $currentTime - 3 * 24 * 60 * 60;
 
                // create some files
-               \OC\Files\Filesystem::mkdir($folder);
-               \OC\Files\Filesystem::file_put_contents($folder . 'user1-1.txt', 'file1');
-               \OC\Files\Filesystem::file_put_contents($folder . 'user1-2.txt', 'file2');
-               \OC\Files\Filesystem::file_put_contents($folder . 'user1-3.txt', 'file3');
-               \OC\Files\Filesystem::file_put_contents($folder . 'user1-4.txt', 'file4');
+               Filesystem::mkdir($folder);
+               Filesystem::file_put_contents($folder . 'user1-1.txt', 'file1');
+               Filesystem::file_put_contents($folder . 'user1-2.txt', 'file2');
+               Filesystem::file_put_contents($folder . 'user1-3.txt', 'file3');
+               Filesystem::file_put_contents($folder . 'user1-4.txt', 'file4');
 
                //share user1-4.txt with user2
                $node = \OC::$server->getUserFolder(self::TEST_TRASHBIN_USER1)->get($folder);
@@ -217,16 +228,16 @@ class TrashbinTest extends \Test\TestCase {
                        ->setNode($node)
                        ->setSharedBy(self::TEST_TRASHBIN_USER1)
                        ->setSharedWith(self::TEST_TRASHBIN_USER2)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = \OC::$server->getShareManager()->createShare($share);
                \OC::$server->getShareManager()->acceptShare($share, self::TEST_TRASHBIN_USER2);
 
                // delete them so that they end up in the trash bin
-               \OC\Files\Filesystem::unlink($folder . 'user1-1.txt');
-               \OC\Files\Filesystem::unlink($folder . 'user1-2.txt');
-               \OC\Files\Filesystem::unlink($folder . 'user1-3.txt');
+               Filesystem::unlink($folder . 'user1-1.txt');
+               Filesystem::unlink($folder . 'user1-2.txt');
+               Filesystem::unlink($folder . 'user1-3.txt');
 
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'name');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'name');
                $this->assertSame(3, count($filesInTrash));
 
                // every second file will get a date in the past so that it will get expired
@@ -235,27 +246,27 @@ class TrashbinTest extends \Test\TestCase {
                // login as user2
                self::loginHelper(self::TEST_TRASHBIN_USER2);
 
-               $this->assertTrue(\OC\Files\Filesystem::file_exists($folder . 'user1-4.txt'));
+               $this->assertTrue(Filesystem::file_exists($folder . 'user1-4.txt'));
 
                // create some files
-               \OC\Files\Filesystem::file_put_contents('user2-1.txt', 'file1');
-               \OC\Files\Filesystem::file_put_contents('user2-2.txt', 'file2');
+               Filesystem::file_put_contents('user2-1.txt', 'file1');
+               Filesystem::file_put_contents('user2-2.txt', 'file2');
 
                // delete them so that they end up in the trash bin
-               \OC\Files\Filesystem::unlink('user2-1.txt');
-               \OC\Files\Filesystem::unlink('user2-2.txt');
+               Filesystem::unlink('user2-1.txt');
+               Filesystem::unlink('user2-2.txt');
 
-               $filesInTrashUser2 = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER2, 'name');
+               $filesInTrashUser2 = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER2, 'name');
                $this->assertSame(2, count($filesInTrashUser2));
 
                // every second file will get a date in the past so that it will get expired
                $this->manipulateDeleteTime($filesInTrashUser2, $this->trashRoot2, $expiredDate);
 
-               \OC\Files\Filesystem::unlink($folder . 'user1-4.txt');
+               Filesystem::unlink($folder . 'user1-4.txt');
 
                $this->runCommands();
 
-               $filesInTrashUser2AfterDelete = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER2);
+               $filesInTrashUser2AfterDelete = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER2);
 
                // user2-1.txt should have been expired
                $this->verifyArray($filesInTrashUser2AfterDelete, ['user2-2.txt', 'user1-4.txt']);
@@ -263,7 +274,7 @@ class TrashbinTest extends \Test\TestCase {
                self::loginHelper(self::TEST_TRASHBIN_USER1);
 
                // user1-1.txt and user1-3.txt should have been expired
-               $filesInTrashUser1AfterDelete = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1);
+               $filesInTrashUser1AfterDelete = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1);
 
                $this->verifyArray($filesInTrashUser1AfterDelete, ['user1-2.txt', 'user1-4.txt']);
        }
@@ -303,7 +314,7 @@ class TrashbinTest extends \Test\TestCase {
                        $counter = ($counter + 1) % 2;
                        if ($counter === 1) {
                                $source = $trashRoot . '/files/' . $file['name'] . '.d' . $file['mtime'];
-                               $target = \OC\Files\Filesystem::normalizePath($trashRoot . '/files/' . $file['name'] . '.d' . $expireDate);
+                               $target = Filesystem::normalizePath($trashRoot . '/files/' . $file['name'] . '.d' . $expireDate);
                                $this->rootView->rename($source, $target);
                                $file['mtime'] = $expireDate;
                        }
@@ -319,19 +330,19 @@ class TrashbinTest extends \Test\TestCase {
        public function testExpireOldFilesUtilLimitsAreMet(): void {
 
                // create some files
-               \OC\Files\Filesystem::file_put_contents('file1.txt', 'file1');
-               \OC\Files\Filesystem::file_put_contents('file2.txt', 'file2');
-               \OC\Files\Filesystem::file_put_contents('file3.txt', 'file3');
+               Filesystem::file_put_contents('file1.txt', 'file1');
+               Filesystem::file_put_contents('file2.txt', 'file2');
+               Filesystem::file_put_contents('file3.txt', 'file3');
 
                // delete them so that they end up in the trash bin
-               \OC\Files\Filesystem::unlink('file3.txt');
+               Filesystem::unlink('file3.txt');
                sleep(1); // make sure that every file has a unique mtime
-               \OC\Files\Filesystem::unlink('file2.txt');
+               Filesystem::unlink('file2.txt');
                sleep(1); // make sure that every file has a unique mtime
-               \OC\Files\Filesystem::unlink('file1.txt');
+               Filesystem::unlink('file1.txt');
 
                //make sure that files are in the trash bin
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
                $this->assertSame(3, count($filesInTrash));
 
                $testClass = new TrashbinForTesting();
@@ -340,7 +351,7 @@ class TrashbinTest extends \Test\TestCase {
                // the two oldest files (file3.txt and file2.txt) should be deleted
                $this->assertSame(10, $sizeOfDeletedFiles);
 
-               $newTrashContent = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1);
+               $newTrashContent = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1);
                $this->assertSame(1, count($newTrashContent));
                $element = reset($newTrashContent);
                $this->assertSame('file1.txt', $element['name']);
@@ -360,14 +371,14 @@ class TrashbinTest extends \Test\TestCase {
 
                $this->assertFalse($userFolder->nodeExists('file1.txt'));
 
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
                $this->assertCount(1, $filesInTrash);
 
                /** @var \OCP\Files\FileInfo */
                $trashedFile = $filesInTrash[0];
 
                $this->assertTrue(
-                       OCA\Files_Trashbin\Trashbin::restore(
+                       Trashbin::restore(
                                'file1.txt.d' . $trashedFile->getMtime(),
                                $trashedFile->getName(),
                                $trashedFile->getMtime()
@@ -393,14 +404,14 @@ class TrashbinTest extends \Test\TestCase {
 
                $this->assertFalse($userFolder->nodeExists('folder/file1.txt'));
 
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
                $this->assertCount(1, $filesInTrash);
 
                /** @var \OCP\Files\FileInfo */
                $trashedFile = $filesInTrash[0];
 
                $this->assertTrue(
-                       OCA\Files_Trashbin\Trashbin::restore(
+                       Trashbin::restore(
                                'file1.txt.d' . $trashedFile->getMtime(),
                                $trashedFile->getName(),
                                $trashedFile->getMtime()
@@ -426,14 +437,14 @@ class TrashbinTest extends \Test\TestCase {
 
                $this->assertFalse($userFolder->nodeExists('folder'));
 
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
                $this->assertCount(1, $filesInTrash);
 
                /** @var \OCP\Files\FileInfo */
                $trashedFolder = $filesInTrash[0];
 
                $this->assertTrue(
-                       OCA\Files_Trashbin\Trashbin::restore(
+                       Trashbin::restore(
                                'folder.d' . $trashedFolder->getMtime(),
                                $trashedFolder->getName(),
                                $trashedFolder->getMtime()
@@ -459,14 +470,14 @@ class TrashbinTest extends \Test\TestCase {
 
                $this->assertFalse($userFolder->nodeExists('folder'));
 
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
                $this->assertCount(1, $filesInTrash);
 
                /** @var \OCP\Files\FileInfo */
                $trashedFile = $filesInTrash[0];
 
                $this->assertTrue(
-                       OCA\Files_Trashbin\Trashbin::restore(
+                       Trashbin::restore(
                                'folder.d' . $trashedFile->getMtime() . '/file1.txt',
                                'file1.txt',
                                $trashedFile->getMtime()
@@ -493,7 +504,7 @@ class TrashbinTest extends \Test\TestCase {
 
                $this->assertFalse($userFolder->nodeExists('folder/file1.txt'));
 
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
                $this->assertCount(1, $filesInTrash);
 
                /** @var \OCP\Files\FileInfo */
@@ -503,7 +514,7 @@ class TrashbinTest extends \Test\TestCase {
                $folder->delete();
 
                $this->assertTrue(
-                       OCA\Files_Trashbin\Trashbin::restore(
+                       Trashbin::restore(
                                'file1.txt.d' . $trashedFile->getMtime(),
                                $trashedFile->getName(),
                                $trashedFile->getMtime()
@@ -529,7 +540,7 @@ class TrashbinTest extends \Test\TestCase {
 
                $this->assertFalse($userFolder->nodeExists('file1.txt'));
 
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
                $this->assertCount(1, $filesInTrash);
 
                /** @var \OCP\Files\FileInfo */
@@ -540,7 +551,7 @@ class TrashbinTest extends \Test\TestCase {
                $file->putContent('bar');
 
                $this->assertTrue(
-                       OCA\Files_Trashbin\Trashbin::restore(
+                       Trashbin::restore(
                                'file1.txt.d' . $trashedFile->getMtime(),
                                $trashedFile->getName(),
                                $trashedFile->getMtime()
@@ -570,7 +581,7 @@ class TrashbinTest extends \Test\TestCase {
 
                $this->assertFalse($userFolder->nodeExists('folder/file1.txt'));
 
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
                $this->assertCount(1, $filesInTrash);
 
                /** @var \OCP\Files\FileInfo */
@@ -581,7 +592,7 @@ class TrashbinTest extends \Test\TestCase {
                $file->putContent('bar');
 
                $this->assertTrue(
-                       OCA\Files_Trashbin\Trashbin::restore(
+                       Trashbin::restore(
                                'file1.txt.d' . $trashedFile->getMtime(),
                                $trashedFile->getName(),
                                $trashedFile->getMtime()
@@ -600,7 +611,7 @@ class TrashbinTest extends \Test\TestCase {
         */
        public function testRestoreUnexistingFile(): void {
                $this->assertFalse(
-                       OCA\Files_Trashbin\Trashbin::restore(
+                       Trashbin::restore(
                                'unexist.txt.d123456',
                                'unexist.txt',
                                '123456'
@@ -624,7 +635,7 @@ class TrashbinTest extends \Test\TestCase {
 
                $this->assertFalse($userFolder->nodeExists('folder/file1.txt'));
 
-               $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
+               $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
                $this->assertCount(1, $filesInTrash);
 
                /** @var \OCP\Files\FileInfo */
@@ -632,13 +643,13 @@ class TrashbinTest extends \Test\TestCase {
 
                // delete source folder
                [$storage, $internalPath] = $this->rootView->resolvePath('/' . self::TEST_TRASHBIN_USER1 . '/files/folder');
-               if ($storage instanceof \OC\Files\Storage\Local) {
+               if ($storage instanceof Local) {
                        $folderAbsPath = $storage->getSourcePath($internalPath);
                        // make folder read-only
                        chmod($folderAbsPath, 0555);
 
                        $this->assertTrue(
-                               OCA\Files_Trashbin\Trashbin::restore(
+                               Trashbin::restore(
                                        'file1.txt.d' . $trashedFile->getMtime(),
                                        $trashedFile->getName(),
                                        $trashedFile->getMtime()
@@ -666,7 +677,7 @@ class TrashbinTest extends \Test\TestCase {
 
                \OC_Util::tearDownFS();
                \OC_User::setUserId('');
-               \OC\Files\Filesystem::tearDown();
+               Filesystem::tearDown();
                \OC_User::setUserId($user);
                \OC_Util::setupFS($user);
                \OC::$server->getUserFolder($user);
@@ -675,7 +686,7 @@ class TrashbinTest extends \Test\TestCase {
 
 
 // just a dummy class to make protected methods available for testing
-class TrashbinForTesting extends \OCA\Files_Trashbin\Trashbin {
+class TrashbinForTesting extends Trashbin {
 
        /**
         * @param OCP\Files\FileInfo[] $files
index 098e101fbc2f6d27446bba1fd22de36c3456d279..0df87d7d83b47c7b2c3caacb488a5438e6035dea 100644 (file)
@@ -6,6 +6,7 @@
  */
 namespace OCA\Files_Versions\BackgroundJob;
 
+use OC\Files\View;
 use OCA\Files_Versions\Expiration;
 use OCA\Files_Versions\Storage;
 use OCP\AppFramework\Utility\ITimeFactory;
@@ -59,7 +60,7 @@ class ExpireVersions extends TimedJob {
                \OC_Util::setupFS($user);
 
                // Check if this user has a versions directory
-               $view = new \OC\Files\View('/' . $user);
+               $view = new View('/' . $user);
                if (!$view->is_dir('/files_versions')) {
                        return false;
                }
index d37a6a40b7033743a3343b94ef927d4942d3ed2a..fd0118549c6ce9ede62f749e7a20efb0aa636b35 100644 (file)
@@ -6,6 +6,7 @@
  */
 namespace OCA\Files_Versions\Command;
 
+use OC\Files\View;
 use OCA\Files_Versions\Expiration;
 use OCA\Files_Versions\Storage;
 use OCP\IUser;
@@ -84,7 +85,7 @@ class ExpireVersions extends Command {
                \OC_Util::setupFS($user);
 
                // Check if this user has a version directory
-               $view = new \OC\Files\View('/' . $user);
+               $view = new View('/' . $user);
                if (!$view->is_dir('/files_versions')) {
                        return false;
                }
index af14f8e4b9f2ab2f050aa541127f44e380f261b0..e5849bf936db2b80f366d7d028cf187b1231f045 100644 (file)
@@ -12,6 +12,7 @@ use OC\Files\Search\SearchBinaryOperator;
 use OC\Files\Search\SearchComparison;
 use OC\Files\Search\SearchQuery;
 use OC\Files\View;
+use OC\User\NoUserException;
 use OC_User;
 use OCA\Files_Sharing\SharedMount;
 use OCA\Files_Versions\AppInfo\Application;
@@ -37,6 +38,8 @@ use OCP\IURLGenerator;
 use OCP\IUser;
 use OCP\IUserManager;
 use OCP\Lock\ILockingProvider;
+use OCP\Server;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 class Storage {
@@ -68,7 +71,7 @@ class Storage {
                6 => ['intervalEndsAfter' => -1,      'step' => 604800],
        ];
 
-       /** @var \OCA\Files_Versions\AppInfo\Application */
+       /** @var Application */
        private static $application;
 
        /**
@@ -598,7 +601,7 @@ class Storage {
                                $version->delete();
                                \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $internalPath, 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]);
                        } catch (NotPermittedException $e) {
-                               \OCP\Server::get(LoggerInterface::class)->error("Missing permissions to delete version: {$internalPath}", ['app' => 'files_versions', 'exception' => $e]);
+                               Server::get(LoggerInterface::class)->error("Missing permissions to delete version: {$internalPath}", ['app' => 'files_versions', 'exception' => $e]);
                        }
                }
        }
@@ -814,7 +817,7 @@ class Storage {
                        $user = \OC::$server->get(IUserManager::class)->get($uid);
                        if (is_null($user)) {
                                $logger->error('Backends provided no user object for ' . $uid, ['app' => 'files_versions']);
-                               throw new \OC\User\NoUserException('Backends provided no user object for ' . $uid);
+                               throw new NoUserException('Backends provided no user object for ' . $uid);
                        }
 
                        \OC_Util::setupFS($uid);
@@ -841,7 +844,7 @@ class Storage {
                                $quota = Filesystem::free_space('/');
                                $softQuota = false;
                        } else {
-                               $quota = \OCP\Util::computerFileSize($quota);
+                               $quota = Util::computerFileSize($quota);
                        }
 
                        // make sure that we have the current size of the version history
index bc46da857525ae54b5f14e0b443996fd58a723a7..92b326b6cd383f368e7e9eadfe8b0ff875b9f086 100644 (file)
@@ -15,6 +15,7 @@ use OCA\DAV\Connector\Sabre\Exception\Forbidden;
 use OCA\Files_Versions\Db\VersionEntity;
 use OCA\Files_Versions\Db\VersionsMapper;
 use OCA\Files_Versions\Storage;
+use OCP\Constants;
 use OCP\Files\File;
 use OCP\Files\FileInfo;
 use OCP\Files\Folder;
@@ -162,7 +163,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend
        }
 
        public function rollback(IVersion $version) {
-               if (!$this->currentUserHasPermissions($version->getSourceFile(), \OCP\Constants::PERMISSION_UPDATE)) {
+               if (!$this->currentUserHasPermissions($version->getSourceFile(), Constants::PERMISSION_UPDATE)) {
                        throw new Forbidden('You cannot restore this version because you do not have update permissions on the source file.');
                }
 
@@ -212,7 +213,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend
        }
 
        public function deleteVersion(IVersion $version): void {
-               if (!$this->currentUserHasPermissions($version->getSourceFile(), \OCP\Constants::PERMISSION_DELETE)) {
+               if (!$this->currentUserHasPermissions($version->getSourceFile(), Constants::PERMISSION_DELETE)) {
                        throw new Forbidden('You cannot delete this version because you do not have delete permissions on the source file.');
                }
 
@@ -303,7 +304,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend
        }
 
        public function setMetadataValue(Node $node, int $revision, string $key, string $value): void {
-               if (!$this->currentUserHasPermissions($node, \OCP\Constants::PERMISSION_UPDATE)) {
+               if (!$this->currentUserHasPermissions($node, Constants::PERMISSION_UPDATE)) {
                        throw new Forbidden('You cannot update the version\'s metadata because you do not have update permissions on the source file.');
                }
 
index 8103c69487913312f6814e5d3bfddb3e2ba85832..62d9576e9c50552927563f682d1a6708d5c609e8 100644 (file)
@@ -12,6 +12,7 @@ use OCP\Files\Cache\ICache;
 use OCP\Files\Folder;
 use OCP\Files\IRootFolder;
 use OCP\Files\Storage\IStorage;
+use OCP\UserInterface;
 use Test\TestCase;
 
 /**
@@ -142,7 +143,7 @@ class CleanupTest extends TestCase {
                        ->setConstructorArgs([$this->rootFolder, $this->userManager, $this->versionMapper])
                        ->getMock();
 
-               $backend = $this->getMockBuilder(\OCP\UserInterface::class)
+               $backend = $this->getMockBuilder(UserInterface::class)
                        ->disableOriginalConstructor()->getMock();
                $backend->expects($this->once())->method('getUsers')
                        ->with('', 500, 0)
index 5b3a29571da17af4851ca8215ed269183ad0468f..e20fbc623dc72ced584f1bfea4ab21aa6dcc82cf 100644 (file)
@@ -6,14 +6,24 @@
  */
 namespace OCA\Files_Versions\Tests;
 
+use OC\AllConfig;
+use OC\Files\Cache\Watcher;
+use OC\Files\Filesystem;
 use OC\Files\Storage\Temporary;
+use OC\Files\View;
+use OC\User\NoUserException;
+use OCA\Files_Sharing\AppInfo\Application;
 use OCA\Files_Versions\Db\VersionEntity;
 use OCA\Files_Versions\Db\VersionsMapper;
+use OCA\Files_Versions\Storage;
 use OCA\Files_Versions\Versions\IVersionManager;
+use OCP\Constants;
 use OCP\Files\IMimeTypeLoader;
 use OCP\IConfig;
 use OCP\IUser;
+use OCP\Server;
 use OCP\Share\IShare;
+use OCP\Util;
 
 /**
  * Class Test_Files_versions
@@ -44,7 +54,7 @@ class VersioningTest extends \Test\TestCase {
        public static function setUpBeforeClass(): void {
                parent::setUpBeforeClass();
 
-               $application = new \OCA\Files_Sharing\AppInfo\Application();
+               $application = new Application();
 
                // create test user
                self::loginHelper(self::TEST_VERSIONS_USER2, true);
@@ -74,12 +84,12 @@ class VersioningTest extends \Test\TestCase {
                        ->method('getSystemValue')
                        ->willReturnCallback(function ($key, $default) use ($config) {
                                if ($key === 'filesystem_check_changes') {
-                                       return \OC\Files\Cache\Watcher::CHECK_ONCE;
+                                       return Watcher::CHECK_ONCE;
                                } else {
                                        return $config->getSystemValue($key, $default);
                                }
                        });
-               $this->overwriteService(\OC\AllConfig::class, $mockConfig);
+               $this->overwriteService(AllConfig::class, $mockConfig);
 
                // clear hooks
                \OC_Hook::clear();
@@ -87,13 +97,13 @@ class VersioningTest extends \Test\TestCase {
                \OC::$server->boot();
 
                self::loginHelper(self::TEST_VERSIONS_USER);
-               $this->rootView = new \OC\Files\View();
+               $this->rootView = new View();
                if (!$this->rootView->file_exists(self::USERS_VERSIONS_ROOT)) {
                        $this->rootView->mkdir(self::USERS_VERSIONS_ROOT);
                }
 
-               $this->versionsMapper = \OCP\Server::get(VersionsMapper::class);
-               $this->mimeTypeLoader = \OCP\Server::get(IMimeTypeLoader::class);
+               $this->versionsMapper = Server::get(VersionsMapper::class);
+               $this->mimeTypeLoader = Server::get(IMimeTypeLoader::class);
 
                $this->user1 = $this->createMock(IUser::class);
                $this->user1->method('getUID')
@@ -104,7 +114,7 @@ class VersioningTest extends \Test\TestCase {
        }
 
        protected function tearDown(): void {
-               $this->restoreService(\OC\AllConfig::class);
+               $this->restoreService(AllConfig::class);
 
                if ($this->rootView) {
                        $this->rootView->deleteAll(self::TEST_VERSIONS_USER . '/files/');
@@ -270,7 +280,7 @@ class VersioningTest extends \Test\TestCase {
        }
 
        public function testRename(): void {
-               \OC\Files\Filesystem::file_put_contents('test.txt', 'test file');
+               Filesystem::file_put_contents('test.txt', 'test file');
 
                $t1 = time();
                // second version is two weeks older, this way we make sure that no
@@ -287,7 +297,7 @@ class VersioningTest extends \Test\TestCase {
                $this->rootView->file_put_contents($v2, 'version2');
 
                // execute rename hook of versions app
-               \OC\Files\Filesystem::rename('test.txt', 'test2.txt');
+               Filesystem::rename('test.txt', 'test2.txt');
 
                $this->runCommands();
 
@@ -299,9 +309,9 @@ class VersioningTest extends \Test\TestCase {
        }
 
        public function testRenameInSharedFolder(): void {
-               \OC\Files\Filesystem::mkdir('folder1');
-               \OC\Files\Filesystem::mkdir('folder1/folder2');
-               \OC\Files\Filesystem::file_put_contents('folder1/test.txt', 'test file');
+               Filesystem::mkdir('folder1');
+               Filesystem::mkdir('folder1/folder2');
+               Filesystem::file_put_contents('folder1/test.txt', 'test file');
 
                $t1 = time();
                // second version is two weeks older, this way we make sure that no
@@ -324,16 +334,16 @@ class VersioningTest extends \Test\TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedBy(self::TEST_VERSIONS_USER)
                        ->setSharedWith(self::TEST_VERSIONS_USER2)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = \OC::$server->getShareManager()->createShare($share);
                \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
 
                self::loginHelper(self::TEST_VERSIONS_USER2);
 
-               $this->assertTrue(\OC\Files\Filesystem::file_exists('folder1/test.txt'));
+               $this->assertTrue(Filesystem::file_exists('folder1/test.txt'));
 
                // execute rename hook of versions app
-               \OC\Files\Filesystem::rename('/folder1/test.txt', '/folder1/folder2/test.txt');
+               Filesystem::rename('/folder1/test.txt', '/folder1/folder2/test.txt');
 
                $this->runCommands();
 
@@ -349,9 +359,9 @@ class VersioningTest extends \Test\TestCase {
        }
 
        public function testMoveFolder(): void {
-               \OC\Files\Filesystem::mkdir('folder1');
-               \OC\Files\Filesystem::mkdir('folder2');
-               \OC\Files\Filesystem::file_put_contents('folder1/test.txt', 'test file');
+               Filesystem::mkdir('folder1');
+               Filesystem::mkdir('folder2');
+               Filesystem::file_put_contents('folder1/test.txt', 'test file');
 
                $t1 = time();
                // second version is two weeks older, this way we make sure that no
@@ -369,7 +379,7 @@ class VersioningTest extends \Test\TestCase {
                $this->rootView->file_put_contents($v2, 'version2');
 
                // execute rename hook of versions app
-               \OC\Files\Filesystem::rename('folder1', 'folder2/folder1');
+               Filesystem::rename('folder1', 'folder2/folder1');
 
                $this->runCommands();
 
@@ -382,8 +392,8 @@ class VersioningTest extends \Test\TestCase {
 
 
        public function testMoveFileIntoSharedFolderAsRecipient(): void {
-               \OC\Files\Filesystem::mkdir('folder1');
-               $fileInfo = \OC\Files\Filesystem::getFileInfo('folder1');
+               Filesystem::mkdir('folder1');
+               $fileInfo = Filesystem::getFileInfo('folder1');
 
                $node = \OC::$server->getUserFolder(self::TEST_VERSIONS_USER)->get('folder1');
                $share = \OC::$server->getShareManager()->newShare();
@@ -391,13 +401,13 @@ class VersioningTest extends \Test\TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedBy(self::TEST_VERSIONS_USER)
                        ->setSharedWith(self::TEST_VERSIONS_USER2)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = \OC::$server->getShareManager()->createShare($share);
                \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
 
                self::loginHelper(self::TEST_VERSIONS_USER2);
                $versionsFolder2 = '/' . self::TEST_VERSIONS_USER2 . '/files_versions';
-               \OC\Files\Filesystem::file_put_contents('test.txt', 'test file');
+               Filesystem::file_put_contents('test.txt', 'test file');
 
                $t1 = time();
                // second version is two weeks older, this way we make sure that no
@@ -413,7 +423,7 @@ class VersioningTest extends \Test\TestCase {
                $this->rootView->file_put_contents($v2, 'version2');
 
                // move file into the shared folder as recipient
-               \OC\Files\Filesystem::rename('/test.txt', '/folder1/test.txt');
+               Filesystem::rename('/test.txt', '/folder1/test.txt');
 
                $this->assertFalse($this->rootView->file_exists($v1));
                $this->assertFalse($this->rootView->file_exists($v2));
@@ -432,7 +442,7 @@ class VersioningTest extends \Test\TestCase {
        }
 
        public function testMoveFolderIntoSharedFolderAsRecipient(): void {
-               \OC\Files\Filesystem::mkdir('folder1');
+               Filesystem::mkdir('folder1');
 
                $node = \OC::$server->getUserFolder(self::TEST_VERSIONS_USER)->get('folder1');
                $share = \OC::$server->getShareManager()->newShare();
@@ -440,14 +450,14 @@ class VersioningTest extends \Test\TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedBy(self::TEST_VERSIONS_USER)
                        ->setSharedWith(self::TEST_VERSIONS_USER2)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = \OC::$server->getShareManager()->createShare($share);
                \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
 
                self::loginHelper(self::TEST_VERSIONS_USER2);
                $versionsFolder2 = '/' . self::TEST_VERSIONS_USER2 . '/files_versions';
-               \OC\Files\Filesystem::mkdir('folder2');
-               \OC\Files\Filesystem::file_put_contents('folder2/test.txt', 'test file');
+               Filesystem::mkdir('folder2');
+               Filesystem::file_put_contents('folder2/test.txt', 'test file');
 
                $t1 = time();
                // second version is two weeks older, this way we make sure that no
@@ -464,7 +474,7 @@ class VersioningTest extends \Test\TestCase {
                $this->rootView->file_put_contents($v2, 'version2');
 
                // move file into the shared folder as recipient
-               \OC\Files\Filesystem::rename('/folder2', '/folder1/folder2');
+               Filesystem::rename('/folder2', '/folder1/folder2');
 
                $this->assertFalse($this->rootView->file_exists($v1));
                $this->assertFalse($this->rootView->file_exists($v2));
@@ -483,7 +493,7 @@ class VersioningTest extends \Test\TestCase {
        }
 
        public function testRenameSharedFile(): void {
-               \OC\Files\Filesystem::file_put_contents('test.txt', 'test file');
+               Filesystem::file_put_contents('test.txt', 'test file');
 
                $t1 = time();
                // second version is two weeks older, this way we make sure that no
@@ -507,16 +517,16 @@ class VersioningTest extends \Test\TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedBy(self::TEST_VERSIONS_USER)
                        ->setSharedWith(self::TEST_VERSIONS_USER2)
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE);
+                       ->setPermissions(Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE);
                $share = \OC::$server->getShareManager()->createShare($share);
                \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
 
                self::loginHelper(self::TEST_VERSIONS_USER2);
 
-               $this->assertTrue(\OC\Files\Filesystem::file_exists('test.txt'));
+               $this->assertTrue(Filesystem::file_exists('test.txt'));
 
                // execute rename hook of versions app
-               \OC\Files\Filesystem::rename('test.txt', 'test2.txt');
+               Filesystem::rename('test.txt', 'test2.txt');
 
                self::loginHelper(self::TEST_VERSIONS_USER);
 
@@ -532,7 +542,7 @@ class VersioningTest extends \Test\TestCase {
        }
 
        public function testCopy(): void {
-               \OC\Files\Filesystem::file_put_contents('test.txt', 'test file');
+               Filesystem::file_put_contents('test.txt', 'test file');
 
                $t1 = time();
                // second version is two weeks older, this way we make sure that no
@@ -549,7 +559,7 @@ class VersioningTest extends \Test\TestCase {
                $this->rootView->file_put_contents($v2, 'version2');
 
                // execute copy hook of versions app
-               \OC\Files\Filesystem::copy('test.txt', 'test2.txt');
+               Filesystem::copy('test.txt', 'test2.txt');
 
                $this->runCommands();
 
@@ -580,7 +590,7 @@ class VersioningTest extends \Test\TestCase {
                $this->rootView->file_put_contents($v2, 'version2');
 
                // execute copy hook of versions app
-               $versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, '/subfolder/test.txt');
+               $versions = Storage::getVersions(self::TEST_VERSIONS_USER, '/subfolder/test.txt');
 
                $this->assertCount(2, $versions);
 
@@ -599,10 +609,10 @@ class VersioningTest extends \Test\TestCase {
         */
        public function testGetVersionsEmptyFile(): void {
                // execute copy hook of versions app
-               $versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, '');
+               $versions = Storage::getVersions(self::TEST_VERSIONS_USER, '');
                $this->assertCount(0, $versions);
 
-               $versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, null);
+               $versions = Storage::getVersions(self::TEST_VERSIONS_USER, null);
                $this->assertCount(0, $versions);
        }
 
@@ -611,29 +621,29 @@ class VersioningTest extends \Test\TestCase {
                // needed to have a FS setup (the background job does this)
                \OC_Util::setupFS(self::TEST_VERSIONS_USER);
 
-               $this->assertFalse(\OCA\Files_Versions\Storage::expire('/void/unexist.txt', self::TEST_VERSIONS_USER));
+               $this->assertFalse(Storage::expire('/void/unexist.txt', self::TEST_VERSIONS_USER));
        }
 
 
        public function testExpireNonexistingUser(): void {
-               $this->expectException(\OC\User\NoUserException::class);
+               $this->expectException(NoUserException::class);
 
                $this->logout();
                // needed to have a FS setup (the background job does this)
                \OC_Util::setupFS(self::TEST_VERSIONS_USER);
-               \OC\Files\Filesystem::file_put_contents('test.txt', 'test file');
+               Filesystem::file_put_contents('test.txt', 'test file');
 
-               $this->assertFalse(\OCA\Files_Versions\Storage::expire('test.txt', 'unexist'));
+               $this->assertFalse(Storage::expire('test.txt', 'unexist'));
        }
 
        public function testRestoreSameStorage(): void {
-               \OC\Files\Filesystem::mkdir('sub');
+               Filesystem::mkdir('sub');
                $this->doTestRestore();
        }
 
        public function testRestoreCrossStorage(): void {
                $storage2 = new Temporary([]);
-               \OC\Files\Filesystem::mount($storage2, [], self::TEST_VERSIONS_USER . '/files/sub');
+               Filesystem::mount($storage2, [], self::TEST_VERSIONS_USER . '/files/sub');
 
                $this->doTestRestore();
        }
@@ -650,12 +660,12 @@ class VersioningTest extends \Test\TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedBy(self::TEST_VERSIONS_USER)
                        ->setSharedWith(self::TEST_VERSIONS_USER2)
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ);
+                       ->setPermissions(Constants::PERMISSION_READ);
                $share = \OC::$server->getShareManager()->createShare($share);
                \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
 
                $versions = $this->createAndCheckVersions(
-                       \OC\Files\Filesystem::getView(),
+                       Filesystem::getView(),
                        'folder/test.txt'
                );
 
@@ -665,7 +675,7 @@ class VersioningTest extends \Test\TestCase {
 
                $firstVersion = current($versions);
 
-               $this->assertFalse(\OCA\Files_Versions\Storage::rollback('folder/test.txt', $firstVersion['version'], $this->user2), 'Revert did not happen');
+               $this->assertFalse(Storage::rollback('folder/test.txt', $firstVersion['version'], $this->user2), 'Revert did not happen');
 
                $this->loginAsUser(self::TEST_VERSIONS_USER);
 
@@ -689,7 +699,7 @@ class VersioningTest extends \Test\TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedBy(self::TEST_VERSIONS_USER)
                        ->setSharedWith(self::TEST_VERSIONS_USER2)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = \OC::$server->getShareManager()->createShare($share);
                $shareManager = \OC::$server->getShareManager();
                $shareManager->acceptShare($share, self::TEST_VERSIONS_USER2);
@@ -698,7 +708,7 @@ class VersioningTest extends \Test\TestCase {
                $shareManager->moveShare($share, self::TEST_VERSIONS_USER2);
 
                $versions = $this->createAndCheckVersions(
-                       \OC\Files\Filesystem::getView(),
+                       Filesystem::getView(),
                        'folder/test.txt'
                );
 
@@ -708,7 +718,7 @@ class VersioningTest extends \Test\TestCase {
 
                $firstVersion = current($versions);
 
-               $this->assertTrue(\OCA\Files_Versions\Storage::rollback('folder/test.txt', $firstVersion['version'], $this->user1));
+               $this->assertTrue(Storage::rollback('folder/test.txt', $firstVersion['version'], $this->user1));
 
                $this->loginAsUser(self::TEST_VERSIONS_USER);
 
@@ -737,7 +747,7 @@ class VersioningTest extends \Test\TestCase {
                                }
                        );
 
-               \OCP\Util::connectHook(
+               Util::connectHook(
                        '\OCP\Versions',
                        $hookName,
                        $eventHandler,
@@ -783,7 +793,7 @@ class VersioningTest extends \Test\TestCase {
                $versionEntity->setMetadata([]);
                $this->versionsMapper->insert($versionEntity);
 
-               $oldVersions = \OCA\Files_Versions\Storage::getVersions(
+               $oldVersions = Storage::getVersions(
                        self::TEST_VERSIONS_USER, '/sub/test.txt'
                );
 
@@ -795,7 +805,7 @@ class VersioningTest extends \Test\TestCase {
                $params = [];
                $this->connectMockHooks('rollback', $params);
 
-               $versionManager = \OCP\Server::get(IVersionManager::class);
+               $versionManager = Server::get(IVersionManager::class);
                $versions = $versionManager->getVersionsForFile($this->user1, $info1);
                $version = array_filter($versions, function ($version) use ($t2) {
                        return $version->getRevisionId() === $t2;
@@ -828,7 +838,7 @@ class VersioningTest extends \Test\TestCase {
                        'Restored file has mtime from version'
                );
 
-               $newVersions = \OCA\Files_Versions\Storage::getVersions(
+               $newVersions = Storage::getVersions(
                        self::TEST_VERSIONS_USER, '/sub/test.txt'
                );
 
@@ -868,7 +878,7 @@ class VersioningTest extends \Test\TestCase {
                $this->loginAsUser(self::TEST_VERSIONS_USER);
 
                $this->createAndCheckVersions(
-                       \OC\Files\Filesystem::getView(),
+                       Filesystem::getView(),
                        'test.txt'
                );
        }
@@ -879,8 +889,8 @@ class VersioningTest extends \Test\TestCase {
        public function testStoreVersionAsRecipient(): void {
                $this->loginAsUser(self::TEST_VERSIONS_USER);
 
-               \OC\Files\Filesystem::mkdir('folder');
-               \OC\Files\Filesystem::file_put_contents('folder/test.txt', 'test file');
+               Filesystem::mkdir('folder');
+               Filesystem::file_put_contents('folder/test.txt', 'test file');
 
                $node = \OC::$server->getUserFolder(self::TEST_VERSIONS_USER)->get('folder');
                $share = \OC::$server->getShareManager()->newShare();
@@ -888,14 +898,14 @@ class VersioningTest extends \Test\TestCase {
                        ->setShareType(IShare::TYPE_USER)
                        ->setSharedBy(self::TEST_VERSIONS_USER)
                        ->setSharedWith(self::TEST_VERSIONS_USER2)
-                       ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+                       ->setPermissions(Constants::PERMISSION_ALL);
                $share = \OC::$server->getShareManager()->createShare($share);
                \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
 
                $this->loginAsUser(self::TEST_VERSIONS_USER2);
 
                $this->createAndCheckVersions(
-                       \OC\Files\Filesystem::getView(),
+                       Filesystem::getView(),
                        'folder/test.txt'
                );
 
@@ -916,7 +926,7 @@ class VersioningTest extends \Test\TestCase {
                // needed to make the hooks fire
                \OC_Util::setupFS(self::TEST_VERSIONS_USER);
 
-               $userView = new \OC\Files\View('/' . self::TEST_VERSIONS_USER . '/files');
+               $userView = new View('/' . self::TEST_VERSIONS_USER . '/files');
                $this->createAndCheckVersions(
                        $userView,
                        'test.txt'
@@ -927,7 +937,7 @@ class VersioningTest extends \Test\TestCase {
         * @param \OC\Files\View $view
         * @param string $path
         */
-       private function createAndCheckVersions(\OC\Files\View $view, $path) {
+       private function createAndCheckVersions(View $view, $path) {
                $view->file_put_contents($path, 'test file');
                $view->file_put_contents($path, 'version 1');
                $view->file_put_contents($path, 'version 2');
@@ -938,7 +948,7 @@ class VersioningTest extends \Test\TestCase {
                [$rootStorage,] = $this->rootView->resolvePath(self::TEST_VERSIONS_USER . '/files_versions');
                $rootStorage->getScanner()->scan('files_versions');
 
-               $versions = \OCA\Files_Versions\Storage::getVersions(
+               $versions = Storage::getVersions(
                        self::TEST_VERSIONS_USER, '/' . $path
                );
 
@@ -962,7 +972,7 @@ class VersioningTest extends \Test\TestCase {
 
                \OC_Util::tearDownFS();
                \OC_User::setUserId('');
-               \OC\Files\Filesystem::tearDown();
+               Filesystem::tearDown();
                \OC_User::setUserId($user);
                \OC_Util::setupFS($user);
                \OC::$server->getUserFolder($user);
@@ -970,7 +980,7 @@ class VersioningTest extends \Test\TestCase {
 }
 
 // extend the original class to make it possible to test protected methods
-class VersionStorageToTest extends \OCA\Files_Versions\Storage {
+class VersionStorageToTest extends Storage {
 
        /**
         * @param integer $time
index 5bb069248f3d6128d2583fa8f9c9ced54ed09784..d1d595ef00317069aa878cc3ab4814641ed4a8a2 100644 (file)
@@ -7,6 +7,7 @@ namespace OCA\OAuth2\Tests\Db;
 
 use OCA\OAuth2\Db\AccessToken;
 use OCA\OAuth2\Db\AccessTokenMapper;
+use OCA\OAuth2\Exceptions\AccessTokenNotFoundException;
 use OCP\AppFramework\Utility\ITimeFactory;
 use Test\TestCase;
 
@@ -39,7 +40,7 @@ class AccessTokenMapperTest extends TestCase {
 
 
        public function testDeleteByClientId(): void {
-               $this->expectException(\OCA\OAuth2\Exceptions\AccessTokenNotFoundException::class);
+               $this->expectException(AccessTokenNotFoundException::class);
 
                $this->accessTokenMapper->deleteByClientId(1234);
                $token = new AccessToken();
index 8c00c2e0a21a662c8f13a51249e81d12604e2168..7c11470d09668c04dff21a7d28e6f4946c62075b 100644 (file)
@@ -7,6 +7,7 @@ namespace OCA\OAuth2\Tests\Db;
 
 use OCA\OAuth2\Db\Client;
 use OCA\OAuth2\Db\ClientMapper;
+use OCA\OAuth2\Exceptions\ClientNotFoundException;
 use Test\TestCase;
 
 /**
@@ -40,7 +41,7 @@ class ClientMapperTest extends TestCase {
        }
 
        public function testGetByIdentifierNotExisting(): void {
-               $this->expectException(\OCA\OAuth2\Exceptions\ClientNotFoundException::class);
+               $this->expectException(ClientNotFoundException::class);
 
                $this->clientMapper->getByIdentifier('MyTotallyNotExistingClient');
        }
@@ -57,7 +58,7 @@ class ClientMapperTest extends TestCase {
        }
 
        public function testGetByUidNotExisting(): void {
-               $this->expectException(\OCA\OAuth2\Exceptions\ClientNotFoundException::class);
+               $this->expectException(ClientNotFoundException::class);
 
                $this->clientMapper->getByUid(1234);
        }
index 273e63c742dab336e5a5f87444459e246d66bd25..b02d3bb814e95409546c767b747d4eea2d518895 100644 (file)
@@ -47,6 +47,7 @@ use OCP\L10N\IFactory;
 use OCP\Security\Events\GenerateSecurePasswordEvent;
 use OCP\Security\ISecureRandom;
 use OCP\User\Backend\ISetDisplayNameBackend;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -1032,7 +1033,7 @@ class UsersController extends AUserData {
                                        if (is_numeric($quota)) {
                                                $quota = (float)$quota;
                                        } else {
-                                               $quota = \OCP\Util::computerFileSize($quota);
+                                               $quota = Util::computerFileSize($quota);
                                        }
                                        if ($quota === false) {
                                                throw new OCSException($this->l10n->t('Invalid quota value: %1$s', [$value]), 101);
@@ -1044,7 +1045,7 @@ class UsersController extends AUserData {
                                                if ($maxQuota !== -1 && $quota > $maxQuota) {
                                                        throw new OCSException($this->l10n->t('Invalid quota value. %1$s is exceeding the maximum quota', [$value]), 101);
                                                }
-                                               $quota = \OCP\Util::humanFileSize($quota);
+                                               $quota = Util::humanFileSize($quota);
                                        }
                                }
                                // no else block because quota can be set to 'none' in previous if
index f878b6b73d0b86e005464dc2192ea20622998fe8..41739b6283fe6484df121a0df903ae18e2588309 100644 (file)
@@ -17,6 +17,7 @@ use OCP\IL10N;
 use OCP\IRequest;
 use OCP\IUser;
 use OCP\IUserSession;
+use OCP\Server;
 use OCP\Settings\IManager;
 use PHPUnit\Framework\MockObject\MockObject;
 use Test\TestCase;
@@ -45,7 +46,7 @@ class AppConfigControllerTest extends TestCase {
                $this->l10n = $this->createMock(IL10N::class);
                $this->settingManager = $this->createMock(IManager::class);
                $this->groupManager = $this->createMock(IGroupManager::class);
-               $this->appManager = \OCP\Server::get(IAppManager::class);
+               $this->appManager = Server::get(IAppManager::class);
        }
 
        /**
index 9c815a5217818cc9e8ec836b064c17c42d939bad..51980ce7ed20113ca221855c4336124160df8dda 100644 (file)
@@ -8,7 +8,9 @@
 namespace OCA\Provisioning_API\Tests\Controller;
 
 use OCA\Provisioning_API\Controller\AppsController;
+use OCA\Provisioning_API\Tests\TestCase;
 use OCP\App\IAppManager;
+use OCP\AppFramework\OCS\OCSException;
 use OCP\IRequest;
 use OCP\IUserSession;
 
@@ -19,7 +21,7 @@ use OCP\IUserSession;
  *
  * @package OCA\Provisioning_API\Tests
  */
-class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
+class AppsControllerTest extends TestCase {
        /** @var IAppManager */
        private $appManager;
        /** @var AppsController */
@@ -57,7 +59,7 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
 
 
        public function testGetAppInfoOnBadAppID(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(998);
 
                $this->api->getAppInfo('not_provisioning_api');
@@ -94,7 +96,7 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
 
        
        public function testGetAppsInvalidFilter(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(101);
 
                $this->api->getApps('foo');
index 5ddf5d7eff88823278b521ea5cd5a12bd611dd66..dc5e96b3ef01c6a2bc6d86afe88b094a216db1fd 100644 (file)
@@ -11,6 +11,7 @@ use OC\Group\Manager;
 use OC\User\NoUserException;
 use OCA\Provisioning_API\Controller\GroupsController;
 use OCP\Accounts\IAccountManager;
+use OCP\AppFramework\OCS\OCSException;
 use OCP\Group\ISubAdmin;
 use OCP\IConfig;
 use OCP\IRequest;
@@ -255,7 +256,7 @@ class GroupsControllerTest extends \Test\TestCase {
 
 
        public function testGetGroupAsIrrelevantSubadmin(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(403);
 
                $group = $this->createGroup('group');
@@ -300,7 +301,7 @@ class GroupsControllerTest extends \Test\TestCase {
 
 
        public function testGetGroupNonExisting(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('The requested group could not be found');
                $this->expectExceptionCode(404);
 
@@ -311,7 +312,7 @@ class GroupsControllerTest extends \Test\TestCase {
 
 
        public function testGetSubAdminsOfGroupsNotExists(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Group does not exist');
                $this->expectExceptionCode(101);
 
@@ -358,7 +359,7 @@ class GroupsControllerTest extends \Test\TestCase {
 
 
        public function testAddGroupEmptyGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Invalid group name');
                $this->expectExceptionCode(101);
 
@@ -367,7 +368,7 @@ class GroupsControllerTest extends \Test\TestCase {
 
 
        public function testAddGroupExistingGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(102);
 
                $this->groupManager
@@ -412,7 +413,7 @@ class GroupsControllerTest extends \Test\TestCase {
 
 
        public function testDeleteGroupNonExisting(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(101);
 
                $this->api->deleteGroup('NonExistingGroup');
@@ -420,7 +421,7 @@ class GroupsControllerTest extends \Test\TestCase {
 
 
        public function testDeleteAdminGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(102);
 
                $this->groupManager
index 2ccb1196fbbb8e2972b91e76adf5ea50945a0230..2d339205fae6ff1037f8a5dc7b932a8cf0b2db6a 100644 (file)
@@ -221,7 +221,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddUserAlreadyExisting(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(102);
 
                $this->userManager
@@ -255,7 +255,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddUserNonExistingGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Group NonExistingGroup does not exist');
                $this->expectExceptionCode(104);
 
@@ -291,7 +291,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddUserExistingGroupNonExistingGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Group NonExistingGroup does not exist');
                $this->expectExceptionCode(104);
 
@@ -533,7 +533,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddUserFailedToGenerateUserID(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Could not create non-existing user ID');
                $this->expectExceptionCode(111);
 
@@ -576,7 +576,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddUserEmailRequired(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Required email address was not provided');
                $this->expectExceptionCode(110);
 
@@ -683,7 +683,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddUserUnsuccessful(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Bad request');
                $this->expectExceptionCode(101);
 
@@ -730,7 +730,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddUserAsSubAdminNoGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('No group specified (required for sub-admins)');
                $this->expectExceptionCode(106);
 
@@ -763,7 +763,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddUserAsSubAdminValidGroupNotSubAdmin(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Insufficient privileges for group ExistingGroup');
                $this->expectExceptionCode(105);
 
@@ -906,7 +906,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testGetUserTargetDoesNotExist(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('User does not exist');
                $this->expectExceptionCode(404);
 
@@ -1218,7 +1218,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testGetUserDataAsSubAdminAndUserIsNotAccessible(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(998);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)
@@ -1681,7 +1681,7 @@ class UsersControllerTest extends TestCase {
        }
 
        public function testEditUserRegularUserSelfEditChangeEmailInvalid(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(101);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)
@@ -1915,7 +1915,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testEditUserRegularUserSelfEditChangeQuota(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(113);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)
@@ -2001,7 +2001,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testEditUserAdminUserSelfEditChangeInvalidQuota(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Invalid quota value: ABC');
                $this->expectExceptionCode(101);
 
@@ -2152,7 +2152,7 @@ class UsersControllerTest extends TestCase {
         * @dataProvider dataEditUserSelfEditChangeLanguageButForced
         */
        public function testEditUserSelfEditChangeLanguageButForced($forced): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
 
                $this->config->expects($this->any())
                        ->method('getSystemValue')
@@ -2248,7 +2248,7 @@ class UsersControllerTest extends TestCase {
         * @dataProvider dataEditUserSelfEditChangeLanguageButForced
         */
        public function testEditUserAdminEditChangeLanguageInvalidLanguage(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
 
 
                $this->l10nFactory->expects($this->once())
@@ -2352,7 +2352,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testEditUserSubadminUserInaccessible(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(998);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -2392,7 +2392,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testDeleteUserNotExistingUser(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(998);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -2415,7 +2415,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testDeleteUserSelf(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(101);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -2476,7 +2476,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testDeleteUnsuccessfulUserAsAdmin(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(101);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -2557,7 +2557,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testDeleteUnsuccessfulUserAsSubadmin(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(101);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -2605,7 +2605,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testDeleteUserAsSubAdminAndUserIsNotAccessible(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(998);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -2649,7 +2649,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testGetUsersGroupsTargetUserNotExisting(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(998);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -2786,7 +2786,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testGetUsersGroupsForSubAdminUserAndUserIsInaccessible(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(998);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -2835,7 +2835,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddToGroupWithTargetGroupNotExisting(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(102);
 
                $this->groupManager->expects($this->once())
@@ -2848,7 +2848,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddToGroupWithNoGroupSpecified(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(101);
 
                $this->api->addToGroup('TargetUser');
@@ -2856,7 +2856,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddToGroupWithTargetUserNotExisting(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(103);
 
                $targetGroup = $this->createMock(IGroup::class);
@@ -2870,7 +2870,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddToGroupNoSubadmin(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(104);
 
                $targetUser = $this->createMock(IUser::class);
@@ -3004,7 +3004,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveFromGroupWithNoTargetGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(101);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -3018,7 +3018,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveFromGroupWithEmptyTargetGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(101);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -3032,7 +3032,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveFromGroupWithNotExistingTargetGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(102);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -3051,7 +3051,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveFromGroupWithNotExistingTargetUser(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(103);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -3076,7 +3076,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveFromGroupWithoutPermission(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(104);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
@@ -3117,7 +3117,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveFromGroupAsAdminFromAdmin(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Cannot remove yourself from the admin group');
                $this->expectExceptionCode(105);
 
@@ -3167,7 +3167,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveFromGroupAsSubAdminFromSubAdmin(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Cannot remove yourself from this group as you are a sub-admin');
                $this->expectExceptionCode(105);
 
@@ -3222,7 +3222,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveFromGroupAsSubAdminFromLastSubAdminGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Not viable to remove user from the last group you are sub-admin of');
                $this->expectExceptionCode(105);
 
@@ -3325,7 +3325,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddSubAdminWithNotExistingTargetUser(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('User does not exist');
                $this->expectExceptionCode(101);
 
@@ -3340,7 +3340,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddSubAdminWithNotExistingTargetGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Group does not exist');
                $this->expectExceptionCode(102);
 
@@ -3362,7 +3362,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testAddSubAdminToAdminGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Cannot create sub-admins for admin group');
                $this->expectExceptionCode(103);
 
@@ -3448,7 +3448,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveSubAdminNotExistingTargetUser(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('User does not exist');
                $this->expectExceptionCode(101);
 
@@ -3463,7 +3463,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveSubAdminNotExistingTargetGroup(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Group does not exist');
                $this->expectExceptionCode(101);
 
@@ -3485,7 +3485,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testRemoveSubAdminFromNotASubadmin(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('User is not a sub-admin of this group');
                $this->expectExceptionCode(102);
 
@@ -3550,7 +3550,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testGetUserSubAdminGroupsNotExistingTargetUser(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('User does not exist');
                $this->expectExceptionCode(404);
 
@@ -3723,7 +3723,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testGetCurrentUserNotLoggedIn(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
 
 
                $this->userSession->expects($this->once())->method('getUser')
@@ -3800,7 +3800,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testResendWelcomeMessageWithNotExistingTargetUser(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(998);
 
                $this->userManager
@@ -3814,7 +3814,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testResendWelcomeMessageAsSubAdminAndUserIsNotAccessible(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionCode(998);
 
                $loggedInUser = $this->getMockBuilder(IUser::class)
@@ -3859,7 +3859,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testResendWelcomeMessageNoEmail(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Email address not available');
                $this->expectExceptionCode(101);
 
@@ -3904,7 +3904,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testResendWelcomeMessageNullEmail(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Email address not available');
                $this->expectExceptionCode(101);
 
@@ -4051,7 +4051,7 @@ class UsersControllerTest extends TestCase {
 
 
        public function testResendWelcomeMessageFailed(): void {
-               $this->expectException(\OCP\AppFramework\OCS\OCSException::class);
+               $this->expectException(OCSException::class);
                $this->expectExceptionMessage('Sending email failed');
                $this->expectExceptionCode(102);
 
index a971a893393c23992bc257aa4ec51da7c77b6e9b..7f8e2db44182d146dad77589d5d34fbcd4b3e764 100644 (file)
@@ -37,11 +37,13 @@ use OCP\Files\SimpleFS\ISimpleFile;
 use OCP\Files\SimpleFS\ISimpleFolder;
 use OCP\Http\Client\IClientService;
 use OCP\IConfig;
+use OCP\IGroup;
 use OCP\IL10N;
 use OCP\INavigationManager;
 use OCP\IRequest;
 use OCP\IURLGenerator;
 use OCP\L10N\IFactory;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
@@ -93,8 +95,8 @@ class AppSettingsController extends Controller {
                $templateResponse = new TemplateResponse('settings', 'settings/empty', ['pageTitle' => $this->l10n->t('Settings')]);
                $templateResponse->setContentSecurityPolicy($policy);
 
-               \OCP\Util::addStyle('settings', 'settings');
-               \OCP\Util::addScript('settings', 'vue-settings-apps-users-management');
+               Util::addStyle('settings', 'settings');
+               Util::addScript('settings', 'vue-settings-apps-users-management');
 
                return $templateResponse;
        }
@@ -512,7 +514,7 @@ class AppSettingsController extends Controller {
                $groupsList = [];
                foreach ($groups as $group) {
                        $groupItem = $groupManager->get($group);
-                       if ($groupItem instanceof \OCP\IGroup) {
+                       if ($groupItem instanceof IGroup) {
                                $groupsList[] = $groupManager->get($group);
                        }
                }
index 32bbebb210c0e77ca5340c2b4480875150fe2b51..13a83e175499d483ebef954356259e509af19827 100644 (file)
@@ -11,6 +11,8 @@ namespace OCA\Settings\Controller;
 
 use OC\Group\Manager as GroupManager;
 use OC\User\Session;
+use OCA\Encryption\KeyManager;
+use OCA\Encryption\Recovery;
 use OCP\App\IAppManager;
 use OCP\AppFramework\Controller;
 use OCP\AppFramework\Http\Attribute\BruteForceProtection;
@@ -24,6 +26,7 @@ use OCP\IRequest;
 use OCP\IUser;
 use OCP\IUserManager;
 use OCP\IUserSession;
+use OCP\Server;
 
 class ChangePasswordController extends Controller {
        private ?string $userId;
@@ -146,8 +149,8 @@ class ChangePasswordController extends Controller {
 
                if ($this->appManager->isEnabledForUser('encryption')) {
                        //handle the recovery case
-                       $keyManager = \OCP\Server::get(\OCA\Encryption\KeyManager::class);
-                       $recovery = \OCP\Server::get(\OCA\Encryption\Recovery::class);
+                       $keyManager = Server::get(KeyManager::class);
+                       $recovery = Server::get(Recovery::class);
                        $recoveryAdminEnabled = $recovery->isRecoveryKeyEnabled();
 
                        $validRecoveryPassword = false;
index 2e3b0d80ebcfc913f6a97d38f22b8bc27565c161..d99319471fff9919f3431c4883f7c799ec389125 100644 (file)
@@ -14,6 +14,7 @@ use InvalidArgumentException;
 use OC\AppFramework\Http;
 use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
 use OC\ForbiddenException;
+use OC\Group\MetaData;
 use OC\KnownUser\KnownUserService;
 use OC\Security\IdentityProof\Manager;
 use OC\User\Manager as UserManager;
@@ -46,6 +47,7 @@ use OCP\IUser;
 use OCP\IUserSession;
 use OCP\L10N\IFactory;
 use OCP\Mail\IMailer;
+use OCP\Util;
 use function in_array;
 
 #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
@@ -101,17 +103,17 @@ class UsersController extends Controller {
                \OC::$server->getNavigationManager()->setActiveEntry('core_users');
 
                /* SORT OPTION: SORT_USERCOUNT or SORT_GROUPNAME */
-               $sortGroupsBy = \OC\Group\MetaData::SORT_USERCOUNT;
+               $sortGroupsBy = MetaData::SORT_USERCOUNT;
                $isLDAPUsed = false;
                if ($this->config->getSystemValueBool('sort_groups_by_name', false)) {
-                       $sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME;
+                       $sortGroupsBy = MetaData::SORT_GROUPNAME;
                } else {
                        if ($this->appManager->isEnabledForUser('user_ldap')) {
                                $isLDAPUsed =
                                        $this->groupManager->isBackendUsed('\OCA\User_LDAP\Group_Proxy');
                                if ($isLDAPUsed) {
                                        // LDAP user count can be slow, so we sort by group name here
-                                       $sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME;
+                                       $sortGroupsBy = MetaData::SORT_GROUPNAME;
                                }
                        }
                }
@@ -119,7 +121,7 @@ class UsersController extends Controller {
                $canChangePassword = $this->canAdminChangeUserPasswords();
 
                /* GROUPS */
-               $groupsInfo = new \OC\Group\MetaData(
+               $groupsInfo = new MetaData(
                        $uid,
                        $isAdmin,
                        $isDelegatedAdmin,
@@ -192,7 +194,7 @@ class UsersController extends Controller {
                $languages = $this->l10nFactory->getLanguages();
 
                /** Using LDAP or admins (system config) can enfore sorting by group name, in this case the frontend setting is overwritten */
-               $forceSortGroupByName = $sortGroupsBy === \OC\Group\MetaData::SORT_GROUPNAME;
+               $forceSortGroupByName = $sortGroupsBy === MetaData::SORT_GROUPNAME;
 
                /* FINAL DATA */
                $serverData = [];
@@ -202,8 +204,8 @@ class UsersController extends Controller {
                $serverData['isAdmin'] = $isAdmin;
                $serverData['isDelegatedAdmin'] = $isDelegatedAdmin;
                $serverData['sortGroups'] = $forceSortGroupByName
-                       ? \OC\Group\MetaData::SORT_GROUPNAME
-                       : (int)$this->config->getAppValue('core', 'group.sortBy', (string)\OC\Group\MetaData::SORT_USERCOUNT);
+                       ? MetaData::SORT_GROUPNAME
+                       : (int)$this->config->getAppValue('core', 'group.sortBy', (string)MetaData::SORT_USERCOUNT);
                $serverData['forceSortGroupByName'] = $forceSortGroupByName;
                $serverData['quotaPreset'] = $quotaPreset;
                $serverData['allowUnlimitedQuota'] = $allowUnlimitedQuota;
@@ -220,8 +222,8 @@ class UsersController extends Controller {
 
                $this->initialState->provideInitialState('usersSettings', $serverData);
 
-               \OCP\Util::addStyle('settings', 'settings');
-               \OCP\Util::addScript('settings', 'vue-settings-apps-users-management');
+               Util::addStyle('settings', 'settings');
+               Util::addScript('settings', 'vue-settings-apps-users-management');
 
                return new TemplateResponse('settings', 'settings/empty', ['pageTitle' => $this->l10n->t('Settings')]);
        }
index a94e3da18fe89ec4f04e2b21129f9a22fa5829b2..3614c637f41ae3501aad4f07e1e82487de783ffb 100644 (file)
@@ -9,6 +9,7 @@ use OCP\AppFramework\Http\TemplateResponse;
 use OCP\IBinaryFinder;
 use OCP\IConfig;
 use OCP\IL10N;
+use OCP\Server;
 use OCP\Settings\IDelegatedSettings;
 
 class Mail implements IDelegatedSettings {
@@ -33,7 +34,7 @@ class Mail implements IDelegatedSettings {
        public function getForm() {
                $parameters = [
                        // Mail
-                       'sendmail_is_available' => (bool)\OCP\Server::get(IBinaryFinder::class)->findBinaryPath('sendmail'),
+                       'sendmail_is_available' => (bool)Server::get(IBinaryFinder::class)->findBinaryPath('sendmail'),
                        'mail_domain' => $this->config->getSystemValue('mail_domain', ''),
                        'mail_from_address' => $this->config->getSystemValue('mail_from_address', ''),
                        'mail_smtpmode' => $this->config->getSystemValue('mail_smtpmode', ''),
index 34c91f3bce97b3bd49ec411ca1f391e3bd1b76a0..c9ad58250c9ac112638b6601b480c5c96852938d 100644 (file)
@@ -77,7 +77,7 @@ class Sharing implements IDelegatedSettings {
                $this->initialState->provideInitialState('sharingDocumentation', $this->urlGenerator->linkToDocs('admin-sharing'));
                $this->initialState->provideInitialState('sharingSettings', $parameters);
 
-               \OCP\Util::addScript($this->appName, 'vue-settings-admin-sharing');
+               Util::addScript($this->appName, 'vue-settings-admin-sharing');
                return new TemplateResponse($this->appName, 'settings/admin/sharing', [], '');
        }
 
index 03cdc91cb5f4601522d011bcf85a027aec8b035a..d42b0f67298279feaadba1d54e40cb085c661ef4 100644 (file)
@@ -8,6 +8,7 @@ declare(strict_types=1);
  */
 namespace OCA\Settings\SetupChecks;
 
+use OC\Memcache\Memcached;
 use OCP\IConfig;
 use OCP\IL10N;
 use OCP\IURLGenerator;
@@ -35,7 +36,7 @@ class MemcacheConfigured implements ISetupCheck {
                $memcacheLockingClass = $this->config->getSystemValue('memcache.locking', null);
                $memcacheLocalClass = $this->config->getSystemValue('memcache.local', null);
                $caches = array_filter([$memcacheDistributedClass,$memcacheLockingClass,$memcacheLocalClass]);
-               if (in_array(\OC\Memcache\Memcached::class, array_map(fn (string $class) => ltrim($class, '\\'), $caches))) {
+               if (in_array(Memcached::class, array_map(fn (string $class) => ltrim($class, '\\'), $caches))) {
                        // wrong PHP module is installed
                        if (extension_loaded('memcache') && !extension_loaded('memcached')) {
                                return SetupResult::warning(
index 81107cd81c59919f432bd4ffcc6b9e228088de64..4306c63560ea7dcfc4d49a4cabea394ad922c8b7 100644 (file)
@@ -18,6 +18,7 @@ use OCA\Settings\AppInfo\Application;
 use OCP\Accounts\IAccountManager;
 use OCP\IAvatarManager;
 use OCP\IL10N;
+use OCP\Image;
 use OCP\IUser;
 use OCP\UserMigration\IExportDestination;
 use OCP\UserMigration\IImportSource;
@@ -156,7 +157,7 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
 
                        $output->writeln('Importing avatar from ' . $importPath . '…');
                        $stream = $importSource->getFileAsStream($importPath);
-                       $image = new \OCP\Image();
+                       $image = new Image();
                        $image->loadFromFileHandle($stream);
 
                        try {
index c8ba8edb9683b15677ddedef42627d796af88b48..445e3971cf8ffd82ff8dd5d3280f84bcd5295f29 100644 (file)
@@ -16,6 +16,7 @@ use OCP\IRequest;
 use OCP\IUser;
 use OCP\IUserManager;
 use OCP\IUserSession;
+use OCP\Server;
 use OCP\Settings\IDeclarativeManager;
 use OCP\Settings\IManager;
 use PHPUnit\Framework\MockObject\MockObject;
@@ -66,17 +67,17 @@ class AdminSettingsControllerTest extends TestCase {
                        $this->initialState,
                );
 
-               $user = \OCP\Server::get(IUserManager::class)->createUser($this->adminUid, 'mylongrandompassword');
+               $user = Server::get(IUserManager::class)->createUser($this->adminUid, 'mylongrandompassword');
                \OC_User::setUserId($user->getUID());
-               \OCP\Server::get(IGroupManager::class)->createGroup('admin')->addUser($user);
+               Server::get(IGroupManager::class)->createGroup('admin')->addUser($user);
        }
 
        protected function tearDown(): void {
-               \OCP\Server::get(IUserManager::class)
+               Server::get(IUserManager::class)
                        ->get($this->adminUid)
                        ->delete();
                \OC_User::setUserId(null);
-               \OCP\Server::get(IUserSession::class)->setUser(null);
+               Server::get(IUserSession::class)->setUser(null);
 
                parent::tearDown();
        }
index 579ab2cdbb0c98f8bdb3db525ffadf59bc1c0ccf..87ad301dee71ac2111e145b0ef6f022394a747b3 100644 (file)
@@ -7,6 +7,7 @@ namespace OCA\Settings\Tests\Mailer;
 
 use OC\Mail\EMailTemplate;
 use OC\Mail\Message;
+use OCA\Settings\Mailer\NewUserMailHelper;
 use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\Defaults;
 use OCP\IConfig;
@@ -40,7 +41,7 @@ class NewUserMailHelperTest extends TestCase {
        private $config;
        /** @var ICrypto|\PHPUnit\Framework\MockObject\MockObject */
        private $crypto;
-       /** @var \OCA\Settings\Mailer\NewUserMailHelper */
+       /** @var NewUserMailHelper */
        private $newUserMailHelper;
 
        protected function setUp(): void {
@@ -89,7 +90,7 @@ class NewUserMailHelperTest extends TestCase {
                                return $this->l10n;
                        });
 
-               $this->newUserMailHelper = new \OCA\Settings\Mailer\NewUserMailHelper(
+               $this->newUserMailHelper = new NewUserMailHelper(
                        $this->defaults,
                        $this->urlGenerator,
                        $this->l10nFactory,
index c4672a06d4939f13beef1a4117dcb846f17e911e..dc725e2d377d94120038999465baa35ac6c06396 100644 (file)
@@ -45,7 +45,7 @@ class SubadminMiddlewareTest extends \Test\TestCase {
 
 
        public function testBeforeControllerAsUserWithExemption(): void {
-               $this->expectException(\OC\AppFramework\Middleware\Security\Exceptions\NotAdminException::class);
+               $this->expectException(NotAdminException::class);
 
                $this->reflector
                        ->expects($this->exactly(2))
index 8ea0ea9bb0ced8e9143774987f05837f16b7ee4b..f5c5b91aad7fea2e23cd35c72614452c6b72c5f8 100644 (file)
@@ -10,6 +10,7 @@ use OCP\AppFramework\Http\TemplateResponse;
 use OCP\IBinaryFinder;
 use OCP\IConfig;
 use OCP\IL10N;
+use OCP\Server;
 use Test\TestCase;
 
 class MailTest extends TestCase {
@@ -52,7 +53,7 @@ class MailTest extends TestCase {
                        'settings',
                        'settings/admin/additional-mail',
                        [
-                               'sendmail_is_available' => (bool)\OCP\Server::get(IBinaryFinder::class)->findBinaryPath('sendmail'),
+                               'sendmail_is_available' => (bool)Server::get(IBinaryFinder::class)->findBinaryPath('sendmail'),
                                'mail_domain' => 'mx.nextcloud.com',
                                'mail_from_address' => 'no-reply@nextcloud.com',
                                'mail_smtpmode' => 'smtp',
index 0ba1621c5febb800ef8877f470c5b47ceaa5970f..4bf529da6bb814dc61f16a8d5bc5d31387b75982 100644 (file)
@@ -12,6 +12,7 @@ use OCA\Settings\SetupChecks\SupportedDatabase;
 use OCP\IDBConnection;
 use OCP\IL10N;
 use OCP\IUrlGenerator;
+use OCP\Server;
 use OCP\SetupCheck\SetupResult;
 use Test\TestCase;
 
@@ -30,12 +31,12 @@ class SupportedDatabaseTest extends TestCase {
 
                $this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
                $this->urlGenerator = $this->getMockBuilder(IUrlGenerator::class)->getMock();
-               $this->connection = \OCP\Server::get(IDBConnection::class);
+               $this->connection = Server::get(IDBConnection::class);
 
                $this->check = new SupportedDatabase(
                        $this->l10n,
                        $this->urlGenerator,
-                       \OCP\Server::get(IDBConnection::class)
+                       Server::get(IDBConnection::class)
                );
        }
 
index 19a463528c13be1b44c6d787341e7ed9b162576c..3ec13dd3a08e3366ac97b9700637b90f110c93b3 100644 (file)
@@ -35,6 +35,7 @@ use OCP\Share\IAttributes;
 use OCP\Share\IManager as IShareManager;
 use OCP\Share\IShare;
 use OCP\Share\IShareProviderWithNotification;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -382,7 +383,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider
                                ]
                        );
                }
-               $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]);
+               $message->setFrom([Util::getDefaultEmailAddress($instanceName) => $senderName]);
 
                // The "Reply-To" is set to the sharer if an mail address is configured
                // also the default footer contains a "Do not reply" which needs to be adjusted.
@@ -478,7 +479,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider
                                ]
                        );
                }
-               $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]);
+               $message->setFrom([Util::getDefaultEmailAddress($instanceName) => $senderName]);
 
                // The "Reply-To" is set to the sharer if an mail address is configured
                // also the default footer contains a "Do not reply" which needs to be adjusted.
@@ -548,7 +549,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider
                                ]
                        );
                }
-               $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]);
+               $message->setFrom([Util::getDefaultEmailAddress($instanceName) => $senderName]);
                if ($this->settingsManager->replyToInitiator() && $initiatorEmailAddress !== null) {
                        $message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]);
                        $emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan());
@@ -617,7 +618,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider
                                $instanceName
                        ]
                );
-               $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]);
+               $message->setFrom([Util::getDefaultEmailAddress($instanceName) => $senderName]);
                $message->setTo([$initiatorEMailAddress => $initiatorDisplayName]);
                $message->useTemplate($emailTemplate);
                $this->mailer->send($message);
@@ -1203,7 +1204,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider
                        ->from('share')
                        ->where(
                                $qb->expr()->orX(
-                                       $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share\IShare::TYPE_EMAIL))
+                                       $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL))
                                )
                        );
 
index 78e026c830ce713afe3c07f20b01d866a07d629e..9f5434dbe5abdf16aad3750673eb210b5b9a3845 100644 (file)
@@ -7,9 +7,11 @@ namespace OCA\ShareByMail\Tests;
 
 use DateTime;
 use OC\Mail\Message;
+use OC\Share20\Share;
 use OCA\ShareByMail\Settings\SettingsManager;
 use OCA\ShareByMail\ShareByMailProvider;
 use OCP\Activity\IManager as IActivityManager;
+use OCP\Constants;
 use OCP\Defaults;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\File;
@@ -28,9 +30,12 @@ use OCP\Security\Events\GenerateSecurePasswordEvent;
 use OCP\Security\IHasher;
 use OCP\Security\ISecureRandom;
 use OCP\Security\PasswordContext;
+use OCP\Server;
+use OCP\Share\Exceptions\ShareNotFound;
 use OCP\Share\IAttributes;
 use OCP\Share\IManager;
 use OCP\Share\IShare;
+use OCP\Util;
 use PHPUnit\Framework\MockObject\MockObject;
 use Psr\Log\LoggerInterface;
 use Test\TestCase;
@@ -64,7 +69,7 @@ class ShareByMailProviderTest extends TestCase {
        protected function setUp(): void {
                parent::setUp();
 
-               $this->connection = \OCP\Server::get(IDBConnection::class);
+               $this->connection = Server::get(IDBConnection::class);
 
                $this->l = $this->getMockBuilder(IL10N::class)->getMock();
                $this->l->method('t')
@@ -885,7 +890,7 @@ class ShareByMailProviderTest extends TestCase {
 
 
        public function testGetShareByIdFailed(): void {
-               $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
+               $this->expectException(ShareNotFound::class);
 
                $instance = $this->getInstance(['createShareObject']);
 
@@ -968,7 +973,7 @@ class ShareByMailProviderTest extends TestCase {
 
 
        public function testGetShareByTokenFailed(): void {
-               $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
+               $this->expectException(ShareNotFound::class);
 
 
                $itemSource = 11;
@@ -1095,7 +1100,7 @@ class ShareByMailProviderTest extends TestCase {
 
 
        public function testGetRawShareFailed(): void {
-               $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
+               $this->expectException(ShareNotFound::class);
 
                $itemSource = 11;
                $itemType = 'file';
@@ -1145,7 +1150,7 @@ class ShareByMailProviderTest extends TestCase {
 
                $this->shareManager->expects($this->any())
                        ->method('newShare')
-                       ->willReturn(new \OC\Share20\Share($rootFolder, $userManager));
+                       ->willReturn(new Share($rootFolder, $userManager));
 
                $provider = $this->getInstance(['sendMailNotification', 'createShareActivity']);
                $this->mailer->expects($this->any())->method('validateMailAddress')->willReturn(true);
@@ -1161,7 +1166,7 @@ class ShareByMailProviderTest extends TestCase {
                $share1->setSharedWith('user@server.com')
                        ->setSharedBy($u1->getUID())
                        ->setShareOwner($u1->getUID())
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file1);
                $provider->create($share1);
 
@@ -1169,7 +1174,7 @@ class ShareByMailProviderTest extends TestCase {
                $share2->setSharedWith('user@server.com')
                        ->setSharedBy($u2->getUID())
                        ->setShareOwner($u1->getUID())
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($file2);
                $provider->create($share2);
 
@@ -1192,7 +1197,7 @@ class ShareByMailProviderTest extends TestCase {
 
                $this->shareManager->expects($this->any())
                        ->method('newShare')
-                       ->willReturn(new \OC\Share20\Share($rootFolder, $userManager));
+                       ->willReturn(new Share($rootFolder, $userManager));
 
                $provider = $this->getInstance(['sendMailNotification', 'createShareActivity']);
                $this->mailer->expects($this->any())->method('validateMailAddress')->willReturn(true);
@@ -1213,7 +1218,7 @@ class ShareByMailProviderTest extends TestCase {
                $share1->setSharedWith('user@server.com')
                        ->setSharedBy($u1->getUID())
                        ->setShareOwner($u1->getUID())
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder);
                $share1 = $provider->create($share1);
 
@@ -1221,7 +1226,7 @@ class ShareByMailProviderTest extends TestCase {
                $share2->setSharedWith('user2@server.com')
                        ->setSharedBy($u2->getUID())
                        ->setShareOwner($u1->getUID())
-                       ->setPermissions(\OCP\Constants::PERMISSION_READ)
+                       ->setPermissions(Constants::PERMISSION_READ)
                        ->setNode($folder);
                $share2 = $provider->create($share2);
 
@@ -1310,7 +1315,7 @@ class ShareByMailProviderTest extends TestCase {
                        ->expects($this->once())
                        ->method('setFrom')
                        ->with([
-                               \OCP\Util::getDefaultEmailAddress('UnitTestCloud') => 'Mrs. Owner User via UnitTestCloud'
+                               Util::getDefaultEmailAddress('UnitTestCloud') => 'Mrs. Owner User via UnitTestCloud'
                        ]);
                $user
                        ->expects($this->once())
@@ -1436,7 +1441,7 @@ class ShareByMailProviderTest extends TestCase {
                        ->expects($this->once())
                        ->method('setFrom')
                        ->with([
-                               \OCP\Util::getDefaultEmailAddress('UnitTestCloud') => 'Mrs. Owner User via UnitTestCloud'
+                               Util::getDefaultEmailAddress('UnitTestCloud') => 'Mrs. Owner User via UnitTestCloud'
                        ]);
                $user
                        ->expects($this->once())
@@ -1567,7 +1572,7 @@ class ShareByMailProviderTest extends TestCase {
                        ->expects($this->once())
                        ->method('setFrom')
                        ->with([
-                               \OCP\Util::getDefaultEmailAddress('UnitTestCloud') => 'Mrs. Owner User via UnitTestCloud'
+                               Util::getDefaultEmailAddress('UnitTestCloud') => 'Mrs. Owner User via UnitTestCloud'
                        ]);
                $user
                        ->expects($this->once())
@@ -1681,7 +1686,7 @@ class ShareByMailProviderTest extends TestCase {
                        ->expects($this->once())
                        ->method('setFrom')
                        ->with([
-                               \OCP\Util::getDefaultEmailAddress('UnitTestCloud') => 'Mr. Initiator User via UnitTestCloud'
+                               Util::getDefaultEmailAddress('UnitTestCloud') => 'Mr. Initiator User via UnitTestCloud'
                        ]);
                $message
                        ->expects($this->never())
@@ -1785,7 +1790,7 @@ class ShareByMailProviderTest extends TestCase {
                        ->expects($this->once())
                        ->method('setFrom')
                        ->with([
-                               \OCP\Util::getDefaultEmailAddress('UnitTestCloud') => 'UnitTestCloud'
+                               Util::getDefaultEmailAddress('UnitTestCloud') => 'UnitTestCloud'
                        ]);
                // Since replyToInitiator is false, we never get the initiator email address
                $user
@@ -1893,7 +1898,7 @@ class ShareByMailProviderTest extends TestCase {
                        ->expects($this->once())
                        ->method('setFrom')
                        ->with([
-                               \OCP\Util::getDefaultEmailAddress('UnitTestCloud') => 'UnitTestCloud'
+                               Util::getDefaultEmailAddress('UnitTestCloud') => 'UnitTestCloud'
                        ]);
                $message
                        ->expects($this->never())
index 82c6682f2066a23e568a64ecaac4f8c04d78ddcb..0f364fc115e6cc45cbbc03e98dc03194c6f91292 100644 (file)
@@ -24,6 +24,7 @@ use OCP\BeforeSabrePubliclyLoadedEvent;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\SystemTag\ManagerEvent;
 use OCP\SystemTag\MapperEvent;
+use OCP\Util;
 
 class Application extends App implements IBootstrap {
        public const APP_ID = 'systemtags';
@@ -48,13 +49,13 @@ class Application extends App implements IBootstrap {
                        $dispatcher->addListener(
                                LoadAdditionalScriptsEvent::class,
                                function (): void {
-                                       \OCP\Util::addScript('core', 'systemtags');
-                                       \OCP\Util::addInitScript(self::APP_ID, 'init');
+                                       Util::addScript('core', 'systemtags');
+                                       Util::addInitScript(self::APP_ID, 'init');
                                }
                        );
 
                        $managerListener = function (ManagerEvent $event) use ($context): void {
-                               /** @var \OCA\SystemTags\Activity\Listener $listener */
+                               /** @var Listener $listener */
                                $listener = $context->getServerContainer()->query(Listener::class);
                                $listener->event($event);
                        };
@@ -63,7 +64,7 @@ class Application extends App implements IBootstrap {
                        $dispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener);
 
                        $mapperListener = function (MapperEvent $event) use ($context): void {
-                               /** @var \OCA\SystemTags\Activity\Listener $listener */
+                               /** @var Listener $listener */
                                $listener = $context->getServerContainer()->query(Listener::class);
                                $listener->mapperEvent($event);
                        };
index 544138316dfc6ce5db95e98bf06c3421ff74d83e..b032e6b7694586818dc653f9c9694d5d41c3b8ca 100644 (file)
@@ -7,6 +7,7 @@ namespace OCA\SystemTags\Settings;
 
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\Settings\ISettings;
+use OCP\Util;
 
 class Admin implements ISettings {
 
@@ -14,7 +15,7 @@ class Admin implements ISettings {
         * @return TemplateResponse
         */
        public function getForm() {
-               \OCP\Util::addScript('systemtags', 'admin');
+               Util::addScript('systemtags', 'admin');
                return new TemplateResponse('systemtags', 'admin', [], '');
        }
 
index 38ceb4042089695b313f59f198eebada04460634..730b11bcf74b7215dbca4556ed7e1622e7196a81 100644 (file)
@@ -5,6 +5,8 @@
  */
 namespace OCA\Testing;
 
+use OC\User\Database;
+
 /**
  * Alternative home user backend.
  *
@@ -17,7 +19,7 @@ namespace OCA\Testing;
  *                     ],
  *     ]
  */
-class AlternativeHomeUserBackend extends \OC\User\Database {
+class AlternativeHomeUserBackend extends Database {
        public function __construct() {
                parent::__construct();
        }
index cda149cd48fa32ff2efb6ac56689583b5aceeb4d..1b02595fa39a6ae7866f0beb308aef2a9c9b9ec8 100644 (file)
@@ -17,6 +17,7 @@ use OCP\AppFramework\Http\Attribute\AuthorizedAdminSetting;
 use OCP\AppFramework\Http\Attribute\BruteForceProtection;
 use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
 use OCP\AppFramework\Http\Attribute\PublicPage;
+use OCP\AppFramework\Http\ContentSecurityPolicy;
 use OCP\AppFramework\Http\DataDisplayResponse;
 use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\Http\FileDisplayResponse;
@@ -346,7 +347,7 @@ class ThemingController extends Controller {
                }
 
                $response = new FileDisplayResponse($file);
-               $csp = new Http\ContentSecurityPolicy();
+               $csp = new ContentSecurityPolicy();
                $csp->allowInlineStyle();
                $response->setContentSecurityPolicy($csp);
                $response->cacheFor(3600);
index bef0f38f598c0b90c7d3a54f52ab7324acfb335f..f75c46de85cbbd70a6a90ba9d0c5470d091be6ce 100644 (file)
@@ -21,6 +21,7 @@ use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\Http\FileDisplayResponse;
 use OCP\AppFramework\Http\JSONResponse;
 use OCP\AppFramework\Http\NotFoundResponse;
+use OCP\AppFramework\Http\Response;
 use OCP\AppFramework\OCS\OCSBadRequestException;
 use OCP\AppFramework\OCS\OCSForbiddenException;
 use OCP\AppFramework\OCSController;
@@ -136,7 +137,7 @@ class UserThemeController extends OCSController {
         */
        #[NoAdminRequired]
        #[NoCSRFRequired]
-       public function getBackground(): Http\Response {
+       public function getBackground(): Response {
                $file = $this->backgroundService->getBackground();
                if ($file !== null) {
                        $response = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $file->getMimeType()]);
index 2ad495b02397de309e1a97a9e77b5571dc0d7d25..3aae94174585396274c20891327676ba4b2138bb 100644 (file)
@@ -19,6 +19,7 @@ use OCP\EventDispatcher\Event;
 use OCP\EventDispatcher\IEventListener;
 use OCP\IConfig;
 use OCP\IUserSession;
+use OCP\Util;
 use Psr\Container\ContainerInterface;
 
 /** @template-implements IEventListener<BeforeTemplateRenderedEvent|BeforeLoginTemplateRenderedEvent> */
@@ -64,6 +65,6 @@ class BeforeTemplateRenderedListener implements IEventListener {
                $this->themeInjectionService->injectHeaders();
 
                // Making sure to inject just after core
-               \OCP\Util::addScript('theming', 'theming', 'core');
+               Util::addScript('theming', 'theming', 'core');
        }
 }
index a070ebb3d56493dafdf145e9eaea880814ab4db3..0f0a019a490595b90f1bed1aa257a7a7af209c77 100644 (file)
@@ -12,8 +12,9 @@ namespace OCA\Theming\Migration;
 use OCA\Theming\Jobs\MigrateBackgroundImages;
 use OCP\BackgroundJob\IJobList;
 use OCP\Migration\IOutput;
+use OCP\Migration\IRepairStep;
 
-class InitBackgroundImagesMigration implements \OCP\Migration\IRepairStep {
+class InitBackgroundImagesMigration implements IRepairStep {
 
        private IJobList $jobList;
 
index dcec954f585a0883562f76f26a44c46c94f75d4f..92b3c0e4cfadf09ef8dbc7848f129dd685be7e8d 100644 (file)
@@ -15,11 +15,12 @@ use OCA\Theming\Jobs\RestoreBackgroundImageColor;
 use OCP\BackgroundJob\IJobList;
 use OCP\IAppConfig;
 use OCP\IDBConnection;
+use OCP\Migration\IMigrationStep;
 use OCP\Migration\IOutput;
 
 // This can only be executed once because `background_color` is again used with Nextcloud 30,
 // so this part only works when updating -> Nextcloud 29 -> 30
-class Version2006Date20240905111627 implements \OCP\Migration\IMigrationStep {
+class Version2006Date20240905111627 implements IMigrationStep {
 
        public function __construct(
                private IJobList $jobList,
index f7ca24c1b55109ed3744bf61d0f084526c45adc0..ee9466c3a36682264289979e7a1d5dd882ba09e7 100644 (file)
@@ -20,6 +20,7 @@ use OCP\Files\SimpleFS\ISimpleFile;
 use OCP\Files\SimpleFS\ISimpleFolder;
 use OCP\IAppConfig;
 use OCP\IConfig;
+use OCP\Image;
 use OCP\Lock\LockedException;
 use OCP\PreConditionNotMetException;
 use RuntimeException;
@@ -241,7 +242,7 @@ class BackgroundService {
        public function recalculateMeanColor(?string $userId = null): void {
                $userId = $userId ?? $this->getUserId();
 
-               $image = new \OCP\Image();
+               $image = new Image();
                $handle = $this->getAppDataFolder($userId)->getFile('background.jpg')->read();
                if ($handle === false || $image->loadFromFileHandle($handle) === false) {
                        throw new InvalidArgumentException('Invalid image file');
@@ -311,7 +312,7 @@ class BackgroundService {
         * @return string|null The fallback background color - if any
         */
        public function setGlobalBackground($path): ?string {
-               $image = new \OCP\Image();
+               $image = new Image();
                $handle = is_resource($path) ? $path : fopen($path, 'rb');
 
                if ($handle && $image->loadFromFileHandle($handle) !== false) {
@@ -328,7 +329,7 @@ class BackgroundService {
         * Calculate mean color of an given image
         * It only takes the upper part into account so that a matching text color can be derived for the app menu
         */
-       private function calculateMeanColor(\OCP\Image $image): false|string {
+       private function calculateMeanColor(Image $image): false|string {
                /**
                 * Small helper to ensure one channel is returned as 8byte hex
                 */
@@ -342,7 +343,7 @@ class BackgroundService {
                        };
                }
 
-               $tempImage = new \OCP\Image();
+               $tempImage = new Image();
 
                // Crop to only analyze top bar
                $resource = $image->cropNew(0, 0, $image->width(), min(max(50, (int)($image->height() * 0.125)), $image->height()));
index 100b0722bddac0ff08e37d2473dc080fbcfbc040..eead85d1ca314d4bce362eaa0822e6214da8e0bc 100644 (file)
@@ -12,7 +12,11 @@ use OCA\Theming\Service\ThemesService;
 use OCA\Theming\ThemingDefaults;
 use OCP\App\IAppManager;
 use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\ContentSecurityPolicy;
 use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\Http\FileDisplayResponse;
+use OCP\AppFramework\Http\JSONResponse;
+use OCP\AppFramework\Http\NotFoundResponse;
 use OCP\AppFramework\Services\IAppConfig;
 use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\Files\NotFoundException;
@@ -638,7 +642,7 @@ class ThemingControllerTest extends TestCase {
                        ->with($this->equalTo('logo'))
                        ->willThrowException(new NotFoundException());
 
-               $expected = new Http\NotFoundResponse();
+               $expected = new NotFoundResponse();
                $this->assertEquals($expected, $this->themingController->getImage('logo'));
        }
 
@@ -655,11 +659,11 @@ class ThemingControllerTest extends TestCase {
                        ->with('theming', 'logoMime', '')
                        ->willReturn('text/svg');
 
-               @$expected = new Http\FileDisplayResponse($file);
+               @$expected = new FileDisplayResponse($file);
                $expected->cacheFor(3600);
                $expected->addHeader('Content-Type', 'text/svg');
                $expected->addHeader('Content-Disposition', 'attachment; filename="logo"');
-               $csp = new Http\ContentSecurityPolicy();
+               $csp = new ContentSecurityPolicy();
                $csp->allowInlineStyle();
                $expected->setContentSecurityPolicy($csp);
                @$this->assertEquals($expected, $this->themingController->getImage('logo'));
@@ -670,7 +674,7 @@ class ThemingControllerTest extends TestCase {
                $this->imageManager->method('getImage')
                        ->with($this->equalTo('background'))
                        ->willThrowException(new NotFoundException());
-               $expected = new Http\NotFoundResponse();
+               $expected = new NotFoundResponse();
                $this->assertEquals($expected, $this->themingController->getImage('background'));
        }
 
@@ -688,11 +692,11 @@ class ThemingControllerTest extends TestCase {
                        ->with('theming', 'backgroundMime', '')
                        ->willReturn('image/png');
 
-               @$expected = new Http\FileDisplayResponse($file);
+               @$expected = new FileDisplayResponse($file);
                $expected->cacheFor(3600);
                $expected->addHeader('Content-Type', 'image/png');
                $expected->addHeader('Content-Disposition', 'attachment; filename="background"');
-               $csp = new Http\ContentSecurityPolicy();
+               $csp = new ContentSecurityPolicy();
                $csp->allowInlineStyle();
                $expected->setContentSecurityPolicy($csp);
                @$this->assertEquals($expected, $this->themingController->getImage('background'));
@@ -719,7 +723,7 @@ class ThemingControllerTest extends TestCase {
                                ['theming.Icon.getTouchIcon', ['app' => 'core'], 'touchicon'],
                                ['theming.Icon.getFavicon', ['app' => 'core'], 'favicon'],
                        ]);
-               $response = new Http\JSONResponse([
+               $response = new JSONResponse([
                        'name' => 'Nextcloud',
                        'start_url' => 'localhost',
                        'icons' =>
index a3fba874289ea21bbc91a716db828b64509414e4..68c8a06ee2ffdd443f0f7216c7fcceeea1466860 100644 (file)
@@ -168,7 +168,7 @@ class ImageManagerTest extends TestCase {
 
 
        public function testGetImageUnset(): void {
-               $this->expectException(\OCP\Files\NotFoundException::class);
+               $this->expectException(NotFoundException::class);
 
                $this->config->expects($this->once())
                        ->method('getAppValue')->with('theming', 'logoMime', false)
@@ -223,13 +223,13 @@ class ImageManagerTest extends TestCase {
 
 
        public function testGetCachedImageNotFound(): void {
-               $this->expectException(\OCP\Files\NotFoundException::class);
+               $this->expectException(NotFoundException::class);
 
                $folder = $this->setupCacheFolder();
                $folder->expects($this->once())
                        ->method('getFile')
                        ->with('filename')
-                       ->will($this->throwException(new \OCP\Files\NotFoundException()));
+                       ->will($this->throwException(new NotFoundException()));
                $image = $this->imageManager->getCachedImage('filename');
        }
 
index a022ee40114001926e881156039b316b56c10e02..4bd8b329f2dcc8c8e8655e43ae07b0d78914c174 100644 (file)
@@ -6,6 +6,7 @@
 namespace OCA\Theming\Tests\Service;
 
 use OC\Route\Router;
+use OC\URLGenerator;
 use OCA\Theming\ImageManager;
 use OCA\Theming\ITheme;
 use OCA\Theming\Themes\DyslexiaFont;
@@ -61,7 +62,7 @@ class DyslexiaFontTest extends TestCase {
                $cacheFactory = $this->createMock(ICacheFactory::class);
                $request = $this->createMock(IRequest::class);
                $router = $this->createMock(Router::class);
-               $this->urlGenerator = new \OC\URLGenerator(
+               $this->urlGenerator = new URLGenerator(
                        $this->config,
                        $userSession,
                        $cacheFactory,
index 9a05c77a274856b142239df1512d323324abbcdf..f664a46733daa10c094aa86086705d724443287e 100644 (file)
@@ -13,6 +13,7 @@ use OCP\Files\NotFoundException;
 use OCP\Files\SimpleFS\ISimpleFile;
 use OCP\Files\SimpleFS\ISimpleFolder;
 use OCP\IConfig;
+use OCP\Server;
 use OCP\ServerVersion;
 use PHPUnit\Framework\MockObject\MockObject;
 use Test\TestCase;
@@ -29,7 +30,7 @@ class UtilTest extends TestCase {
                parent::setUp();
                $this->config = $this->createMock(IConfig::class);
                $this->appData = $this->createMock(IAppData::class);
-               $this->appManager = \OCP\Server::get(IAppManager::class);
+               $this->appManager = Server::get(IAppManager::class);
                $this->imageManager = $this->createMock(ImageManager::class);
                $this->util = new Util($this->createMock(ServerVersion::class), $this->config, $this->appManager, $this->appData, $this->imageManager);
        }
@@ -154,9 +155,9 @@ class UtilTest extends TestCase {
 
        public function dataGetAppIcon() {
                return [
-                       ['user_ldap', \OCP\Server::get(IAppManager::class)->getAppPath('user_ldap') . '/img/app.svg'],
+                       ['user_ldap', Server::get(IAppManager::class)->getAppPath('user_ldap') . '/img/app.svg'],
                        ['noapplikethis', \OC::$SERVERROOT . '/core/img/logo/logo.svg'],
-                       ['comments', \OCP\Server::get(IAppManager::class)->getAppPath('comments') . '/img/comments.svg'],
+                       ['comments', Server::get(IAppManager::class)->getAppPath('comments') . '/img/comments.svg'],
                ];
        }
 
index f184cb1c75c7d228e155e696a2417cbc5b67ba89..083efa9d273ef89d5d02e655251ffca9655de585 100644 (file)
@@ -9,6 +9,7 @@ declare(strict_types=1);
 namespace OCA\TwoFactorBackupCodes\Tests\Service;
 
 use OCA\TwoFactorBackupCodes\Service\BackupCodeStorage;
+use OCP\IUser;
 use OCP\Notification\IManager;
 use OCP\Notification\INotification;
 use Test\TestCase;
@@ -39,7 +40,7 @@ class BackupCodeStorageTest extends TestCase {
        }
 
        public function testSimpleWorkFlow(): void {
-               $user = $this->getMockBuilder(\OCP\IUser::class)->getMock();
+               $user = $this->getMockBuilder(IUser::class)->getMock();
                $user->expects($this->any())
                        ->method('getUID')
                        ->willReturn($this->testUID);
index 709cd7ef9e5e8abcf2e806a29dce58602c51fcf2..a274ed3d2b2753e87942acaf2a958289149692c4 100644 (file)
@@ -17,6 +17,7 @@ use OCP\AppFramework\Http\Attribute\OpenAPI;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\AppFramework\Services\IInitialState;
 use OCP\IRequest;
+use OCP\Util;
 
 #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
 class ChangelogController extends Controller {
@@ -55,7 +56,7 @@ class ChangelogController extends Controller {
                        'text' => $changes,
                ]);
 
-               \OCP\Util::addScript($this->appName, 'view-changelog-page');
+               Util::addScript($this->appName, 'view-changelog-page');
                return new TemplateResponse($this->appName, 'empty');
        }
 }
index 0e221fb9bcf7455336e44e0469e7be2cad309df3..974734a76f499045d468769deb3f72405b3d51f2 100644 (file)
@@ -14,6 +14,7 @@ use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
 use OCP\EventDispatcher\Event;
 use OCP\EventDispatcher\IEventListener;
 use OCP\IAppConfig;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 /** @template-implements IEventListener<BeforeTemplateRenderedEvent> */
@@ -48,6 +49,6 @@ class BeforeTemplateRenderedEventListener implements IEventListener {
                        return;
                }
 
-               \OCP\Util::addInitScript(Application::APP_NAME, 'init');
+               Util::addInitScript(Application::APP_NAME, 'init');
        }
 }
index f731df5399ed4fab0e980f90089976b0a8d3df83..6c608df313d265a0b7de07432ea793c8dca8f74d 100644 (file)
@@ -10,6 +10,8 @@ declare(strict_types=1);
 namespace OCA\UpdateNotification\Migration;
 
 use OCA\UpdateNotification\BackgroundJob\ResetToken;
+use OCA\UpdateNotification\Notification\BackgroundJob;
+use OCA\UpdateNotification\ResetTokenBackgroundJob;
 use OCP\BackgroundJob\IJobList;
 use OCP\Migration\IOutput;
 use OCP\Migration\SimpleMigrationStep;
@@ -30,13 +32,13 @@ class Version011901Date20240305120000 extends SimpleMigrationStep {
                 * This class was renamed so it is now unknow but we still need to remove it
                 * @psalm-suppress UndefinedClass, InvalidArgument
                 */
-               $hasOldResetToken = $this->joblist->has(\OCA\UpdateNotification\ResetTokenBackgroundJob::class, null);
+               $hasOldResetToken = $this->joblist->has(ResetTokenBackgroundJob::class, null);
                $hasNewResetToken = $this->joblist->has(ResetToken::class, null);
                if ($hasOldResetToken) {
                        /**
                         * @psalm-suppress UndefinedClass, InvalidArgument
                         */
-                       $this->joblist->remove(\OCA\UpdateNotification\ResetTokenBackgroundJob::class);
+                       $this->joblist->remove(ResetTokenBackgroundJob::class);
                        if (!$hasNewResetToken) {
                                $this->joblist->add(ResetToken::class);
                        }
@@ -46,11 +48,11 @@ class Version011901Date20240305120000 extends SimpleMigrationStep {
                 * Remove the "has updates" background job, the new one is automatically started from the info.xml
                 * @psalm-suppress UndefinedClass, InvalidArgument
                 */
-               if ($this->joblist->has(\OCA\UpdateNotification\Notification\BackgroundJob::class, null)) {
+               if ($this->joblist->has(BackgroundJob::class, null)) {
                        /**
                         * @psalm-suppress UndefinedClass, InvalidArgument
                         */
-                       $this->joblist->remove(\OCA\UpdateNotification\Notification\BackgroundJob::class);
+                       $this->joblist->remove(BackgroundJob::class);
                }
        }
 }
index ce7d2a6a62bd7429ebab40a93bf7e8f74896d392..7b270547bbb8234db2d97d48d7b6df3bb526573d 100644 (file)
@@ -20,6 +20,7 @@ use OCP\Notification\IManager;
 use OCP\Notification\INotification;
 use OCP\Notification\INotifier;
 use OCP\Notification\UnknownNotificationException;
+use OCP\Server;
 use OCP\Util;
 
 class Notifier implements INotifier {
@@ -188,6 +189,6 @@ class Notifier implements INotifier {
        }
 
        protected function getAppInfo($appId, $languageCode) {
-               return \OCP\Server::get(IAppManager::class)->getAppInfo($appId, false, $languageCode);
+               return Server::get(IAppManager::class)->getAppInfo($appId, false, $languageCode);
        }
 }
index bd866769cc8442155a6fe8e5a7f00f1e99a21e6f..7df622f5e377d72e25d0806e75423f45ca97b139 100644 (file)
@@ -5,13 +5,13 @@
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  * SPDX-License-Identifier: AGPL-3.0-only
  */
-
 use OCA\User_LDAP\Mapping\GroupMapping;
 use OCA\User_LDAP\Mapping\UserMapping;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Server;
 use OCP\User\Events\BeforeUserIdUnassignedEvent;
 use OCP\User\Events\UserIdUnassignedEvent;
+use OCP\Util;
 
 // Check user and app status
 \OC_JSON::checkAdminUser();
@@ -41,7 +41,7 @@ try {
        }
 
        if ($mapping === null || !$result) {
-               $l = \OCP\Util::getL10N('user_ldap');
+               $l = Util::getL10N('user_ldap');
                throw new \Exception($l->t('Failed to clear the mappings.'));
        }
        \OC_JSON::success();
index b8e9a09dc1c37e4c00309d46bffe7db4bc9af847..09899a7c6c642b7ee064848cbe8603ba1c6c74e9 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+use OCA\User_LDAP\Helper;
+use OCP\Util;
+
 /**
  * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
 \OC_JSON::callCheck();
 
 $prefix = (string)$_POST['ldap_serverconfig_chooser'];
-$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection());
+$helper = new Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection());
 if ($helper->deleteServerConfiguration($prefix)) {
        \OC_JSON::success();
 } else {
-       $l = \OCP\Util::getL10N('user_ldap');
+       $l = Util::getL10N('user_ldap');
        \OC_JSON::error(['message' => $l->t('Failed to delete the server configuration')]);
 }
index 31372e89c20dec73454f6d0618db106d6985600d..79a7372813c6e372b132a1fedb42f4ba10f842e5 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use OCA\User_LDAP\LDAP;
+
 /**
  * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -11,7 +13,7 @@
 \OC_JSON::callCheck();
 
 $prefix = (string)$_POST['ldap_serverconfig_chooser'];
-$ldapWrapper = new OCA\User_LDAP\LDAP();
+$ldapWrapper = new LDAP();
 $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
 $configuration = $connection->getConfiguration();
 if (isset($configuration['ldap_agent_password']) && $configuration['ldap_agent_password'] !== '') {
index ccd96250d524fd738c031c0e6a785f4cd2f813f4..9ee225ddaa02eebe3d77add4adbcdab19ee3e8b8 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+use OCA\User_LDAP\Configuration;
+use OCA\User_LDAP\Helper;
+
 /**
  * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -10,7 +13,7 @@
 \OC_JSON::checkAppEnabled('user_ldap');
 \OC_JSON::callCheck();
 
-$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection());
+$helper = new Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection());
 $serverConnections = $helper->getServerConfigurationPrefixes();
 sort($serverConnections);
 $lk = array_pop($serverConnections);
@@ -19,12 +22,12 @@ $nk = 's' . str_pad($ln + 1, 2, '0', STR_PAD_LEFT);
 
 $resultData = ['configPrefix' => $nk];
 
-$newConfig = new \OCA\User_LDAP\Configuration($nk, false);
+$newConfig = new Configuration($nk, false);
 if (isset($_POST['copyConfig'])) {
-       $originalConfig = new \OCA\User_LDAP\Configuration($_POST['copyConfig']);
+       $originalConfig = new Configuration($_POST['copyConfig']);
        $newConfig->setConfiguration($originalConfig->getConfiguration());
 } else {
-       $configuration = new \OCA\User_LDAP\Configuration($nk, false);
+       $configuration = new Configuration($nk, false);
        $newConfig->setConfiguration($configuration->getDefaults());
        $resultData['defaults'] = $configuration->getDefaults();
 }
index afa3b551899edde7836825eccafe538dea54850e..815ef04025729500d5a58c67fa8dfc758dc61b48 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use OCA\User_LDAP\LDAP;
+
 /**
  * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -23,7 +25,7 @@ foreach ($chkboxes as $boxid) {
        }
 }
 
-$ldapWrapper = new OCA\User_LDAP\LDAP();
+$ldapWrapper = new LDAP();
 $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
 $connection->setConfiguration($_POST);
 $connection->saveConfiguration();
index 93e4813d8b0e5c25bdcac219d7625d41c53b0a00..16f0c583ae0d2387fda8ede63952a319b448fbaa 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+use OCA\User_LDAP\LDAP;
+use OCP\Util;
+
 /**
  * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -10,9 +13,9 @@
 \OC_JSON::checkAppEnabled('user_ldap');
 \OC_JSON::callCheck();
 
-$l = \OCP\Util::getL10N('user_ldap');
+$l = Util::getL10N('user_ldap');
 
-$ldapWrapper = new OCA\User_LDAP\LDAP();
+$ldapWrapper = new LDAP();
 $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $_POST['ldap_serverconfig_chooser']);
 
 
index f1778677327128efc1a97b594e28d6f5d7fc2d41..fa6ed9d3a5ac768021c96d92287280ab55a1e1c5 100644 (file)
@@ -1,5 +1,11 @@
 <?php
 
+use OCA\User_LDAP\AccessFactory;
+use OCA\User_LDAP\Configuration;
+use OCA\User_LDAP\LDAP;
+use OCA\User_LDAP\Wizard;
+use OCP\Util;
+
 /**
  * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -10,7 +16,7 @@
 \OC_JSON::checkAppEnabled('user_ldap');
 \OC_JSON::callCheck();
 
-$l = \OCP\Util::getL10N('user_ldap');
+$l = Util::getL10N('user_ldap');
 
 if (!isset($_POST['action'])) {
        \OC_JSON::error(['message' => $l->t('No action specified')]);
@@ -22,18 +28,18 @@ if (!isset($_POST['ldap_serverconfig_chooser'])) {
 }
 $prefix = (string)$_POST['ldap_serverconfig_chooser'];
 
-$ldapWrapper = new \OCA\User_LDAP\LDAP();
-$configuration = new \OCA\User_LDAP\Configuration($prefix);
+$ldapWrapper = new LDAP();
+$configuration = new Configuration($prefix);
 
 $con = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix, null);
 $con->setConfiguration($configuration->getConfiguration());
 $con->ldapConfigurationActive = (string)true;
 $con->setIgnoreValidation(true);
 
-$factory = \OC::$server->get(\OCA\User_LDAP\AccessFactory::class);
+$factory = \OC::$server->get(AccessFactory::class);
 $access = $factory->get($con);
 
-$wizard = new \OCA\User_LDAP\Wizard($configuration, $ldapWrapper, $access);
+$wizard = new Wizard($configuration, $ldapWrapper, $access);
 
 switch ($action) {
        case 'guessPortAndTLS':
index fae78b8982e30428243280a29ca5f040e4ccef0c..fb49c6f54d5f72c5c633ad57fdb1c45a8dee2121 100644 (file)
@@ -2,6 +2,9 @@
 
 declare(strict_types=1);
 
+use OCA\User_LDAP\AppInfo\Application;
+use OCP\AppFramework\App;
+
 /**
  * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -22,7 +25,7 @@ $this->create('user_ldap_ajax_testConfiguration', 'apps/user_ldap/ajax/testConfi
 $this->create('user_ldap_ajax_wizard', 'apps/user_ldap/ajax/wizard.php')
        ->actionInclude('user_ldap/ajax/wizard.php');
 
-$application = new \OCP\AppFramework\App('user_ldap');
+$application = new App('user_ldap');
 $application->registerRoutes($this, [
        'ocs' => [
                ['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'],
@@ -32,8 +35,8 @@ $application->registerRoutes($this, [
        ]
 ]);
 
-/** @var \OCA\User_LDAP\AppInfo\Application $application */
-$application = \OC::$server->query(\OCA\User_LDAP\AppInfo\Application::class);
+/** @var Application $application */
+$application = \OC::$server->query(Application::class);
 $application->registerRoutes($this, [
        'routes' => [
                ['name' => 'renewPassword#tryRenewPassword', 'url' => '/renewpassword', 'verb' => 'POST'],
index e0c396a2cadabb3e79c8b17062b8f725fb837550..ba62239138d5f5cf17b8a52fe15e1d4f2d9916d6 100644 (file)
@@ -21,6 +21,7 @@ use OCP\IAppConfig;
 use OCP\IConfig;
 use OCP\IUserManager;
 use OCP\User\Events\UserIdAssignedEvent;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 use function strlen;
 use function substr;
@@ -260,7 +261,7 @@ class Access extends LDAPUtility {
                        return false;
                }
                //LDAP attributes are not case sensitive
-               $result = \OCP\Util::mb_array_change_key_case(
+               $result = Util::mb_array_change_key_case(
                        $this->invokeLDAPMethod('getAttributes', $er), MB_CASE_LOWER, 'UTF-8');
 
                return $result;
@@ -341,7 +342,7 @@ class Access extends LDAPUtility {
                        return @$this->invokeLDAPMethod('exopPasswd', $userDN, '', $password) ||
                                @$this->invokeLDAPMethod('modReplace', $userDN, $password);
                } catch (ConstraintViolationException $e) {
-                       throw new HintException('Password change rejected.', \OCP\Util::getL10N('user_ldap')->t('Password change rejected. Hint: ') . $e->getMessage(), (int)$e->getCode());
+                       throw new HintException('Password change rejected.', Util::getL10N('user_ldap')->t('Password change rejected. Hint: ') . $e->getMessage(), (int)$e->getCode());
                }
        }
 
@@ -1329,7 +1330,7 @@ class Access extends LDAPUtility {
                                if (!is_array($item)) {
                                        continue;
                                }
-                               $item = \OCP\Util::mb_array_change_key_case($item, MB_CASE_LOWER, 'UTF-8');
+                               $item = Util::mb_array_change_key_case($item, MB_CASE_LOWER, 'UTF-8');
                                foreach ($attr as $key) {
                                        if (isset($item[$key])) {
                                                if (is_array($item[$key]) && isset($item[$key]['count'])) {
index ae6092ae10183964b115eabcf1c4ca9096b62044..3c1cb5daa123b247c0951c4a25c5ea4f95261e81 100644 (file)
@@ -40,6 +40,7 @@ use OCP\IUserManager;
 use OCP\Notification\IManager as INotificationManager;
 use OCP\Share\IManager as IShareManager;
 use OCP\User\Events\PostLoginEvent;
+use OCP\Util;
 use Psr\Container\ContainerInterface;
 use Psr\Log\LoggerInterface;
 
@@ -129,7 +130,7 @@ class Application extends App implements IBootstrap {
 
                $context->injectFn(Closure::fromCallable([$this, 'registerBackendDependents']));
 
-               \OCP\Util::connectHook(
+               Util::connectHook(
                        '\OCA\Files_Sharing\API\Server2Server',
                        'preLoginNameUsedAsUserName',
                        '\OCA\User_LDAP\Helper',
index 989d0bd3929d8dd8563145f988f225caeccc2f5d..658ade62f5dc277919defa99f35472873fc6d70f 100644 (file)
@@ -7,6 +7,7 @@
  */
 namespace OCA\User_LDAP;
 
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -673,7 +674,7 @@ class Configuration {
                        return [strtolower($attribute)];
                }
                if ($value !== self::AVATAR_PREFIX_DEFAULT) {
-                       \OCP\Server::get(LoggerInterface::class)->warning('Invalid config value to ldapUserAvatarRule; falling back to default.');
+                       Server::get(LoggerInterface::class)->warning('Invalid config value to ldapUserAvatarRule; falling back to default.');
                }
                return $defaultAttributes;
        }
index 2a17282361a1c36aaa5e48cc9f715d1087ec88ab..eea7ec62ad8ded516bd2a86c90f7b106e5dd9a23 100644 (file)
@@ -7,6 +7,8 @@
  */
 namespace OCA\User_LDAP;
 
+use OC\Files\Filesystem;
+
 /**
  * @brief wraps around static Nextcloud core methods
  */
@@ -17,7 +19,7 @@ class FilesystemHelper {
         * @return bool
         */
        public function isLoaded() {
-               return \OC\Files\Filesystem::$loaded;
+               return Filesystem::$loaded;
        }
 
        /**
index 37622a534806844860a31be2efff8548ad9ad0dd..6bdb5559a0224e2fcf20f4ff7d035b088b5ad2d4 100644 (file)
@@ -6,6 +6,7 @@
 namespace OCA\User_LDAP;
 
 use OCP\GroupInterface;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 
 class GroupPluginManager {
@@ -41,7 +42,7 @@ class GroupPluginManager {
                foreach ($this->which as $action => $v) {
                        if ((bool)($respondToActions & $action)) {
                                $this->which[$action] = $plugin;
-                               \OCP\Server::get(LoggerInterface::class)->debug('Registered action ' . $action . ' to plugin ' . get_class($plugin), ['app' => 'user_ldap']);
+                               Server::get(LoggerInterface::class)->debug('Registered action ' . $action . ' to plugin ' . get_class($plugin), ['app' => 'user_ldap']);
                        }
                }
        }
index 1a78a65e61ec2c858e14853ff7f7c4a0a7a6a936..931ad7d181a8b0055a9891adbe663939aaad6361 100644 (file)
@@ -18,7 +18,7 @@ use OCP\GroupInterface;
 use OCP\IConfig;
 use OCP\IUserManager;
 
-class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGetDisplayNameBackend, INamedBackend, IDeleteGroupBackend, IBatchMethodsBackend, IIsAdminBackend {
+class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP, IGetDisplayNameBackend, INamedBackend, IDeleteGroupBackend, IBatchMethodsBackend, IIsAdminBackend {
        private $backends = [];
        private ?Group_LDAP $refBackend = null;
        private Helper $helper;
index 088a563dc2750947b5a09aab2f51114501f5089a..12dcc1673d6d6392900abdb921c7006b4d73ceb2 100644 (file)
@@ -14,6 +14,7 @@ use OCA\User_LDAP\User_LDAP;
 use OCA\User_LDAP\User_Proxy;
 use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\BackgroundJob\TimedJob;
+use OCP\Server;
 
 /**
  * Class CleanUp
@@ -95,7 +96,7 @@ class CleanUp extends TimedJob {
                if (isset($arguments['mapping'])) {
                        $this->mapping = $arguments['mapping'];
                } else {
-                       $this->mapping = \OCP\Server::get(UserMapping::class);
+                       $this->mapping = Server::get(UserMapping::class);
                }
 
                if (isset($arguments['deletedUsersIndex'])) {
index b57cae72436c2609f246cbcaa92139a8cc338d33..5e801dec72075aaaed9a528985d79a63299dc1db 100644 (file)
@@ -12,6 +12,7 @@ use OCA\User_LDAP\DataCollector\LdapDataCollector;
 use OCA\User_LDAP\Exceptions\ConstraintViolationException;
 use OCP\IConfig;
 use OCP\Profiler\IProfiler;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 
 class LDAP implements ILDAPWrapper {
@@ -31,7 +32,7 @@ class LDAP implements ILDAPWrapper {
                        $profiler->add($this->dataCollector);
                }
 
-               $this->logger = \OCP\Server::get(LoggerInterface::class);
+               $this->logger = Server::get(LoggerInterface::class);
        }
 
        /**
index 94ac3c985cae260a03823fff724413ad690a4cdd..a8f0cf84d76101a91b443c950566ce02741a6e20 100644 (file)
@@ -11,6 +11,7 @@ use Doctrine\DBAL\Exception;
 use OCP\DB\IPreparedStatement;
 use OCP\DB\QueryBuilder\IQueryBuilder;
 use OCP\IDBConnection;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -34,7 +35,7 @@ abstract class AbstractMapping {
        /**
         * @param \OCP\IDBConnection $dbc
         */
-       public function __construct(\OCP\IDBConnection $dbc) {
+       public function __construct(IDBConnection $dbc) {
                $this->dbc = $dbc;
        }
 
@@ -333,7 +334,7 @@ abstract class AbstractMapping {
         */
        public function map($fdn, $name, $uuid) {
                if (mb_strlen($fdn) > 4000) {
-                       \OCP\Server::get(LoggerInterface::class)->error(
+                       Server::get(LoggerInterface::class)->error(
                                'Cannot map, because the DN exceeds 4000 characters: {dn}',
                                [
                                        'app' => 'user_ldap',
index 23ad77f75f2acd7b5d9a0024dcac3ab72db00c07..8858bc33f802dee8f4f0b1554e947c5205317f86 100644 (file)
@@ -18,7 +18,7 @@ class Notifier implements INotifier {
        /**
         * @param IFactory $l10nFactory
         */
-       public function __construct(\OCP\L10N\IFactory $l10nFactory) {
+       public function __construct(IFactory $l10nFactory) {
                $this->l10nFactory = $l10nFactory;
        }
 
index 5d5ad8b26585f06dabaada903f0bd7816f09ad0c..7b03483200da6a303ae5daccfbac1035db9208fb 100644 (file)
@@ -77,7 +77,7 @@ class Manager {
         * property array
         * @param string $dn the DN of the user
         * @param string $uid the internal (owncloud) username
-        * @return \OCA\User_LDAP\User\User
+        * @return User
         */
        private function createAndCache($dn, $uid) {
                $this->checkAccess();
@@ -188,7 +188,7 @@ class Manager {
        /**
         * creates and returns an instance of OfflineUser for the specified user
         * @param string $id
-        * @return \OCA\User_LDAP\User\OfflineUser
+        * @return OfflineUser
         */
        public function getDeletedUser($id) {
                return new OfflineUser(
@@ -202,7 +202,7 @@ class Manager {
        /**
         * @brief returns a User object by its Nextcloud username
         * @param string $id the DN or username of the user
-        * @return \OCA\User_LDAP\User\User|\OCA\User_LDAP\User\OfflineUser|null
+        * @return User|OfflineUser|null
         */
        protected function createInstancyByUserName($id) {
                //most likely a uid. Check whether it is a deleted user
@@ -219,7 +219,7 @@ class Manager {
        /**
         * @brief returns a User object by its DN or Nextcloud username
         * @param string $id the DN or username of the user
-        * @return \OCA\User_LDAP\User\User|\OCA\User_LDAP\User\OfflineUser|null
+        * @return User|OfflineUser|null
         * @throws \Exception when connection could not be established
         */
        public function get($id) {
index eed715ccc1cc39677010ee81941cfa00766f1670..873bd597df83ccffb456e9a599a2f4be8f04c2ab 100644 (file)
@@ -60,7 +60,7 @@ class OfflineUser {
         */
        protected $db;
        /**
-        * @var \OCA\User_LDAP\Mapping\UserMapping
+        * @var UserMapping
         */
        protected $mapping;
        /** @var IManager */
index 4a5f2442c9b4e02689688af894b305cb590a06d9..0a310f5701251c65643738d064191c34da70511b 100644 (file)
@@ -23,6 +23,7 @@ use OCP\IUser;
 use OCP\IUserManager;
 use OCP\Notification\IManager as INotificationManager;
 use OCP\Server;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -121,7 +122,7 @@ class User {
                $this->notificationManager = $notificationManager;
                $this->birthdateParser = new BirthdateParserService();
 
-               \OCP\Util::connectHook('OC_User', 'post_login', $this, 'handlePasswordExpiry');
+               Util::connectHook('OC_User', 'post_login', $this, 'handlePasswordExpiry');
        }
 
        /**
@@ -228,7 +229,7 @@ class User {
                        //User Profile Field - Phone number
                        $attr = strtolower($this->connection->ldapAttributePhone);
                        if (!empty($attr)) { // attribute configured
-                               $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_PHONE]
+                               $profileValues[IAccountManager::PROPERTY_PHONE]
                                        = $ldapEntry[$attr][0] ?? '';
                        }
                        //User Profile Field - website
@@ -237,57 +238,57 @@ class User {
                                $cutPosition = strpos($ldapEntry[$attr][0], ' ');
                                if ($cutPosition) {
                                        // drop appended label
-                                       $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE]
+                                       $profileValues[IAccountManager::PROPERTY_WEBSITE]
                                                = substr($ldapEntry[$attr][0], 0, $cutPosition);
                                } else {
-                                       $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE]
+                                       $profileValues[IAccountManager::PROPERTY_WEBSITE]
                                                = $ldapEntry[$attr][0];
                                }
                        } elseif (!empty($attr)) {      // configured, but not defined
-                               $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE] = '';
+                               $profileValues[IAccountManager::PROPERTY_WEBSITE] = '';
                        }
                        //User Profile Field - Address
                        $attr = strtolower($this->connection->ldapAttributeAddress);
                        if (isset($ldapEntry[$attr])) {
                                if (str_contains($ldapEntry[$attr][0], '$')) {
                                        // basic format conversion from postalAddress syntax to commata delimited
-                                       $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS]
+                                       $profileValues[IAccountManager::PROPERTY_ADDRESS]
                                                = str_replace('$', ', ', $ldapEntry[$attr][0]);
                                } else {
-                                       $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS]
+                                       $profileValues[IAccountManager::PROPERTY_ADDRESS]
                                                = $ldapEntry[$attr][0];
                                }
                        } elseif (!empty($attr)) {      // configured, but not defined
-                               $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS] = '';
+                               $profileValues[IAccountManager::PROPERTY_ADDRESS] = '';
                        }
                        //User Profile Field - Twitter
                        $attr = strtolower($this->connection->ldapAttributeTwitter);
                        if (!empty($attr)) {
-                               $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_TWITTER]
+                               $profileValues[IAccountManager::PROPERTY_TWITTER]
                                        = $ldapEntry[$attr][0] ?? '';
                        }
                        //User Profile Field - fediverse
                        $attr = strtolower($this->connection->ldapAttributeFediverse);
                        if (!empty($attr)) {
-                               $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_FEDIVERSE]
+                               $profileValues[IAccountManager::PROPERTY_FEDIVERSE]
                                        = $ldapEntry[$attr][0] ?? '';
                        }
                        //User Profile Field - organisation
                        $attr = strtolower($this->connection->ldapAttributeOrganisation);
                        if (!empty($attr)) {
-                               $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ORGANISATION]
+                               $profileValues[IAccountManager::PROPERTY_ORGANISATION]
                                        = $ldapEntry[$attr][0] ?? '';
                        }
                        //User Profile Field - role
                        $attr = strtolower($this->connection->ldapAttributeRole);
                        if (!empty($attr)) {
-                               $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ROLE]
+                               $profileValues[IAccountManager::PROPERTY_ROLE]
                                        = $ldapEntry[$attr][0] ?? '';
                        }
                        //User Profile Field - headline
                        $attr = strtolower($this->connection->ldapAttributeHeadline);
                        if (!empty($attr)) {
-                               $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_HEADLINE]
+                               $profileValues[IAccountManager::PROPERTY_HEADLINE]
                                        = $ldapEntry[$attr][0] ?? '';
                        }
                        //User Profile Field - biography
@@ -295,14 +296,14 @@ class User {
                        if (isset($ldapEntry[$attr])) {
                                if (str_contains($ldapEntry[$attr][0], '\r')) {
                                        // convert line endings
-                                       $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY]
+                                       $profileValues[IAccountManager::PROPERTY_BIOGRAPHY]
                                                = str_replace(["\r\n","\r"], "\n", $ldapEntry[$attr][0]);
                                } else {
-                                       $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY]
+                                       $profileValues[IAccountManager::PROPERTY_BIOGRAPHY]
                                                = $ldapEntry[$attr][0];
                                }
                        } elseif (!empty($attr)) {      // configured, but not defined
-                               $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY] = '';
+                               $profileValues[IAccountManager::PROPERTY_BIOGRAPHY] = '';
                        }
                        //User Profile Field - birthday
                        $attr = strtolower($this->connection->ldapAttributeBirthDate);
@@ -310,7 +311,7 @@ class User {
                                $value = $ldapEntry[$attr][0];
                                try {
                                        $birthdate = $this->birthdateParser->parseBirthdate($value);
-                                       $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIRTHDATE]
+                                       $profileValues[IAccountManager::PROPERTY_BIRTHDATE]
                                                = $birthdate->format('Y-m-d');
                                } catch (InvalidArgumentException $e) {
                                        // Invalid date -> just skip the property
@@ -323,7 +324,7 @@ class User {
                        //User Profile Field - pronouns
                        $attr = strtolower($this->connection->ldapAttributePronouns);
                        if (!empty($attr)) {
-                               $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_PRONOUNS]
+                               $profileValues[IAccountManager::PROPERTY_PRONOUNS]
                                        = $ldapEntry[$attr][0] ?? '';
                        }
                        // check for changed data and cache just for TTL checking
@@ -354,7 +355,7 @@ class User {
                                // system must be postponed after the login. It is to ensure
                                // external mounts are mounted properly (e.g. with login
                                // credentials from the session).
-                               \OCP\Util::connectHook('OC_User', 'post_login', $this, 'updateAvatarPostLogin');
+                               Util::connectHook('OC_User', 'post_login', $this, 'updateAvatarPostLogin');
                                break;
                        }
                }
index 7c51dc70f837f9a6f74684494899d66bee4096a9..bbcf4157016b455f414c059878b39ea18a217026 100644 (file)
@@ -6,6 +6,7 @@
 namespace OCA\User_LDAP;
 
 use OC\User\Backend;
+use OCP\Server;
 use Psr\Log\LoggerInterface;
 
 class UserPluginManager {
@@ -43,12 +44,12 @@ class UserPluginManager {
                foreach ($this->which as $action => $v) {
                        if (is_int($action) && (bool)($respondToActions & $action)) {
                                $this->which[$action] = $plugin;
-                               \OCP\Server::get(LoggerInterface::class)->debug('Registered action ' . $action . ' to plugin ' . get_class($plugin), ['app' => 'user_ldap']);
+                               Server::get(LoggerInterface::class)->debug('Registered action ' . $action . ' to plugin ' . get_class($plugin), ['app' => 'user_ldap']);
                        }
                }
                if (method_exists($plugin, 'deleteUser')) {
                        $this->which['deleteUser'] = $plugin;
-                       \OCP\Server::get(LoggerInterface::class)->debug('Registered action deleteUser to plugin ' . get_class($plugin), ['app' => 'user_ldap']);
+                       Server::get(LoggerInterface::class)->debug('Registered action deleteUser to plugin ' . get_class($plugin), ['app' => 'user_ldap']);
                }
        }
 
index bd1a65f4d4257247782cacd8c0d5014abd8d121e..85ed69195b6eaedfdf34fb9761fe5abe81c6a5a5 100644 (file)
@@ -258,8 +258,8 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I
        /**
         * checks whether a user is still available on LDAP
         *
-        * @param string|\OCA\User_LDAP\User\User $user either the Nextcloud user
-        *                                              name or an instance of that user
+        * @param string|User $user either the Nextcloud user
+        *                          name or an instance of that user
         * @throws \Exception
         * @throws \OC\ServerNotAvailableException
         */
index 0c00771aa670dbc28d13f69ffe39093cecefce8d..3abaae741d882e1484d745b0f3c2e5b9c04ad48d 100644 (file)
@@ -220,8 +220,8 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP
        /**
         * check if a user exists on LDAP
         *
-        * @param string|\OCA\User_LDAP\User\User $user either the Nextcloud user
-        *                                              name or an instance of that user
+        * @param string|User $user either the Nextcloud user
+        *                          name or an instance of that user
         */
        public function userExistsOnLDAP($user, bool $ignoreCache = false): bool {
                $id = ($user instanceof User) ? $user->getUsername() : $user;
index 87f0d04f4974a38a671e1d1407b3f74043162091..262777c5022f9a558d79fed194c3aaa5221b19af 100644 (file)
@@ -11,6 +11,7 @@ namespace OCA\User_LDAP;
 use OC\ServerNotAvailableException;
 use OCP\IL10N;
 use OCP\L10N\IFactory as IL10NFactory;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 class Wizard extends LDAPUtility {
@@ -1253,7 +1254,7 @@ class Wizard extends LDAPUtility {
                }
 
                // strtolower on all keys for proper comparison
-               $result = \OCP\Util::mb_array_change_key_case($result);
+               $result = Util::mb_array_change_key_case($result);
                $attribute = strtolower($attribute);
                if (isset($result[$attribute])) {
                        foreach ($result[$attribute] as $key => $val) {
index 6deaad763f12ebec37ae22e28438102f3296b965..5bb4a4657cbed6d2a53558db7223413df8447ed5 100644 (file)
@@ -6,6 +6,7 @@
  */
 namespace OCA\User_LDAP\Tests;
 
+use OC\ServerNotAvailableException;
 use OCA\User_LDAP\Access;
 use OCA\User_LDAP\Connection;
 use OCA\User_LDAP\Exceptions\ConstraintViolationException;
@@ -19,6 +20,7 @@ use OCA\User_LDAP\User\Manager;
 use OCA\User_LDAP\User\OfflineUser;
 use OCA\User_LDAP\User\User;
 use OCP\EventDispatcher\IEventDispatcher;
+use OCP\HintException;
 use OCP\IAppConfig;
 use OCP\IAvatarManager;
 use OCP\IConfig;
@@ -470,19 +472,19 @@ class AccessTest extends TestCase {
                $this->connection
                        ->expects($this->once())
                        ->method('getConnectionResource')
-                       ->willThrowException(new \OC\ServerNotAvailableException('Connection to LDAP server could not be established'));
+                       ->willThrowException(new ServerNotAvailableException('Connection to LDAP server could not be established'));
                $this->ldap
                        ->expects($this->never())
                        ->method('isResource');
 
-               $this->expectException(\OC\ServerNotAvailableException::class);
+               $this->expectException(ServerNotAvailableException::class);
                $this->expectExceptionMessage('Connection to LDAP server could not be established');
                $this->access->setPassword('CN=foo', 'MyPassword');
        }
 
 
        public function testSetPasswordWithRejectedChange(): void {
-               $this->expectException(\OCP\HintException::class);
+               $this->expectException(HintException::class);
                $this->expectExceptionMessage('Password change rejected.');
 
                $this->connection
index bc65de39f94fc2d8fe38134b93fc247dd62a1f29..9cb19891b3dc4a5da4a834c88dbd683b9254044d 100644 (file)
@@ -7,6 +7,7 @@
  */
 namespace OCA\User_LDAP\Tests;
 
+use OC\ServerNotAvailableException;
 use OCA\User_LDAP\Connection;
 use OCA\User_LDAP\ILDAPWrapper;
 
@@ -18,7 +19,7 @@ use OCA\User_LDAP\ILDAPWrapper;
  * @package OCA\User_LDAP\Tests
  */
 class ConnectionTest extends \Test\TestCase {
-       /** @var \OCA\User_LDAP\ILDAPWrapper|\PHPUnit\Framework\MockObject\MockObject */
+       /** @var ILDAPWrapper|\PHPUnit\Framework\MockObject\MockObject */
        protected $ldap;
 
        /** @var Connection */
@@ -114,7 +115,7 @@ class ConnectionTest extends \Test\TestCase {
                        ->willReturnCallback(function () use (&$isThrown) {
                                if (!$isThrown) {
                                        $isThrown = true;
-                                       throw new \OC\ServerNotAvailableException();
+                                       throw new ServerNotAvailableException();
                                }
                                return true;
                        });
@@ -212,7 +213,7 @@ class ConnectionTest extends \Test\TestCase {
 
                try {
                        $this->assertFalse($this->connection->bind(), 'Connection::bind() should not return true with invalid credentials.');
-               } catch (\OC\ServerNotAvailableException $e) {
+               } catch (ServerNotAvailableException $e) {
                        $this->fail('Failed asserting that exception of type "OC\ServerNotAvailableException" is not thrown.');
                }
        }
@@ -260,7 +261,7 @@ class ConnectionTest extends \Test\TestCase {
                        ->method('startTls')
                        ->willReturn(false);
 
-               $this->expectException(\OC\ServerNotAvailableException::class);
+               $this->expectException(ServerNotAvailableException::class);
                $this->expectExceptionMessage('Start TLS failed, when connecting to LDAP host ' . $host . '.');
 
                $this->connection->init();
index fd24fe8a891263b5ac7f5aaa5eb7096cdb4a637d..30b3e573cd4708cdaf093c4747edaf698ee0627d 100644 (file)
@@ -16,6 +16,8 @@ use OCA\User_LDAP\LDAP;
 use OCA\User_LDAP\User\Manager;
 use OCA\User_LDAP\UserPluginManager;
 use OCP\IAvatarManager;
+use OCP\Image;
+use OCP\Server;
 use OCP\Share\IManager;
 use Psr\Log\LoggerInterface;
 
@@ -57,10 +59,10 @@ abstract class AbstractIntegrationTest {
         */
        public function init() {
                \OC::$server->registerService(UserPluginManager::class, function () {
-                       return new \OCA\User_LDAP\UserPluginManager();
+                       return new UserPluginManager();
                });
                \OC::$server->registerService(GroupPluginManager::class, function () {
-                       return new \OCA\User_LDAP\GroupPluginManager();
+                       return new GroupPluginManager();
                });
 
                $this->initLDAPWrapper();
@@ -106,7 +108,7 @@ abstract class AbstractIntegrationTest {
                        new FilesystemHelper(),
                        \OC::$server->get(LoggerInterface::class),
                        \OC::$server->get(IAvatarManager::class),
-                       new \OCP\Image(),
+                       new Image(),
                        \OC::$server->getUserManager(),
                        \OC::$server->getNotificationManager(),
                        \OC::$server->get(IManager::class)
@@ -124,7 +126,7 @@ abstract class AbstractIntegrationTest {
         * initializes the Access test instance
         */
        protected function initAccess() {
-               $this->access = new Access($this->connection, $this->ldap, $this->userManager, $this->helper, \OC::$server->getConfig(), \OCP\Server::get(LoggerInterface::class));
+               $this->access = new Access($this->connection, $this->ldap, $this->userManager, $this->helper, \OC::$server->getConfig(), Server::get(LoggerInterface::class));
        }
 
        /**
index 4618179f8abc00ec6b26b6f8dbea4b29eca48a70..2beab95b71f2bafe68237f8cd1b3facd050c1c29 100644 (file)
@@ -39,7 +39,7 @@ class ExceptionOnLostConnection {
        /** @var string */
        private $ldapHost;
 
-       /** @var \OCA\User_LDAP\LDAP */
+       /** @var LDAP */
        private $ldap;
 
        /** @var bool */
index e96b7b59a94362df577a26d4e6c61b6c1410734b..5888c6624f305038d7bff230607d9db2ec5c8df1 100644 (file)
@@ -5,12 +5,15 @@
  */
 namespace OCA\User_LDAP\Tests;
 
+use OC\Config;
 use OC\User\Manager;
 use OCA\User_LDAP\Access;
 use OCA\User_LDAP\Connection;
 use OCA\User_LDAP\Group_LDAP;
+use OCA\User_LDAP\Helper;
 use OCA\User_LDAP\IGroupLDAP;
 use OCA\User_LDAP\IUserLDAP;
+use OCA\User_LDAP\LDAPProviderFactory;
 use OCA\User_LDAP\User_LDAP;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\ICacheFactory;
@@ -33,7 +36,7 @@ class LDAPProviderTest extends \Test\TestCase {
        private function getServerMock(IUserLDAP $userBackend, IGroupLDAP $groupBackend) {
                $server = $this->getMockBuilder('OC\Server')
                        ->setMethods(['getUserManager', 'getBackends', 'getGroupManager'])
-                       ->setConstructorArgs(['', new \OC\Config(\OC::$configDir)])
+                       ->setConstructorArgs(['', new Config(\OC::$configDir)])
                        ->getMock();
                $server->expects($this->any())
                        ->method('getUserManager')
@@ -84,7 +87,7 @@ class LDAPProviderTest extends \Test\TestCase {
        }
 
        private function getLDAPProvider(IServerContainer $serverContainer) {
-               $factory = new \OCA\User_LDAP\LDAPProviderFactory($serverContainer);
+               $factory = new LDAPProviderFactory($serverContainer);
                return $factory->getLDAPProvider();
        }
 
@@ -201,7 +204,7 @@ class LDAPProviderTest extends \Test\TestCase {
 
                $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock());
 
-               $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection());
+               $helper = new Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection());
 
                $ldapProvider = $this->getLDAPProvider($server);
                $this->assertEquals(
@@ -217,7 +220,7 @@ class LDAPProviderTest extends \Test\TestCase {
 
                $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock());
 
-               $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection());
+               $helper = new Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection());
 
                $ldapProvider = $this->getLDAPProvider($server);
                $this->assertEquals(
index 84703e096160b9d574f16dcfdd395d0919897d4e..b95856a0f4c095d356119cf21652925999088ee0 100644 (file)
@@ -11,7 +11,7 @@ use OCA\User_LDAP\Mapping\AbstractMapping;
 use OCP\IDBConnection;
 
 abstract class AbstractMappingTest extends \Test\TestCase {
-       abstract public function getMapper(\OCP\IDBConnection $dbMock);
+       abstract public function getMapper(IDBConnection $dbMock);
 
        /**
         * kiss test on isColNameValid
@@ -52,7 +52,7 @@ abstract class AbstractMappingTest extends \Test\TestCase {
 
        /**
         * calls map() on the given mapper and asserts result for true
-        * @param \OCA\User_LDAP\Mapping\AbstractMapping $mapper
+        * @param AbstractMapping $mapper
         * @param array $data
         */
        protected function mapEntries($mapper, $data) {
index 0d407577e1b9e41363cf53de27b3f2b57fb0cc02..efa42e478633b7ac19f785fb618681a837568070 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\User_LDAP\Tests\Mapping;
 
 use OCA\User_LDAP\Mapping\GroupMapping;
+use OCP\IDBConnection;
 
 /**
  * Class GroupMappingTest
@@ -17,7 +18,7 @@ use OCA\User_LDAP\Mapping\GroupMapping;
  * @package OCA\User_LDAP\Tests\Mapping
  */
 class GroupMappingTest extends AbstractMappingTest {
-       public function getMapper(\OCP\IDBConnection $dbMock) {
+       public function getMapper(IDBConnection $dbMock) {
                return new GroupMapping($dbMock);
        }
 }
index 1792a4124be7cd6b504b31408b3de5dc6f5bc8f6..07980ba470c79664aa1501230975415d05db2fc4 100644 (file)
@@ -8,6 +8,7 @@
 namespace OCA\User_LDAP\Tests\Mapping;
 
 use OCA\User_LDAP\Mapping\UserMapping;
+use OCP\IDBConnection;
 use OCP\Support\Subscription\IAssertion;
 
 /**
@@ -18,7 +19,7 @@ use OCP\Support\Subscription\IAssertion;
  * @package OCA\User_LDAP\Tests\Mapping
  */
 class UserMappingTest extends AbstractMappingTest {
-       public function getMapper(\OCP\IDBConnection $dbMock) {
+       public function getMapper(IDBConnection $dbMock) {
                return new UserMapping($dbMock, $this->createMock(IAssertion::class));
        }
 }
index d596402d322963da767a8b8ead289d166d1e5d78..3939c41c4ca0f9cb0e755daa81e0ccef1bb7d7a4 100644 (file)
@@ -19,6 +19,7 @@ use OCP\IUser;
 use OCP\IUserManager;
 use OCP\Notification\IManager as INotificationManager;
 use OCP\Notification\INotification;
+use OCP\Util;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -1149,7 +1150,7 @@ class UserTest extends \Test\TestCase {
                        ->method('notify');
 
                \OC_Hook::clear();//disconnect irrelevant hooks
-               \OCP\Util::connectHook('OC_User', 'post_login', $this->user, 'handlePasswordExpiry');
+               Util::connectHook('OC_User', 'post_login', $this->user, 'handlePasswordExpiry');
                /** @noinspection PhpUnhandledExceptionInspection */
                \OC_Hook::emit('OC_User', 'post_login', ['uid' => $this->uid]);
        }
@@ -1213,7 +1214,7 @@ class UserTest extends \Test\TestCase {
                        ->method('notify');
 
                \OC_Hook::clear();//disconnect irrelevant hooks
-               \OCP\Util::connectHook('OC_User', 'post_login', $this->user, 'handlePasswordExpiry');
+               Util::connectHook('OC_User', 'post_login', $this->user, 'handlePasswordExpiry');
                /** @noinspection PhpUnhandledExceptionInspection */
                \OC_Hook::emit('OC_User', 'post_login', ['uid' => $this->uid]);
        }
index f766c7f583aebea2fe9f8f8c5281c79d1f8543fc..5b01b25109f3d41ce585f05da69dc79a1d4cd7cc 100644 (file)
@@ -1238,7 +1238,7 @@ class User_LDAPTest extends TestCase {
 
 
        public function testSetPasswordInvalid(): void {
-               $this->expectException(\OCP\HintException::class);
+               $this->expectException(HintException::class);
                $this->expectExceptionMessage('Password fails quality checking policy');
 
                $this->prepareAccessForSetPassword($this->access);
@@ -1383,7 +1383,7 @@ class User_LDAPTest extends TestCase {
 
 
        public function testSetDisplayNameErrorWithPlugin(): void {
-               $this->expectException(\OCP\HintException::class);
+               $this->expectException(HintException::class);
 
                $newDisplayName = 'J. Baker';
                $this->pluginManager->expects($this->once())
index 49ac93573dd96f234cf02d15853d46e741d4b8f6..031ad4f9126a79a52d4231da3b55b8026f3bbe98 100644 (file)
@@ -18,6 +18,7 @@ use OCP\EventDispatcher\Event;
 use OCP\EventDispatcher\IEventListener;
 use OCP\IInitialStateService;
 use OCP\IUserSession;
+use OCP\Util;
 
 /** @template-implements IEventListener<BeforeTemplateRenderedEvent> */
 class BeforeTemplateRenderedListener implements IEventListener {
@@ -80,7 +81,7 @@ class BeforeTemplateRenderedListener implements IEventListener {
                        return ['profileEnabled' => $this->profileManager->isProfileEnabled($user)];
                });
 
-               \OCP\Util::addScript('user_status', 'menu');
-               \OCP\Util::addStyle('user_status', 'user-status-menu');
+               Util::addScript('user_status', 'menu');
+               Util::addStyle('user_status', 'user-status-menu');
        }
 }
index c78be6e4e6b5d0a3ab2178f7a29071e396c06c71..997e8931703edfb75980487ecfec0c906f459476 100644 (file)
@@ -9,6 +9,7 @@ declare(strict_types=1);
 
 namespace OCA\WebhookListeners\BackgroundJobs;
 
+use OCA\AppAPI\PublicFunctions;
 use OCA\WebhookListeners\Db\AuthMethod;
 use OCA\WebhookListeners\Db\WebhookListenerMapper;
 use OCP\App\IAppManager;
@@ -16,6 +17,7 @@ use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\BackgroundJob\QueuedJob;
 use OCP\Http\Client\IClientService;
 use OCP\ICertificateManager;
+use OCP\Server;
 use Psr\Container\ContainerExceptionInterface;
 use Psr\Container\NotFoundExceptionInterface;
 use Psr\Log\LoggerInterface;
@@ -62,7 +64,7 @@ class WebhookCall extends QueuedJob {
                                        throw new RuntimeException('AppAPI is disabled or not installed.');
                                }
                                try {
-                                       $appApiFunctions = \OCP\Server::get(\OCA\AppAPI\PublicFunctions::class);
+                                       $appApiFunctions = Server::get(PublicFunctions::class);
                                } catch (ContainerExceptionInterface|NotFoundExceptionInterface) {
                                        throw new RuntimeException('Could not get AppAPI public functions.');
                                }
index 4f226a3407ca71a27d9bf883a1d86738b48fa614..af974e7b0e25f45faaab78ce036d9cfdaa631524 100644 (file)
@@ -11,6 +11,7 @@ namespace OCA\WebhookListeners\Db;
 
 use OCP\AppFramework\Db\Entity;
 use OCP\Security\ICrypto;
+use OCP\Server;
 
 /**
  * @method void setUserId(?string $userId)
@@ -89,7 +90,7 @@ class WebhookListener extends Entity implements \JsonSerializable {
                ?ICrypto $crypto = null,
        ) {
                if ($crypto === null) {
-                       $crypto = \OCP\Server::get(ICrypto::class);
+                       $crypto = Server::get(ICrypto::class);
                }
                $this->crypto = $crypto;
                $this->addType('appId', 'string');
index aefed2961ead1f8a244fc9a674ab756b96449d27..be99bccb677397326edbba3da2617eb599d74b1d 100644 (file)
@@ -14,6 +14,7 @@ use OCA\WebhookListeners\Db\WebhookListenerMapper;
 use OCP\Files\Events\Node\NodeWrittenEvent;
 use OCP\ICacheFactory;
 use OCP\IDBConnection;
+use OCP\Server;
 use OCP\User\Events\UserCreatedEvent;
 use Test\TestCase;
 
@@ -28,8 +29,8 @@ class WebhookListenerMapperTest extends TestCase {
        protected function setUp(): void {
                parent::setUp();
 
-               $this->connection = \OCP\Server::get(IDBConnection::class);
-               $this->cacheFactory = \OCP\Server::get(ICacheFactory::class);
+               $this->connection = Server::get(IDBConnection::class);
+               $this->cacheFactory = Server::get(ICacheFactory::class);
                $this->pruneTables();
 
                $this->mapper = new WebhookListenerMapper(
index c598c756bedef7e19ed01b5325a4cb3b92064b15..774f866bf127db5ce51a819eea64f8dce342e177 100644 (file)
@@ -5,6 +5,7 @@
  */
 namespace OCA\WorkflowEngine\Tests\Check;
 
+use OCA\WorkflowEngine\Check\AbstractStringCheck;
 use OCP\IL10N;
 
 class AbstractStringCheckTest extends \Test\TestCase {
@@ -55,7 +56,7 @@ class AbstractStringCheckTest extends \Test\TestCase {
        public function testExecuteStringCheck($operation, $checkValue, $actualValue, $expected): void {
                $check = $this->getCheckMock();
 
-               /** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */
+               /** @var AbstractStringCheck $check */
                $this->assertEquals($expected, $this->invokePrivate($check, 'executeStringCheck', [$operation, $checkValue, $actualValue]));
        }
 
@@ -76,7 +77,7 @@ class AbstractStringCheckTest extends \Test\TestCase {
        public function testValidateCheck($operator, $value): void {
                $check = $this->getCheckMock();
 
-               /** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */
+               /** @var AbstractStringCheck $check */
                $check->validateCheck($operator, $value);
 
                $this->addToAssertionCount(1);
@@ -102,7 +103,7 @@ class AbstractStringCheckTest extends \Test\TestCase {
                $check = $this->getCheckMock();
 
                try {
-                       /** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */
+                       /** @var AbstractStringCheck $check */
                        $check->validateCheck($operator, $value);
                } catch (\UnexpectedValueException $e) {
                        $this->assertEquals($exceptionCode, $e->getCode());
index 438a59a8a48e4b6083d409475eef20e93a7211ea..3775d7ff76827ad7f3a24af9dc2bd27649480ff0 100644 (file)
@@ -5,6 +5,7 @@
  */
 namespace OCA\WorkflowEngine\Tests\Check;
 
+use OCA\WorkflowEngine\Check\RequestRemoteAddress;
 use OCP\IL10N;
 use OCP\IRequest;
 
@@ -53,7 +54,7 @@ class RequestRemoteAddressTest extends \Test\TestCase {
         * @param bool $expected
         */
        public function testExecuteCheckMatchesIPv4($value, $ip, $expected): void {
-               $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request);
+               $check = new RequestRemoteAddress($this->getL10NMock(), $this->request);
 
                $this->request->expects($this->once())
                        ->method('getRemoteAddress')
@@ -69,7 +70,7 @@ class RequestRemoteAddressTest extends \Test\TestCase {
         * @param bool $expected
         */
        public function testExecuteCheckNotMatchesIPv4($value, $ip, $expected): void {
-               $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request);
+               $check = new RequestRemoteAddress($this->getL10NMock(), $this->request);
 
                $this->request->expects($this->once())
                        ->method('getRemoteAddress')
@@ -97,7 +98,7 @@ class RequestRemoteAddressTest extends \Test\TestCase {
         * @param bool $expected
         */
        public function testExecuteCheckMatchesIPv6($value, $ip, $expected): void {
-               $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request);
+               $check = new RequestRemoteAddress($this->getL10NMock(), $this->request);
 
                $this->request->expects($this->once())
                        ->method('getRemoteAddress')
@@ -113,7 +114,7 @@ class RequestRemoteAddressTest extends \Test\TestCase {
         * @param bool $expected
         */
        public function testExecuteCheckNotMatchesIPv6($value, $ip, $expected): void {
-               $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request);
+               $check = new RequestRemoteAddress($this->getL10NMock(), $this->request);
 
                $this->request->expects($this->once())
                        ->method('getRemoteAddress')
index 34ea656f416f94c256223173adda727762e7bf3e..083e6171d29a1947a9607a91342bbb89ac81839a 100644 (file)
@@ -5,6 +5,7 @@
  */
 namespace OCA\WorkflowEngine\Tests\Check;
 
+use OCA\WorkflowEngine\Check\RequestTime;
 use OCP\IL10N;
 
 class RequestTimeTest extends \Test\TestCase {
@@ -72,7 +73,7 @@ class RequestTimeTest extends \Test\TestCase {
         * @param bool $expected
         */
        public function testExecuteCheckIn($value, $timestamp, $expected): void {
-               $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory);
+               $check = new RequestTime($this->getL10NMock(), $this->timeFactory);
 
                $this->timeFactory->expects($this->once())
                        ->method('getTime')
@@ -88,7 +89,7 @@ class RequestTimeTest extends \Test\TestCase {
         * @param bool $expected
         */
        public function testExecuteCheckNotIn($value, $timestamp, $expected): void {
-               $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory);
+               $check = new RequestTime($this->getL10NMock(), $this->timeFactory);
 
                $this->timeFactory->expects($this->once())
                        ->method('getTime')
@@ -111,7 +112,7 @@ class RequestTimeTest extends \Test\TestCase {
         * @param string $value
         */
        public function testValidateCheck($operator, $value): void {
-               $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory);
+               $check = new RequestTime($this->getL10NMock(), $this->timeFactory);
                $check->validateCheck($operator, $value);
                $this->addToAssertionCount(1);
        }
@@ -136,7 +137,7 @@ class RequestTimeTest extends \Test\TestCase {
         * @param string $exceptionMessage
         */
        public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage): void {
-               $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory);
+               $check = new RequestTime($this->getL10NMock(), $this->timeFactory);
 
                try {
                        $check->validateCheck($operator, $value);
index f74cf669cc7b9dc83ab59367836979f14959c356..cc5cf3209b3bf499209620e1cb82b898820eb595 100644 (file)
@@ -5,6 +5,7 @@
  */
 namespace OCA\WorkflowEngine\Tests\Check;
 
+use OCA\WorkflowEngine\Check\AbstractStringCheck;
 use OCA\WorkflowEngine\Check\RequestUserAgent;
 use OCP\IL10N;
 use OCP\IRequest;
@@ -95,7 +96,7 @@ class RequestUserAgentTest extends TestCase {
                        ->method('getHeader')
                        ->willReturn($actualValue);
 
-               /** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */
+               /** @var AbstractStringCheck $check */
                $this->assertEquals($expected, $this->check->executeCheck($operation, $checkValue));
        }
 }