aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-10-10 12:40:31 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2024-10-15 10:40:25 +0200
commit1580c8612b01bfa780d1a7372080a27d182fb7dd (patch)
treeb2776d0cd254ac9d6e54828978ce18b702f550d5 /apps/dav
parent4ff9b3e0ce53227e2be47c4c2dcb1fdc3e540b5f (diff)
downloadnextcloud-server-1580c8612b01bfa780d1a7372080a27d182fb7dd.tar.gz
nextcloud-server-1580c8612b01bfa780d1a7372080a27d182fb7dd.zip
chore(apps): Apply new rector configuration to autouse classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/appinfo/v1/caldav.php17
-rw-r--r--apps/dav/appinfo/v1/carddav.php18
-rw-r--r--apps/dav/appinfo/v1/publicwebdav.php43
-rw-r--r--apps/dav/appinfo/v1/webdav.php21
-rw-r--r--apps/dav/appinfo/v2/direct.php6
-rw-r--r--apps/dav/appinfo/v2/publicremote.php52
-rw-r--r--apps/dav/appinfo/v2/remote.php4
-rw-r--r--apps/dav/lib/AppInfo/Application.php5
-rw-r--r--apps/dav/lib/BackgroundJob/EventReminderJob.php6
-rw-r--r--apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php4
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php4
-rw-r--r--apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php21
-rw-r--r--apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php3
-rw-r--r--apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php4
-rw-r--r--apps/dav/lib/CalDAV/Schedule/IMipPlugin.php8
-rw-r--r--apps/dav/lib/CalDAV/Schedule/Plugin.php7
-rw-r--r--apps/dav/lib/CalDAV/Search/SearchPlugin.php2
-rw-r--r--apps/dav/lib/CardDAV/ContactsManager.php2
-rw-r--r--apps/dav/lib/CardDAV/PhotoCache.php3
-rw-r--r--apps/dav/lib/CardDAV/UserAddressBooks.php3
-rw-r--r--apps/dav/lib/Comments/CommentsPlugin.php5
-rw-r--r--apps/dav/lib/Connector/LegacyPublicAuth.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/Auth.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/BearerAuth.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/Directory.php27
-rw-r--r--apps/dav/lib/Connector/Sabre/Exception/FileLocked.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php36
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesPlugin.php10
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesReportPlugin.php5
-rw-r--r--apps/dav/lib/Connector/Sabre/Node.php10
-rw-r--r--apps/dav/lib/Connector/Sabre/ObjectTree.php13
-rw-r--r--apps/dav/lib/Connector/Sabre/Principal.php5
-rw-r--r--apps/dav/lib/Connector/Sabre/PublicAuth.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/ServerFactory.php39
-rw-r--r--apps/dav/lib/Connector/Sabre/TagsPlugin.php10
-rw-r--r--apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php2
-rw-r--r--apps/dav/lib/Files/FileSearchBackend.php5
-rw-r--r--apps/dav/lib/Files/FilesHome.php3
-rw-r--r--apps/dav/lib/RootCollection.php12
-rw-r--r--apps/dav/lib/Server.php44
-rw-r--r--apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php5
-rw-r--r--apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php3
-rw-r--r--apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php4
-rw-r--r--apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php4
-rw-r--r--apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php2
-rw-r--r--apps/dav/tests/unit/Command/ListAddressbooksTest.php2
-rw-r--r--apps/dav/tests/unit/Comments/EntityCollectionTest.php14
-rw-r--r--apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php5
-rw-r--r--apps/dav/tests/unit/Comments/RootCollectionTest.php5
-rw-r--r--apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php5
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/AuthTest.php11
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php3
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php5
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php16
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FileTest.php151
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php15
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php7
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/NodeTest.php13
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php21
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php3
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php4
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php7
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php22
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php17
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php10
-rw-r--r--apps/dav/tests/unit/Upload/AssemblyStreamTest.php7
-rw-r--r--apps/dav/tests/unit/Upload/FutureFileTest.php7
75 files changed, 504 insertions, 358 deletions
diff --git a/apps/dav/appinfo/v1/caldav.php b/apps/dav/appinfo/v1/caldav.php
index bfa4d6184d5..ea6d2dcf406 100644
--- a/apps/dav/appinfo/v1/caldav.php
+++ b/apps/dav/appinfo/v1/caldav.php
@@ -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();
diff --git a/apps/dav/appinfo/v1/carddav.php b/apps/dav/appinfo/v1/carddav.php
index 72be4712705..dbcdacc27f0 100644
--- a/apps/dav/appinfo/v1/carddav.php
+++ b/apps/dav/appinfo/v1/carddav.php
@@ -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();
diff --git a/apps/dav/appinfo/v1/publicwebdav.php b/apps/dav/appinfo/v1/publicwebdav.php
index 38753374150..dc74fe214af 100644
--- a/apps/dav/appinfo/v1/publicwebdav.php
+++ b/apps/dav/appinfo/v1/publicwebdav.php
@@ -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);
diff --git a/apps/dav/appinfo/v1/webdav.php b/apps/dav/appinfo/v1/webdav.php
index 1683c29ca80..0faed7ccc94 100644
--- a/apps/dav/appinfo/v1/webdav.php
+++ b/apps/dav/appinfo/v1/webdav.php
@@ -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!
diff --git a/apps/dav/appinfo/v2/direct.php b/apps/dav/appinfo/v2/direct.php
index 46443a60f8a..5ba9570602a 100644
--- a/apps/dav/appinfo/v2/direct.php
+++ b/apps/dav/appinfo/v2/direct.php
@@ -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()
);
diff --git a/apps/dav/appinfo/v2/publicremote.php b/apps/dav/appinfo/v2/publicremote.php
index cc2d1ed5bc8..91d5a0448eb 100644
--- a/apps/dav/appinfo/v2/publicremote.php
+++ b/apps/dav/appinfo/v2/publicremote.php
@@ -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) {
diff --git a/apps/dav/appinfo/v2/remote.php b/apps/dav/appinfo/v2/remote.php
index 73031c0794f..28cfe338a93 100644
--- a/apps/dav/appinfo/v2/remote.php
+++ b/apps/dav/appinfo/v2/remote.php
@@ -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();
diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php
index fb6a195aedb..2325a3c3ba8 100644
--- a/apps/dav/lib/AppInfo/Application.php
+++ b/apps/dav/lib/AppInfo/Application.php
@@ -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());
});
diff --git a/apps/dav/lib/BackgroundJob/EventReminderJob.php b/apps/dav/lib/BackgroundJob/EventReminderJob.php
index 5025919c84f..894b347de9f 100644
--- a/apps/dav/lib/BackgroundJob/EventReminderJob.php
+++ b/apps/dav/lib/BackgroundJob/EventReminderJob.php
@@ -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 {
diff --git a/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php b/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php
index 56e91c581f8..3e058a9b6c1 100644
--- a/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php
+++ b/apps/dav/lib/CalDAV/AppCalendar/AppCalendarPlugin.php
@@ -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));
})
);
}
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 101bf36617a..c9d323d27df 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -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) {
diff --git a/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php b/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php
index 6fa94eebc91..32a3eb0ae15 100644
--- a/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php
+++ b/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php
@@ -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()
));
diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php
index 59f412c0a7b..b33b9c61834 100644
--- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php
+++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php
@@ -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();
diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php b/apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php
index f64de85c449..21f4f5094d4 100644
--- a/apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php
+++ b/apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php
@@ -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);
}
diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
index e46cd039fd5..beca5cff233 100644
--- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
+++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
@@ -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,
diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php
index 48f4cbf22ef..11f0dfbe251 100644
--- a/apps/dav/lib/CalDAV/Schedule/Plugin.php
+++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php
@@ -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) {
diff --git a/apps/dav/lib/CalDAV/Search/SearchPlugin.php b/apps/dav/lib/CalDAV/Search/SearchPlugin.php
index fb55dec593c..c69537523f2 100644
--- a/apps/dav/lib/CalDAV/Search/SearchPlugin.php
+++ b/apps/dav/lib/CalDAV/Search/SearchPlugin.php
@@ -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) {
diff --git a/apps/dav/lib/CardDAV/ContactsManager.php b/apps/dav/lib/CardDAV/ContactsManager.php
index 30af37481ab..899396ddc17 100644
--- a/apps/dav/lib/CardDAV/ContactsManager.php
+++ b/apps/dav/lib/CardDAV/ContactsManager.php
@@ -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,
diff --git a/apps/dav/lib/CardDAV/PhotoCache.php b/apps/dav/lib/CardDAV/PhotoCache.php
index 00989386df7..0fb5592142e 100644
--- a/apps/dav/lib/CardDAV/PhotoCache.php
+++ b/apps/dav/lib/CardDAV/PhotoCache.php
@@ -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());
diff --git a/apps/dav/lib/CardDAV/UserAddressBooks.php b/apps/dav/lib/CardDAV/UserAddressBooks.php
index e2d3fe4d8c8..aee26af4ed9 100644
--- a/apps/dav/lib/CardDAV/UserAddressBooks.php
+++ b/apps/dav/lib/CardDAV/UserAddressBooks.php
@@ -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
diff --git a/apps/dav/lib/Comments/CommentsPlugin.php b/apps/dav/lib/Comments/CommentsPlugin.php
index ef0de057ebb..6cae12d20ab 100644
--- a/apps/dav/lib/Comments/CommentsPlugin.php
+++ b/apps/dav/lib/Comments/CommentsPlugin.php
@@ -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);
}
}
}
diff --git a/apps/dav/lib/Connector/LegacyPublicAuth.php b/apps/dav/lib/Connector/LegacyPublicAuth.php
index 564eae506ac..731654df31a 100644
--- a/apps/dav/lib/Connector/LegacyPublicAuth.php
+++ b/apps/dav/lib/Connector/LegacyPublicAuth.php
@@ -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';
}
diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php
index 9b67d960107..4c6ce557980 100644
--- a/apps/dav/lib/Connector/Sabre/Auth.php
+++ b/apps/dav/lib/Connector/Sabre/Auth.php
@@ -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';
}
diff --git a/apps/dav/lib/Connector/Sabre/BearerAuth.php b/apps/dav/lib/Connector/Sabre/BearerAuth.php
index 8caae8dced9..d5840848cef 100644
--- a/apps/dav/lib/Connector/Sabre/BearerAuth.php
+++ b/apps/dav/lib/Connector/Sabre/BearerAuth.php
@@ -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';
}
diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php
index c1b69323a44..c520a6c5a84 100644
--- a/apps/dav/lib/Connector/Sabre/Directory.php
+++ b/apps/dav/lib/Connector/Sabre/Directory.php
@@ -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) {
diff --git a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
index bad4bfa12ab..38708e945e9 100644
--- a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
+++ b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
@@ -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);
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index d1769ce6b81..36ac0fcec72 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -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);
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
index 07308d4e805..3855f51c65a 100644
--- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
@@ -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);
diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
index b82fee957bc..49ceff9118d 100644
--- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
@@ -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 {
diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php
index ac5514e11e1..93cf302ff89 100644
--- a/apps/dav/lib/Connector/Sabre/Node.php
+++ b/apps/dav/lib/Connector/Sabre/Node.php
@@ -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());
}
}
diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php
index 94098b4aca3..6cdd5708743 100644
--- a/apps/dav/lib/Connector/Sabre/ObjectTree.php
+++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php
@@ -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());
}
diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php
index 029061694ea..0151bc9cf69 100644
--- a/apps/dav/lib/Connector/Sabre/Principal.php
+++ b/apps/dav/lib/Connector/Sabre/Principal.php
@@ -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 */
diff --git a/apps/dav/lib/Connector/Sabre/PublicAuth.php b/apps/dav/lib/Connector/Sabre/PublicAuth.php
index 3e2cd81a800..977b3bf304e 100644
--- a/apps/dav/lib/Connector/Sabre/PublicAuth.php
+++ b/apps/dav/lib/Connector/Sabre/PublicAuth.php
@@ -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();
}
diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php
index 617ba60f80d..967bd0a74b8 100644
--- a/apps/dav/lib/Connector/Sabre/ServerFactory.php
+++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php
@@ -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);
diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php
index a3f2847ee1a..c048b79484a 100644
--- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php
@@ -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;
}
diff --git a/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php b/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
index 8484dfa1935..7e92dd18c83 100644
--- a/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
@@ -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;
}
diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php
index 3bc729d6407..1b785962112 100644
--- a/apps/dav/lib/Files/FileSearchBackend.php
+++ b/apps/dav/lib/Files/FileSearchBackend.php
@@ -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);
diff --git a/apps/dav/lib/Files/FilesHome.php b/apps/dav/lib/Files/FilesHome.php
index 1c0c531e2f9..b865b7c1bb6 100644
--- a/apps/dav/lib/Files/FilesHome.php
+++ b/apps/dav/lib/Files/FilesHome.php
@@ -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);
}
diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php
index d9ba4c3e2a6..6ede8cb683c 100644
--- a/apps/dav/lib/RootCollection.php
+++ b/apps/dav/lib/RootCollection.php
@@ -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,
diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php
index 4bfc8019218..986f7465051 100644
--- a/apps/dav/lib/Server.php
+++ b/apps/dav/lib/Server.php
@@ -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
diff --git a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
index 85000aba6d3..21e999d34be 100644
--- a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
@@ -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())
diff --git a/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php b/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
index 4874e79b9a2..82d2251f17a 100644
--- a/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
@@ -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 {
diff --git a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
index 89ef73ec134..f895deb7fd1 100644
--- a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
@@ -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;
diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
index 708581f9b6d..42eb0b0faa3 100644
--- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
+++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
@@ -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) {
diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php
index 98d49552b02..bdb318ee32f 100644
--- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php
+++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php
@@ -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');
diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
index ed39129fa56..b2fd9cfb93f 100644
--- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
@@ -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 */
diff --git a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
index ae4519e2542..0da971dc36b 100644
--- a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
@@ -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 {
diff --git a/apps/dav/tests/unit/Command/ListAddressbooksTest.php b/apps/dav/tests/unit/Command/ListAddressbooksTest.php
index b6a8c25477c..2c6b1579042 100644
--- a/apps/dav/tests/unit/Command/ListAddressbooksTest.php
+++ b/apps/dav/tests/unit/Command/ListAddressbooksTest.php
@@ -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;
diff --git a/apps/dav/tests/unit/Comments/EntityCollectionTest.php b/apps/dav/tests/unit/Comments/EntityCollectionTest.php
index 0d4adae250e..6996022b607 100644
--- a/apps/dav/tests/unit/Comments/EntityCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/EntityCollectionTest.php
@@ -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'));
}
diff --git a/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php b/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
index 5ab9c38ecd0..15b8073481c 100644
--- a/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
@@ -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,
diff --git a/apps/dav/tests/unit/Comments/RootCollectionTest.php b/apps/dav/tests/unit/Comments/RootCollectionTest.php
index 6da96be5818..8f58e5c3c5f 100644
--- a/apps/dav/tests/unit/Comments/RootCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/RootCollectionTest.php
@@ -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,
diff --git a/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php b/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php
index 4f3581d6071..2bb68374162 100644
--- a/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php
+++ b/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php
@@ -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,
diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
index de258c9aaec..c6d247b3951 100644
--- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
@@ -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');
diff --git a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php
index 9922dee5e6e..06c070454af 100644
--- a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php
@@ -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);
diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
index 7da38afdf3a..3f134745f86 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
@@ -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(),
diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
index 3490937a543..d659b01d039 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
@@ -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);
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index 55a6783225d..ef02f145375 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -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')));
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
index 9d8f4e8d4c4..db07165ebf0 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
@@ -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(
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
index 76a70a93e13..8b169dcd46f 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
@@ -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),
diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
index c5e2b03d8b4..04cd60fbdaa 100644
--- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
@@ -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]);
}
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
index 4f2e5174325..393f3c72c20 100644
--- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
@@ -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));
diff --git a/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php b/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php
index b6c91cd7ae5..00bddf2e69c 100644
--- a/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php
@@ -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,
diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
index 815837799fd..c370e0fb0f7 100644
--- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
@@ -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 {
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php
index 9b20b2f8630..b1e68f9597b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php
+++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php
@@ -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[]
*/
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
index 29574d53bca..67c2aa61430 100644
--- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
+++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
@@ -25,7 +25,7 @@ abstract class RequestTestCase extends TestCase {
use MountProviderTrait;
/**
- * @var \OCA\DAV\Connector\Sabre\ServerFactory
+ * @var ServerFactory
*/
protected $serverFactory;
diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
index 546be840cd8..125fe3959bb 100644
--- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
@@ -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,
diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
index 635f62dac87..59fd1e56963 100644
--- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
@@ -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(
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
index 308950cef34..ed830685b7a 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
@@ -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',
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
index 82aa81674df..7ad1d34d94f 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
@@ -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,
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
index 67e7afa9c54..91dab4ecf11 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
@@ -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,
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
index db55d82adc9..2ffbc1cf01f 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
@@ -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
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
index c2e62f73828..66052847f16 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
@@ -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,
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
index b202f340e32..62f6963e202 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
@@ -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'));
}
diff --git a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php
index a8517bf757c..51c53fb262f 100644
--- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php
+++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php
@@ -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) {
diff --git a/apps/dav/tests/unit/Upload/FutureFileTest.php b/apps/dav/tests/unit/Upload/FutureFileTest.php
index 9ec455a9595..750670992eb 100644
--- a/apps/dav/tests/unit/Upload/FutureFileTest.php
+++ b/apps/dav/tests/unit/Upload/FutureFileTest.php
@@ -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');
}
}