aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external
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/files_external
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/files_external')
-rw-r--r--apps/files_external/lib/Command/Verify.php3
-rw-r--r--apps/files_external/lib/Config/ConfigAdapter.php9
-rw-r--r--apps/files_external/lib/Controller/ApiController.php5
-rw-r--r--apps/files_external/lib/Controller/StoragesController.php3
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php3
-rw-r--r--apps/files_external/lib/Lib/Storage/OwnCloud.php3
-rw-r--r--apps/files_external/lib/Lib/Storage/SFTP.php3
-rw-r--r--apps/files_external/lib/Lib/Storage/StreamWrapper.php4
-rw-r--r--apps/files_external/lib/Lib/Storage/Swift.php11
-rw-r--r--apps/files_external/lib/Lib/StorageConfig.php5
-rw-r--r--apps/files_external/lib/MountConfig.php6
-rw-r--r--apps/files_external/lib/Service/GlobalStoragesService.php19
-rw-r--r--apps/files_external/lib/Service/LegacyStoragesService.php9
-rw-r--r--apps/files_external/lib/Service/StoragesService.php6
-rw-r--r--apps/files_external/lib/Service/UserStoragesService.php3
-rw-r--r--apps/files_external/lib/Settings/Admin.php3
-rw-r--r--apps/files_external/lib/Settings/Personal.php3
-rw-r--r--apps/files_external/tests/Auth/Password/GlobalAuth.php3
-rw-r--r--apps/files_external/tests/Command/CommandTest.php3
-rw-r--r--apps/files_external/tests/Controller/StoragesControllerTest.php9
-rw-r--r--apps/files_external/tests/OwnCloudFunctionsTest.php4
-rw-r--r--apps/files_external/tests/PersonalMountTest.php3
-rw-r--r--apps/files_external/tests/Service/BackendServiceTest.php2
-rw-r--r--apps/files_external/tests/Service/GlobalStoragesServiceTest.php73
-rw-r--r--apps/files_external/tests/Service/StoragesServiceTest.php19
-rw-r--r--apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php3
-rw-r--r--apps/files_external/tests/Service/UserStoragesServiceTest.php14
-rw-r--r--apps/files_external/tests/Settings/AdminTest.php3
28 files changed, 136 insertions, 98 deletions
diff --git a/apps/files_external/lib/Command/Verify.php b/apps/files_external/lib/Command/Verify.php
index 1455e427b77..32c94fc582a 100644
--- a/apps/files_external/lib/Command/Verify.php
+++ b/apps/files_external/lib/Command/Verify.php
@@ -9,6 +9,7 @@ namespace OCA\Files_External\Command;
use OC\Core\Command\Base;
use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\GlobalStoragesService;
use OCP\AppFramework\Http;
@@ -92,7 +93,7 @@ class Verify extends Base {
$backend = $storage->getBackend();
// update status (can be time-consuming)
$storage->setStatus(
- \OCA\Files_External\MountConfig::getBackendStatus(
+ MountConfig::getBackendStatus(
$backend->getStorageClass(),
$storage->getBackendOptions(),
false
diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php
index a55406b302e..be435d4de2f 100644
--- a/apps/files_external/lib/Config/ConfigAdapter.php
+++ b/apps/files_external/lib/Config/ConfigAdapter.php
@@ -6,11 +6,13 @@
*/
namespace OCA\Files_External\Config;
+use OC\Files\Cache\Storage;
use OC\Files\Storage\FailedStorage;
use OC\Files\Storage\Wrapper\Availability;
use OC\Files\Storage\Wrapper\KnownMtime;
use OCA\Files_External\Lib\PersonalMount;
use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
use OCA\Files_External\Service\UserGlobalStoragesService;
use OCA\Files_External\Service\UserStoragesService;
use OCP\Files\Config\IMountProvider;
@@ -20,6 +22,7 @@ use OCP\Files\Storage\IStorage;
use OCP\Files\Storage\IStorageFactory;
use OCP\Files\StorageNotAvailableException;
use OCP\IUser;
+use OCP\Server;
use Psr\Clock\ClockInterface;
use Psr\Log\LoggerInterface;
@@ -41,7 +44,7 @@ class ConfigAdapter implements IMountProvider {
*/
private function prepareStorageConfig(StorageConfig &$storage, IUser $user): void {
foreach ($storage->getBackendOptions() as $option => $value) {
- $storage->setBackendOption($option, \OCA\Files_External\MountConfig::substitutePlaceholdersInConfig($value, $user->getUID()));
+ $storage->setBackendOption($option, MountConfig::substitutePlaceholdersInConfig($value, $user->getUID()));
}
$objectStore = $storage->getBackendOption('objectstore');
@@ -65,7 +68,7 @@ class ConfigAdapter implements IMountProvider {
private function constructStorage(StorageConfig $storageConfig): IStorage {
$class = $storageConfig->getBackend()->getStorageClass();
if (!is_a($class, IConstructableStorage::class, true)) {
- \OCP\Server::get(LoggerInterface::class)->warning('Building a storage not implementing IConstructableStorage is deprecated since 31.0.0', ['class' => $class]);
+ Server::get(LoggerInterface::class)->warning('Building a storage not implementing IConstructableStorage is deprecated since 31.0.0', ['class' => $class]);
}
$storage = new $class($storageConfig->getBackendOptions());
@@ -98,7 +101,7 @@ class ConfigAdapter implements IMountProvider {
}, $storageConfigs);
- \OC\Files\Cache\Storage::getGlobalCache()->loadForStorageIds(array_map(function (IStorage $storage) {
+ Storage::getGlobalCache()->loadForStorageIds(array_map(function (IStorage $storage) {
return $storage->getId();
}, $storages));
diff --git a/apps/files_external/lib/Controller/ApiController.php b/apps/files_external/lib/Controller/ApiController.php
index d326e1f7f44..cb8d8cbb0ff 100644
--- a/apps/files_external/lib/Controller/ApiController.php
+++ b/apps/files_external/lib/Controller/ApiController.php
@@ -17,6 +17,7 @@ use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
+use OCP\Constants;
use OCP\IRequest;
/**
@@ -55,10 +56,10 @@ class ApiController extends OCSController {
$isSystemMount = $mountConfig->getType() === StorageConfig::MOUNT_TYPE_ADMIN;
- $permissions = \OCP\Constants::PERMISSION_READ;
+ $permissions = Constants::PERMISSION_READ;
// personal mounts can be deleted
if (!$isSystemMount) {
- $permissions |= \OCP\Constants::PERMISSION_DELETE;
+ $permissions |= Constants::PERMISSION_DELETE;
}
$entry = [
diff --git a/apps/files_external/lib/Controller/StoragesController.php b/apps/files_external/lib/Controller/StoragesController.php
index fcd3863e658..9144b766d5d 100644
--- a/apps/files_external/lib/Controller/StoragesController.php
+++ b/apps/files_external/lib/Controller/StoragesController.php
@@ -10,6 +10,7 @@ use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Backend\Backend;
use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\StoragesService;
use OCP\AppFramework\Controller;
@@ -220,7 +221,7 @@ abstract class StoragesController extends Controller {
$backend = $storage->getBackend();
// update status (can be time-consuming)
$storage->setStatus(
- \OCA\Files_External\MountConfig::getBackendStatus(
+ MountConfig::getBackendStatus(
$backend->getStorageClass(),
$storage->getBackendOptions(),
false,
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index be07314311e..63f08dd4131 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -13,6 +13,7 @@ use Icewind\Streams\IteratorDirectory;
use OC\Files\Cache\CacheEntry;
use OC\Files\ObjectStore\S3ConnectionTrait;
use OC\Files\ObjectStore\S3ObjectTrait;
+use OC\Files\Storage\Common;
use OCP\Cache\CappedMemoryCache;
use OCP\Constants;
use OCP\Files\FileInfo;
@@ -22,7 +23,7 @@ use OCP\ICacheFactory;
use OCP\Server;
use Psr\Log\LoggerInterface;
-class AmazonS3 extends \OC\Files\Storage\Common {
+class AmazonS3 extends Common {
use S3ConnectionTrait;
use S3ObjectTrait;
diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php
index 5de708afb04..ff519c60e2d 100644
--- a/apps/files_external/lib/Lib/Storage/OwnCloud.php
+++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php
@@ -6,6 +6,7 @@
*/
namespace OCA\Files_External\Lib\Storage;
+use OC\Files\Storage\DAV;
use OCP\Files\Storage\IDisableEncryptionStorage;
use Sabre\DAV\Client;
@@ -16,7 +17,7 @@ use Sabre\DAV\Client;
* http://%host/%context/remote.php/webdav/%root
*
*/
-class OwnCloud extends \OC\Files\Storage\DAV implements IDisableEncryptionStorage {
+class OwnCloud extends DAV implements IDisableEncryptionStorage {
public const OC_URL_SUFFIX = 'remote.php/webdav';
public function __construct($params) {
diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php
index e5188db9bcc..c430cc2b5fd 100644
--- a/apps/files_external/lib/Lib/Storage/SFTP.php
+++ b/apps/files_external/lib/Lib/Storage/SFTP.php
@@ -10,6 +10,7 @@ use Icewind\Streams\CountWrapper;
use Icewind\Streams\IteratorDirectory;
use Icewind\Streams\RetryWrapper;
use OC\Files\Storage\Common;
+use OC\Files\View;
use OCP\Constants;
use OCP\Files\FileInfo;
use OCP\Files\IMimeTypeDetector;
@@ -174,7 +175,7 @@ class SFTP extends Common {
return false;
}
- $view = new \OC\Files\View('/' . $userId . '/files_external');
+ $view = new View('/' . $userId . '/files_external');
return $view->getLocalFile('ssh_hostKeys');
} catch (\Exception $e) {
diff --git a/apps/files_external/lib/Lib/Storage/StreamWrapper.php b/apps/files_external/lib/Lib/Storage/StreamWrapper.php
index 8d90161323d..0490acc98e1 100644
--- a/apps/files_external/lib/Lib/Storage/StreamWrapper.php
+++ b/apps/files_external/lib/Lib/Storage/StreamWrapper.php
@@ -6,7 +6,9 @@
*/
namespace OCA\Files_External\Lib\Storage;
-abstract class StreamWrapper extends \OC\Files\Storage\Common {
+use OC\Files\Storage\Common;
+
+abstract class StreamWrapper extends Common {
abstract public function constructUrl(string $path): ?string;
diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php
index 0dd6e64bc65..985d51dccd8 100644
--- a/apps/files_external/lib/Lib/Storage/Swift.php
+++ b/apps/files_external/lib/Lib/Storage/Swift.php
@@ -12,7 +12,10 @@ namespace OCA\Files_External\Lib\Storage;
use GuzzleHttp\Psr7\Uri;
use Icewind\Streams\CallbackWrapper;
use Icewind\Streams\IteratorDirectory;
+use OC\Files\Filesystem;
use OC\Files\ObjectStore\SwiftFactory;
+use OC\Files\Storage\Common;
+use OCP\Cache\CappedMemoryCache;
use OCP\Files\IMimeTypeDetector;
use OCP\Files\StorageBadConfigException;
use OpenStack\Common\Error\BadResponseError;
@@ -20,7 +23,7 @@ use OpenStack\ObjectStore\v1\Models\Container;
use OpenStack\ObjectStore\v1\Models\StorageObject;
use Psr\Log\LoggerInterface;
-class Swift extends \OC\Files\Storage\Common {
+class Swift extends Common {
/** @var SwiftFactory */
private $connectionFactory;
/**
@@ -155,7 +158,7 @@ class Swift extends \OC\Files\Storage\Common {
$this->params = $params;
// FIXME: private class...
- $this->objectCache = new \OCP\Cache\CappedMemoryCache();
+ $this->objectCache = new CappedMemoryCache();
$this->connectionFactory = new SwiftFactory(
\OC::$server->getMemCacheFactory()->createDistributed('swift/'),
$this->params,
@@ -216,7 +219,7 @@ class Swift extends \OC\Files\Storage\Common {
$dh = $this->opendir($path);
while (($file = readdir($dh)) !== false) {
- if (\OC\Files\Filesystem::isIgnoredDir($file)) {
+ if (Filesystem::isIgnoredDir($file)) {
continue;
}
@@ -482,7 +485,7 @@ class Swift extends \OC\Files\Storage\Common {
$dh = $this->opendir($source);
while (($file = readdir($dh)) !== false) {
- if (\OC\Files\Filesystem::isIgnoredDir($file)) {
+ if (Filesystem::isIgnoredDir($file)) {
continue;
}
diff --git a/apps/files_external/lib/Lib/StorageConfig.php b/apps/files_external/lib/Lib/StorageConfig.php
index 682516c73ba..12523937071 100644
--- a/apps/files_external/lib/Lib/StorageConfig.php
+++ b/apps/files_external/lib/Lib/StorageConfig.php
@@ -6,6 +6,7 @@
*/
namespace OCA\Files_External\Lib;
+use OC\Files\Filesystem;
use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Auth\IUserProvided;
use OCA\Files_External\Lib\Backend\Backend;
@@ -152,7 +153,7 @@ class StorageConfig implements \JsonSerializable {
* @param string $mountPoint path
*/
public function setMountPoint($mountPoint) {
- $this->mountPoint = \OC\Files\Filesystem::normalizePath($mountPoint);
+ $this->mountPoint = Filesystem::normalizePath($mountPoint);
}
/**
@@ -203,7 +204,7 @@ class StorageConfig implements \JsonSerializable {
foreach ($backendOptions as $key => $value) {
if (isset($parameters[$key])) {
switch ($parameters[$key]->getType()) {
- case \OCA\Files_External\Lib\DefinitionParameter::VALUE_BOOLEAN:
+ case DefinitionParameter::VALUE_BOOLEAN:
$value = (bool)$value;
break;
}
diff --git a/apps/files_external/lib/MountConfig.php b/apps/files_external/lib/MountConfig.php
index 1cbd6e14ebe..744bdcacef3 100644
--- a/apps/files_external/lib/MountConfig.php
+++ b/apps/files_external/lib/MountConfig.php
@@ -14,6 +14,8 @@ use OCA\Files_External\Service\GlobalStoragesService;
use OCA\Files_External\Service\UserGlobalStoragesService;
use OCA\Files_External\Service\UserStoragesService;
use OCP\Files\StorageNotAvailableException;
+use OCP\IL10N;
+use OCP\Util;
use phpseclib\Crypt\AES;
use Psr\Log\LoggerInterface;
@@ -119,7 +121,7 @@ class MountConfig {
* @param Backend[] $backends
*/
public static function dependencyMessage(array $backends): string {
- $l = \OCP\Util::getL10N('files_external');
+ $l = Util::getL10N('files_external');
$message = '';
$dependencyGroups = [];
@@ -147,7 +149,7 @@ class MountConfig {
/**
* Returns a dependency missing message
*/
- private static function getSingleDependencyMessage(\OCP\IL10N $l, string $module, string $backend): string {
+ private static function getSingleDependencyMessage(IL10N $l, string $module, string $backend): string {
switch (strtolower($module)) {
case 'curl':
return $l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]);
diff --git a/apps/files_external/lib/Service/GlobalStoragesService.php b/apps/files_external/lib/Service/GlobalStoragesService.php
index c799007cc6d..92961d73228 100644
--- a/apps/files_external/lib/Service/GlobalStoragesService.php
+++ b/apps/files_external/lib/Service/GlobalStoragesService.php
@@ -8,6 +8,7 @@ namespace OCA\Files_External\Service;
use OC\Files\Filesystem;
use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
/**
* Service class to manage global external storage
@@ -29,7 +30,7 @@ class GlobalStoragesService extends StoragesService {
$this->triggerApplicableHooks(
$signal,
$storage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
['all']
);
return;
@@ -38,13 +39,13 @@ class GlobalStoragesService extends StoragesService {
$this->triggerApplicableHooks(
$signal,
$storage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
$applicableUsers
);
$this->triggerApplicableHooks(
$signal,
$storage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
$applicableGroups
);
}
@@ -78,7 +79,7 @@ class GlobalStoragesService extends StoragesService {
$this->triggerApplicableHooks(
Filesystem::signal_delete_mount,
$oldStorage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
['all']
);
}
@@ -87,7 +88,7 @@ class GlobalStoragesService extends StoragesService {
$this->triggerApplicableHooks(
Filesystem::signal_delete_mount,
$oldStorage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
$userDeletions
);
@@ -95,7 +96,7 @@ class GlobalStoragesService extends StoragesService {
$this->triggerApplicableHooks(
Filesystem::signal_delete_mount,
$oldStorage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
$groupDeletions
);
@@ -103,7 +104,7 @@ class GlobalStoragesService extends StoragesService {
$this->triggerApplicableHooks(
Filesystem::signal_create_mount,
$newStorage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
$userAdditions
);
@@ -111,7 +112,7 @@ class GlobalStoragesService extends StoragesService {
$this->triggerApplicableHooks(
Filesystem::signal_create_mount,
$newStorage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
$groupAdditions
);
@@ -123,7 +124,7 @@ class GlobalStoragesService extends StoragesService {
$this->triggerApplicableHooks(
Filesystem::signal_create_mount,
$newStorage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
['all']
);
}
diff --git a/apps/files_external/lib/Service/LegacyStoragesService.php b/apps/files_external/lib/Service/LegacyStoragesService.php
index 1f5cf8cdf28..20a26a07e8b 100644
--- a/apps/files_external/lib/Service/LegacyStoragesService.php
+++ b/apps/files_external/lib/Service/LegacyStoragesService.php
@@ -7,6 +7,7 @@
namespace OCA\Files_External\Service;
use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
use Psr\Log\LoggerInterface;
/**
@@ -62,13 +63,13 @@ abstract class LegacyStoragesService {
$storageOptions['priority'] = $backend->getPriority();
}
$storageConfig->setPriority($storageOptions['priority']);
- if ($mountType === \OCA\Files_External\MountConfig::MOUNT_TYPE_USER) {
+ if ($mountType === MountConfig::MOUNT_TYPE_USER) {
$applicableUsers = $storageConfig->getApplicableUsers();
if ($applicable !== 'all') {
$applicableUsers[] = $applicable;
$storageConfig->setApplicableUsers($applicableUsers);
}
- } elseif ($mountType === \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP) {
+ } elseif ($mountType === MountConfig::MOUNT_TYPE_GROUP) {
$applicableGroups = $storageConfig->getApplicableGroups();
$applicableGroups[] = $applicable;
$storageConfig->setApplicableGroups($applicableGroups);
@@ -129,7 +130,7 @@ abstract class LegacyStoragesService {
$relativeMountPath = rtrim($parts[2], '/');
// note: we cannot do this after the loop because the decrypted config
// options might be needed for the config hash
- $storageOptions['options'] = \OCA\Files_External\MountConfig::decryptPasswords($storageOptions['options']);
+ $storageOptions['options'] = MountConfig::decryptPasswords($storageOptions['options']);
if (!isset($storageOptions['backend'])) {
$storageOptions['backend'] = $storageOptions['class']; // legacy compat
}
@@ -147,7 +148,7 @@ abstract class LegacyStoragesService {
// but at this point we don't know the max-id, so use
// first group it by config hash
$storageOptions['mountpoint'] = $rootMountPath;
- $configId = \OCA\Files_External\MountConfig::makeConfigHash($storageOptions);
+ $configId = MountConfig::makeConfigHash($storageOptions);
if (isset($storagesWithConfigHash[$configId])) {
$currentStorage = $storagesWithConfigHash[$configId];
}
diff --git a/apps/files_external/lib/Service/StoragesService.php b/apps/files_external/lib/Service/StoragesService.php
index 40bf5bfe1a8..12bf074a095 100644
--- a/apps/files_external/lib/Service/StoragesService.php
+++ b/apps/files_external/lib/Service/StoragesService.php
@@ -6,6 +6,7 @@
*/
namespace OCA\Files_External\Service;
+use OC\Files\Cache\Storage;
use OC\Files\Filesystem;
use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Auth\InvalidAuth;
@@ -18,6 +19,7 @@ use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\Events\InvalidateMountCacheEvent;
use OCP\Files\StorageNotAvailableException;
+use OCP\Util;
use Psr\Log\LoggerInterface;
/**
@@ -324,7 +326,7 @@ abstract class StoragesService {
protected function triggerApplicableHooks($signal, $mountPoint, $mountType, $applicableArray): void {
$this->eventDispatcher->dispatchTyped(new InvalidateMountCacheEvent(null));
foreach ($applicableArray as $applicable) {
- \OCP\Util::emitHook(
+ Util::emitHook(
Filesystem::CLASSNAME,
$signal,
[
@@ -463,7 +465,7 @@ abstract class StoragesService {
$this->triggerHooks($deletedStorage, Filesystem::signal_delete_mount);
// delete oc_storages entries and oc_filecache
- \OC\Files\Cache\Storage::cleanByMountId($id);
+ Storage::cleanByMountId($id);
}
/**
diff --git a/apps/files_external/lib/Service/UserStoragesService.php b/apps/files_external/lib/Service/UserStoragesService.php
index b461451389b..defa97451cd 100644
--- a/apps/files_external/lib/Service/UserStoragesService.php
+++ b/apps/files_external/lib/Service/UserStoragesService.php
@@ -8,6 +8,7 @@ namespace OCA\Files_External\Service;
use OC\Files\Filesystem;
use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
use OCA\Files_External\NotFoundException;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\IUserMountCache;
@@ -58,7 +59,7 @@ class UserStoragesService extends StoragesService {
$this->triggerApplicableHooks(
$signal,
$storage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
[$user]
);
}
diff --git a/apps/files_external/lib/Settings/Admin.php b/apps/files_external/lib/Settings/Admin.php
index 707f7704702..41f2c43b5f1 100644
--- a/apps/files_external/lib/Settings/Admin.php
+++ b/apps/files_external/lib/Settings/Admin.php
@@ -6,6 +6,7 @@
namespace OCA\Files_External\Settings;
use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
+use OCA\Files_External\MountConfig;
use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Service\GlobalStoragesService;
use OCP\AppFramework\Http\TemplateResponse;
@@ -48,7 +49,7 @@ class Admin implements ISettings {
'storages' => $this->globalStoragesService->getStorages(),
'backends' => $this->backendService->getAvailableBackends(),
'authMechanisms' => $this->backendService->getAuthMechanisms(),
- 'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
+ 'dependencies' => MountConfig::dependencyMessage($this->backendService->getBackends()),
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
'globalCredentials' => $this->globalAuth->getAuth(''),
'globalCredentialsUid' => '',
diff --git a/apps/files_external/lib/Settings/Personal.php b/apps/files_external/lib/Settings/Personal.php
index f84051626a2..186b2638e1f 100644
--- a/apps/files_external/lib/Settings/Personal.php
+++ b/apps/files_external/lib/Settings/Personal.php
@@ -6,6 +6,7 @@
namespace OCA\Files_External\Settings;
use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
+use OCA\Files_External\MountConfig;
use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Service\UserGlobalStoragesService;
use OCP\AppFramework\Http\TemplateResponse;
@@ -56,7 +57,7 @@ class Personal implements ISettings {
'storages' => $this->userGlobalStoragesService->getStorages(),
'backends' => $this->backendService->getAvailableBackends(),
'authMechanisms' => $this->backendService->getAuthMechanisms(),
- 'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
+ 'dependencies' => MountConfig::dependencyMessage($this->backendService->getBackends()),
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
'globalCredentials' => $this->globalAuth->getAuth($uid),
'globalCredentialsUid' => $uid,
diff --git a/apps/files_external/tests/Auth/Password/GlobalAuth.php b/apps/files_external/tests/Auth/Password/GlobalAuth.php
index 823b66702ab..aa28083e09e 100644
--- a/apps/files_external/tests/Auth/Password/GlobalAuth.php
+++ b/apps/files_external/tests/Auth/Password/GlobalAuth.php
@@ -7,6 +7,7 @@
namespace OCA\Files_External\Tests\Auth\Password;
use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
+use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
use OCA\Files_external\Lib\StorageConfig;
use OCP\IL10N;
use OCP\Security\ICredentialsManager;
@@ -90,7 +91,7 @@ class GlobalAuthTest extends TestCase {
public function testNoCredentialsPersonal(): void {
- $this->expectException(\OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException::class);
+ $this->expectException(InsufficientDataForMeaningfulAnswerException::class);
$this->credentialsManager->expects($this->never())
->method('retrieve');
diff --git a/apps/files_external/tests/Command/CommandTest.php b/apps/files_external/tests/Command/CommandTest.php
index eb47fe08ac4..ed991fd784d 100644
--- a/apps/files_external/tests/Command/CommandTest.php
+++ b/apps/files_external/tests/Command/CommandTest.php
@@ -8,6 +8,7 @@ namespace OCA\Files_External\Tests\Command;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\NotFoundException;
+use OCA\Files_External\Service\GlobalStoragesService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\Input;
@@ -17,7 +18,7 @@ use Test\TestCase;
abstract class CommandTest extends TestCase {
/**
* @param StorageConfig[] $mounts
- * @return \OCA\Files_External\Service\GlobalStoragesService|\PHPUnit\Framework\MockObject\MockObject
+ * @return GlobalStoragesService|\PHPUnit\Framework\MockObject\MockObject
*/
protected function getGlobalStorageService(array $mounts = []) {
$mock = $this->getMockBuilder('OCA\Files_External\Service\GlobalStoragesService')
diff --git a/apps/files_external/tests/Controller/StoragesControllerTest.php b/apps/files_external/tests/Controller/StoragesControllerTest.php
index 94512c56cad..0d604ff2d47 100644
--- a/apps/files_external/tests/Controller/StoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/StoragesControllerTest.php
@@ -9,8 +9,9 @@ namespace OCA\Files_External\Tests\Controller;
use OCA\Files_External\Controller\GlobalStoragesController;
use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Backend\Backend;
-
use OCA\Files_External\Lib\StorageConfig;
+
+use OCA\Files_External\MountConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\GlobalStoragesService;
use OCA\Files_External\Service\UserStoragesService;
@@ -30,11 +31,11 @@ abstract class StoragesControllerTest extends \Test\TestCase {
protected $service;
protected function setUp(): void {
- \OCA\Files_External\MountConfig::$skipTest = true;
+ MountConfig::$skipTest = true;
}
protected function tearDown(): void {
- \OCA\Files_External\MountConfig::$skipTest = false;
+ MountConfig::$skipTest = false;
}
/**
@@ -54,7 +55,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
}
/**
- * @return \OCA\Files_External\Lib\Auth\AuthMechanism|MockObject
+ * @return AuthMechanism|MockObject
*/
protected function getAuthMechMock($scheme = 'null', $class = '\OCA\Files_External\Lib\Auth\NullMechanism') {
$authMech = $this->getMockBuilder(AuthMechanism::class)
diff --git a/apps/files_external/tests/OwnCloudFunctionsTest.php b/apps/files_external/tests/OwnCloudFunctionsTest.php
index 99cb0cf94de..3488195d3e8 100644
--- a/apps/files_external/tests/OwnCloudFunctionsTest.php
+++ b/apps/files_external/tests/OwnCloudFunctionsTest.php
@@ -6,6 +6,8 @@
*/
namespace OCA\Files_External\Tests;
+use OCA\Files_External\Lib\Storage\OwnCloud;
+
/**
* Class OwnCloudFunctions
*
@@ -89,7 +91,7 @@ class OwnCloudFunctionsTest extends \Test\TestCase {
public function testConfig($config, $expectedUri): void {
$config['user'] = 'someuser';
$config['password'] = 'somepassword';
- $instance = new \OCA\Files_External\Lib\Storage\OwnCloud($config);
+ $instance = new OwnCloud($config);
$this->assertEquals($expectedUri, $instance->createBaseUri());
}
}
diff --git a/apps/files_external/tests/PersonalMountTest.php b/apps/files_external/tests/PersonalMountTest.php
index 2d8f41c3e50..b268d3b5142 100644
--- a/apps/files_external/tests/PersonalMountTest.php
+++ b/apps/files_external/tests/PersonalMountTest.php
@@ -10,12 +10,13 @@ use OC\Files\Mount\Manager;
use OC\Files\SetupManagerFactory;
use OCA\Files_External\Lib\PersonalMount;
use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\Service\UserStoragesService;
use Test\TestCase;
class PersonalMountTest extends TestCase {
public function testFindByStorageId(): void {
$storageConfig = $this->createMock(StorageConfig::class);
- /** @var \OCA\Files_External\Service\UserStoragesService $storageService */
+ /** @var UserStoragesService $storageService */
$storageService = $this->getMockBuilder('\OCA\Files_External\Service\UserStoragesService')
->disableOriginalConstructor()
->getMock();
diff --git a/apps/files_external/tests/Service/BackendServiceTest.php b/apps/files_external/tests/Service/BackendServiceTest.php
index 74a4b223a96..59907b07d6a 100644
--- a/apps/files_external/tests/Service/BackendServiceTest.php
+++ b/apps/files_external/tests/Service/BackendServiceTest.php
@@ -40,7 +40,7 @@ class BackendServiceTest extends \Test\TestCase {
/**
* @param string $class
*
- * @return \OCA\Files_External\Lib\Auth\AuthMechanism|\PHPUnit\Framework\MockObject\MockObject
+ * @return AuthMechanism|\PHPUnit\Framework\MockObject\MockObject
*/
protected function getAuthMechanismMock($class) {
$backend = $this->getMockBuilder(AuthMechanism::class)
diff --git a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php
index 0c9df2e858b..b4907f7f00f 100644
--- a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php
+++ b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php
@@ -7,6 +7,7 @@
namespace OCA\Files_External\Tests\Service;
use OC\Files\Filesystem;
+use OCA\Files_External\MountConfig;
use OCA\Files_External\Service\GlobalStoragesService;
@@ -181,7 +182,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'all'
],
],
@@ -194,7 +195,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user1',
],
],
@@ -207,7 +208,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group1',
],
],
@@ -219,12 +220,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user1',
],
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user2',
],
],
@@ -237,12 +238,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group1'
],
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group2'
],
],
@@ -255,22 +256,22 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user1',
],
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user2',
],
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group1'
],
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group2'
],
],
@@ -313,27 +314,27 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
// delete the "all entry"
[
Filesystem::signal_delete_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'all',
],
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user1',
],
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user2',
],
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group1'
],
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group2'
],
],
@@ -348,12 +349,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user2',
],
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group2'
],
],
@@ -368,12 +369,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_delete_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user2',
],
[
Filesystem::signal_delete_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group2'
],
],
@@ -388,18 +389,18 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_delete_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user1',
],
[
Filesystem::signal_delete_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group1'
],
// create the "all" entry
[
Filesystem::signal_create_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'all'
],
],
@@ -470,50 +471,50 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
Filesystem::signal_delete_mount,
'/mountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user1',
],
[
Filesystem::signal_delete_mount,
'/mountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user2',
],
[
Filesystem::signal_delete_mount,
'/mountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group1',
],
[
Filesystem::signal_delete_mount,
'/mountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group2',
],
// creates new one
[
Filesystem::signal_create_mount,
'/renamedMountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user1',
],
[
Filesystem::signal_create_mount,
'/renamedMountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user2',
],
[
Filesystem::signal_create_mount,
'/renamedMountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group1',
],
[
Filesystem::signal_create_mount,
'/renamedMountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group2',
],
];
@@ -540,22 +541,22 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_delete_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user1',
],
[
Filesystem::signal_delete_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'user2',
],
[
Filesystem::signal_delete_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group1'
],
[
Filesystem::signal_delete_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
+ MountConfig::MOUNT_TYPE_GROUP,
'group2'
],
],
@@ -567,7 +568,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
[
[
Filesystem::signal_delete_mount,
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
'all',
],
],
diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php
index 40cba73a74f..a4e823ab6f0 100644
--- a/apps/files_external/tests/Service/StoragesServiceTest.php
+++ b/apps/files_external/tests/Service/StoragesServiceTest.php
@@ -6,13 +6,15 @@
*/
namespace OCA\Files_External\Tests\Service;
+use OC\Files\Cache\Storage;
use OC\Files\Filesystem;
-
use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Auth\InvalidAuth;
+
use OCA\Files_External\Lib\Backend\Backend;
use OCA\Files_External\Lib\Backend\InvalidBackend;
use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Service\DBConfigService;
@@ -26,6 +28,7 @@ use OCP\Files\Storage\IStorage;
use OCP\IDBConnection;
use OCP\IUser;
use OCP\Server;
+use OCP\Util;
class CleaningDBConfig extends DBConfigService {
private $mountIds = [];
@@ -91,7 +94,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
'datadirectory',
\OC::$SERVERROOT . '/data/'
);
- \OCA\Files_External\MountConfig::$skipTest = true;
+ MountConfig::$skipTest = true;
$this->mountCache = $this->createMock(IUserMountCache::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
@@ -143,11 +146,11 @@ abstract class StoragesServiceTest extends \Test\TestCase {
->willReturn($backends);
$this->overwriteService(BackendService::class, $this->backendService);
- \OCP\Util::connectHook(
+ Util::connectHook(
Filesystem::CLASSNAME,
Filesystem::signal_create_mount,
get_class($this), 'createHookCallback');
- \OCP\Util::connectHook(
+ Util::connectHook(
Filesystem::CLASSNAME,
Filesystem::signal_delete_mount,
get_class($this), 'deleteHookCallback');
@@ -162,7 +165,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
}
protected function tearDown(): void {
- \OCA\Files_External\MountConfig::$skipTest = false;
+ MountConfig::$skipTest = false;
self::$hookCalls = [];
if ($this->dbConfig) {
$this->dbConfig->clean();
@@ -249,7 +252,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
}
public function testNonExistingStorage(): void {
- $this->expectException(\OCA\Files_External\NotFoundException::class);
+ $this->expectException(NotFoundException::class);
$this->ActualNonExistingStorageTest();
}
@@ -295,7 +298,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
// manually trigger storage entry because normally it happens on first
// access, which isn't possible within this test
- $storageCache = new \OC\Files\Cache\Storage($rustyStorageId, true, Server::get(IDBConnection::class));
+ $storageCache = new Storage($rustyStorageId, true, Server::get(IDBConnection::class));
/** @var IUserMountCache $mountCache */
$mountCache = \OC::$server->get(IUserMountCache::class);
@@ -353,7 +356,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
}
public function testDeleteUnexistingStorage(): void {
- $this->expectException(\OCA\Files_External\NotFoundException::class);
+ $this->expectException(NotFoundException::class);
$this->actualDeletedUnexistingStorageTest();
}
diff --git a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
index ff8d5f4e494..7aef65cebee 100644
--- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
+++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
@@ -6,6 +6,7 @@
*/
namespace OCA\Files_External\Tests\Service;
+use OC\User\User;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\StoragesService;
@@ -46,7 +47,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
$this->globalStoragesService = $this->service;
- $this->user = new \OC\User\User(self::USER_ID, null, \OC::$server->get(IEventDispatcher::class));
+ $this->user = new User(self::USER_ID, null, \OC::$server->get(IEventDispatcher::class));
/** @var \OCP\IUserSession|\PHPUnit\Framework\MockObject\MockObject $userSession */
$userSession = $this->createMock(IUserSession::class);
$userSession
diff --git a/apps/files_external/tests/Service/UserStoragesServiceTest.php b/apps/files_external/tests/Service/UserStoragesServiceTest.php
index cb7abfaf725..4a4404839a4 100644
--- a/apps/files_external/tests/Service/UserStoragesServiceTest.php
+++ b/apps/files_external/tests/Service/UserStoragesServiceTest.php
@@ -7,8 +7,10 @@
namespace OCA\Files_External\Tests\Service;
use OC\Files\Filesystem;
-
use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\MountConfig;
+
+use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\GlobalStoragesService;
use OCA\Files_External\Service\StoragesService;
use OCA\Files_External\Service\UserStoragesService;
@@ -85,7 +87,7 @@ class UserStoragesServiceTest extends StoragesServiceTest {
current(self::$hookCalls),
Filesystem::signal_create_mount,
$storage->getMountPoint(),
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
$this->userId
);
@@ -136,7 +138,7 @@ class UserStoragesServiceTest extends StoragesServiceTest {
self::$hookCalls[1],
Filesystem::signal_delete_mount,
'/mountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
$this->userId
);
}
@@ -157,21 +159,21 @@ class UserStoragesServiceTest extends StoragesServiceTest {
self::$hookCalls[0],
Filesystem::signal_delete_mount,
'/mountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
$this->userId
);
$this->assertHookCall(
self::$hookCalls[1],
Filesystem::signal_create_mount,
'/renamedMountpoint',
- \OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
+ MountConfig::MOUNT_TYPE_USER,
$this->userId
);
}
public function testGetAdminStorage(): void {
- $this->expectException(\OCA\Files_External\NotFoundException::class);
+ $this->expectException(NotFoundException::class);
$backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB');
$authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism');
diff --git a/apps/files_external/tests/Settings/AdminTest.php b/apps/files_external/tests/Settings/AdminTest.php
index 602e0124950..aceb8d2e915 100644
--- a/apps/files_external/tests/Settings/AdminTest.php
+++ b/apps/files_external/tests/Settings/AdminTest.php
@@ -6,6 +6,7 @@
namespace OCA\Files_External\Tests\Settings;
use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
+use OCA\Files_External\MountConfig;
use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Service\GlobalStoragesService;
use OCA\Files_External\Settings\Admin;
@@ -76,7 +77,7 @@ class AdminTest extends TestCase {
'storages' => ['a', 'b', 'c'],
'backends' => ['d', 'e', 'f'],
'authMechanisms' => ['g', 'h', 'i'],
- 'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
+ 'dependencies' => MountConfig::dependencyMessage($this->backendService->getBackends()),
'allowUserMounting' => true,
'globalCredentials' => 'asdf:asdf',
'globalCredentialsUid' => '',