From d0b20534b94d0295472ab22157a2bc4c2c9fb703 Mon Sep 17 00:00:00 2001 From: Hamid Dehnavi Date: Fri, 7 Jul 2023 04:54:20 +0330 Subject: Refactor "substr" calls to improve code readability Signed-off-by: Hamid Dehnavi --- lib/private/Files/Storage/DAV.php | 4 ++-- lib/private/Files/Storage/Local.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/private/Files/Storage') diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 70f22a17034..2d2bb52635b 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -120,9 +120,9 @@ class DAV extends Common { if (isset($params['host']) && isset($params['user']) && isset($params['password'])) { $host = $params['host']; //remove leading http[s], will be generated in createBaseUri() - if (substr($host, 0, 8) == "https://") { + if (str_starts_with($host, "https://")) { $host = substr($host, 8); - } elseif (substr($host, 0, 7) == "http://") { + } elseif (str_starts_with($host, "http://")) { $host = substr($host, 7); } $this->host = $host; diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index c0ce0e7021a..5515f5b1564 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -85,7 +85,7 @@ class Local extends \OC\Files\Storage\Common { $realPath = realpath($this->datadir) ?: $this->datadir; $this->realDataDir = rtrim($realPath, '/') . '/'; } - if (substr($this->datadir, -1) !== '/') { + if (!str_ends_with($this->datadir, '/')) { $this->datadir .= '/'; } $this->dataDirLength = strlen($this->realDataDir); @@ -155,7 +155,7 @@ class Local extends \OC\Files\Storage\Common { } public function is_dir($path) { - if (substr($path, -1) == '/') { + if (str_ends_with($path, '/')) { $path = substr($path, 0, -1); } return is_dir($this->getSourcePath($path)); -- cgit v1.2.3 From a031bc4788229b7943a13202998e895d08161490 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 14 Aug 2023 15:50:05 +0200 Subject: more share permission logic to storage wrapper this way we only have to determine the share permissions once Signed-off-by: Robin Appelman --- apps/files_sharing/tests/ApiTest.php | 4 ++++ lib/private/Files/FileInfo.php | 8 ++------ lib/private/Files/ObjectStore/HomeObjectStoreStorage.php | 3 ++- lib/private/Files/SetupManager.php | 16 ++++++++++++++-- lib/private/Files/Storage/Home.php | 3 ++- lib/public/Files/IHomeStorage.php | 8 ++++++++ 6 files changed, 32 insertions(+), 10 deletions(-) (limited to 'lib/private/Files/Storage') diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index d7661297e9e..3484bb29d94 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -36,6 +36,8 @@ namespace OCA\Files_Sharing\Tests; use OC\Files\Cache\Scanner; +use OC\Files\Filesystem; +use OC\Files\SetupManager; use OCA\Files_Sharing\Controller\ShareAPIController; use OCP\App\IAppManager; use OCP\AppFramework\OCS\OCSBadRequestException; @@ -74,6 +76,8 @@ class ApiTest extends TestCase { \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no'); \OC::$server->getConfig()->setAppValue('core', 'shareapi_expire_after_n_days', '7'); + Filesystem::getLoader()->removeStorageWrapper('sharing_mask'); + $this->folder = self::TEST_FOLDER_NAME; $this->subfolder = '/subfolder_share_api_test'; $this->subsubfolder = '/subsubfolder_share_api_test'; diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 2b6b83a2546..b3c4629e2b2 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -231,7 +231,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { } /** - * Return the currently version used for the HMAC in the encryption app + * Return the current version used for the HMAC in the encryption app */ public function getEncryptedVersion(): int { return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1; @@ -241,11 +241,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @return int */ public function getPermissions() { - $perms = (int) $this->data['permissions']; - if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) { - $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE; - } - return $perms; + return (int) $this->data['permissions']; } /** diff --git a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php index 824adcc1d0e..b361249ff47 100644 --- a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php @@ -26,6 +26,7 @@ namespace OC\Files\ObjectStore; use OC\User\User; +use OCP\IUser; class HomeObjectStoreStorage extends ObjectStoreStorage implements \OCP\Files\IHomeStorage { /** @@ -61,7 +62,7 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements \OCP\Files\IH * @param string $path, optional * @return \OC\User\User */ - public function getUser($path = null) { + public function getUser($path = null): IUser { return $this->user; } } diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index 2198c8c60b7..b1d609a9225 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -34,9 +34,11 @@ use OC\Files\Storage\Wrapper\Encoding; use OC\Files\Storage\Wrapper\PermissionsMask; use OC\Files\Storage\Wrapper\Quota; use OC\Lockdown\Filesystem\NullStorage; +use OC\Share\Share; use OC_App; use OC_Hook; use OC_Util; +use OCA\Files_Sharing\ISharedStorage; use OCP\Constants; use OCP\Diagnostics\IEventLogger; use OCP\EventDispatcher\IEventDispatcher; @@ -60,6 +62,7 @@ use OCP\IUserManager; use OCP\IUserSession; use OCP\Lockdown\ILockdownManager; use OCP\Share\Events\ShareCreatedEvent; +use OCP\Share\IManager; use Psr\Log\LoggerInterface; class SetupManager { @@ -139,8 +142,17 @@ class SetupManager { return $storage; }); - Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, IStorage $storage, IMountPoint $mount) { - if (!$mount->getOption('enable_sharing', true)) { + Filesystem::addStorageWrapper('sharing_mask', function ($mountPoint, IStorage $storage, IMountPoint $mount) { + $reSharingEnabled = Share::isResharingAllowed(); + $sharingEnabledForMount = $mount->getOption('enable_sharing', true); + /** @var IUserSession $userSession */ + $userSession = \OC::$server->get(IUserSession::class); + $user = $userSession->getUser(); + /** @var IManager $shareManager */ + $shareManager = \OC::$server->get(IManager::class); + $sharingEnabledForUser = $user ? !$shareManager->sharingDisabledForUser($user->getUID()) : true; + $isShared = $storage->instanceOfStorage(ISharedStorage::class); + if (!$sharingEnabledForMount || !$sharingEnabledForUser || (!$reSharingEnabled && $isShared)) { return new PermissionsMask([ 'storage' => $storage, 'mask' => Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE, diff --git a/lib/private/Files/Storage/Home.php b/lib/private/Files/Storage/Home.php index 5427bc425c2..5100b15215b 100644 --- a/lib/private/Files/Storage/Home.php +++ b/lib/private/Files/Storage/Home.php @@ -26,6 +26,7 @@ namespace OC\Files\Storage; use OC\Files\Cache\HomePropagator; +use OCP\IUser; /** * Specialized version of Local storage for home directory usage @@ -94,7 +95,7 @@ class Home extends Local implements \OCP\Files\IHomeStorage { * * @return \OC\User\User owner of this home storage */ - public function getUser() { + public function getUser(): IUser { return $this->user; } diff --git a/lib/public/Files/IHomeStorage.php b/lib/public/Files/IHomeStorage.php index 7eb3ffc4a24..1fea80f2d87 100644 --- a/lib/public/Files/IHomeStorage.php +++ b/lib/public/Files/IHomeStorage.php @@ -27,6 +27,7 @@ namespace OCP\Files; use OCP\Files\Storage\IStorage; +use OCP\IUser; /** * Interface IHomeStorage @@ -34,4 +35,11 @@ use OCP\Files\Storage\IStorage; * @since 7.0.0 */ interface IHomeStorage extends IStorage { + /** + * Get the user for this home storage + * + * @return IUser + * @since 28.0.0 + */ + public function getUser(): IUser; } -- cgit v1.2.3 From 8d1a3daa3fd7d1a4ecb7934662a76266a02ce225 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 3 Aug 2023 23:09:17 +0200 Subject: Allow ext storage Local to go unavailable Whenever an external storage of type Local points at a non-existing directory, process this as a StorageNotAvailable instead of returning 404. This makes desktop clients ignore the folder instead of deleting it when it becomes unavailable. The code change was limited to external storages to avoid issues during setup and with the default home storage. Signed-off-by: Vincent Petry --- apps/files_external/lib/Lib/Backend/Local.php | 6 ++++++ lib/private/Files/Storage/Local.php | 7 +++++++ tests/lib/Files/Storage/LocalTest.php | 11 +++++++++++ 3 files changed, 24 insertions(+) (limited to 'lib/private/Files/Storage') diff --git a/apps/files_external/lib/Lib/Backend/Local.php b/apps/files_external/lib/Lib/Backend/Local.php index 88b251360d6..bd15cb46127 100644 --- a/apps/files_external/lib/Lib/Backend/Local.php +++ b/apps/files_external/lib/Lib/Backend/Local.php @@ -26,8 +26,10 @@ namespace OCA\Files_External\Lib\Backend; use OCA\Files_External\Lib\Auth\AuthMechanism; use OCA\Files_External\Lib\Auth\NullMechanism; use OCA\Files_External\Lib\DefinitionParameter; +use OCA\Files_External\Lib\StorageConfig; use OCA\Files_External\Service\BackendService; use OCP\IL10N; +use OCP\IUser; class Local extends Backend { public function __construct(IL10N $l, NullMechanism $legacyAuth) { @@ -45,4 +47,8 @@ class Local extends Backend { ->setLegacyAuthMechanism($legacyAuth) ; } + + public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null): void { + $storage->setBackendOption('isExternal', true); + } } diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 02708ed4f7d..fdc30b49259 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -51,6 +51,7 @@ use OCP\Files\ForbiddenException; use OCP\Files\GenericFileException; use OCP\Files\IMimeTypeDetector; use OCP\Files\Storage\IStorage; +use OCP\Files\StorageNotAvailableException; use OCP\IConfig; use OCP\Util; use Psr\Log\LoggerInterface; @@ -95,6 +96,12 @@ class Local extends \OC\Files\Storage\Common { // support Write-Once-Read-Many file systems $this->unlinkOnTruncate = $this->config->getSystemValueBool('localstorage.unlink_on_truncate', false); + + if (isset($arguments['isExternal']) && $arguments['isExternal'] && !$this->stat('')) { + // data dir not accessible or available, can happen when using an external storage of type Local + // on an unmounted system mount point + throw new StorageNotAvailableException('Local storage path does not exist "' . $this->getSourcePath('') . '"'); + } } public function __destruct() { diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php index e324d2b28db..1190a2b2da0 100644 --- a/tests/lib/Files/Storage/LocalTest.php +++ b/tests/lib/Files/Storage/LocalTest.php @@ -139,4 +139,15 @@ class LocalTest extends Storage { umask($oldMask); $this->assertTrue($this->instance->isUpdatable('test.txt')); } + + public function testUnavailableExternal() { + $this->expectException(\OCP\Files\StorageNotAvailableException::class); + $this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir . '/unexist', 'isExternal' => true]); + } + + public function testUnavailableNonExternal() { + $this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir . '/unexist']); + // no exception thrown + $this->assertNotNull($this->instance); + } } -- cgit v1.2.3 From e4f85226c575d7013bedf6bfcccead006d97ceb9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 10 Jan 2023 13:48:31 +0100 Subject: extend fix-key-location to handle cases from broken cross-storage moves Signed-off-by: Robin Appelman --- apps/encryption/lib/Command/FixKeyLocation.php | 333 ++++++++++++++++++++--- lib/private/Encryption/EncryptionWrapper.php | 12 +- lib/private/Encryption/Manager.php | 7 + lib/private/Encryption/Util.php | 28 ++ lib/private/Files/Storage/Wrapper/Encryption.php | 46 ++-- 5 files changed, 356 insertions(+), 70 deletions(-) (limited to 'lib/private/Files/Storage') diff --git a/apps/encryption/lib/Command/FixKeyLocation.php b/apps/encryption/lib/Command/FixKeyLocation.php index 5339247ae19..b961b40f572 100644 --- a/apps/encryption/lib/Command/FixKeyLocation.php +++ b/apps/encryption/lib/Command/FixKeyLocation.php @@ -23,8 +23,11 @@ declare(strict_types=1); namespace OCA\Encryption\Command; +use OC\Encryption\Manager; use OC\Encryption\Util; +use OC\Files\Storage\Wrapper\Encryption; use OC\Files\View; +use OCP\Encryption\IManager; use OCP\Files\Config\ICachedMountInfo; use OCP\Files\Config\IUserMountCache; use OCP\Files\Folder; @@ -46,14 +49,25 @@ class FixKeyLocation extends Command { private IRootFolder $rootFolder; private string $keyRootDirectory; private View $rootView; + private Manager $encryptionManager; - public function __construct(IUserManager $userManager, IUserMountCache $userMountCache, Util $encryptionUtil, IRootFolder $rootFolder) { + public function __construct( + IUserManager $userManager, + IUserMountCache $userMountCache, + Util $encryptionUtil, + IRootFolder $rootFolder, + IManager $encryptionManager + ) { $this->userManager = $userManager; $this->userMountCache = $userMountCache; $this->encryptionUtil = $encryptionUtil; $this->rootFolder = $rootFolder; $this->keyRootDirectory = rtrim($this->encryptionUtil->getKeyStorageRoot(), '/'); $this->rootView = new View(); + if (!$encryptionManager instanceof Manager) { + throw new \Exception("Wrong encryption manager"); + } + $this->encryptionManager = $encryptionManager; parent::__construct(); } @@ -88,18 +102,71 @@ class FixKeyLocation extends Command { continue; } - $files = $this->getAllFiles($mountRootFolder); + $files = $this->getAllEncryptedFiles($mountRootFolder); foreach ($files as $file) { - if ($this->isKeyStoredForUser($user, $file)) { - if ($dryRun) { - $output->writeln("" . $file->getPath() . " needs migration"); + /** @var File $file */ + $hasSystemKey = $this->hasSystemKey($file); + $hasUserKey = $this->hasUserKey($user, $file); + if (!$hasSystemKey) { + if ($hasUserKey) { + // key was stored incorrectly as user key, migrate + + if ($dryRun) { + $output->writeln("" . $file->getPath() . " needs migration"); + } else { + $output->write("Migrating key for " . $file->getPath() . " "); + if ($this->copyUserKeyToSystemAndValidate($user, $file)) { + $output->writeln(""); + } else { + $output->writeln("❌"); + $output->writeln(" Failed to validate key for " . $file->getPath() . ", key will not be migrated"); + } + } } else { - $output->write("Migrating key for " . $file->getPath() . " "); - if ($this->copyKeyAndValidate($user, $file)) { - $output->writeln(""); + // no matching key, probably from a broken cross-storage move + + $shouldBeEncrypted = $file->getStorage()->instanceOfStorage(Encryption::class); + $isActuallyEncrypted = $this->isDataEncrypted($file); + if ($isActuallyEncrypted) { + if ($dryRun) { + if ($shouldBeEncrypted) { + $output->write("" . $file->getPath() . " needs migration"); + } else { + $output->write("" . $file->getPath() . " needs decryption"); + } + $foundKey = $this->findUserKeyForSystemFile($user, $file); + if ($foundKey) { + $output->writeln(", valid key found at " . $foundKey . ""); + } else { + $output->writeln(" ❌ No key found"); + } + } else { + if ($shouldBeEncrypted) { + $output->write("Migrating key for " . $file->getPath() . ""); + } else { + $output->write("Decrypting " . $file->getPath() . ""); + } + $foundKey = $this->findUserKeyForSystemFile($user, $file); + if ($foundKey) { + if ($shouldBeEncrypted) { + $systemKeyPath = $this->getSystemKeyPath($file); + $this->rootView->copy($foundKey, $systemKeyPath); + $output->writeln(" Migrated key from " . $foundKey . ""); + } else { + $this->decryptWithSystemKey($file, $foundKey); + $output->writeln(" Decrypted with key from " . $foundKey . ""); + } + } else { + $output->writeln(" ❌ No key found"); + } + } } else { - $output->writeln("❌"); - $output->writeln(" Failed to validate key for " . $file->getPath() . ", key will not be migrated"); + if ($dryRun) { + $output->writeln("" . $file->getPath() . " needs to be marked as not encrypted"); + } else { + $this->markAsUnEncrypted($file); + $output->writeln("" . $file->getPath() . " marked as not encrypted"); + } } } } @@ -109,47 +176,68 @@ class FixKeyLocation extends Command { return 0; } + private function getUserRelativePath(string $path): string { + $parts = explode('/', $path, 3); + if (count($parts) >= 3) { + return '/' . $parts[2]; + } else { + return ''; + } + } + /** * @param IUser $user * @return ICachedMountInfo[] */ private function getSystemMountsForUser(IUser $user): array { - return array_filter($this->userMountCache->getMountsForUser($user), function(ICachedMountInfo $mount) use ($user) { + return array_filter($this->userMountCache->getMountsForUser($user), function (ICachedMountInfo $mount) use ( + $user + ) { $mountPoint = substr($mount->getMountPoint(), strlen($user->getUID() . '/')); return $this->encryptionUtil->isSystemWideMountPoint($mountPoint, $user->getUID()); }); } /** + * Get all files in a folder which are marked as encrypted + * * @param Folder $folder * @return \Generator */ - private function getAllFiles(Folder $folder) { + private function getAllEncryptedFiles(Folder $folder) { foreach ($folder->getDirectoryListing() as $child) { if ($child instanceof Folder) { - yield from $this->getAllFiles($child); + yield from $this->getAllEncryptedFiles($child); } else { - yield $child; + if (substr($child->getName(), -4) !== '.bak' && $child->isEncrypted()) { + yield $child; + } } } } - /** - * Check if the key for a file is stored in the user's keystore and not the system one - * - * @param IUser $user - * @param Node $node - * @return bool - */ - private function isKeyStoredForUser(IUser $user, Node $node): bool { - $path = trim(substr($node->getPath(), strlen($user->getUID()) + 1), '/'); - $systemKeyPath = $this->keyRootDirectory . '/files_encryption/keys/' . $path . '/'; - $userKeyPath = $this->keyRootDirectory . '/' . $user->getUID() . '/files_encryption/keys/' . $path . '/'; + private function getSystemKeyPath(Node $node): string { + $path = $this->getUserRelativePath($node->getPath()); + return $this->keyRootDirectory . '/files_encryption/keys/' . $path . '/'; + } + + private function getUserBaseKeyPath(IUser $user): string { + return $this->keyRootDirectory . '/' . $user->getUID() . '/files_encryption/keys'; + } + private function getUserKeyPath(IUser $user, Node $node): string { + $path = $this->getUserRelativePath($node->getPath()); + return $this->getUserBaseKeyPath($user) . '/' . $path . '/'; + } + + private function hasSystemKey(Node $node): bool { // this uses View instead of the RootFolder because the keys might not be in the cache - $systemKeyExists = $this->rootView->file_exists($systemKeyPath); - $userKeyExists = $this->rootView->file_exists($userKeyPath); - return $userKeyExists && !$systemKeyExists; + return $this->rootView->file_exists($this->getSystemKeyPath($node)); + } + + private function hasUserKey(IUser $user, Node $node): bool { + // this uses View instead of the RootFolder because the keys might not be in the cache + return $this->rootView->file_exists($this->getUserKeyPath($user, $node)); } /** @@ -159,28 +247,201 @@ class FixKeyLocation extends Command { * @param File $node * @return bool */ - private function copyKeyAndValidate(IUser $user, File $node): bool { + private function copyUserKeyToSystemAndValidate(IUser $user, File $node): bool { $path = trim(substr($node->getPath(), strlen($user->getUID()) + 1), '/'); $systemKeyPath = $this->keyRootDirectory . '/files_encryption/keys/' . $path . '/'; $userKeyPath = $this->keyRootDirectory . '/' . $user->getUID() . '/files_encryption/keys/' . $path . '/'; $this->rootView->copy($userKeyPath, $systemKeyPath); + if ($this->tryReadFile($node)) { + // cleanup wrong key location + $this->rootView->rmdir($userKeyPath); + return true; + } else { + // remove the copied key if we know it's invalid + $this->rootView->rmdir($systemKeyPath); + return false; + } + } + + private function tryReadFile(File $node): bool { try { - // check that the copied key is valid $fh = $node->fopen('r'); // read a single chunk $data = fread($fh, 8192); if ($data === false) { - throw new \Exception("Read failed"); + return false; + } else { + return true; } + } catch (\Exception $e) { + return false; + } + } - // cleanup wrong key location - $this->rootView->rmdir($userKeyPath); - return true; + /** + * Get the contents of a file without decrypting it + * + * @param File $node + * @return resource + */ + private function openWithoutDecryption(File $node, string $mode) { + $storage = $node->getStorage(); + $internalPath = $node->getInternalPath(); + if ($storage->instanceOfStorage(Encryption::class)) { + /** @var Encryption $storage */ + try { + $storage->setEnabled(false); + $handle = $storage->fopen($internalPath, 'r'); + $storage->setEnabled(true); + } catch (\Exception $e) { + $storage->setEnabled(true); + throw $e; + } + } else { + $handle = $storage->fopen($internalPath, $mode); + } + /** @var resource|false $handle */ + if ($handle === false) { + throw new \Exception("Failed to open " . $node->getPath()); + } + return $handle; + } + + /** + * Check if the data stored for a file is encrypted, regardless of it's metadata + * + * @param File $node + * @return bool + */ + private function isDataEncrypted(File $node): bool { + $handle = $this->openWithoutDecryption($node, 'r'); + $firstBlock = fread($handle, $this->encryptionUtil->getHeaderSize()); + fclose($handle); + + $header = $this->encryptionUtil->parseRawHeader($firstBlock); + return isset($header['oc_encryption_module']); + } + + /** + * Attempt to find a key (stored for user) for a file (that needs a system key) even when it's not stored in the expected location + * + * @param File $node + * @return string + */ + private function findUserKeyForSystemFile(IUser $user, File $node): ?string { + $userKeyPath = $this->getUserBaseKeyPath($user); + $possibleKeys = $this->findKeysByFileName($userKeyPath, $node->getName()); + foreach ($possibleKeys as $possibleKey) { + if ($this->testSystemKey($user, $possibleKey, $node)) { + return $possibleKey; + } + } + return null; + } + + /** + * Attempt to find a key for a file even when it's not stored in the expected location + * + * @param string $basePath + * @param string $name + * @return \Generator + */ + private function findKeysByFileName(string $basePath, string $name) { + if ($this->rootView->is_dir($basePath . '/' . $name . '/OC_DEFAULT_MODULE')) { + yield $basePath . '/' . $name; + } else { + /** @var false|resource $dh */ + $dh = $this->rootView->opendir($basePath); + if (!$dh) { + throw new \Exception("Invalid base path " . $basePath); + } + while ($child = readdir($dh)) { + if ($child != '..' && $child != '.') { + $childPath = $basePath . '/' . $child; + + // recurse if the child is not a key folder + if ($this->rootView->is_dir($childPath) && !is_dir($childPath . '/OC_DEFAULT_MODULE')) { + yield from $this->findKeysByFileName($childPath, $name); + } + } + } + } + } + + /** + * Test if the provided key is valid as a system key for the file + * + * @param IUser $user + * @param string $key + * @param File $node + * @return bool + */ + private function testSystemKey(IUser $user, string $key, File $node): bool { + $systemKeyPath = $this->getSystemKeyPath($node); + + if ($this->rootView->file_exists($systemKeyPath)) { + // already has a key, reject new key + return false; + } + + $this->rootView->copy($key, $systemKeyPath); + $isValid = $this->tryReadFile($node); + $this->rootView->rmdir($systemKeyPath); + return $isValid; + } + + /** + * Decrypt a file with the specified system key and mark the key as not-encrypted + * + * @param File $node + * @param string $key + * @return void + */ + private function decryptWithSystemKey(File $node, string $key): void { + $storage = $node->getStorage(); + $name = $node->getName(); + + $node->move($node->getPath() . '.bak'); + $systemKeyPath = $this->getSystemKeyPath($node); + $this->rootView->copy($key, $systemKeyPath); + + try { + if (!$storage->instanceOfStorage(Encryption::class)) { + $storage = $this->encryptionManager->forceWrapStorage($node->getMountPoint(), $storage); + } + /** @var false|resource $source */ + $source = $storage->fopen($node->getInternalPath(), 'r'); + if (!$source) { + throw new \Exception("Failed to open " . $node->getPath() . " with " . $key); + } + $decryptedNode = $node->getParent()->newFile($name); + + $target = $this->openWithoutDecryption($decryptedNode, 'w'); + stream_copy_to_stream($source, $target); + fclose($target); + fclose($source); + + $decryptedNode->getStorage()->getScanner()->scan($decryptedNode->getInternalPath()); } catch (\Exception $e) { - // remove the copied key if we know it's invalid $this->rootView->rmdir($systemKeyPath); - return false; + + // remove the .bak + $node->move(substr($node->getPath(), 0, -4)); + + throw $e; + } + + if ($this->isDataEncrypted($decryptedNode)) { + throw new \Exception($node->getPath() . " still encrypted after attempting to decrypt with " . $key); } + + $this->markAsUnEncrypted($decryptedNode); + + $this->rootView->rmdir($systemKeyPath); + } + + private function markAsUnEncrypted(Node $node): void { + $node->getStorage()->getCache()->update($node->getId(), ['encrypted' => 0]); } } diff --git a/lib/private/Encryption/EncryptionWrapper.php b/lib/private/Encryption/EncryptionWrapper.php index 37264e81823..e58b3656593 100644 --- a/lib/private/Encryption/EncryptionWrapper.php +++ b/lib/private/Encryption/EncryptionWrapper.php @@ -29,7 +29,8 @@ use OC\Files\Storage\Wrapper\Encryption; use OC\Files\View; use OC\Memcache\ArrayCache; use OCP\Files\Mount\IMountPoint; -use OCP\Files\Storage; +use OCP\Files\Storage\IDisableEncryptionStorage; +use OCP\Files\Storage\IStorage; use Psr\Log\LoggerInterface; /** @@ -64,18 +65,19 @@ class EncryptionWrapper { * Wraps the given storage when it is not a shared storage * * @param string $mountPoint - * @param Storage $storage + * @param IStorage $storage * @param IMountPoint $mount - * @return Encryption|Storage + * @param bool $force apply the wrapper even if the storage normally has encryption disabled, helpful for repair steps + * @return Encryption|IStorage */ - public function wrapStorage($mountPoint, Storage $storage, IMountPoint $mount) { + public function wrapStorage(string $mountPoint, IStorage $storage, IMountPoint $mount, bool $force = false) { $parameters = [ 'storage' => $storage, 'mountPoint' => $mountPoint, 'mount' => $mount ]; - if (!$storage->instanceOfStorage(Storage\IDisableEncryptionStorage::class) && $mountPoint !== '/') { + if ($force || (!$storage->instanceOfStorage(IDisableEncryptionStorage::class) && $mountPoint !== '/')) { $user = \OC::$server->getUserSession()->getUser(); $mountManager = Filesystem::getMountManager(); $uid = $user ? $user->getUID() : null; diff --git a/lib/private/Encryption/Manager.php b/lib/private/Encryption/Manager.php index f751bd94b28..28bee7dacb7 100644 --- a/lib/private/Encryption/Manager.php +++ b/lib/private/Encryption/Manager.php @@ -32,6 +32,8 @@ use OC\Memcache\ArrayCache; use OC\ServiceUnavailableException; use OCP\Encryption\IEncryptionModule; use OCP\Encryption\IManager; +use OCP\Files\Mount\IMountPoint; +use OCP\Files\Storage\IStorage; use OCP\IConfig; use OCP\IL10N; use Psr\Log\LoggerInterface; @@ -234,6 +236,11 @@ class Manager implements IManager { } } + public function forceWrapStorage(IMountPoint $mountPoint, IStorage $storage) { + $encryptionWrapper = new EncryptionWrapper($this->arrayCache, $this, $this->logger); + return $encryptionWrapper->wrapStorage($mountPoint->getMountPoint(), $storage, $mountPoint, true); + } + /** * check if key storage is ready diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php index a468908ffc8..a828483265b 100644 --- a/lib/private/Encryption/Util.php +++ b/lib/private/Encryption/Util.php @@ -357,4 +357,32 @@ class Util { public function getKeyStorageRoot(): string { return $this->config->getAppValue('core', 'encryption_key_storage_root', ''); } + + /** + * parse raw header to array + * + * @param string $rawHeader + * @return array + */ + public function parseRawHeader(string $rawHeader) { + $result = []; + if (str_starts_with($rawHeader, Util::HEADER_START)) { + $header = $rawHeader; + $endAt = strpos($header, Util::HEADER_END); + if ($endAt !== false) { + $header = substr($header, 0, $endAt + strlen(Util::HEADER_END)); + + // +1 to not start with an ':' which would result in empty element at the beginning + $exploded = explode(':', substr($header, strlen(Util::HEADER_START) + 1)); + + $element = array_shift($exploded); + while ($element !== Util::HEADER_END && $element !== null) { + $result[$element] = array_shift($exploded); + $element = array_shift($exploded); + } + } + } + + return $result; + } } diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index a27f499a210..d559454fcb7 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -100,6 +100,8 @@ class Encryption extends Wrapper { /** @var CappedMemoryCache */ private CappedMemoryCache $encryptedPaths; + private $enabled = true; + /** * @param array $parameters */ @@ -392,6 +394,10 @@ class Encryption extends Wrapper { return $this->storage->fopen($path, $mode); } + if (!$this->enabled) { + return $this->storage->fopen($path, $mode); + } + $encryptionEnabled = $this->encryptionManager->isEnabled(); $shouldEncrypt = false; $encryptionModule = null; @@ -937,34 +943,6 @@ class Encryption extends Wrapper { return $headerSize; } - /** - * parse raw header to array - * - * @param string $rawHeader - * @return array - */ - protected function parseRawHeader($rawHeader) { - $result = []; - if (str_starts_with($rawHeader, Util::HEADER_START)) { - $header = $rawHeader; - $endAt = strpos($header, Util::HEADER_END); - if ($endAt !== false) { - $header = substr($header, 0, $endAt + strlen(Util::HEADER_END)); - - // +1 to not start with an ':' which would result in empty element at the beginning - $exploded = explode(':', substr($header, strlen(Util::HEADER_START) + 1)); - - $element = array_shift($exploded); - while ($element !== Util::HEADER_END) { - $result[$element] = array_shift($exploded); - $element = array_shift($exploded); - } - } - } - - return $result; - } - /** * read header from file * @@ -988,7 +966,7 @@ class Encryption extends Wrapper { if ($isEncrypted) { $firstBlock = $this->readFirstBlock($path); - $result = $this->parseRawHeader($firstBlock); + $result = $this->util->parseRawHeader($firstBlock); // if the header doesn't contain a encryption module we check if it is a // legacy file. If true, we add the default encryption module @@ -1103,4 +1081,14 @@ class Encryption extends Wrapper { public function clearIsEncryptedCache(): void { $this->encryptedPaths->clear(); } + + /** + * Allow temporarily disabling the wrapper + * + * @param bool $enabled + * @return void + */ + public function setEnabled(bool $enabled): void { + $this->enabled = $enabled; + } } -- cgit v1.2.3 From 88a96e4db7b2ef2768ee3b8a7f84df4fa183216d Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Wed, 14 Jun 2023 14:38:33 +0200 Subject: fix: Only store unencrypted_size if path should be encrypted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Files/ObjectStore/ObjectStoreStorage.php | 2 ++ lib/private/Files/Storage/Wrapper/Encryption.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/private/Files/Storage') diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index d918bd98729..4dceee9a58b 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -559,6 +559,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil } if ($exists) { + // Always update the unencrypted size, for encryption the Encryption wrapper will update this afterwards anyways + $stat['unencrypted_size'] = $stat['size']; $this->getCache()->update($fileId, $stat); } else { if (!$this->validateWrites || $this->objectStore->objectExists($urn)) { diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index d559454fcb7..7ce4338256f 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -1071,7 +1071,7 @@ class Encryption extends Wrapper { // object store, stores the size after write and doesn't update this during scan // manually store the unencrypted size - if ($result && $this->getWrapperStorage()->instanceOfStorage(ObjectStoreStorage::class)) { + if ($result && $this->getWrapperStorage()->instanceOfStorage(ObjectStoreStorage::class) && $this->shouldEncrypt($path)) { $this->getCache()->put($path, ['unencrypted_size' => $count]); } -- cgit v1.2.3 From 5bf34979feb5b1f5b8bd4e2c0d002f8aaf8794e1 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 19 Sep 2023 12:39:55 +0200 Subject: add wrapper to ensure we don't get an mtime that is lower than we know it is Signed-off-by: Robin Appelman --- lib/composer/composer/autoload_classmap.php | 1 + lib/composer/composer/autoload_static.php | 1 + lib/private/Files/Storage/Wrapper/KnownMtime.php | 142 +++++++++++++++++++++ tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php | 71 +++++++++++ 4 files changed, 215 insertions(+) create mode 100644 lib/private/Files/Storage/Wrapper/KnownMtime.php create mode 100644 tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php (limited to 'lib/private/Files/Storage') diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index fb063a82088..e92ed2c55a1 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -1346,6 +1346,7 @@ return array( 'OC\\Files\\Storage\\Wrapper\\EncodingDirectoryWrapper' => $baseDir . '/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php', 'OC\\Files\\Storage\\Wrapper\\Encryption' => $baseDir . '/lib/private/Files/Storage/Wrapper/Encryption.php', 'OC\\Files\\Storage\\Wrapper\\Jail' => $baseDir . '/lib/private/Files/Storage/Wrapper/Jail.php', + 'OC\\Files\\Storage\\Wrapper\\KnownMtime' => $baseDir . '/lib/private/Files/Storage/Wrapper/KnownMtime.php', 'OC\\Files\\Storage\\Wrapper\\PermissionsMask' => $baseDir . '/lib/private/Files/Storage/Wrapper/PermissionsMask.php', 'OC\\Files\\Storage\\Wrapper\\Quota' => $baseDir . '/lib/private/Files/Storage/Wrapper/Quota.php', 'OC\\Files\\Storage\\Wrapper\\Wrapper' => $baseDir . '/lib/private/Files/Storage/Wrapper/Wrapper.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 35b2318c4b1..ccd4adebedc 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -1379,6 +1379,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2 'OC\\Files\\Storage\\Wrapper\\EncodingDirectoryWrapper' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php', 'OC\\Files\\Storage\\Wrapper\\Encryption' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Wrapper/Encryption.php', 'OC\\Files\\Storage\\Wrapper\\Jail' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Wrapper/Jail.php', + 'OC\\Files\\Storage\\Wrapper\\KnownMtime' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Wrapper/KnownMtime.php', 'OC\\Files\\Storage\\Wrapper\\PermissionsMask' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Wrapper/PermissionsMask.php', 'OC\\Files\\Storage\\Wrapper\\Quota' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Wrapper/Quota.php', 'OC\\Files\\Storage\\Wrapper\\Wrapper' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Wrapper/Wrapper.php', diff --git a/lib/private/Files/Storage/Wrapper/KnownMtime.php b/lib/private/Files/Storage/Wrapper/KnownMtime.php new file mode 100644 index 00000000000..dde209c44ab --- /dev/null +++ b/lib/private/Files/Storage/Wrapper/KnownMtime.php @@ -0,0 +1,142 @@ +knowMtimes = new CappedMemoryCache(); + $this->clock = $arguments['clock']; + } + + public function file_put_contents($path, $data) { + $result = parent::file_put_contents($path, $data); + if ($result) { + $now = $this->clock->now()->getTimestamp(); + $this->knowMtimes->set($path, $this->clock->now()->getTimestamp()); + } + return $result; + } + + public function stat($path) { + $stat = parent::stat($path); + if ($stat) { + $this->applyKnownMtime($path, $stat); + } + return $stat; + } + + public function getMetaData($path) { + $stat = parent::getMetaData($path); + if ($stat) { + $this->applyKnownMtime($path, $stat); + } + return $stat; + } + + private function applyKnownMtime(string $path, array &$stat) { + if (isset($stat['mtime'])) { + $knownMtime = $this->knowMtimes->get($path) ?? 0; + $stat['mtime'] = max($stat['mtime'], $knownMtime); + } + } + + public function filemtime($path) { + $knownMtime = $this->knowMtimes->get($path) ?? 0; + return max(parent::filemtime($path), $knownMtime); + } + + public function mkdir($path) { + $result = parent::mkdir($path); + if ($result) { + $this->knowMtimes->set($path, $this->clock->now()->getTimestamp()); + } + return $result; + } + + public function rmdir($path) { + $result = parent::rmdir($path); + if ($result) { + $this->knowMtimes->set($path, $this->clock->now()->getTimestamp()); + } + return $result; + } + + public function unlink($path) { + $result = parent::unlink($path); + if ($result) { + $this->knowMtimes->set($path, $this->clock->now()->getTimestamp()); + } + return $result; + } + + public function rename($source, $target) { + $result = parent::rename($source, $target); + if ($result) { + $this->knowMtimes->set($target, $this->clock->now()->getTimestamp()); + $this->knowMtimes->set($source, $this->clock->now()->getTimestamp()); + } + return $result; + } + + public function copy($source, $target) { + $result = parent::copy($source, $target); + if ($result) { + $this->knowMtimes->set($target, $this->clock->now()->getTimestamp()); + } + return $result; + } + + public function fopen($path, $mode) { + $result = parent::fopen($path, $mode); + if ($result && $mode === 'w') { + $this->knowMtimes->set($path, $this->clock->now()->getTimestamp()); + } + return $result; + } + + public function touch($path, $mtime = null) { + $result = parent::touch($path, $mtime); + if ($result) { + $this->knowMtimes->set($path, $mtime ?? $this->clock->now()->getTimestamp()); + } + return $result; + } + + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + $result = parent::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); + if ($result) { + $this->knowMtimes->set($targetInternalPath, $this->clock->now()->getTimestamp()); + } + return $result; + } + + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + $result = parent::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); + if ($result) { + $this->knowMtimes->set($targetInternalPath, $this->clock->now()->getTimestamp()); + } + return $result; + } + + public function writeStream(string $path, $stream, int $size = null): int { + $result = parent::writeStream($path, $stream, $size); + if ($result) { + $this->knowMtimes->set($path, $this->clock->now()->getTimestamp()); + } + return $result; + } +} diff --git a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php new file mode 100644 index 00000000000..9694fc7bc99 --- /dev/null +++ b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php @@ -0,0 +1,71 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace lib\Files\Storage\Wrapper; + +use OC\Files\Storage\Temporary; +use OC\Files\Storage\Wrapper\KnownMtime; +use OCP\Constants; +use PHPUnit\Framework\MockObject\MockObject; +use Psr\Clock\ClockInterface; +use Test\Files\Storage\Storage; + +/** + * @group DB + */ +class KnownMtimeTest extends Storage { + /** @var Temporary */ + private $sourceStorage; + + /** @var ClockInterface|MockObject */ + private $clock; + private int $fakeTime = 0; + + protected function setUp(): void { + parent::setUp(); + $this->fakeTime = 0; + $this->sourceStorage = new Temporary([]); + $this->clock = $this->createMock(ClockInterface::class); + $this->clock->method('now')->willReturnCallback(function () { + if ($this->fakeTime) { + return new \DateTimeImmutable("@{$this->fakeTime}"); + } else { + return new \DateTimeImmutable(); + } + }); + $this->instance = $this->getWrappedStorage(); + } + + protected function tearDown(): void { + $this->sourceStorage->cleanUp(); + parent::tearDown(); + } + + protected function getWrappedStorage() { + return new KnownMtime([ + 'storage' => $this->sourceStorage, + 'clock' => $this->clock, + ]); + } + + public function testNewerKnownMtime() { + $future = time() + 1000; + $this->fakeTime = $future; + + $this->instance->file_put_contents('foo.txt', 'bar'); + + // fuzzy match since the clock might have ticked + $this->assertLessThan(2, abs(time() - $this->sourceStorage->filemtime('foo.txt'))); + $this->assertEquals($this->sourceStorage->filemtime('foo.txt'), $this->sourceStorage->stat('foo.txt')['mtime']); + $this->assertEquals($this->sourceStorage->filemtime('foo.txt'), $this->sourceStorage->getMetaData('foo.txt')['mtime']); + + $this->assertEquals($future, $this->instance->filemtime('foo.txt')); + $this->assertEquals($future, $this->instance->stat('foo.txt')['mtime']); + $this->assertEquals($future, $this->instance->getMetaData('foo.txt')['mtime']); + } +} -- cgit v1.2.3 From ea06cf2f39c5c4e7f1ea20d075c01e3ba0cc6dd0 Mon Sep 17 00:00:00 2001 From: Hamid Dehnavi Date: Fri, 7 Jul 2023 13:43:21 +0330 Subject: Convert isset ternary to null coalescing operator Signed-off-by: Hamid Dehnavi --- lib/private/App/AppStore/Version/VersionParser.php | 4 ++-- lib/private/AppConfig.php | 2 +- lib/private/AppFramework/Http/Request.php | 8 ++------ lib/private/DB/ConnectionFactory.php | 2 +- lib/private/Files/Cache/Scanner.php | 4 ++-- lib/private/Files/Config/UserMountCache.php | 2 +- lib/private/Files/Mount/MountPoint.php | 2 +- lib/private/Files/Mount/ObjectHomeMountProvider.php | 2 +- lib/private/Files/ObjectStore/S3ConnectionTrait.php | 2 +- lib/private/Files/Storage/Common.php | 2 +- lib/private/Files/Storage/Wrapper/PermissionsMask.php | 4 ++-- lib/private/NavigationManager.php | 6 +++--- lib/private/Remote/User.php | 2 +- lib/private/Setup/AbstractDatabase.php | 2 +- lib/private/Share20/DefaultShareProvider.php | 6 +++--- lib/private/legacy/OC_App.php | 2 +- 16 files changed, 24 insertions(+), 28 deletions(-) (limited to 'lib/private/Files/Storage') diff --git a/lib/private/App/AppStore/Version/VersionParser.php b/lib/private/App/AppStore/Version/VersionParser.php index 2b88399b9fd..eac9c935517 100644 --- a/lib/private/App/AppStore/Version/VersionParser.php +++ b/lib/private/App/AppStore/Version/VersionParser.php @@ -54,9 +54,9 @@ class VersionParser { // Count the amount of =, if it is one then it's either maximum or minimum // version. If it is two then it is maximum and minimum. $versionElements = explode(' ', $versionSpec); - $firstVersion = isset($versionElements[0]) ? $versionElements[0] : ''; + $firstVersion = $versionElements[0] ?? ''; $firstVersionNumber = substr($firstVersion, 2); - $secondVersion = isset($versionElements[1]) ? $versionElements[1] : ''; + $secondVersion = $versionElements[1] ?? ''; $secondVersionNumber = substr($secondVersion, 2); switch (count($versionElements)) { diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index 84f0d5b9e5a..79c650705b2 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -373,7 +373,7 @@ class AppConfig implements IAppConfig { } else { $appIds = $this->getApps(); $values = array_map(function ($appId) use ($key) { - return isset($this->cache[$appId][$key]) ? $this->cache[$appId][$key] : null; + return $this->cache[$appId][$key] ?? null; }, $appIds); $result = array_combine($appIds, $values); diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 408e88583a0..26a76e0da27 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -193,9 +193,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { */ #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->items['parameters'][$offset]) - ? $this->items['parameters'][$offset] - : null; + return $this->items['parameters'][$offset] ?? null; } /** @@ -255,9 +253,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { case 'cookies': case 'urlParams': case 'method': - return isset($this->items[$name]) - ? $this->items[$name] - : null; + return $this->items[$name] ?? null; case 'parameters': case 'params': if ($this->isPutStreamContent()) { diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php index 1b0ac436364..4b286ff5442 100644 --- a/lib/private/DB/ConnectionFactory.php +++ b/lib/private/DB/ConnectionFactory.php @@ -139,7 +139,7 @@ class ConnectionFactory { $additionalConnectionParams = array_merge($additionalConnectionParams, $additionalConnectionParams['driverOptions']); } $host = $additionalConnectionParams['host']; - $port = isset($additionalConnectionParams['port']) ? $additionalConnectionParams['port'] : null; + $port = $additionalConnectionParams['port'] ?? null; $dbName = $additionalConnectionParams['dbname']; // we set the connect string as dbname and unset the host to coerce doctrine into using it as connect string diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 790221955f6..074e88e7639 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -439,7 +439,7 @@ class Scanner extends BasicEmitter implements IScanner { $childQueue = []; $newChildNames = []; foreach ($newChildren as $fileMeta) { - $permissions = isset($fileMeta['scan_permissions']) ? $fileMeta['scan_permissions'] : $fileMeta['permissions']; + $permissions = $fileMeta['scan_permissions'] ?? $fileMeta['permissions']; if ($permissions === 0) { continue; } @@ -456,7 +456,7 @@ class Scanner extends BasicEmitter implements IScanner { $newChildNames[] = $file; $child = $path ? $path . '/' . $file : $file; try { - $existingData = isset($existingChildren[$file]) ? $existingChildren[$file] : false; + $existingData = $existingChildren[$file] ?? false; $data = $this->scanFile($child, $reuse, $folderId, $existingData, $lock, $fileMeta); if ($data) { if ($data['mimetype'] === 'httpd/unix-directory' && $recursive === self::SCAN_RECURSIVE) { diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php index 90f94b6598e..8a6b818d413 100644 --- a/lib/private/Files/Config/UserMountCache.php +++ b/lib/private/Files/Config/UserMountCache.php @@ -238,7 +238,7 @@ class UserMountCache implements IUserMountCache { $row['mount_point'], $row['mount_provider_class'] ?? '', $mount_id, - isset($row['path']) ? $row['path'] : '', + $row['path'] ?? '', ); } diff --git a/lib/private/Files/Mount/MountPoint.php b/lib/private/Files/Mount/MountPoint.php index f526928cc15..fe6358b32f1 100644 --- a/lib/private/Files/Mount/MountPoint.php +++ b/lib/private/Files/Mount/MountPoint.php @@ -272,7 +272,7 @@ class MountPoint implements IMountPoint { * @return mixed */ public function getOption($name, $default) { - return isset($this->mountOptions[$name]) ? $this->mountOptions[$name] : $default; + return $this->mountOptions[$name] ?? $default; } /** diff --git a/lib/private/Files/Mount/ObjectHomeMountProvider.php b/lib/private/Files/Mount/ObjectHomeMountProvider.php index 77912adfd34..889a39fbd9e 100644 --- a/lib/private/Files/Mount/ObjectHomeMountProvider.php +++ b/lib/private/Files/Mount/ObjectHomeMountProvider.php @@ -122,7 +122,7 @@ class ObjectHomeMountProvider implements IHomeMountProvider { $config['arguments']['bucket'] = ''; } $mapper = new \OC\Files\ObjectStore\Mapper($user, $this->config); - $numBuckets = isset($config['arguments']['num_buckets']) ? $config['arguments']['num_buckets'] : 64; + $numBuckets = $config['arguments']['num_buckets'] ?? 64; $config['arguments']['bucket'] .= $mapper->getBucket($numBuckets); $this->config->setUserValue($user->getUID(), 'homeobjectstore', 'bucket', $config['arguments']['bucket']); diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index 49942b385bc..044c3cdc900 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -128,7 +128,7 @@ trait S3ConnectionTrait { ); $options = [ - 'version' => isset($this->params['version']) ? $this->params['version'] : 'latest', + 'version' => $this->params['version'] ?? 'latest', 'credentials' => $provider, 'endpoint' => $base_url, 'region' => $this->params['region'], diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 5ab411434d0..3d5a2f098b2 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -601,7 +601,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { * @return mixed */ public function getMountOption($name, $default = null) { - return isset($this->mountOptions[$name]) ? $this->mountOptions[$name] : $default; + return $this->mountOptions[$name] ?? $default; } /** diff --git a/lib/private/Files/Storage/Wrapper/PermissionsMask.php b/lib/private/Files/Storage/Wrapper/PermissionsMask.php index 0d140e0a39d..a79eaad0569 100644 --- a/lib/private/Files/Storage/Wrapper/PermissionsMask.php +++ b/lib/private/Files/Storage/Wrapper/PermissionsMask.php @@ -140,7 +140,7 @@ class PermissionsMask extends Wrapper { $data = parent::getMetaData($path); if ($data && isset($data['permissions'])) { - $data['scan_permissions'] = isset($data['scan_permissions']) ? $data['scan_permissions'] : $data['permissions']; + $data['scan_permissions'] = $data['scan_permissions'] ?? $data['permissions']; $data['permissions'] &= $this->mask; } return $data; @@ -155,7 +155,7 @@ class PermissionsMask extends Wrapper { public function getDirectoryContent($directory): \Traversable { foreach ($this->getWrapperStorage()->getDirectoryContent($directory) as $data) { - $data['scan_permissions'] = isset($data['scan_permissions']) ? $data['scan_permissions'] : $data['permissions']; + $data['scan_permissions'] = $data['scan_permissions'] ?? $data['permissions']; $data['permissions'] &= $this->mask; yield $data; diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index ef6e6f4cb74..a651cde379d 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -101,7 +101,7 @@ class NavigationManager implements INavigationManager { } $id = $entry['id']; - $entry['unread'] = isset($this->unreadCounters[$id]) ? $this->unreadCounters[$id] : 0; + $entry['unread'] = $this->unreadCounters[$id] ?? 0; $this->entries[$id] = $entry; } @@ -313,7 +313,7 @@ class NavigationManager implements INavigationManager { if (!isset($nav['route']) && $nav['type'] !== 'settings') { continue; } - $role = isset($nav['@attributes']['role']) ? $nav['@attributes']['role'] : 'all'; + $role = $nav['@attributes']['role'] ?? 'all'; if ($role === 'admin' && !$this->isAdmin()) { continue; } @@ -322,7 +322,7 @@ class NavigationManager implements INavigationManager { $order = $customOrders[$app][$key] ?? $nav['order'] ?? 100; $type = $nav['type']; $route = !empty($nav['route']) ? $this->urlGenerator->linkToRoute($nav['route']) : ''; - $icon = isset($nav['icon']) ? $nav['icon'] : 'app.svg'; + $icon = $nav['icon'] ?? 'app.svg'; foreach ([$icon, "$app.svg"] as $i) { try { $icon = $this->urlGenerator->imagePath($app, $i); diff --git a/lib/private/Remote/User.php b/lib/private/Remote/User.php index 5590fcfba38..d67b279bccb 100644 --- a/lib/private/Remote/User.php +++ b/lib/private/Remote/User.php @@ -92,7 +92,7 @@ class User implements IUser { * @return string */ public function getTwitter() { - return isset($this->data['twitter']) ? $this->data['twitter'] : ''; + return $this->data['twitter'] ?? ''; } /** diff --git a/lib/private/Setup/AbstractDatabase.php b/lib/private/Setup/AbstractDatabase.php index 9ec4137cdef..79f23de8ef8 100644 --- a/lib/private/Setup/AbstractDatabase.php +++ b/lib/private/Setup/AbstractDatabase.php @@ -88,7 +88,7 @@ abstract class AbstractDatabase { $dbName = $config['dbname']; $dbHost = !empty($config['dbhost']) ? $config['dbhost'] : 'localhost'; $dbPort = !empty($config['dbport']) ? $config['dbport'] : ''; - $dbTablePrefix = isset($config['dbtableprefix']) ? $config['dbtableprefix'] : 'oc_'; + $dbTablePrefix = $config['dbtableprefix'] ?? 'oc_'; $createUserConfig = $this->config->getValue("setup_create_db_user", true); // accept `false` both as bool and string, since setting config values from env will result in a string diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 3f5d01618eb..55ac3eda644 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -1364,7 +1364,7 @@ class DefaultShareProvider implements IShareProvider { $type = (int)$row['share_type']; if ($type === IShare::TYPE_USER) { $uid = $row['share_with']; - $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; + $users[$uid] = $users[$uid] ?? []; $users[$uid][$row['id']] = $row; } elseif ($type === IShare::TYPE_GROUP) { $gid = $row['share_with']; @@ -1377,14 +1377,14 @@ class DefaultShareProvider implements IShareProvider { $userList = $group->getUsers(); foreach ($userList as $user) { $uid = $user->getUID(); - $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; + $users[$uid] = $users[$uid] ?? []; $users[$uid][$row['id']] = $row; } } elseif ($type === IShare::TYPE_LINK) { $link = true; } elseif ($type === IShare::TYPE_USERGROUP && $currentAccess === true) { $uid = $row['share_with']; - $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; + $users[$uid] = $users[$uid] ?? []; $users[$uid][$row['id']] = $row; } } diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 64c125d33a2..23e0b099e91 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -390,7 +390,7 @@ class OC_App { public static function getAppVersionByPath(string $path): string { $infoFile = $path . '/appinfo/info.xml'; $appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true); - return isset($appData['version']) ? $appData['version'] : ''; + return $appData['version'] ?? ''; } /** -- cgit v1.2.3 From 460344336e283d6ebca4066a3a876ca4843600bd Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 19 Oct 2023 19:27:00 +0200 Subject: optimize cache jail creation Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Wrapper/CacheJail.php | 2 -- lib/private/Files/Storage/Wrapper/Jail.php | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'lib/private/Files/Storage') diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index d8cf3eb61d7..73c9a017019 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -52,8 +52,6 @@ class CacheJail extends CacheWrapper { public function __construct($cache, $root) { parent::__construct($cache); $this->root = $root; - $this->connection = \OC::$server->getDatabaseConnection(); - $this->mimetypeLoader = \OC::$server->getMimeTypeLoader(); if ($cache instanceof CacheJail) { $this->unjailedRoot = $cache->getSourcePath($root); diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php index 1921ac27848..592acd418ec 100644 --- a/lib/private/Files/Storage/Wrapper/Jail.php +++ b/lib/private/Files/Storage/Wrapper/Jail.php @@ -396,10 +396,7 @@ class Jail extends Wrapper { * @return \OC\Files\Cache\Cache */ public function getCache($path = '', $storage = null) { - if (!$storage) { - $storage = $this->getWrapperStorage(); - } - $sourceCache = $this->getWrapperStorage()->getCache($this->getUnjailedPath($path), $storage); + $sourceCache = $this->getWrapperStorage()->getCache($this->getUnjailedPath($path)); return new CacheJail($sourceCache, $this->rootPath); } -- cgit v1.2.3 From 8418fcfedf8524d3e00263d9028dab5651cf9c00 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 16 Oct 2023 17:39:23 +0200 Subject: add some support for rename on case insensitive local filesystems Signed-off-by: Robin Appelman --- lib/private/Files/Storage/Local.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'lib/private/Files/Storage') diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index eeb9e11b24e..0fca853da59 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -74,6 +74,8 @@ class Local extends \OC\Files\Storage\Common { protected bool $unlinkOnTruncate; + protected bool $caseInsensitive = false; + public function __construct($arguments) { if (!isset($arguments['datadir']) || !is_string($arguments['datadir'])) { throw new \InvalidArgumentException('No data directory set for local storage'); @@ -93,6 +95,7 @@ class Local extends \OC\Files\Storage\Common { $this->config = \OC::$server->get(IConfig::class); $this->mimeTypeDetector = \OC::$server->get(IMimeTypeDetector::class); $this->defUMask = $this->config->getSystemValue('localstorage.umask', 0022); + $this->caseInsensitive = $this->config->getSystemValueBool('localstorage.case_insensitive', false); // support Write-Once-Read-Many file systems $this->unlinkOnTruncate = $this->config->getSystemValueBool('localstorage.unlink_on_truncate', false); @@ -162,6 +165,9 @@ class Local extends \OC\Files\Storage\Common { } public function is_dir($path) { + if ($this->caseInsensitive && !$this->file_exists($path)) { + return false; + } if (str_ends_with($path, '/')) { $path = substr($path, 0, -1); } @@ -169,6 +175,9 @@ class Local extends \OC\Files\Storage\Common { } public function is_file($path) { + if ($this->caseInsensitive && !$this->file_exists($path)) { + return false; + } return is_file($this->getSourcePath($path)); } @@ -271,7 +280,13 @@ class Local extends \OC\Files\Storage\Common { } public function file_exists($path) { - return file_exists($this->getSourcePath($path)); + if ($this->caseInsensitive) { + $fullPath = $this->getSourcePath($path); + $content = scandir(dirname($fullPath), SCANDIR_SORT_NONE); + return is_array($content) && array_search(basename($fullPath), $content) !== false; + } else { + return file_exists($this->getSourcePath($path)); + } } public function filemtime($path) { @@ -372,6 +387,11 @@ class Local extends \OC\Files\Storage\Common { } if (@rename($this->getSourcePath($source), $this->getSourcePath($target))) { + if ($this->caseInsensitive) { + if (mb_strtolower($target) === mb_strtolower($source) && !$this->file_exists($target)) { + return false; + } + } return true; } @@ -388,6 +408,11 @@ class Local extends \OC\Files\Storage\Common { } $result = copy($this->getSourcePath($source), $this->getSourcePath($target)); umask($oldMask); + if ($this->caseInsensitive) { + if (mb_strtolower($target) === mb_strtolower($source) && !$this->file_exists($target)) { + return false; + } + } return $result; } } -- cgit v1.2.3 From aa5f037af71c915424c6dcfd5ad2dc82797dc0d6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 23 Nov 2023 10:22:34 +0100 Subject: chore: apply changes from Nextcloud coding standards 1.1.1 Signed-off-by: Joas Schilling Signed-off-by: Benjamin Gaussorgues --- apps/admin_audit/lib/Actions/Action.php | 9 +- apps/admin_audit/lib/Actions/UserManagement.php | 2 +- apps/admin_audit/lib/AppInfo/Application.php | 14 +-- apps/admin_audit/lib/BackgroundJobs/Rotate.php | 2 +- apps/cloud_federation_api/appinfo/routes.php | 12 +-- .../lib/ResponseDefinitions.php | 1 + apps/comments/lib/AppInfo/Application.php | 4 +- .../lib/Controller/NotificationsController.php | 2 +- apps/comments/lib/Search/LegacyProvider.php | 2 +- apps/contactsinteraction/lib/Db/CardSearchDao.php | 6 +- .../lib/Db/RecentContactMapper.php | 6 +- .../lib/Listeners/ContactInteractionListener.php | 2 - .../lib/Controller/DashboardApiController.php | 13 ++- apps/dashboard/lib/ResponseDefinitions.php | 1 + apps/dav/appinfo/v1/caldav.php | 2 +- apps/dav/lib/AppInfo/Application.php | 26 ++--- .../BuildReminderIndexBackgroundJob.php | 8 +- .../dav/lib/BackgroundJob/CalendarRetentionJob.php | 2 +- apps/dav/lib/BackgroundJob/EventReminderJob.php | 4 +- .../GenerateBirthdayCalendarBackgroundJob.php | 4 +- .../BackgroundJob/PruneOutdatedSyncTokensJob.php | 4 +- .../RegisterRegenerateBirthdayCalendars.php | 4 +- .../UpdateCalendarResourcesRoomsBackgroundJob.php | 56 +++++----- apps/dav/lib/BackgroundJob/UploadCleanup.php | 1 - .../dav/lib/BackgroundJob/UserStatusAutomation.php | 10 +- apps/dav/lib/BulkUpload/BulkUploadPlugin.php | 8 +- apps/dav/lib/BulkUpload/MultipartRequestParser.php | 4 +- apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php | 3 +- .../lib/CalDAV/AppCalendar/AppCalendarPlugin.php | 1 + apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php | 1 + apps/dav/lib/CalDAV/BirthdayService.php | 40 +++---- apps/dav/lib/CalDAV/CalendarImpl.php | 5 +- apps/dav/lib/CalDAV/CalendarObject.php | 4 +- apps/dav/lib/CalDAV/EventComparisonService.php | 6 -- apps/dav/lib/CalDAV/FreeBusy/FreeBusyGenerator.php | 3 +- apps/dav/lib/CalDAV/PublicCalendarRoot.php | 2 +- apps/dav/lib/CalDAV/Publishing/PublishPlugin.php | 96 ++++++++--------- apps/dav/lib/CalDAV/Reminder/Backend.php | 26 ++--- .../lib/CalDAV/Reminder/INotificationProvider.php | 6 +- .../NotificationProvider/AbstractProvider.php | 12 +-- .../NotificationProvider/EmailProvider.php | 24 ++--- .../Reminder/NotificationProvider/PushProvider.php | 16 +-- apps/dav/lib/CalDAV/Reminder/Notifier.php | 8 +- apps/dav/lib/CalDAV/Reminder/ReminderService.php | 34 +++--- .../ResourceBooking/AbstractPrincipalBackend.php | 20 ++-- .../ResourceBooking/ResourcePrincipalBackend.php | 8 +- .../ResourceBooking/RoomPrincipalBackend.php | 8 +- apps/dav/lib/CalDAV/RetentionService.php | 4 +- apps/dav/lib/CalDAV/Schedule/IMipPlugin.php | 20 ++-- apps/dav/lib/CalDAV/Schedule/IMipService.php | 18 ++-- apps/dav/lib/CalDAV/Schedule/Plugin.php | 2 - apps/dav/lib/CalDAV/Status/Status.php | 3 +- apps/dav/lib/CalDAV/Status/StatusService.php | 15 ++- .../lib/CalDAV/Trashbin/DeletedCalendarObject.php | 6 +- .../Trashbin/DeletedCalendarObjectsCollection.php | 2 +- apps/dav/lib/CalDAV/Trashbin/Plugin.php | 2 +- apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php | 2 +- .../CalDAV/WebcalCaching/RefreshWebcalService.php | 2 +- apps/dav/lib/CardDAV/Activity/Backend.php | 8 +- .../lib/CardDAV/Activity/Provider/Addressbook.php | 10 +- apps/dav/lib/CardDAV/Activity/Provider/Base.php | 4 +- apps/dav/lib/CardDAV/Activity/Provider/Card.php | 12 +-- apps/dav/lib/CardDAV/AddressBookImpl.php | 8 +- apps/dav/lib/CardDAV/AddressBookRoot.php | 10 +- apps/dav/lib/CardDAV/Card.php | 3 +- apps/dav/lib/CardDAV/CardDavBackend.php | 22 ++-- apps/dav/lib/CardDAV/Converter.php | 2 +- apps/dav/lib/CardDAV/PhotoCache.php | 2 +- apps/dav/lib/CardDAV/SyncService.php | 15 ++- apps/dav/lib/CardDAV/SystemAddressbook.php | 2 +- apps/dav/lib/CardDAV/UserAddressBooks.php | 14 +-- apps/dav/lib/Command/CreateAddressBook.php | 8 +- apps/dav/lib/Comments/CommentsPlugin.php | 2 +- apps/dav/lib/Connector/PublicAuth.php | 6 +- apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php | 39 +++---- apps/dav/lib/Connector/Sabre/Auth.php | 12 +-- apps/dav/lib/Connector/Sabre/BearerAuth.php | 6 +- .../Connector/Sabre/BlockLegacyClientPlugin.php | 2 +- .../lib/Connector/Sabre/ChecksumUpdatePlugin.php | 2 +- .../Connector/Sabre/CommentPropertiesPlugin.php | 3 +- .../lib/Connector/Sabre/CopyEtagHeaderPlugin.php | 2 +- apps/dav/lib/Connector/Sabre/Directory.php | 2 +- .../lib/Connector/Sabre/DummyGetResponsePlugin.php | 4 +- .../lib/Connector/Sabre/Exception/Forbidden.php | 6 +- .../lib/Connector/Sabre/Exception/InvalidPath.php | 6 +- .../lib/Connector/Sabre/ExceptionLoggerPlugin.php | 1 - apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php | 4 +- apps/dav/lib/Connector/Sabre/FilesPlugin.php | 12 +-- apps/dav/lib/Connector/Sabre/FilesReportPlugin.php | 16 +-- apps/dav/lib/Connector/Sabre/Principal.php | 20 ++-- .../lib/Connector/Sabre/RequestIdHeaderPlugin.php | 4 +- apps/dav/lib/Connector/Sabre/ServerFactory.php | 10 +- apps/dav/lib/Connector/Sabre/SharesPlugin.php | 4 +- apps/dav/lib/Connector/Sabre/TagsPlugin.php | 2 +- .../lib/Controller/BirthdayCalendarController.php | 8 +- apps/dav/lib/Controller/DirectController.php | 19 ++-- .../Controller/InvitationResponseController.php | 4 +- apps/dav/lib/DAV/GroupPrincipalBackend.php | 2 +- apps/dav/lib/DAV/Sharing/Backend.php | 4 +- apps/dav/lib/DAV/Sharing/Plugin.php | 2 +- apps/dav/lib/DAV/ViewOnlyPlugin.php | 4 +- apps/dav/lib/Direct/ServerFactory.php | 12 +-- apps/dav/lib/Events/AddressBookCreatedEvent.php | 2 +- apps/dav/lib/Events/AddressBookDeletedEvent.php | 4 +- .../lib/Events/AddressBookShareUpdatedEvent.php | 8 +- apps/dav/lib/Events/AddressBookUpdatedEvent.php | 6 +- .../Events/CachedCalendarObjectCreatedEvent.php | 6 +- .../Events/CachedCalendarObjectDeletedEvent.php | 6 +- .../Events/CachedCalendarObjectUpdatedEvent.php | 6 +- apps/dav/lib/Events/CalendarCreatedEvent.php | 2 +- apps/dav/lib/Events/CalendarDeletedEvent.php | 4 +- apps/dav/lib/Events/CalendarMovedToTrashEvent.php | 4 +- apps/dav/lib/Events/CalendarObjectCreatedEvent.php | 6 +- apps/dav/lib/Events/CalendarObjectDeletedEvent.php | 6 +- apps/dav/lib/Events/CalendarObjectMovedEvent.php | 12 +-- .../lib/Events/CalendarObjectMovedToTrashEvent.php | 6 +- .../dav/lib/Events/CalendarObjectRestoredEvent.php | 6 +- apps/dav/lib/Events/CalendarObjectUpdatedEvent.php | 6 +- apps/dav/lib/Events/CalendarPublishedEvent.php | 4 +- apps/dav/lib/Events/CalendarRestoredEvent.php | 4 +- apps/dav/lib/Events/CalendarShareUpdatedEvent.php | 8 +- apps/dav/lib/Events/CalendarUnpublishedEvent.php | 2 +- apps/dav/lib/Events/CalendarUpdatedEvent.php | 6 +- apps/dav/lib/Events/CardCreatedEvent.php | 6 +- apps/dav/lib/Events/CardDeletedEvent.php | 6 +- apps/dav/lib/Events/CardMovedEvent.php | 12 +-- apps/dav/lib/Events/CardUpdatedEvent.php | 6 +- apps/dav/lib/Events/SubscriptionCreatedEvent.php | 2 +- apps/dav/lib/Events/SubscriptionDeletedEvent.php | 4 +- apps/dav/lib/Events/SubscriptionUpdatedEvent.php | 6 +- apps/dav/lib/Files/FileSearchBackend.php | 4 +- apps/dav/lib/Files/LazySearchBackend.php | 1 - apps/dav/lib/HookManager.php | 8 +- apps/dav/lib/Listener/ActivityUpdaterListener.php | 2 +- apps/dav/lib/Listener/AddressbookListener.php | 2 +- .../CalendarContactInteractionListener.php | 8 +- .../CalendarDeletionDefaultUpdaterListener.php | 2 +- .../CalendarObjectReminderUpdaterListener.php | 6 +- .../lib/Listener/CalendarPublicationListener.php | 2 +- .../lib/Listener/CalendarShareUpdateListener.php | 2 +- apps/dav/lib/Listener/CardListener.php | 4 +- apps/dav/lib/Listener/OutOfOfficeListener.php | 8 +- apps/dav/lib/Listener/SubscriptionListener.php | 2 +- .../dav/lib/Migration/BuildCalendarSearchIndex.php | 4 +- .../BuildCalendarSearchIndexBackgroundJob.php | 8 +- apps/dav/lib/Migration/BuildSocialSearchIndex.php | 4 +- .../BuildSocialSearchIndexBackgroundJob.php | 8 +- apps/dav/lib/Migration/ChunkCleanup.php | 6 +- .../lib/Migration/RegenerateBirthdayCalendars.php | 2 +- .../RegisterBuildReminderIndexBackgroundJob.php | 4 +- .../Migration/RemoveOrphanEventsAndContacts.php | 16 +-- .../Migration/Version1005Date20180413093149.php | 4 +- .../Migration/Version1005Date20180530124431.php | 2 +- .../Migration/Version1006Date20180619154313.php | 2 +- .../Migration/Version1006Date20180628111625.php | 2 +- .../Migration/Version1008Date20181030113700.php | 2 +- .../Migration/Version1008Date20181105104826.php | 2 +- .../Migration/Version1008Date20181105110300.php | 2 +- .../Migration/Version1011Date20190725113607.php | 2 +- .../Migration/Version1011Date20190806104428.php | 2 +- .../Migration/Version1012Date20190808122342.php | 6 +- .../Migration/Version1027Date20230504122946.php | 9 +- apps/dav/lib/Profiler/ProfilerPlugin.php | 4 +- apps/dav/lib/RootCollection.php | 1 - apps/dav/lib/Search/ACalendarSearchProvider.php | 6 +- apps/dav/lib/Search/EventsSearchProvider.php | 2 +- apps/dav/lib/Service/AbsenceService.php | 1 - apps/dav/lib/Settings/AvailabilitySettings.php | 10 +- apps/dav/lib/Settings/CalDAVSettings.php | 2 +- apps/dav/lib/SystemTag/SystemTagPlugin.php | 6 +- apps/dav/lib/Upload/RootCollection.php | 4 +- apps/dav/lib/UserMigration/CalendarMigrator.php | 2 +- apps/dav/lib/UserMigration/ContactsMigrator.php | 4 +- .../UserMigration/CalendarMigratorTest.php | 2 +- .../UserMigration/ContactsMigratorTest.php | 2 +- .../tests/unit/CalDAV/AbstractCalDavBackend.php | 2 +- .../unit/CalDAV/AppCalendar/CalendarObjectTest.php | 3 +- .../unit/CalDAV/EventComparisonServiceTest.php | 16 +-- apps/dav/tests/unit/CalDAV/PublicCalendarTest.php | 4 +- .../unit/CalDAV/Reminder/ReminderServiceTest.php | 3 +- .../tests/unit/CalDAV/Schedule/IMipPluginTest.php | 3 +- .../tests/unit/CalDAV/Schedule/IMipServiceTest.php | 30 ++---- apps/dav/tests/unit/CardDAV/AddressBookTest.php | 1 - apps/dav/tests/unit/CardDAV/ConverterTest.php | 2 +- apps/dav/tests/unit/Connector/PublicAuthTest.php | 6 +- .../Sabre/BlockLegacyClientPluginTest.php | 2 +- .../Connector/Sabre/Exception/ForbiddenTest.php | 4 +- .../Connector/Sabre/Exception/InvalidPathTest.php | 4 +- .../Connector/Sabre/ExceptionLoggerPluginTest.php | 2 - apps/dav/tests/unit/Connector/Sabre/NodeTest.php | 3 +- apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php | 8 +- .../dav/tests/unit/Files/FileSearchBackendTest.php | 2 +- .../unit/Files/MultipartRequestParserTest.php | 4 +- .../tests/unit/Search/EventsSearchProviderTest.php | 2 +- .../dav/tests/unit/Settings/CalDAVSettingsTest.php | 12 +-- apps/dav/tests/unit/Upload/AssemblyStreamTest.php | 4 +- apps/encryption/lib/Command/DisableMasterKey.php | 4 +- apps/encryption/lib/Command/EnableMasterKey.php | 4 +- apps/encryption/lib/Command/FixKeyLocation.php | 2 +- apps/encryption/lib/Command/RecoverUser.php | 6 +- apps/encryption/lib/Command/ScanLegacyFormat.php | 6 +- .../lib/Controller/RecoveryController.php | 8 +- .../lib/Controller/SettingsController.php | 20 ++-- .../encryption/lib/Controller/StatusController.php | 10 +- apps/encryption/lib/Crypto/Crypt.php | 2 +- apps/encryption/lib/Hooks/UserHooks.php | 6 +- apps/encryption/lib/Recovery.php | 10 +- apps/encryption/lib/Users/Setup.php | 2 +- apps/encryption/templates/settings-admin.php | 8 +- apps/encryption/templates/settings-personal.php | 6 +- apps/encryption/tests/Crypto/CryptTest.php | 2 +- apps/encryption/tests/Hooks/UserHooksTest.php | 2 +- apps/encryption/tests/KeyManagerTest.php | 2 +- apps/encryption/tests/Settings/AdminTest.php | 2 +- .../lib/AppInfo/Application.php | 2 +- .../lib/BackgroundJob/RetryJob.php | 2 +- .../lib/Controller/RequestHandlerController.php | 30 +++--- .../lib/FederatedShareProvider.php | 24 ++--- .../Migration/Version1010Date20200630191755.php | 4 +- .../Migration/Version1011Date20201120125158.php | 2 +- .../federatedfilesharing/lib/Settings/Personal.php | 2 +- .../tests/AddressHandlerTest.php | 2 +- .../Controller/MountPublicLinkControllerTest.php | 16 +-- .../Controller/RequestHandlerControllerTest.php | 24 ++--- .../lib/BackgroundJob/GetSharedSecret.php | 6 +- .../lib/Command/SyncFederationAddressBooks.php | 2 +- .../lib/Controller/SettingsController.php | 6 +- apps/federation/lib/DbHandler.php | 4 +- .../Migration/Version1010Date20200630191302.php | 2 +- apps/federation/lib/SyncFederationAddressBooks.php | 6 +- apps/federation/lib/SyncJob.php | 2 +- apps/federation/lib/TrustedServers.php | 5 +- .../tests/Middleware/AddServerMiddlewareTest.php | 2 +- .../tests/SyncFederationAddressbooksTest.php | 2 +- apps/federation/tests/TrustedServersTest.php | 4 +- apps/files/lib/Activity/Provider.php | 14 +-- apps/files/lib/AppInfo/Application.php | 4 +- .../BackgroundJob/CleanupDirectEditingTokens.php | 2 +- apps/files/lib/BackgroundJob/CleanupFileLocks.php | 2 +- .../BackgroundJob/DeleteExpiredOpenLocalEditor.php | 1 - apps/files/lib/BackgroundJob/TransferOwnership.php | 2 +- .../files/lib/Collaboration/Resources/Listener.php | 2 +- .../Collaboration/Resources/ResourceProvider.php | 4 +- apps/files/lib/Command/Copy.php | 1 - apps/files/lib/Command/Get.php | 1 - apps/files/lib/Command/Move.php | 2 +- apps/files/lib/Command/Object/Delete.php | 2 - apps/files/lib/Command/Object/Get.php | 1 - apps/files/lib/Command/Object/Put.php | 3 +- apps/files/lib/Command/Put.php | 1 - apps/files/lib/Command/Scan.php | 6 +- apps/files/lib/Command/TransferOwnership.php | 4 +- apps/files/lib/Controller/ApiController.php | 18 ++-- .../lib/Controller/DirectEditingController.php | 2 +- apps/files/lib/Controller/TemplateController.php | 2 +- .../lib/Controller/TransferOwnershipController.php | 18 ++-- apps/files/lib/Controller/ViewController.php | 9 +- .../files/lib/Event/LoadAdditionalScriptsEvent.php | 3 +- .../Migration/Version12101Date20221011153334.php | 2 +- apps/files/lib/Notification/Notifier.php | 10 +- apps/files/lib/ResponseDefinitions.php | 1 + apps/files/lib/Search/FilesSearchProvider.php | 16 +-- .../files/lib/Service/OwnershipTransferService.php | 68 ++++++------ apps/files/lib/Service/UserConfig.php | 6 +- apps/files/lib/Service/ViewConfig.php | 10 +- apps/files/list.php | 4 +- apps/files/templates/appnavigation.php | 12 +-- apps/files/tests/Activity/ProviderTest.php | 1 - .../lib/BackgroundJob/CredentialsCleanup.php | 2 +- apps/files_external/lib/Command/Create.php | 2 +- apps/files_external/lib/Command/Verify.php | 2 - apps/files_external/lib/Config/ConfigAdapter.php | 3 +- .../lib/Config/ExternalMountPoint.php | 2 +- .../files_external/lib/Config/SystemMountPoint.php | 1 - .../lib/Controller/AjaxController.php | 10 +- .../lib/Controller/StoragesController.php | 1 - apps/files_external/lib/Lib/Auth/AuthMechanism.php | 4 +- apps/files_external/lib/Lib/Backend/Backend.php | 4 +- .../lib/Lib/Backend/LegacyBackend.php | 24 ++--- apps/files_external/lib/Lib/Storage/AmazonS3.php | 7 +- apps/files_external/lib/Lib/Storage/SFTP.php | 3 +- apps/files_external/lib/Lib/Storage/Swift.php | 2 +- .../lib/Listener/LoadAdditionalListener.php | 5 +- .../Migration/Version1011Date20200630192246.php | 2 +- apps/files_external/lib/ResponseDefinitions.php | 1 + apps/files_external/templates/settings.php | 119 +++++++++++---------- .../Controller/GlobalStoragesControllerTest.php | 1 - .../Controller/UserStoragesControllerTest.php | 1 - .../tests/Listener/StorePasswordListenerTest.php | 2 +- apps/files_external/tests/PersonalMountTest.php | 4 - .../files_external/tests/sso-setup/apps.config.php | 9 +- .../lib/Listener/LoadAdditionalScriptsListener.php | 3 +- .../lib/Listener/NodeDeletedListener.php | 3 +- .../lib/Listener/UserDeletedListener.php | 3 +- apps/files_reminders/lib/Notification/Notifier.php | 3 +- .../lib/Service/ReminderService.php | 3 +- apps/files_sharing/lib/Activity/Providers/Base.php | 12 +-- .../lib/Activity/Providers/Groups.php | 14 +-- .../lib/Activity/Providers/RemoteShares.php | 12 +-- apps/files_sharing/lib/AppInfo/Application.php | 5 +- apps/files_sharing/lib/Cache.php | 2 - .../lib/Collaboration/ShareRecipientSorter.php | 1 - .../lib/Command/DeleteOrphanShares.php | 3 +- .../lib/Command/ExiprationNotification.php | 8 +- .../lib/Controller/DeletedShareAPIController.php | 16 +-- .../lib/Controller/PublicPreviewController.php | 8 +- .../lib/Controller/SettingsController.php | 4 +- .../lib/Controller/ShareAPIController.php | 8 +- .../lib/Controller/ShareController.php | 10 +- .../lib/Controller/ShareInfoController.php | 4 +- .../lib/Controller/ShareesAPIController.php | 8 +- .../lib/DefaultPublicShareTemplateProvider.php | 3 +- apps/files_sharing/lib/External/MountProvider.php | 2 +- .../lib/Listener/LoadAdditionalListener.php | 2 +- .../lib/Listener/LoadSidebarListener.php | 15 ++- .../lib/Middleware/OCSShareAPIMiddleware.php | 2 +- .../lib/Middleware/SharingCheckMiddleware.php | 12 +-- .../lib/Migration/OwncloudGuestShareType.php | 2 +- .../Migration/Version11300Date20201120141438.php | 2 +- .../Migration/Version21000Date20201223143245.php | 2 +- .../Migration/Version24000Date20220208195521.php | 2 +- apps/files_sharing/lib/MountProvider.php | 2 +- apps/files_sharing/lib/Notification/Notifier.php | 10 +- apps/files_sharing/lib/ResponseDefinitions.php | 1 + apps/files_sharing/lib/SharedMount.php | 2 +- apps/files_sharing/lib/SharedStorage.php | 10 +- apps/files_sharing/lib/Updater.php | 2 +- apps/files_sharing/templates/public.php | 2 +- apps/files_sharing/tests/ApiTest.php | 1 - apps/files_sharing/tests/ApplicationTest.php | 8 +- apps/files_sharing/tests/CacheTest.php | 4 +- .../Controller/ExternalShareControllerTest.php | 6 +- .../tests/Controller/ShareAPIControllerTest.php | 23 ++-- .../tests/Controller/ShareControllerTest.php | 12 +-- .../tests/Controller/ShareesAPIControllerTest.php | 2 +- apps/files_sharing/tests/SharedMountTest.php | 4 +- apps/files_sharing/tests/TestCase.php | 2 +- apps/files_trashbin/lib/AppInfo/Application.php | 2 +- .../lib/BackgroundJob/ExpireTrash.php | 1 - apps/files_trashbin/lib/Command/ExpireTrash.php | 2 +- apps/files_trashbin/lib/Expiration.php | 2 +- .../lib/Listeners/LoadAdditionalScripts.php | 3 +- .../Migration/Version1010Date20200630192639.php | 2 +- apps/files_trashbin/lib/Sabre/TrashbinPlugin.php | 4 +- .../lib/Trash/LegacyTrashBackend.php | 2 +- apps/files_trashbin/lib/Trash/TrashItem.php | 1 - apps/files_trashbin/lib/Trashbin.php | 4 +- .../lib/UserMigration/TrashbinMigrator.php | 2 +- apps/files_trashbin/tests/ExpirationTest.php | 2 +- apps/files_versions/lib/AppInfo/Application.php | 4 +- apps/files_versions/lib/Db/VersionsMapper.php | 4 +- apps/files_versions/lib/Expiration.php | 8 +- apps/files_versions/lib/Sabre/Plugin.php | 2 +- apps/files_versions/lib/Sabre/VersionFile.php | 1 - apps/files_versions/lib/Storage.php | 10 +- .../lib/Versions/LegacyVersionsBackend.php | 1 - .../files_versions/lib/Versions/VersionManager.php | 5 +- apps/files_versions/tests/StorageTest.php | 1 - .../lib/AppInfo/Application.php | 4 +- .../lib/BackgroundJobs/RetryJob.php | 10 +- .../lib/UpdateLookupServer.php | 2 +- .../lib/Controller/LoginRedirectorController.php | 14 +-- apps/oauth2/lib/Controller/SettingsController.php | 4 +- apps/oauth2/lib/Migration/SetTokenExpiration.php | 4 +- apps/oauth2/lib/Settings/Admin.php | 2 +- .../tests/Controller/SettingsControllerTest.php | 3 +- apps/provisioning_api/lib/Controller/AUserData.php | 14 +-- .../lib/Controller/AppConfigController.php | 14 +-- .../lib/Controller/GroupsController.php | 16 +-- apps/provisioning_api/lib/ResponseDefinitions.php | 1 + apps/settings/lib/Activity/GroupProvider.php | 8 +- apps/settings/lib/Activity/Provider.php | 6 +- .../settings/lib/BackgroundJobs/VerifyUserData.php | 10 +- .../lib/Controller/AISettingsController.php | 6 -- .../lib/Controller/AppSettingsController.php | 24 ++--- .../lib/Controller/AuthSettingsController.php | 18 ++-- .../lib/Controller/AuthorizedGroupController.php | 4 +- .../lib/Controller/ChangePasswordController.php | 14 +-- apps/settings/lib/Controller/HelpController.php | 2 +- .../lib/Controller/MailSettingsController.php | 26 ++--- .../lib/Controller/TwoFactorSettingsController.php | 4 +- apps/settings/lib/Controller/UsersController.php | 28 ++--- apps/settings/lib/Hooks.php | 16 +-- .../AppPasswordCreatedActivityListener.php | 4 +- apps/settings/lib/Mailer/NewUserMailHelper.php | 18 ++-- .../settings/lib/Middleware/SubadminMiddleware.php | 4 +- apps/settings/lib/Search/SectionSearch.php | 6 +- .../lib/Service/AuthorizedGroupService.php | 6 +- apps/settings/lib/Settings/Admin/Delegation.php | 2 +- apps/settings/lib/Settings/Admin/Security.php | 10 +- apps/settings/lib/Settings/Admin/Server.php | 12 +-- .../lib/Settings/Personal/PersonalInfo.php | 2 +- .../lib/Settings/Personal/Security/Authtokens.php | 14 +-- .../lib/Settings/Personal/Security/Password.php | 2 +- .../lib/Settings/Personal/Security/TwoFactor.php | 16 +-- .../lib/Settings/Personal/Security/WebAuthn.php | 6 +- .../lib/Settings/Personal/ServerDevNotice.php | 10 +- apps/settings/templates/help.php | 12 ++- apps/settings/templates/settings/additional.php | 2 +- .../templates/settings/admin/additional-mail.php | 52 ++++----- .../settings/templates/settings/admin/overview.php | 8 +- apps/settings/templates/settings/empty.php | 2 +- apps/settings/templates/settings/frame.php | 4 +- .../settings/personal/development.notice.php | 2 +- .../settings/personal/security/twofactor.php | 20 ++-- .../Controller/MailSettingsControllerTest.php | 2 +- .../tests/Controller/UsersControllerTest.php | 10 +- .../settings/tests/Settings/Admin/SecurityTest.php | 2 +- apps/settings/tests/Settings/Admin/ServerTest.php | 2 +- .../tests/SetupChecks/PhpDefaultCharsetTest.php | 2 +- apps/sharebymail/lib/Capabilities.php | 4 +- apps/systemtags/lib/Activity/Listener.php | 16 +-- apps/systemtags/lib/AppInfo/Application.php | 2 +- apps/systemtags/lib/Capabilities.php | 1 + apps/systemtags/lib/Search/TagSearchProvider.php | 19 ++-- apps/testing/lib/AppInfo/Application.php | 2 +- apps/testing/lib/Controller/ConfigController.php | 4 +- apps/testing/lib/Controller/LockingController.php | 12 +-- apps/testing/lib/Locking/FakeDBLockingProvider.php | 3 +- apps/theming/lib/Capabilities.php | 5 +- apps/theming/lib/Controller/IconController.php | 2 +- apps/theming/lib/Controller/ThemingController.php | 11 +- .../theming/lib/Controller/UserThemeController.php | 12 +-- apps/theming/lib/ITheme.php | 5 +- apps/theming/lib/IconBuilder.php | 8 +- .../Listener/BeforeTemplateRenderedListener.php | 8 +- apps/theming/lib/Migration/MigrateAdminConfig.php | 3 +- apps/theming/lib/Migration/MigrateUserConfig.php | 16 +-- apps/theming/lib/ResponseDefinitions.php | 1 + apps/theming/lib/Service/BackgroundService.php | 8 +- apps/theming/lib/Service/JSDataService.php | 1 - apps/theming/lib/Service/ThemeInjectionService.php | 13 ++- apps/theming/lib/Service/ThemesService.php | 46 ++++---- apps/theming/lib/Settings/Admin.php | 2 +- apps/theming/lib/Settings/Personal.php | 4 +- apps/theming/lib/Settings/PersonalSection.php | 4 +- apps/theming/lib/Themes/CommonThemeTrait.php | 5 +- apps/theming/lib/Themes/DarkHighContrastTheme.php | 3 +- apps/theming/lib/Themes/DarkTheme.php | 1 + apps/theming/lib/Themes/DefaultTheme.php | 15 +-- apps/theming/lib/Themes/DyslexiaFont.php | 2 +- apps/theming/lib/Themes/HighContrastTheme.php | 3 +- apps/theming/lib/Themes/LightTheme.php | 8 +- apps/theming/lib/ThemingDefaults.php | 16 +-- apps/theming/lib/Util.php | 2 +- .../tests/Controller/ThemingControllerTest.php | 2 +- .../tests/Controller/UserThemeControllerTest.php | 2 +- apps/theming/tests/IconBuilderTest.php | 2 +- apps/theming/tests/Service/ThemesServiceTest.php | 4 +- apps/theming/tests/Settings/PersonalTest.php | 2 +- apps/theming/tests/Themes/DyslexiaFontTest.php | 1 - .../lib/BackgroundJob/RememberBackupCodesJob.php | 8 +- .../lib/Listener/ProviderDisabled.php | 2 +- .../lib/Listener/ProviderEnabled.php | 2 +- .../lib/Provider/BackupCodesProvider.php | 8 +- .../lib/Service/BackupCodeStorage.php | 6 +- .../lib/Controller/APIController.php | 14 +-- .../lib/Controller/AdminController.php | 12 +-- .../lib/ResetTokenBackgroundJob.php | 4 +- .../updatenotification/lib/ResponseDefinitions.php | 1 + apps/updatenotification/lib/Settings/Admin.php | 6 +- apps/updatenotification/templates/admin.php | 2 +- .../tests/Settings/AdminTest.php | 16 +-- apps/user_ldap/ajax/clearMappings.php | 2 +- apps/user_ldap/lib/Access.php | 12 +-- apps/user_ldap/lib/AppInfo/Application.php | 2 +- apps/user_ldap/lib/Command/CheckUser.php | 18 ++-- apps/user_ldap/lib/Command/DeleteConfig.php | 8 +- apps/user_ldap/lib/Command/Search.php | 42 ++++---- apps/user_ldap/lib/Command/SetConfig.php | 24 ++--- apps/user_ldap/lib/Command/ShowConfig.php | 30 +++--- apps/user_ldap/lib/Command/UpdateUUID.php | 27 +++-- .../lib/DataCollector/LdapDataCollector.php | 4 +- apps/user_ldap/lib/GroupPluginManager.php | 2 +- apps/user_ldap/lib/Group_LDAP.php | 2 +- apps/user_ldap/lib/Helper.php | 2 +- apps/user_ldap/lib/Jobs/CleanUp.php | 4 +- apps/user_ldap/lib/Jobs/UpdateGroups.php | 2 +- apps/user_ldap/lib/LDAP.php | 4 +- .../lib/Migration/GroupMappingMigration.php | 2 +- .../user_ldap/lib/Migration/SetDefaultProvider.php | 2 +- apps/user_ldap/lib/Migration/UUIDFixUser.php | 2 +- .../Migration/Version1010Date20200630192842.php | 2 +- .../Migration/Version1120Date20210917155206.php | 1 - apps/user_ldap/lib/User/Manager.php | 2 +- apps/user_ldap/lib/User/User.php | 4 +- apps/user_ldap/lib/User_Proxy.php | 2 +- apps/user_ldap/lib/Wizard.php | 6 +- apps/user_ldap/tests/Group_LDAPTest.php | 2 +- .../tests/Migration/UUIDFixInsertTest.php | 4 +- apps/user_ldap/tests/UserLDAPPluginTest.php | 4 +- apps/user_ldap/tests/User_LDAPTest.php | 2 +- apps/user_status/lib/AppInfo/Application.php | 2 +- .../ClearOldStatusesBackgroundJob.php | 2 +- apps/user_status/lib/Connector/UserStatus.php | 2 +- .../lib/Connector/UserStatusProvider.php | 2 +- .../lib/ContactsMenu/StatusProvider.php | 2 +- .../lib/Controller/HeartbeatController.php | 12 +-- .../lib/Controller/PredefinedStatusController.php | 4 +- .../lib/Controller/StatusesController.php | 4 +- .../lib/Controller/UserStatusController.php | 6 +- .../user_status/lib/Dashboard/UserStatusWidget.php | 16 ++- apps/user_status/lib/Db/UserStatusMapper.php | 2 +- .../lib/Listener/UserDeletedListener.php | 2 +- .../lib/Listener/UserLiveStatusListener.php | 8 +- .../Migration/Version0001Date20200602134824.php | 2 +- apps/user_status/lib/ResponseDefinitions.php | 1 + apps/user_status/lib/Service/JSDataService.php | 2 +- apps/user_status/lib/Service/StatusService.php | 39 ++++--- .../tests/Unit/Connector/UserStatusTest.php | 2 +- .../Unit/Controller/UserStatusControllerTest.php | 44 ++++---- .../tests/Unit/Db/UserStatusMapperTest.php | 2 +- .../Unit/Listener/UserLiveStatusListenerTest.php | 14 +-- .../tests/Unit/Service/StatusServiceTest.php | 54 +++++----- apps/weather_status/lib/AppInfo/Application.php | 2 +- apps/weather_status/lib/Capabilities.php | 4 +- apps/weather_status/lib/ResponseDefinitions.php | 1 + apps/workflowengine/lib/AppInfo/Application.php | 4 +- apps/workflowengine/lib/BackgroundJobs/Rotate.php | 2 +- apps/workflowengine/lib/Check/FileSystemTags.php | 2 +- .../LoadAdditionalSettingsScriptsListener.php | 2 +- apps/workflowengine/lib/Manager.php | 2 +- .../Migration/Version2000Date20190808074233.php | 2 +- build/integration/features/bootstrap/Auth.php | 2 +- .../features/bootstrap/CommentsContext.php | 2 +- build/integration/features/bootstrap/Sharing.php | 14 +-- core/Command/Base.php | 2 +- core/Command/Broadcast/Test.php | 2 +- core/Command/Db/AddMissingIndices.php | 2 +- core/Command/Db/ConvertFilecacheBigInt.php | 2 +- core/Command/Db/ConvertType.php | 2 +- core/Command/Info/FileUtils.php | 2 +- core/Command/Maintenance/Repair.php | 8 +- core/Command/Maintenance/RepairShareOwnership.php | 2 +- core/Command/Preview/Generate.php | 2 +- core/Command/TwoFactorAuth/Enforce.php | 2 +- core/Command/TwoFactorAuth/State.php | 2 +- core/Command/Upgrade.php | 8 +- core/Command/User/AuthTokens/Delete.php | 2 +- core/Command/User/AuthTokens/ListCommand.php | 2 +- core/Controller/ClientFlowLoginController.php | 6 +- core/Controller/LoginController.php | 10 +- core/Controller/LostController.php | 14 +-- core/Controller/ProfileApiController.php | 2 +- core/Controller/ProfilePageController.php | 8 +- core/Controller/ReferenceController.php | 2 +- core/Controller/TextProcessingApiController.php | 4 +- core/Controller/TextToImageApiController.php | 4 +- core/Controller/UnifiedSearchController.php | 2 +- core/Db/ProfileConfig.php | 4 +- core/Migrations/Version13000Date20170705121758.php | 2 +- core/Migrations/Version13000Date20170718121200.php | 38 +++---- core/Migrations/Version14000Date20180522074438.php | 2 +- core/Migrations/Version14000Date20180710092004.php | 2 +- core/Migrations/Version16000Date20190207141427.php | 6 +- core/Migrations/Version16000Date20190212081545.php | 2 +- core/Migrations/Version16000Date20190428150708.php | 2 +- core/Migrations/Version17000Date20190514105811.php | 4 +- core/Migrations/Version18000Date20190920085628.php | 2 +- core/Migrations/Version18000Date20191014105105.php | 4 +- core/Migrations/Version18000Date20191204114856.php | 2 +- core/Migrations/Version20000Date20201109081915.php | 2 +- core/Migrations/Version20000Date20201109081918.php | 2 +- core/Migrations/Version21000Date20201202095923.php | 2 +- core/Migrations/Version23000Date20210721100600.php | 2 +- core/Migrations/Version23000Date20210906132259.php | 36 +++---- core/ajax/update.php | 12 +-- core/templates/publicshareauth.php | 12 +-- lib/composer/composer/installed.php | 4 +- lib/private/Accounts/AccountManager.php | 4 +- lib/private/Activity/Manager.php | 10 +- lib/private/App/AppManager.php | 14 +-- lib/private/App/AppStore/Fetcher/AppFetcher.php | 12 +-- .../App/AppStore/Fetcher/CategoryFetcher.php | 10 +- lib/private/App/AppStore/Fetcher/Fetcher.php | 10 +- lib/private/App/Platform.php | 2 +- lib/private/AppFramework/App.php | 8 +- lib/private/AppFramework/Bootstrap/Coordinator.php | 10 +- .../Bootstrap/EventListenerRegistration.php | 6 +- .../Bootstrap/ParameterRegistration.php | 4 +- .../Bootstrap/PreviewProviderRegistration.php | 4 +- .../AppFramework/Bootstrap/RegistrationContext.php | 18 ++-- .../Bootstrap/ServiceAliasRegistration.php | 4 +- .../Bootstrap/ServiceFactoryRegistration.php | 6 +- lib/private/AppFramework/Http/Dispatcher.php | 16 +-- lib/private/AppFramework/Http/Request.php | 8 +- lib/private/AppFramework/Http/RequestId.php | 2 +- .../Middleware/Security/CORSMiddleware.php | 6 +- .../Middleware/Security/CSPMiddleware.php | 4 +- .../Security/PasswordConfirmationMiddleware.php | 6 +- .../Security/SameSiteCookieMiddleware.php | 2 +- .../Middleware/Security/SecurityMiddleware.php | 24 ++--- .../AppFramework/Middleware/SessionMiddleware.php | 2 +- lib/private/AppFramework/OCS/BaseResponse.php | 8 +- lib/private/AppFramework/ScopedPsrLogger.php | 2 +- .../AppFramework/Utility/SimpleContainer.php | 2 +- lib/private/AppScriptSort.php | 8 +- .../Listeners/RemoteWipeActivityListener.php | 2 +- .../Listeners/RemoteWipeEmailListener.php | 6 +- .../Listeners/RemoteWipeNotificationsListener.php | 2 +- .../Listeners/UserDeletedTokenCleanupListener.php | 2 +- lib/private/Authentication/Login/Chain.php | 22 ++-- .../Login/CreateSessionTokenCommand.php | 2 +- .../Authentication/Login/LoggedInCheckCommand.php | 2 +- lib/private/Authentication/Login/LoginData.php | 10 +- .../Login/SetUserTimezoneCommand.php | 2 +- .../Authentication/Login/TwoFactorCommand.php | 8 +- .../Login/UserDisabledCheckCommand.php | 2 +- lib/private/Authentication/Login/WebAuthnChain.php | 18 ++-- .../Authentication/LoginCredentials/Store.php | 4 +- lib/private/Authentication/Token/IProvider.php | 12 +-- lib/private/Authentication/Token/Manager.php | 12 +-- .../Token/PublicKeyTokenProvider.php | 42 ++++---- lib/private/Authentication/Token/RemoteWipe.php | 8 +- .../TwoFactorAuth/EnforcementState.php | 4 +- .../Authentication/TwoFactorAuth/Manager.php | 18 ++-- .../Authentication/TwoFactorAuth/ProviderSet.php | 2 +- .../Authentication/TwoFactorAuth/Registry.php | 2 +- lib/private/Authentication/WebAuthn/Manager.php | 2 +- lib/private/Avatar/GuestAvatar.php | 2 +- lib/private/BinaryFinder.php | 2 +- lib/private/CapabilitiesManager.php | 2 +- .../Collaboration/Collaborators/MailPlugin.php | 2 +- lib/private/Command/ClosureJob.php | 2 +- lib/private/Command/CronBus.php | 2 +- lib/private/Comments/Manager.php | 16 +-- lib/private/Console/Application.php | 8 +- lib/private/DB/Connection.php | 4 +- lib/private/DB/Migrator.php | 6 +- lib/private/Dashboard/Manager.php | 2 +- lib/private/DirectEditing/Manager.php | 4 +- lib/private/Encryption/EncryptionWrapper.php | 4 +- lib/private/Encryption/File.php | 6 +- lib/private/Encryption/HookManager.php | 2 +- lib/private/Encryption/Update.php | 16 +-- lib/private/EventDispatcher/EventDispatcher.php | 22 ++-- .../EventDispatcher/ServiceEventListener.php | 4 +- lib/private/Federation/CloudFederationShare.php | 20 ++-- lib/private/Files/AppData/AppData.php | 6 +- lib/private/Files/AppData/Factory.php | 2 +- lib/private/Files/Cache/Cache.php | 2 +- lib/private/Files/Cache/Scanner.php | 4 +- lib/private/Files/Filesystem.php | 2 +- lib/private/Files/Mount/Manager.php | 2 +- lib/private/Files/Node/LazyFolder.php | 2 +- lib/private/Files/Node/LazyUserFolder.php | 6 +- lib/private/Files/Node/Root.php | 2 +- lib/private/Files/SimpleFS/SimpleFolder.php | 2 +- lib/private/Files/Storage/DAV.php | 2 +- lib/private/Files/Storage/Wrapper/Encoding.php | 2 +- lib/private/Files/Stream/Encryption.php | 24 ++--- lib/private/Files/Template/TemplateManager.php | 2 +- lib/private/Files/Type/Detection.php | 10 +- lib/private/Files/Utils/Scanner.php | 4 +- lib/private/Files/View.php | 4 +- lib/private/Group/Database.php | 4 +- lib/private/Group/Group.php | 14 +-- lib/private/Group/Manager.php | 6 +- lib/private/Group/MetaData.php | 10 +- lib/private/Http/CookieHelper.php | 14 +-- lib/private/Http/WellKnown/RequestManager.php | 4 +- lib/private/IntegrityCheck/Checker.php | 26 ++--- lib/private/Log.php | 4 +- lib/private/Memcache/Factory.php | 2 +- lib/private/Migration/BackgroundRepair.php | 6 +- lib/private/NavigationManager.php | 10 +- lib/private/Notification/Manager.php | 10 +- lib/private/OCS/DiscoveryService.php | 2 +- lib/private/OCS/Provider.php | 4 +- lib/private/Preview/BackgroundCleanupJob.php | 8 +- lib/private/Preview/Imaginary.php | 4 +- lib/private/Preview/WatcherConnector.php | 2 +- lib/private/Profile/Actions/FediverseAction.php | 2 +- lib/private/Profile/Actions/TwitterAction.php | 2 +- lib/private/Profile/ProfileManager.php | 10 +- lib/private/Profiler/Profiler.php | 6 +- lib/private/Repair.php | 16 +-- lib/private/Repair/ClearFrontendCaches.php | 2 +- lib/private/Repair/ClearGeneratedAvatarCache.php | 2 +- .../Repair/ClearGeneratedAvatarCacheJob.php | 4 +- .../Repair/NC18/ResetGeneratedAvatarFlag.php | 2 +- lib/private/Repair/NC20/EncryptionLegacyCipher.php | 2 +- lib/private/Repair/NC20/EncryptionMigration.php | 2 +- lib/private/Repair/NC21/ValidatePhoneNumber.php | 4 +- lib/private/Repair/Owncloud/CleanPreviews.php | 4 +- .../Repair/Owncloud/CleanPreviewsBackgroundJob.php | 8 +- lib/private/Repair/Owncloud/MigrateOauthTables.php | 4 +- lib/private/Repair/Owncloud/MoveAvatars.php | 2 +- .../Repair/Owncloud/UpdateLanguageCodes.php | 2 +- lib/private/Repair/RemoveLinkShares.php | 8 +- lib/private/Repair/RepairMimeTypes.php | 2 +- lib/private/Route/Router.php | 10 +- lib/private/Search/FilterCollection.php | 2 +- lib/private/Search/FilterFactory.php | 4 +- lib/private/Search/SearchComposer.php | 6 +- lib/private/Search/SearchQuery.php | 2 +- lib/private/Security/Bruteforce/Capabilities.php | 2 +- lib/private/Security/Bruteforce/Throttler.php | 4 +- .../Security/VerificationToken/CleanUpJob.php | 4 +- lib/private/Server.php | 18 ++-- lib/private/Session/CryptoSessionData.php | 4 +- lib/private/Session/CryptoWrapper.php | 6 +- lib/private/Setup.php | 2 +- lib/private/Setup/MySQL.php | 2 +- lib/private/Share/Share.php | 6 +- lib/private/Share20/Manager.php | 12 +-- lib/private/Share20/PublicShareTemplateFactory.php | 2 +- lib/private/Share20/Share.php | 2 +- lib/private/StreamImage.php | 2 +- lib/private/SubAdmin.php | 6 +- lib/private/Support/Subscription/Registry.php | 8 +- lib/private/TagManager.php | 2 +- lib/private/Tagging/TagMapper.php | 2 +- lib/private/Talk/Broker.php | 8 +- lib/private/Template/JSCombiner.php | 8 +- lib/private/Template/JSConfigHelper.php | 22 ++-- lib/private/TextProcessing/Manager.php | 12 +-- lib/private/TextToImage/Manager.php | 16 +-- lib/private/URLGenerator.php | 8 +- lib/private/Updater.php | 20 ++-- .../User/Listeners/BeforeUserDeletedListener.php | 2 +- lib/private/User/Listeners/UserChangedListener.php | 2 +- lib/private/User/Manager.php | 8 +- lib/private/User/Session.php | 24 ++--- lib/private/User/User.php | 10 +- lib/private/UserStatus/Manager.php | 2 +- lib/private/legacy/OC_App.php | 14 +-- lib/private/legacy/OC_Files.php | 6 +- lib/private/legacy/OC_Helper.php | 2 +- lib/public/AppFramework/ApiController.php | 8 +- .../AppFramework/AuthPublicShareController.php | 6 +- .../Bootstrap/IRegistrationContext.php | 4 +- lib/public/AppFramework/Controller.php | 2 +- .../AppFramework/Http/TooManyRequestsResponse.php | 2 +- lib/public/AppFramework/OCSController.php | 8 +- lib/public/AppFramework/PublicShareController.php | 4 +- lib/public/Comments/ICommentsManager.php | 10 +- lib/public/Dashboard/Model/WidgetItem.php | 10 +- lib/public/Files/Events/FileCacheUpdated.php | 2 +- lib/public/Files/Events/NodeAddedToCache.php | 2 +- lib/public/Files/Events/NodeRemovedFromCache.php | 2 +- lib/public/Files/Node.php | 2 +- lib/public/Http/WellKnown/JrdResponse.php | 8 +- .../Log/Audit/CriticalActionPerformedEvent.php | 4 +- lib/public/Search/SearchResult.php | 10 +- lib/public/Search/SearchResultEntry.php | 10 +- lib/public/Security/ISecureRandom.php | 2 +- lib/public/Security/RateLimiting/ILimiter.php | 12 +-- lib/public/Share.php | 2 +- lib/public/Share/Events/VerifyMountPointEvent.php | 4 +- lib/public/Share/IShareProvider.php | 2 +- lib/public/Talk/IBroker.php | 4 +- lib/public/Talk/ITalkBackend.php | 4 +- .../User/Events/BeforePasswordUpdatedEvent.php | 4 +- lib/public/User/Events/BeforeUserCreatedEvent.php | 2 +- lib/public/User/Events/PasswordUpdatedEvent.php | 4 +- lib/public/User/Events/UserChangedEvent.php | 6 +- lib/public/User/Events/UserCreatedEvent.php | 2 +- lib/public/User/Events/UserLiveStatusEvent.php | 4 +- lib/public/Util.php | 2 +- ocs/v1.php | 2 +- remote.php | 2 +- tests/Core/Command/Preview/RepairTest.php | 2 +- tests/Core/Command/User/AuthTokens/DeleteTest.php | 2 +- tests/Core/Controller/LoginControllerTest.php | 2 +- tests/Core/Service/LoginFlowV2ServiceUnitTest.php | 2 +- .../lib/App/AppStore/Version/VersionParserTest.php | 2 +- tests/lib/App/InfoParserTest.php | 2 +- .../lib/AppFramework/Controller/ControllerTest.php | 2 +- tests/lib/AppFramework/Http/DispatcherTest.php | 2 +- .../lib/AppFramework/Middleware/MiddlewareTest.php | 2 +- tests/lib/AppFramework/Routing/RoutingTest.php | 16 +-- .../Authentication/TwoFactorAuth/ManagerTest.php | 2 +- tests/lib/Avatar/AvatarManagerTest.php | 2 +- .../Collaboration/Collaborators/MailPluginTest.php | 2 +- .../Collaboration/Collaborators/UserPluginTest.php | 6 +- tests/lib/Diagnostics/EventLoggerTest.php | 2 +- tests/lib/Encryption/ManagerTest.php | 114 ++++++++++---------- tests/lib/Encryption/UpdateTest.php | 4 +- tests/lib/Files/Cache/UpdaterLegacyTest.php | 4 +- tests/lib/Files/Config/UserMountCacheTest.php | 2 +- tests/lib/Files/EtagTest.php | 2 +- tests/lib/Files/FilesystemTest.php | 6 +- tests/lib/Files/Node/RootTest.php | 2 +- tests/lib/Files/Storage/Wrapper/EncryptionTest.php | 14 +-- tests/lib/Files/Stream/EncryptionTest.php | 14 +-- tests/lib/Files/ViewTest.php | 4 +- tests/lib/Group/ManagerTest.php | 4 +- tests/lib/InitialStateServiceTest.php | 6 +- tests/lib/Mail/MailerTest.php | 8 +- tests/lib/Mail/MessageTest.php | 2 +- tests/lib/Memcache/FactoryTest.php | 2 +- tests/lib/Migration/BackgroundRepairTest.php | 8 +- tests/lib/Repair/RepairDavSharesTest.php | 2 +- tests/lib/RepairTest.php | 6 +- tests/lib/Security/Bruteforce/ThrottlerTest.php | 14 +-- tests/lib/Security/CertificateManagerTest.php | 6 +- .../VerificationToken/VerificationTokenTest.php | 2 +- tests/lib/Settings/ManagerTest.php | 2 +- tests/lib/Share20/DefaultShareProviderTest.php | 4 +- tests/lib/TextProcessing/TextProcessingTest.php | 2 +- tests/lib/Updater/ChangesCheckTest.php | 4 +- tests/lib/UpdaterTest.php | 4 +- tests/lib/User/SessionTest.php | 2 +- tests/lib/Util/Group/Dummy.php | 8 +- 805 files changed, 2727 insertions(+), 2804 deletions(-) (limited to 'lib/private/Files/Storage') diff --git a/apps/admin_audit/lib/Actions/Action.php b/apps/admin_audit/lib/Actions/Action.php index bfd67f474f9..238ed10e4d9 100644 --- a/apps/admin_audit/lib/Actions/Action.php +++ b/apps/admin_audit/lib/Actions/Action.php @@ -34,7 +34,8 @@ class Action { public function __construct( private IAuditLogger $logger, - ) {} + ) { + } /** * Log a single action with a log level of info @@ -45,9 +46,9 @@ class Action { * @param bool $obfuscateParameters */ public function log(string $text, - array $params, - array $elements, - bool $obfuscateParameters = false): void { + array $params, + array $elements, + bool $obfuscateParameters = false): void { foreach ($elements as $element) { if (!isset($params[$element])) { if ($obfuscateParameters) { diff --git a/apps/admin_audit/lib/Actions/UserManagement.php b/apps/admin_audit/lib/Actions/UserManagement.php index 02d5b60d2fa..c66793d8a5b 100644 --- a/apps/admin_audit/lib/Actions/UserManagement.php +++ b/apps/admin_audit/lib/Actions/UserManagement.php @@ -61,7 +61,7 @@ class UserManagement extends Action { */ public function assign(string $uid): void { $this->log( - 'UserID assigned: "%s"', + 'UserID assigned: "%s"', [ 'uid' => $uid ], [ 'uid' ] ); diff --git a/apps/admin_audit/lib/AppInfo/Application.php b/apps/admin_audit/lib/AppInfo/Application.php index 1daf9f18ef0..d034e79e0c2 100644 --- a/apps/admin_audit/lib/AppInfo/Application.php +++ b/apps/admin_audit/lib/AppInfo/Application.php @@ -101,7 +101,7 @@ class Application extends App implements IBootstrap { * Register hooks in order to log them */ private function registerHooks(IAuditLogger $logger, - ContainerInterface $serverContainer): void { + ContainerInterface $serverContainer): void { $this->userManagementHooks($logger, $serverContainer->get(IUserSession::class)); $this->groupHooks($logger, $serverContainer->get(IGroupManager::class)); $this->authHooks($logger); @@ -122,7 +122,7 @@ class Application extends App implements IBootstrap { } private function userManagementHooks(IAuditLogger $logger, - IUserSession $userSession): void { + IUserSession $userSession): void { $userActions = new UserManagement($logger); Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); @@ -136,7 +136,7 @@ class Application extends App implements IBootstrap { } private function groupHooks(IAuditLogger $logger, - IGroupManager $groupManager): void { + IGroupManager $groupManager): void { $groupActions = new GroupManagement($logger); assert($groupManager instanceof GroupManager); @@ -167,7 +167,7 @@ class Application extends App implements IBootstrap { } private function appHooks(IAuditLogger $logger, - IEventDispatcher $eventDispatcher): void { + IEventDispatcher $eventDispatcher): void { $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function (ManagerEvent $event) use ($logger) { $appActions = new AppManagement($logger); $appActions->enableApp($event->getAppID()); @@ -183,7 +183,7 @@ class Application extends App implements IBootstrap { } private function consoleHooks(IAuditLogger $logger, - IEventDispatcher $eventDispatcher): void { + IEventDispatcher $eventDispatcher): void { $eventDispatcher->addListener(ConsoleEvent::class, function (ConsoleEvent $event) use ($logger) { $appActions = new Console($logger); $appActions->runCommand($event->getArguments()); @@ -191,7 +191,7 @@ class Application extends App implements IBootstrap { } private function fileHooks(IAuditLogger $logger, - IEventDispatcher $eventDispatcher): void { + IEventDispatcher $eventDispatcher): void { $fileActions = new Files($logger); $eventDispatcher->addListener( BeforePreviewFetchedEvent::class, @@ -264,7 +264,7 @@ class Application extends App implements IBootstrap { } private function securityHooks(IAuditLogger $logger, - IEventDispatcher $eventDispatcher): void { + IEventDispatcher $eventDispatcher): void { $eventDispatcher->addListener(TwoFactorProviderChallengePassed::class, function (TwoFactorProviderChallengePassed $event) use ($logger) { $security = new Security($logger); $security->twofactorSuccess($event->getUser(), $event->getProvider()); diff --git a/apps/admin_audit/lib/BackgroundJobs/Rotate.php b/apps/admin_audit/lib/BackgroundJobs/Rotate.php index ce441be11f6..4482a45df4e 100755 --- a/apps/admin_audit/lib/BackgroundJobs/Rotate.php +++ b/apps/admin_audit/lib/BackgroundJobs/Rotate.php @@ -27,8 +27,8 @@ declare(strict_types=1); */ namespace OCA\AdminAudit\BackgroundJobs; -use OCP\BackgroundJob\TimedJob; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; use OCP\IConfig; use OCP\Log\RotationTrait; diff --git a/apps/cloud_federation_api/appinfo/routes.php b/apps/cloud_federation_api/appinfo/routes.php index 966ff2ce3a1..ad508e13277 100644 --- a/apps/cloud_federation_api/appinfo/routes.php +++ b/apps/cloud_federation_api/appinfo/routes.php @@ -38,11 +38,11 @@ return [ 'verb' => 'POST', 'root' => '/ocm', ], -// [ -// 'name' => 'RequestHandler#inviteAccepted', -// 'url' => '/invite-accepted', -// 'verb' => 'POST', -// 'root' => '/ocm', -// ] + // [ + // 'name' => 'RequestHandler#inviteAccepted', + // 'url' => '/invite-accepted', + // 'verb' => 'POST', + // 'root' => '/ocm', + // ] ], ]; diff --git a/apps/cloud_federation_api/lib/ResponseDefinitions.php b/apps/cloud_federation_api/lib/ResponseDefinitions.php index 7f916d6c6cd..69090e6196f 100644 --- a/apps/cloud_federation_api/lib/ResponseDefinitions.php +++ b/apps/cloud_federation_api/lib/ResponseDefinitions.php @@ -1,4 +1,5 @@ db->getQueryBuilder(); $cardQuery = $this->db->getQueryBuilder(); $propQuery = $this->db->getQueryBuilder(); diff --git a/apps/contactsinteraction/lib/Db/RecentContactMapper.php b/apps/contactsinteraction/lib/Db/RecentContactMapper.php index 49a705af570..257c888e818 100644 --- a/apps/contactsinteraction/lib/Db/RecentContactMapper.php +++ b/apps/contactsinteraction/lib/Db/RecentContactMapper.php @@ -74,9 +74,9 @@ class RecentContactMapper extends QBMapper { * @return RecentContact[] */ public function findMatch(IUser $user, - ?string $uid, - ?string $email, - ?string $cloudId): array { + ?string $uid, + ?string $email, + ?string $cloudId): array { $qb = $this->db->getQueryBuilder(); $or = $qb->expr()->orX(); diff --git a/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php b/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php index 499a9f28ca5..58be052d2f3 100644 --- a/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php +++ b/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php @@ -38,9 +38,7 @@ use OCP\IL10N; use OCP\IUserManager; use Psr\Log\LoggerInterface; use Sabre\VObject\Component\VCard; -use Sabre\VObject\Reader; use Sabre\VObject\UUIDUtil; -use Throwable; class ContactInteractionListener implements IEventListener { diff --git a/apps/dashboard/lib/Controller/DashboardApiController.php b/apps/dashboard/lib/Controller/DashboardApiController.php index e62c21bcc4a..35db52225da 100644 --- a/apps/dashboard/lib/Controller/DashboardApiController.php +++ b/apps/dashboard/lib/Controller/DashboardApiController.php @@ -29,25 +29,24 @@ declare(strict_types=1); namespace OCA\Dashboard\Controller; use OCA\Dashboard\ResponseDefinitions; -use OCP\AppFramework\OCSController; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; +use OCP\Dashboard\IAPIWidget; +use OCP\Dashboard\IAPIWidgetV2; use OCP\Dashboard\IButtonWidget; use OCP\Dashboard\IIconWidget; -use OCP\Dashboard\IOptionWidget; use OCP\Dashboard\IManager; +use OCP\Dashboard\IOptionWidget; use OCP\Dashboard\IReloadableWidget; use OCP\Dashboard\IWidget; use OCP\Dashboard\Model\WidgetButton; +use OCP\Dashboard\Model\WidgetItem; + use OCP\Dashboard\Model\WidgetOptions; use OCP\IConfig; use OCP\IRequest; -use OCP\Dashboard\IAPIWidget; -use OCP\Dashboard\IAPIWidgetV2; -use OCP\Dashboard\Model\WidgetItem; -use OCP\Dashboard\Model\WidgetItems; - /** * @psalm-import-type DashboardWidget from ResponseDefinitions * @psalm-import-type DashboardWidgetItem from ResponseDefinitions diff --git a/apps/dashboard/lib/ResponseDefinitions.php b/apps/dashboard/lib/ResponseDefinitions.php index b35531be2a7..5592af1a324 100644 --- a/apps/dashboard/lib/ResponseDefinitions.php +++ b/apps/dashboard/lib/ResponseDefinitions.php @@ -1,4 +1,5 @@ setup(); // first time login event setup @@ -268,8 +268,8 @@ class Application extends App implements IBootstrap { } private function setupContactsProvider(IContactsManager $contactsManager, - IAppContainer $container, - string $userID): void { + IAppContainer $container, + string $userID): void { /** @var ContactsManager $cm */ $cm = $container->query(ContactsManager::class); $urlGenerator = $container->getServer()->getURLGenerator(); @@ -277,7 +277,7 @@ class Application extends App implements IBootstrap { } private function setupSystemContactsProvider(IContactsManager $contactsManager, - IAppContainer $container): void { + IAppContainer $container): void { /** @var ContactsManager $cm */ $cm = $container->query(ContactsManager::class); $urlGenerator = $container->getServer()->getURLGenerator(); @@ -285,7 +285,7 @@ class Application extends App implements IBootstrap { } public function registerCalendarManager(ICalendarManager $calendarManager, - IAppContainer $container): void { + IAppContainer $container): void { $calendarManager->register(function () use ($container, $calendarManager) { $user = \OC::$server->getUserSession()->getUser(); if ($user !== null) { @@ -295,14 +295,14 @@ class Application extends App implements IBootstrap { } private function setupCalendarProvider(ICalendarManager $calendarManager, - IAppContainer $container, - $userId) { + IAppContainer $container, + $userId) { $cm = $container->query(CalendarManager::class); $cm->setupCalendarProvider($calendarManager, $userId); } public function registerCalendarReminders(NotificationProviderManager $manager, - LoggerInterface $logger): void { + LoggerInterface $logger): void { try { $manager->registerProvider(AudioProvider::class); $manager->registerProvider(EmailProvider::class); diff --git a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php index a2607ca13c4..d1cafbf57c2 100644 --- a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php @@ -59,10 +59,10 @@ class BuildReminderIndexBackgroundJob extends QueuedJob { * BuildReminderIndexBackgroundJob constructor. */ public function __construct(IDBConnection $db, - ReminderService $reminderService, - LoggerInterface $logger, - IJobList $jobList, - ITimeFactory $timeFactory) { + ReminderService $reminderService, + LoggerInterface $logger, + IJobList $jobList, + ITimeFactory $timeFactory) { parent::__construct($timeFactory); $this->db = $db; $this->reminderService = $reminderService; diff --git a/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php b/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php index b57ed07d5c2..96ceb644489 100644 --- a/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php +++ b/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php @@ -34,7 +34,7 @@ class CalendarRetentionJob extends TimedJob { private $service; public function __construct(ITimeFactory $time, - RetentionService $service) { + RetentionService $service) { parent::__construct($time); $this->service = $service; diff --git a/apps/dav/lib/BackgroundJob/EventReminderJob.php b/apps/dav/lib/BackgroundJob/EventReminderJob.php index 55cecf5519d..f628a728404 100644 --- a/apps/dav/lib/BackgroundJob/EventReminderJob.php +++ b/apps/dav/lib/BackgroundJob/EventReminderJob.php @@ -40,8 +40,8 @@ class EventReminderJob extends TimedJob { private $config; public function __construct(ITimeFactory $time, - ReminderService $reminderService, - IConfig $config) { + ReminderService $reminderService, + IConfig $config) { parent::__construct($time); $this->reminderService = $reminderService; $this->config = $config; diff --git a/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php b/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php index 8e72e8f076c..220050b3927 100644 --- a/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php @@ -39,8 +39,8 @@ class GenerateBirthdayCalendarBackgroundJob extends QueuedJob { private $config; public function __construct(ITimeFactory $time, - BirthdayService $birthdayService, - IConfig $config) { + BirthdayService $birthdayService, + IConfig $config) { parent::__construct($time); $this->birthdayService = $birthdayService; diff --git a/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php b/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php index deca55a26cb..74969069387 100644 --- a/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php +++ b/apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php @@ -25,11 +25,11 @@ declare(strict_types=1); */ namespace OCA\DAV\BackgroundJob; -use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\TimedJob; use OCA\DAV\AppInfo\Application; use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CardDAV\CardDavBackend; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; use OCP\IConfig; use Psr\Log\LoggerInterface; diff --git a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php index 85da81b3b91..8c0b5e3ea45 100644 --- a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php +++ b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php @@ -49,8 +49,8 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob { * @param IJobList $jobList */ public function __construct(ITimeFactory $time, - IUserManager $userManager, - IJobList $jobList) { + IUserManager $userManager, + IJobList $jobList) { parent::__construct($time); $this->userManager = $userManager; $this->jobList = $jobList; diff --git a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php index f0ff16d3f2f..b4571e2509d 100644 --- a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php @@ -55,10 +55,10 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { private $calDavBackend; public function __construct(ITimeFactory $time, - IResourceManager $resourceManager, - IRoomManager $roomManager, - IDBConnection $dbConnection, - CalDavBackend $calDavBackend) { + IResourceManager $resourceManager, + IRoomManager $roomManager, + IDBConnection $dbConnection, + CalDavBackend $calDavBackend) { parent::__construct($time); $this->resourceManager = $resourceManager; $this->roomManager = $roomManager; @@ -101,10 +101,10 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @param string $principalPrefix */ private function runForBackend($backendManager, - string $dbTable, - string $dbTableMetadata, - string $foreignKey, - string $principalPrefix): void { + string $dbTable, + string $dbTableMetadata, + string $foreignKey, + string $principalPrefix): void { $backends = $backendManager->getBackends(); foreach ($backends as $backend) { @@ -194,8 +194,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @return int Insert id */ private function addToCache(string $table, - string $backendId, - $remote): int { + string $backendId, + $remote): int { $query = $this->dbConnection->getQueryBuilder(); $query->insert($table) ->values([ @@ -219,9 +219,9 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @param array $metadata */ private function addMetadataToCache(string $table, - string $foreignKey, - int $foreignId, - array $metadata): void { + string $foreignKey, + int $foreignId, + array $metadata): void { foreach ($metadata as $key => $value) { $query = $this->dbConnection->getQueryBuilder(); $query->insert($table) @@ -241,7 +241,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @param int $id */ private function deleteFromCache(string $table, - int $id): void { + int $id): void { $query = $this->dbConnection->getQueryBuilder(); $query->delete($table) ->where($query->expr()->eq('id', $query->createNamedParameter($id))) @@ -254,8 +254,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @param int $id */ private function deleteMetadataFromCache(string $table, - string $foreignKey, - int $id): void { + string $foreignKey, + int $id): void { $query = $this->dbConnection->getQueryBuilder(); $query->delete($table) ->where($query->expr()->eq($foreignKey, $query->createNamedParameter($id))) @@ -270,8 +270,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @param IResource|IRoom $remote */ private function updateCache(string $table, - int $id, - $remote): void { + int $id, + $remote): void { $query = $this->dbConnection->getQueryBuilder(); $query->update($table) ->set('email', $query->createNamedParameter($remote->getEMail())) @@ -292,10 +292,10 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @param array $cachedMetadata */ private function updateMetadataCache(string $dbTable, - string $foreignKey, - int $id, - array $metadata, - array $cachedMetadata): void { + string $foreignKey, + int $id, + array $metadata, + array $cachedMetadata): void { $newMetadata = array_diff_key($metadata, $cachedMetadata); $deletedMetadata = array_diff_key($cachedMetadata, $metadata); @@ -371,8 +371,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @return array */ private function getAllMetadataOfCache(string $table, - string $foreignKey, - int $id): array { + string $foreignKey, + int $id): array { $query = $this->dbConnection->getQueryBuilder(); $query->select(['key', 'value']) ->from($table) @@ -398,7 +398,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @return array */ private function getAllCachedByBackend(string $tableName, - string $backendId): array { + string $backendId): array { $query = $this->dbConnection->getQueryBuilder(); $query->select('resource_id') ->from($tableName) @@ -417,7 +417,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @param $principalUri */ private function deleteCalendarDataForResource(string $principalPrefix, - string $principalUri): void { + string $principalUri): void { $calendar = $this->calDavBackend->getCalendarByUri( implode('/', [$principalPrefix, $principalUri]), CalDavBackend::RESOURCE_BOOKING_CALENDAR_URI); @@ -438,8 +438,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { * @return int */ private function getIdForBackendAndResource(string $table, - string $backendId, - string $resourceId): int { + string $backendId, + string $resourceId): int { $query = $this->dbConnection->getQueryBuilder(); $query->select('id') ->from($table) diff --git a/apps/dav/lib/BackgroundJob/UploadCleanup.php b/apps/dav/lib/BackgroundJob/UploadCleanup.php index 3a6f296deaf..c35aff4d15a 100644 --- a/apps/dav/lib/BackgroundJob/UploadCleanup.php +++ b/apps/dav/lib/BackgroundJob/UploadCleanup.php @@ -32,7 +32,6 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\IJobList; use OCP\BackgroundJob\TimedJob; -use OCP\Files\Node; use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\IRootFolder; diff --git a/apps/dav/lib/BackgroundJob/UserStatusAutomation.php b/apps/dav/lib/BackgroundJob/UserStatusAutomation.php index 43fccbf233e..53184be6f25 100644 --- a/apps/dav/lib/BackgroundJob/UserStatusAutomation.php +++ b/apps/dav/lib/BackgroundJob/UserStatusAutomation.php @@ -46,11 +46,11 @@ class UserStatusAutomation extends TimedJob { protected IConfig $config; public function __construct(ITimeFactory $timeFactory, - IDBConnection $connection, - IJobList $jobList, - LoggerInterface $logger, - IManager $manager, - IConfig $config) { + IDBConnection $connection, + IJobList $jobList, + LoggerInterface $logger, + IManager $manager, + IConfig $config) { parent::__construct($timeFactory); $this->connection = $connection; $this->jobList = $jobList; diff --git a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php index dab4bbffc6e..66e2a9efa2e 100644 --- a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php +++ b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php @@ -23,15 +23,15 @@ namespace OCA\DAV\BulkUpload; +use OCA\DAV\Connector\Sabre\MtimeSanitizer; +use OCP\AppFramework\Http; +use OCP\Files\DavUtil; +use OCP\Files\Folder; use Psr\Log\LoggerInterface; use Sabre\DAV\Server; use Sabre\DAV\ServerPlugin; use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; -use OCP\Files\DavUtil; -use OCP\Files\Folder; -use OCP\AppFramework\Http; -use OCA\DAV\Connector\Sabre\MtimeSanitizer; class BulkUploadPlugin extends ServerPlugin { private Folder $userFolder; diff --git a/apps/dav/lib/BulkUpload/MultipartRequestParser.php b/apps/dav/lib/BulkUpload/MultipartRequestParser.php index 16c83fee64e..930e86c28b5 100644 --- a/apps/dav/lib/BulkUpload/MultipartRequestParser.php +++ b/apps/dav/lib/BulkUpload/MultipartRequestParser.php @@ -22,11 +22,11 @@ namespace OCA\DAV\BulkUpload; -use Sabre\HTTP\RequestInterface; +use OCP\AppFramework\Http; use Sabre\DAV\Exception; use Sabre\DAV\Exception\BadRequest; use Sabre\DAV\Exception\LengthRequired; -use OCP\AppFramework\Http; +use Sabre\HTTP\RequestInterface; class MultipartRequestParser { diff --git a/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php b/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php index d67f1f5a816..68b71404371 100644 --- a/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php +++ b/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php @@ -1,4 +1,5 @@ calDavBackEnd = $calDavBackEnd; $this->cardDavBackEnd = $cardDavBackEnd; $this->principalBackend = $principalBackend; @@ -81,8 +81,8 @@ class BirthdayService { } public function onCardChanged(int $addressBookId, - string $cardUri, - string $cardData): void { + string $cardUri, + string $cardData): void { if (!$this->isGloballyEnabled()) { return; } @@ -117,7 +117,7 @@ class BirthdayService { } public function onCardDeleted(int $addressBookId, - string $cardUri): void { + string $cardUri): void { if (!$this->isGloballyEnabled()) { return; } @@ -164,9 +164,9 @@ class BirthdayService { * @throws InvalidDataException */ public function buildDateFromContact(string $cardData, - string $dateField, - string $postfix, - ?string $reminderOffset):?VCalendar { + string $dateField, + string $postfix, + ?string $reminderOffset):?VCalendar { if (empty($cardData)) { return null; } @@ -322,7 +322,7 @@ class BirthdayService { * @return bool */ public function birthdayEvenChanged(string $existingCalendarData, - VCalendar $newCalendarData):bool { + VCalendar $newCalendarData):bool { try { $existingBirthday = Reader::read($existingCalendarData); } catch (Exception $ex) { @@ -366,11 +366,11 @@ class BirthdayService { * @throws \Sabre\DAV\Exception\BadRequest */ private function updateCalendar(string $cardUri, - string $cardData, - array $book, - int $calendarId, - array $type, - ?string $reminderOffset):void { + string $cardData, + array $book, + int $calendarId, + array $type, + ?string $reminderOffset):void { $objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics'; $calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['postfix'], $reminderOffset); $existing = $this->calDavBackEnd->getCalendarObject($calendarId, $objectUri); @@ -469,9 +469,9 @@ class BirthdayService { * @return string The formatted title */ private function formatTitle(string $field, - string $name, - int $year = null, - bool $supports4Byte = true):string { + string $name, + int $year = null, + bool $supports4Byte = true):string { if ($supports4Byte) { switch ($field) { case 'BDAY': diff --git a/apps/dav/lib/CalDAV/CalendarImpl.php b/apps/dav/lib/CalDAV/CalendarImpl.php index de20c9ac3ae..397cff38037 100644 --- a/apps/dav/lib/CalDAV/CalendarImpl.php +++ b/apps/dav/lib/CalDAV/CalendarImpl.php @@ -33,7 +33,6 @@ use OCA\DAV\CalDAV\InvitationResponse\InvitationResponseServer; use OCP\Calendar\Exceptions\CalendarException; use OCP\Calendar\ICreateFromString; use OCP\Calendar\IHandleImipMessage; -use OCP\Calendar\ISchedulingInformation; use OCP\Constants; use Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp; use Sabre\DAV\Exception\Conflict; @@ -52,8 +51,8 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage { private array $calendarInfo; public function __construct(Calendar $calendar, - array $calendarInfo, - CalDavBackend $backend) { + array $calendarInfo, + CalDavBackend $backend) { $this->calendar = $calendar; $this->calendarInfo = $calendarInfo; $this->backend = $backend; diff --git a/apps/dav/lib/CalDAV/CalendarObject.php b/apps/dav/lib/CalDAV/CalendarObject.php index 32bcff900c2..7f4bd9054e0 100644 --- a/apps/dav/lib/CalDAV/CalendarObject.php +++ b/apps/dav/lib/CalDAV/CalendarObject.php @@ -45,8 +45,8 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject { * @param array $objectData */ public function __construct(CalDavBackend $caldavBackend, IL10N $l10n, - array $calendarInfo, - array $objectData) { + array $calendarInfo, + array $objectData) { parent::__construct($caldavBackend, $calendarInfo, $objectData); if ($this->isShared()) { diff --git a/apps/dav/lib/CalDAV/EventComparisonService.php b/apps/dav/lib/CalDAV/EventComparisonService.php index d8d6ea07ed2..0f9914dcf98 100644 --- a/apps/dav/lib/CalDAV/EventComparisonService.php +++ b/apps/dav/lib/CalDAV/EventComparisonService.php @@ -25,15 +25,9 @@ declare(strict_types=1); */ namespace OCA\DAV\CalDAV; -use OCA\DAV\AppInfo\Application; use OCA\DAV\CalDAV\Schedule\IMipService; -use OCP\AppFramework\Utility\ITimeFactory; -use OCP\IConfig; use Sabre\VObject\Component\VCalendar; use Sabre\VObject\Component\VEvent; -use Sabre\VObject\Component\VTimeZone; -use Sabre\VObject\Component\VTodo; -use function max; class EventComparisonService { diff --git a/apps/dav/lib/CalDAV/FreeBusy/FreeBusyGenerator.php b/apps/dav/lib/CalDAV/FreeBusy/FreeBusyGenerator.php index 29daca4e092..84dd05dfa55 100644 --- a/apps/dav/lib/CalDAV/FreeBusy/FreeBusyGenerator.php +++ b/apps/dav/lib/CalDAV/FreeBusy/FreeBusyGenerator.php @@ -1,4 +1,5 @@ caldavBackend = $caldavBackend; $this->l10n = $l10n; $this->config = $config; diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php index 1d8505af8ae..fedd918e6a4 100644 --- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php +++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php @@ -114,7 +114,7 @@ class PublishPlugin extends ServerPlugin { $this->server = $server; $this->server->on('method:POST', [$this, 'httpPost']); - $this->server->on('propFind', [$this, 'propFind']); + $this->server->on('propFind', [$this, 'propFind']); } public function propFind(PropFind $propFind, INode $node) { @@ -184,72 +184,72 @@ class PublishPlugin extends ServerPlugin { case '{'.self::NS_CALENDARSERVER.'}publish-calendar': - // We can only deal with IShareableCalendar objects - if (!$node instanceof Calendar) { - return; - } - $this->server->transactionType = 'post-publish-calendar'; + // We can only deal with IShareableCalendar objects + if (!$node instanceof Calendar) { + return; + } + $this->server->transactionType = 'post-publish-calendar'; - // Getting ACL info - $acl = $this->server->getPlugin('acl'); + // Getting ACL info + $acl = $this->server->getPlugin('acl'); - // If there's no ACL support, we allow everything - if ($acl) { - /** @var \Sabre\DAVACL\Plugin $acl */ - $acl->checkPrivileges($path, '{DAV:}write'); + // If there's no ACL support, we allow everything + if ($acl) { + /** @var \Sabre\DAVACL\Plugin $acl */ + $acl->checkPrivileges($path, '{DAV:}write'); - $limitSharingToOwner = $this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes'; - $isOwner = $acl->getCurrentUserPrincipal() === $node->getOwner(); - if ($limitSharingToOwner && !$isOwner) { - return; + $limitSharingToOwner = $this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes'; + $isOwner = $acl->getCurrentUserPrincipal() === $node->getOwner(); + if ($limitSharingToOwner && !$isOwner) { + return; + } } - } - $node->setPublishStatus(true); + $node->setPublishStatus(true); - // iCloud sends back the 202, so we will too. - $response->setStatus(202); + // iCloud sends back the 202, so we will too. + $response->setStatus(202); - // Adding this because sending a response body may cause issues, - // and I wanted some type of indicator the response was handled. - $response->setHeader('X-Sabre-Status', 'everything-went-well'); + // Adding this because sending a response body may cause issues, + // and I wanted some type of indicator the response was handled. + $response->setHeader('X-Sabre-Status', 'everything-went-well'); - // Breaking the event chain - return false; + // Breaking the event chain + return false; case '{'.self::NS_CALENDARSERVER.'}unpublish-calendar': - // We can only deal with IShareableCalendar objects - if (!$node instanceof Calendar) { - return; - } - $this->server->transactionType = 'post-unpublish-calendar'; + // We can only deal with IShareableCalendar objects + if (!$node instanceof Calendar) { + return; + } + $this->server->transactionType = 'post-unpublish-calendar'; - // Getting ACL info - $acl = $this->server->getPlugin('acl'); + // Getting ACL info + $acl = $this->server->getPlugin('acl'); - // If there's no ACL support, we allow everything - if ($acl) { - /** @var \Sabre\DAVACL\Plugin $acl */ - $acl->checkPrivileges($path, '{DAV:}write'); + // If there's no ACL support, we allow everything + if ($acl) { + /** @var \Sabre\DAVACL\Plugin $acl */ + $acl->checkPrivileges($path, '{DAV:}write'); - $limitSharingToOwner = $this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes'; - $isOwner = $acl->getCurrentUserPrincipal() === $node->getOwner(); - if ($limitSharingToOwner && !$isOwner) { - return; + $limitSharingToOwner = $this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes'; + $isOwner = $acl->getCurrentUserPrincipal() === $node->getOwner(); + if ($limitSharingToOwner && !$isOwner) { + return; + } } - } - $node->setPublishStatus(false); + $node->setPublishStatus(false); - $response->setStatus(200); + $response->setStatus(200); - // Adding this because sending a response body may cause issues, - // and I wanted some type of indicator the response was handled. - $response->setHeader('X-Sabre-Status', 'everything-went-well'); + // Adding this because sending a response body may cause issues, + // and I wanted some type of indicator the response was handled. + $response->setHeader('X-Sabre-Status', 'everything-went-well'); - // Breaking the event chain - return false; + // Breaking the event chain + return false; } } diff --git a/apps/dav/lib/CalDAV/Reminder/Backend.php b/apps/dav/lib/CalDAV/Reminder/Backend.php index b0476e9594c..f1f5d8c4ac3 100644 --- a/apps/dav/lib/CalDAV/Reminder/Backend.php +++ b/apps/dav/lib/CalDAV/Reminder/Backend.php @@ -51,7 +51,7 @@ class Backend { * @param ITimeFactory $timeFactory */ public function __construct(IDBConnection $db, - ITimeFactory $timeFactory) { + ITimeFactory $timeFactory) { $this->db = $db; $this->timeFactory = $timeFactory; } @@ -114,17 +114,17 @@ class Backend { * @return int The insert id */ public function insertReminder(int $calendarId, - int $objectId, - string $uid, - bool $isRecurring, - int $recurrenceId, - bool $isRecurrenceException, - string $eventHash, - string $alarmHash, - string $type, - bool $isRelative, - int $notificationDate, - bool $isRepeatBased):int { + int $objectId, + string $uid, + bool $isRecurring, + int $recurrenceId, + bool $isRecurrenceException, + string $eventHash, + string $alarmHash, + string $type, + bool $isRelative, + int $notificationDate, + bool $isRepeatBased):int { $query = $this->db->getQueryBuilder(); $query->insert('calendar_reminders') ->values([ @@ -153,7 +153,7 @@ class Backend { * @param int $newNotificationDate */ public function updateReminder(int $reminderId, - int $newNotificationDate):void { + int $newNotificationDate):void { $query = $this->db->getQueryBuilder(); $query->update('calendar_reminders') ->set('notification_date', $query->createNamedParameter($newNotificationDate)) diff --git a/apps/dav/lib/CalDAV/Reminder/INotificationProvider.php b/apps/dav/lib/CalDAV/Reminder/INotificationProvider.php index e8cbfdd0ab3..1eb3932e611 100644 --- a/apps/dav/lib/CalDAV/Reminder/INotificationProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/INotificationProvider.php @@ -48,7 +48,7 @@ interface INotificationProvider { * @return void */ public function send(VEvent $vevent, - ?string $calendarDisplayName, - array $principalEmailAddresses, - array $users = []): void; + ?string $calendarDisplayName, + array $principalEmailAddresses, + array $users = []): void; } diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php index bccbec5fe3c..52c994554cc 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php @@ -69,9 +69,9 @@ abstract class AbstractProvider implements INotificationProvider { protected $config; public function __construct(LoggerInterface $logger, - L10NFactory $l10nFactory, - IURLGenerator $urlGenerator, - IConfig $config) { + L10NFactory $l10nFactory, + IURLGenerator $urlGenerator, + IConfig $config) { $this->logger = $logger; $this->l10nFactory = $l10nFactory; $this->urlGenerator = $urlGenerator; @@ -88,9 +88,9 @@ abstract class AbstractProvider implements INotificationProvider { * @return void */ abstract public function send(VEvent $vevent, - ?string $calendarDisplayName, - array $principalEmailAddresses, - array $users = []): void; + ?string $calendarDisplayName, + array $principalEmailAddresses, + array $users = []): void; /** * @return string diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php index da275efdcf1..262ceb479f0 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php @@ -58,10 +58,10 @@ class EmailProvider extends AbstractProvider { private IMailer $mailer; public function __construct(IConfig $config, - IMailer $mailer, - LoggerInterface $logger, - L10NFactory $l10nFactory, - IURLGenerator $urlGenerator) { + IMailer $mailer, + LoggerInterface $logger, + L10NFactory $l10nFactory, + IURLGenerator $urlGenerator) { parent::__construct($logger, $l10nFactory, $urlGenerator, $config); $this->mailer = $mailer; } @@ -76,9 +76,9 @@ class EmailProvider extends AbstractProvider { * @throws \Exception */ public function send(VEvent $vevent, - ?string $calendarDisplayName, - array $principalEmailAddresses, - array $users = []):void { + ?string $calendarDisplayName, + array $principalEmailAddresses, + array $users = []):void { $fallbackLanguage = $this->getFallbackLanguage(); $organizerEmailAddress = null; @@ -162,9 +162,9 @@ class EmailProvider extends AbstractProvider { * @param array $eventData */ private function addBulletList(IEMailTemplate $template, - IL10N $l10n, - string $calendarDisplayName, - VEvent $vevent):void { + IL10N $l10n, + string $calendarDisplayName, + VEvent $vevent):void { $template->addBodyListItem($calendarDisplayName, $l10n->t('Calendar:'), $this->getAbsoluteImagePath('actions/info.png')); @@ -220,7 +220,7 @@ class EmailProvider extends AbstractProvider { * @return array */ private function sortEMailAddressesByLanguage(array $emails, - string $defaultLanguage):array { + string $defaultLanguage):array { $sortedByLanguage = []; foreach ($emails as $emailAddress => $parameters) { @@ -435,7 +435,7 @@ class EmailProvider extends AbstractProvider { } private function isDayEqual(DateTime $dtStart, - DateTime $dtEnd):bool { + DateTime $dtEnd):bool { return $dtStart->format('Y-m-d') === $dtEnd->format('Y-m-d'); } diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php index ab7f12c570a..79e4e44e6d8 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php @@ -59,11 +59,11 @@ class PushProvider extends AbstractProvider { private $timeFactory; public function __construct(IConfig $config, - IManager $manager, - LoggerInterface $logger, - L10NFactory $l10nFactory, - IURLGenerator $urlGenerator, - ITimeFactory $timeFactory) { + IManager $manager, + LoggerInterface $logger, + L10NFactory $l10nFactory, + IURLGenerator $urlGenerator, + ITimeFactory $timeFactory) { parent::__construct($logger, $l10nFactory, $urlGenerator, $config); $this->manager = $manager; $this->timeFactory = $timeFactory; @@ -79,9 +79,9 @@ class PushProvider extends AbstractProvider { * @throws \Exception */ public function send(VEvent $vevent, - ?string $calendarDisplayName, - array $principalEmailAddresses, - array $users = []):void { + ?string $calendarDisplayName, + array $principalEmailAddresses, + array $users = []):void { if ($this->config->getAppValue('dav', 'sendEventRemindersPush', 'yes') !== 'yes') { return; } diff --git a/apps/dav/lib/CalDAV/Reminder/Notifier.php b/apps/dav/lib/CalDAV/Reminder/Notifier.php index c658ef2ff01..271d8e88fa7 100644 --- a/apps/dav/lib/CalDAV/Reminder/Notifier.php +++ b/apps/dav/lib/CalDAV/Reminder/Notifier.php @@ -66,8 +66,8 @@ class Notifier implements INotifier { * @param ITimeFactory $timeFactory */ public function __construct(IFactory $factory, - IURLGenerator $urlGenerator, - ITimeFactory $timeFactory) { + IURLGenerator $urlGenerator, + ITimeFactory $timeFactory) { $this->l10nFactory = $factory; $this->urlGenerator = $urlGenerator; $this->timeFactory = $timeFactory; @@ -102,7 +102,7 @@ class Notifier implements INotifier { * @throws \Exception */ public function prepare(INotification $notification, - string $languageCode):INotification { + string $languageCode):INotification { if ($notification->getApp() !== Application::APP_ID) { throw new \InvalidArgumentException('Notification not from this app'); } @@ -289,7 +289,7 @@ class Notifier implements INotifier { * @return bool */ private function isDayEqual(DateTime $dtStart, - DateTime $dtEnd):bool { + DateTime $dtEnd):bool { return $dtStart->format('Y-m-d') === $dtEnd->format('Y-m-d'); } diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php index d4b22911099..9ededb8d015 100644 --- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php +++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php @@ -98,14 +98,14 @@ class ReminderService { ]; public function __construct(Backend $backend, - NotificationProviderManager $notificationProviderManager, - IUserManager $userManager, - IGroupManager $groupManager, - CalDavBackend $caldavBackend, - ITimeFactory $timeFactory, - IConfig $config, - LoggerInterface $logger, - Principal $principalConnector) { + NotificationProviderManager $notificationProviderManager, + IUserManager $userManager, + IGroupManager $groupManager, + CalDavBackend $caldavBackend, + ITimeFactory $timeFactory, + IConfig $config, + LoggerInterface $logger, + Principal $principalConnector) { $this->backend = $backend; $this->notificationProviderManager = $notificationProviderManager; $this->userManager = $userManager; @@ -390,12 +390,12 @@ class ReminderService { * @return array */ private function getRemindersForVAlarm(VAlarm $valarm, - array $objectData, - DateTimeZone $calendarTimeZone, - string $eventHash = null, - string $alarmHash = null, - bool $isRecurring = false, - bool $isRecurrenceException = false):array { + array $objectData, + DateTimeZone $calendarTimeZone, + string $eventHash = null, + string $alarmHash = null, + bool $isRecurring = false, + bool $isRecurrenceException = false):array { if ($eventHash === null) { $eventHash = $this->getEventHash($valarm->parent); } @@ -490,7 +490,7 @@ class ReminderService { * @param VEvent $vevent */ private function deleteOrProcessNext(array $reminder, - VObject\Component\VEvent $vevent):void { + VObject\Component\VEvent $vevent):void { if ($reminder['is_repeat_based'] || !$reminder['is_recurring'] || !$reminder['is_relative'] || @@ -673,8 +673,8 @@ class ReminderService { * @return VEvent|null */ private function getVEventByRecurrenceId(VObject\Component\VCalendar $vcalendar, - int $recurrenceId, - bool $isRecurrenceException):?VEvent { + int $recurrenceId, + bool $isRecurrenceException):?VEvent { $vevents = $this->getAllVEventsFromVCalendar($vcalendar); if (count($vevents) === 0) { return null; diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php index 32642bee195..92c61e72780 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php @@ -75,13 +75,13 @@ abstract class AbstractPrincipalBackend implements BackendInterface { private $cuType; public function __construct(IDBConnection $dbConnection, - IUserSession $userSession, - IGroupManager $groupManager, - LoggerInterface $logger, - ProxyMapper $proxyMapper, - string $principalPrefix, - string $dbPrefix, - string $cuType) { + IUserSession $userSession, + IGroupManager $groupManager, + LoggerInterface $logger, + ProxyMapper $proxyMapper, + string $principalPrefix, + string $dbPrefix, + string $cuType) { $this->db = $dbConnection; $this->userSession = $userSession; $this->groupManager = $groupManager; @@ -165,7 +165,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { } [, $name] = \Sabre\Uri\split($path); - [$backendId, $resourceId] = explode('-', $name, 2); + [$backendId, $resourceId] = explode('-', $name, 2); $query = $this->db->getQueryBuilder(); $query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname']) @@ -309,7 +309,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { case IRoomMetadata::CAPACITY: case IResourceMetadata::VEHICLE_SEATING_CAPACITY: - $results[] = $this->searchPrincipalsByCapacity($prop,$value); + $results[] = $this->searchPrincipalsByCapacity($prop, $value); break; default: @@ -470,7 +470,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { } [, $name] = \Sabre\Uri\split($path); - [$backendId, $resourceId] = explode('-', $name, 2); + [$backendId, $resourceId] = explode('-', $name, 2); $query = $this->db->getQueryBuilder(); $query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname', 'group_restrictions']) diff --git a/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php index 20fdadbca0c..45795377e11 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php @@ -39,10 +39,10 @@ class ResourcePrincipalBackend extends AbstractPrincipalBackend { * ResourcePrincipalBackend constructor. */ public function __construct(IDBConnection $dbConnection, - IUserSession $userSession, - IGroupManager $groupManager, - LoggerInterface $logger, - ProxyMapper $proxyMapper) { + IUserSession $userSession, + IGroupManager $groupManager, + LoggerInterface $logger, + ProxyMapper $proxyMapper) { parent::__construct($dbConnection, $userSession, $groupManager, $logger, $proxyMapper, 'principals/calendar-resources', 'resource', 'RESOURCE'); } diff --git a/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php index 931635d632f..829ca7d6033 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php @@ -39,10 +39,10 @@ class RoomPrincipalBackend extends AbstractPrincipalBackend { * RoomPrincipalBackend constructor. */ public function __construct(IDBConnection $dbConnection, - IUserSession $userSession, - IGroupManager $groupManager, - LoggerInterface $logger, - ProxyMapper $proxyMapper) { + IUserSession $userSession, + IGroupManager $groupManager, + LoggerInterface $logger, + ProxyMapper $proxyMapper) { parent::__construct($dbConnection, $userSession, $groupManager, $logger, $proxyMapper, 'principals/calendar-rooms', 'room', 'ROOM'); } diff --git a/apps/dav/lib/CalDAV/RetentionService.php b/apps/dav/lib/CalDAV/RetentionService.php index 1d92d847641..9a43d5bdc91 100644 --- a/apps/dav/lib/CalDAV/RetentionService.php +++ b/apps/dav/lib/CalDAV/RetentionService.php @@ -44,8 +44,8 @@ class RetentionService { private $calDavBackend; public function __construct(IConfig $config, - ITimeFactory $time, - CalDavBackend $calDavBackend) { + ITimeFactory $time, + CalDavBackend $calDavBackend) { $this->config = $config; $this->time = $time; $this->calDavBackend = $calDavBackend; diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index 437a135e38c..fcc2ae1e166 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -86,14 +86,14 @@ class IMipPlugin extends SabreIMipPlugin { private EventComparisonService $eventComparisonService; public function __construct(IConfig $config, - IMailer $mailer, - LoggerInterface $logger, - ITimeFactory $timeFactory, - Defaults $defaults, - IUserManager $userManager, - $userId, - IMipService $imipService, - EventComparisonService $eventComparisonService) { + IMailer $mailer, + LoggerInterface $logger, + ITimeFactory $timeFactory, + Defaults $defaults, + IUserManager $userManager, + $userId, + IMipService $imipService, + EventComparisonService $eventComparisonService) { parent::__construct(''); $this->userId = $userId; $this->config = $config; @@ -305,9 +305,9 @@ class IMipPlugin extends SabreIMipPlugin { $itip_msg = $iTipMessage->message->serialize(); $message->attachInline( - $itip_msg, + $itip_msg, 'event.ics', - 'text/calendar; method=' . $iTipMessage->method, + 'text/calendar; method=' . $iTipMessage->method, ); try { diff --git a/apps/dav/lib/CalDAV/Schedule/IMipService.php b/apps/dav/lib/CalDAV/Schedule/IMipService.php index 1e7b0bc3b02..4cd859d79ac 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipService.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipService.php @@ -1,4 +1,5 @@ urlGenerator = $urlGenerator; $this->config = $config; $this->db = $db; @@ -99,7 +100,7 @@ class IMipService { return $default; } $newstring = $vevent->$property->getValue(); - if(isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring ) { + if(isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) { $oldstring = $oldVEvent->$property->getValue(); return sprintf($strikethrough, $oldstring, $newstring); } @@ -162,7 +163,7 @@ class IMipService { if(!empty($oldVEvent)) { $oldMeetingWhen = $this->generateWhenString($oldVEvent); - $data['meeting_title_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'SUMMARY', $data['meeting_title']); + $data['meeting_title_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'SUMMARY', $data['meeting_title']); $data['meeting_description_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'DESCRIPTION', $data['meeting_description']); $data['meeting_location_html'] = $this->generateLinkifiedDiffString($vEvent, $oldVEvent, 'LOCATION', $data['meeting_location']); @@ -281,7 +282,8 @@ class IMipService { $strikethrough = "%s"; $newMeetingWhen = $this->generateWhenString($vEvent); - $newSummary = isset($vEvent->SUMMARY) && (string)$vEvent->SUMMARY !== '' ? (string)$vEvent->SUMMARY : $this->l10n->t('Untitled event');; + $newSummary = isset($vEvent->SUMMARY) && (string)$vEvent->SUMMARY !== '' ? (string)$vEvent->SUMMARY : $this->l10n->t('Untitled event'); + ; $newDescription = isset($vEvent->DESCRIPTION) && (string)$vEvent->DESCRIPTION !== '' ? (string)$vEvent->DESCRIPTION : $defaultVal; $newUrl = isset($vEvent->URL) && (string)$vEvent->URL !== '' ? sprintf('%1$s', $vEvent->URL) : $defaultVal; $newLocation = isset($vEvent->LOCATION) && (string)$vEvent->LOCATION !== '' ? (string)$vEvent->LOCATION : $defaultVal; @@ -483,7 +485,7 @@ class IMipService { htmlspecialchars($organizer->getNormalizedValue()), htmlspecialchars($organizerName ?: $organizerEmail)); $organizerText = sprintf('%s <%s>', $organizerName, $organizerEmail); - if(isset($organizer['PARTSTAT']) ) { + if(isset($organizer['PARTSTAT'])) { /** @var Parameter $partstat */ $partstat = $organizer['PARTSTAT']; if(strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) { diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php index 16acc72d988..2845ccdf6c2 100644 --- a/apps/dav/lib/CalDAV/Schedule/Plugin.php +++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php @@ -36,7 +36,6 @@ use OCA\DAV\CalDAV\CalendarHome; use OCP\IConfig; use Psr\Log\LoggerInterface; use Sabre\CalDAV\ICalendar; -use Sabre\CalDAV\Schedule\IOutbox; use Sabre\DAV\INode; use Sabre\DAV\IProperties; use Sabre\DAV\PropFind; @@ -45,7 +44,6 @@ use Sabre\DAV\Xml\Property\LocalHref; use Sabre\DAVACL\IPrincipal; use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; -use Sabre\VObject; use Sabre\VObject\Component; use Sabre\VObject\Component\VCalendar; use Sabre\VObject\Component\VEvent; diff --git a/apps/dav/lib/CalDAV/Status/Status.php b/apps/dav/lib/CalDAV/Status/Status.php index 8857d0f14e7..d1c35002fcd 100644 --- a/apps/dav/lib/CalDAV/Status/Status.php +++ b/apps/dav/lib/CalDAV/Status/Status.php @@ -27,7 +27,8 @@ namespace OCA\DAV\CalDAV\Status; class Status { - public function __construct(private string $status = '', private ?string $message = null, private ?string $customMessage = null){} + public function __construct(private string $status = '', private ?string $message = null, private ?string $customMessage = null) { + } public function getStatus(): string { return $this->status; diff --git a/apps/dav/lib/CalDAV/Status/StatusService.php b/apps/dav/lib/CalDAV/Status/StatusService.php index 92554f800c3..1dce2c4c3a3 100644 --- a/apps/dav/lib/CalDAV/Status/StatusService.php +++ b/apps/dav/lib/CalDAV/Status/StatusService.php @@ -48,16 +48,13 @@ declare(strict_types=1); */ namespace OCA\DAV\CalDAV\Status; -use DateTimeZone; use OC\Calendar\CalendarQuery; use OCA\DAV\CalDAV\CalendarImpl; use OCA\DAV\CalDAV\FreeBusy\FreeBusyGenerator; use OCA\DAV\CalDAV\InvitationResponse\InvitationResponseServer; -use OCA\DAV\CalDAV\IUser; use OCA\DAV\CalDAV\Schedule\Plugin as SchedulePlugin; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Calendar\IManager; -use OCP\Calendar\ISchedulingInformation; use OCP\IL10N; use OCP\IUser as User; use OCP\UserStatus\IUserStatus; @@ -66,7 +63,6 @@ use Sabre\DAV\Exception\NotAuthenticated; use Sabre\DAVACL\Exception\NeedPrivileges; use Sabre\DAVACL\Plugin as AclPlugin; use Sabre\VObject\Component; -use Sabre\VObject\Component\VCalendar; use Sabre\VObject\Component\VEvent; use Sabre\VObject\Parameter; use Sabre\VObject\Property; @@ -74,10 +70,11 @@ use Sabre\VObject\Reader; class StatusService { public function __construct(private ITimeFactory $timeFactory, - private IManager $calendarManager, - private InvitationResponseServer $server, - private IL10N $l10n, - private FreeBusyGenerator $generator){} + private IManager $calendarManager, + private InvitationResponseServer $server, + private IL10N $l10n, + private FreeBusyGenerator $generator) { + } public function processCalendarAvailability(User $user, ?string $availability): ?Status { $userId = $user->getUID(); @@ -172,7 +169,7 @@ class StatusService { foreach ($calendarEvents as $calendarEvent) { $vEvent = new VEvent($calendar, 'VEVENT'); foreach($calendarEvent['objects'] as $component) { - foreach ($component as $key => $value) { + foreach ($component as $key => $value) { $vEvent->add($key, $value[0]); } } diff --git a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php index 5730b7a1002..b1a3fea21b7 100644 --- a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php +++ b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php @@ -48,9 +48,9 @@ class DeletedCalendarObject implements IACL, ICalendarObject, IRestorable { private $calDavBackend; public function __construct(string $name, - array $objectData, - string $principalUri, - CalDavBackend $calDavBackend) { + array $objectData, + string $principalUri, + CalDavBackend $calDavBackend) { $this->name = $name; $this->objectData = $objectData; $this->calDavBackend = $calDavBackend; diff --git a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php index 20d05c047b1..f7f0bd7b512 100644 --- a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php +++ b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php @@ -45,7 +45,7 @@ class DeletedCalendarObjectsCollection implements ICalendarObjectContainer { private $principalInfo; public function __construct(CalDavBackend $caldavBackend, - array $principalInfo) { + array $principalInfo) { $this->caldavBackend = $caldavBackend; $this->principalInfo = $principalInfo; } diff --git a/apps/dav/lib/CalDAV/Trashbin/Plugin.php b/apps/dav/lib/CalDAV/Trashbin/Plugin.php index 58ff76beca1..8a661732f19 100644 --- a/apps/dav/lib/CalDAV/Trashbin/Plugin.php +++ b/apps/dav/lib/CalDAV/Trashbin/Plugin.php @@ -56,7 +56,7 @@ class Plugin extends ServerPlugin { private $server; public function __construct(IRequest $request, - RetentionService $retentionService) { + RetentionService $retentionService) { $this->disableTrashbin = $request->getHeader('X-NC-CalDAV-No-Trashbin') === '1'; $this->retentionService = $retentionService; } diff --git a/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php b/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php index 34d11e51eb3..e9bf6da19e8 100644 --- a/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php +++ b/apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php @@ -50,7 +50,7 @@ class TrashbinHome implements IACL, ICollection, IProperties { private $principalInfo; public function __construct(CalDavBackend $caldavBackend, - array $principalInfo) { + array $principalInfo) { $this->caldavBackend = $caldavBackend; $this->principalInfo = $principalInfo; } diff --git a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php index 8928d05b93c..4035f345876 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php @@ -46,9 +46,9 @@ use Sabre\DAV\Xml\Property\Href; use Sabre\VObject\Component; use Sabre\VObject\DateTimeParser; use Sabre\VObject\InvalidDataException; -use Sabre\VObject\Recur\NoInstancesException; use Sabre\VObject\ParseException; use Sabre\VObject\Reader; +use Sabre\VObject\Recur\NoInstancesException; use Sabre\VObject\Splitter\ICalendar; use Sabre\VObject\UUIDUtil; use function count; diff --git a/apps/dav/lib/CardDAV/Activity/Backend.php b/apps/dav/lib/CardDAV/Activity/Backend.php index 53639f84f84..f0a5ee05e82 100644 --- a/apps/dav/lib/CardDAV/Activity/Backend.php +++ b/apps/dav/lib/CardDAV/Activity/Backend.php @@ -55,10 +55,10 @@ class Backend { protected $userManager; public function __construct(IActivityManager $activityManager, - IGroupManager $groupManager, - IUserSession $userSession, - IAppManager $appManager, - IUserManager $userManager) { + IGroupManager $groupManager, + IUserSession $userSession, + IAppManager $appManager, + IUserManager $userManager) { $this->activityManager = $activityManager; $this->groupManager = $groupManager; $this->userSession = $userSession; diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php index 0f4acaaa434..a9ed767ffc7 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php @@ -53,11 +53,11 @@ class Addressbook extends Base { protected $eventMerger; public function __construct(IFactory $languageFactory, - IURLGenerator $url, - IManager $activityManager, - IUserManager $userManager, - IGroupManager $groupManager, - IEventMerger $eventMerger) { + IURLGenerator $url, + IManager $activityManager, + IUserManager $userManager, + IGroupManager $groupManager, + IEventMerger $eventMerger) { parent::__construct($userManager, $groupManager, $url); $this->languageFactory = $languageFactory; $this->activityManager = $activityManager; diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Base.php b/apps/dav/lib/CardDAV/Activity/Provider/Base.php index a59c3b57262..f475f9d76b7 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Base.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Base.php @@ -51,8 +51,8 @@ abstract class Base implements IProvider { protected $url; public function __construct(IUserManager $userManager, - IGroupManager $groupManager, - IURLGenerator $urlGenerator) { + IGroupManager $groupManager, + IURLGenerator $urlGenerator) { $this->userManager = $userManager; $this->groupManager = $groupManager; $this->url = $urlGenerator; diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Card.php b/apps/dav/lib/CardDAV/Activity/Provider/Card.php index e2abdda161a..8f205942d4b 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Card.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Card.php @@ -53,12 +53,12 @@ class Card extends Base { protected $appManager; public function __construct(IFactory $languageFactory, - IURLGenerator $url, - IManager $activityManager, - IUserManager $userManager, - IGroupManager $groupManager, - IEventMerger $eventMerger, - IAppManager $appManager) { + IURLGenerator $url, + IManager $activityManager, + IUserManager $userManager, + IGroupManager $groupManager, + IEventMerger $eventMerger, + IAppManager $appManager) { parent::__construct($userManager, $groupManager, $url); $this->languageFactory = $languageFactory; $this->activityManager = $activityManager; diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php index c385d0e7b86..79720429479 100644 --- a/apps/dav/lib/CardDAV/AddressBookImpl.php +++ b/apps/dav/lib/CardDAV/AddressBookImpl.php @@ -63,10 +63,10 @@ class AddressBookImpl implements IAddressBook { * @param IUrlGenerator $urlGenerator */ public function __construct( - AddressBook $addressBook, - array $addressBookInfo, - CardDavBackend $backend, - IURLGenerator $urlGenerator) { + AddressBook $addressBook, + array $addressBookInfo, + CardDavBackend $backend, + IURLGenerator $urlGenerator) { $this->addressBook = $addressBook; $this->addressBookInfo = $addressBookInfo; $this->backend = $backend; diff --git a/apps/dav/lib/CardDAV/AddressBookRoot.php b/apps/dav/lib/CardDAV/AddressBookRoot.php index c82943d2879..f450dbe2ef9 100644 --- a/apps/dav/lib/CardDAV/AddressBookRoot.php +++ b/apps/dav/lib/CardDAV/AddressBookRoot.php @@ -41,11 +41,11 @@ class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot { * @param string $principalPrefix */ public function __construct(\Sabre\DAVACL\PrincipalBackend\BackendInterface $principalBackend, - \Sabre\CardDAV\Backend\BackendInterface $carddavBackend, - PluginManager $pluginManager, - ?IUser $user, - ?IGroupManager $groupManager, - string $principalPrefix = 'principals') { + \Sabre\CardDAV\Backend\BackendInterface $carddavBackend, + PluginManager $pluginManager, + ?IUser $user, + ?IGroupManager $groupManager, + string $principalPrefix = 'principals') { parent::__construct($principalBackend, $carddavBackend, $principalPrefix); $this->pluginManager = $pluginManager; $this->user = $user; diff --git a/apps/dav/lib/CardDAV/Card.php b/apps/dav/lib/CardDAV/Card.php index 72a9bd88c1e..093255392e0 100644 --- a/apps/dav/lib/CardDAV/Card.php +++ b/apps/dav/lib/CardDAV/Card.php @@ -24,8 +24,7 @@ declare(strict_types=1); */ namespace OCA\DAV\CardDAV; -class Card extends \Sabre\CardDAV\Card -{ +class Card extends \Sabre\CardDAV\Card { public function getId(): int { return (int) $this->cardData['id']; } diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 8be0bd8050c..c1f0fe0c93c 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -35,6 +35,7 @@ */ namespace OCA\DAV\CardDAV; +use OC\Search\Filter\DateTimeFilter; use OCA\DAV\Connector\Sabre\Principal; use OCA\DAV\DAV\Sharing\Backend; use OCA\DAV\DAV\Sharing\IShareable; @@ -53,7 +54,6 @@ use OCP\EventDispatcher\IEventDispatcher; use OCP\IDBConnection; use OCP\IGroupManager; use OCP\IUserManager; -use OC\Search\Filter\DateTimeFilter; use PDO; use Sabre\CardDAV\Backend\BackendInterface; use Sabre\CardDAV\Backend\SyncSupport; @@ -98,10 +98,10 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param IEventDispatcher $dispatcher */ public function __construct(IDBConnection $db, - Principal $principalBackend, - IUserManager $userManager, - IGroupManager $groupManager, - IEventDispatcher $dispatcher) { + Principal $principalBackend, + IUserManager $userManager, + IGroupManager $groupManager, + IEventDispatcher $dispatcher) { $this->db = $db; $this->principalBackend = $principalBackend; $this->userManager = $userManager; @@ -1093,9 +1093,9 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @return array */ public function searchPrincipalUri(string $principalUri, - string $pattern, - array $searchProperties, - array $options = []): array { + string $pattern, + array $searchProperties, + array $options = []): array { return $this->atomic(function () use ($principalUri, $pattern, $searchProperties, $options) { $addressBookIds = array_map(static function ($row):int { return (int) $row['id']; @@ -1123,9 +1123,9 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @return array */ private function searchByAddressBookIds(array $addressBookIds, - string $pattern, - array $searchProperties, - array $options = []): array { + string $pattern, + array $searchProperties, + array $options = []): array { if (empty($addressBookIds)) { return []; } diff --git a/apps/dav/lib/CardDAV/Converter.php b/apps/dav/lib/CardDAV/Converter.php index e19b52b4783..8ea75fbef74 100644 --- a/apps/dav/lib/CardDAV/Converter.php +++ b/apps/dav/lib/CardDAV/Converter.php @@ -29,8 +29,8 @@ namespace OCA\DAV\CardDAV; use Exception; use OCP\Accounts\IAccountManager; -use OCP\IURLGenerator; use OCP\IImage; +use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; use Sabre\VObject\Component\VCard; diff --git a/apps/dav/lib/CardDAV/PhotoCache.php b/apps/dav/lib/CardDAV/PhotoCache.php index 0d31f1f5239..9f05ec2354a 100644 --- a/apps/dav/lib/CardDAV/PhotoCache.php +++ b/apps/dav/lib/CardDAV/PhotoCache.php @@ -34,12 +34,12 @@ use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; +use Psr\Log\LoggerInterface; use Sabre\CardDAV\Card; use Sabre\VObject\Document; use Sabre\VObject\Parameter; use Sabre\VObject\Property\Binary; use Sabre\VObject\Reader; -use Psr\Log\LoggerInterface; class PhotoCache { diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php index 09c31683069..66927d35e04 100644 --- a/apps/dav/lib/CardDAV/SyncService.php +++ b/apps/dav/lib/CardDAV/SyncService.php @@ -30,7 +30,6 @@ */ namespace OCA\DAV\CardDAV; -use OC\Accounts\AccountManager; use OCP\AppFramework\Db\TTransactional; use OCP\AppFramework\Http; use OCP\IDBConnection; @@ -57,10 +56,10 @@ class SyncService { protected string $certPath; public function __construct(CardDavBackend $backend, - IUserManager $userManager, - IDBConnection $dbConnection, - LoggerInterface $logger, - Converter $converter) { + IUserManager $userManager, + IDBConnection $dbConnection, + LoggerInterface $logger, + Converter $converter) { $this->backend = $backend; $this->userManager = $userManager; $this->logger = $logger; @@ -97,7 +96,7 @@ class SyncService { $cardUri = basename($resource); if (isset($status[200])) { $vCard = $this->download($url, $userName, $sharedSecret, $resource); - $this->atomic(function() use ($addressBookId, $cardUri, $vCard) { + $this->atomic(function () use ($addressBookId, $cardUri, $vCard) { $existingCard = $this->backend->getCard($addressBookId, $cardUri); if ($existingCard === false) { $this->backend->createCard($addressBookId, $cardUri, $vCard['body']); @@ -117,7 +116,7 @@ class SyncService { * @throws \Sabre\DAV\Exception\BadRequest */ public function ensureSystemAddressBookExists(string $principal, string $uri, array $properties): ?array { - return $this->atomic(function() use ($principal, $uri, $properties) { + return $this->atomic(function () use ($principal, $uri, $properties) { $book = $this->backend->getAddressBooksByUri($principal, $uri); if (!is_null($book)) { return $book; @@ -226,7 +225,7 @@ class SyncService { $cardId = self::getCardUri($user); if ($user->isEnabled()) { - $this->atomic(function() use ($addressBookId, $cardId, $user) { + $this->atomic(function () use ($addressBookId, $cardId, $user) { $card = $this->backend->getCard($addressBookId, $cardId); if ($card === false) { $vCard = $this->converter->createCardFromUser($user); diff --git a/apps/dav/lib/CardDAV/SystemAddressbook.php b/apps/dav/lib/CardDAV/SystemAddressbook.php index 498c4e95be7..dc5ee0e1f21 100644 --- a/apps/dav/lib/CardDAV/SystemAddressbook.php +++ b/apps/dav/lib/CardDAV/SystemAddressbook.php @@ -36,8 +36,8 @@ use OCP\IGroupManager; use OCP\IL10N; use OCP\IRequest; use OCP\IUserSession; -use Sabre\CardDAV\Backend\SyncSupport; use Sabre\CardDAV\Backend\BackendInterface; +use Sabre\CardDAV\Backend\SyncSupport; use Sabre\CardDAV\Card; use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\NotFound; diff --git a/apps/dav/lib/CardDAV/UserAddressBooks.php b/apps/dav/lib/CardDAV/UserAddressBooks.php index 02e500acc86..2d129410067 100644 --- a/apps/dav/lib/CardDAV/UserAddressBooks.php +++ b/apps/dav/lib/CardDAV/UserAddressBooks.php @@ -29,8 +29,8 @@ declare(strict_types=1); namespace OCA\DAV\CardDAV; use OCA\DAV\AppInfo\PluginManager; -use OCA\DAV\CardDAV\Integration\IAddressBookProvider; use OCA\DAV\CardDAV\Integration\ExternalAddressBook; +use OCA\DAV\CardDAV\Integration\IAddressBookProvider; use OCA\Federation\TrustedServers; use OCP\AppFramework\QueryException; use OCP\IConfig; @@ -42,10 +42,10 @@ use OCP\IUserSession; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Sabre\CardDAV\Backend; -use Sabre\DAV\Exception\MethodNotAllowed; use Sabre\CardDAV\IAddressBook; -use function array_map; +use Sabre\DAV\Exception\MethodNotAllowed; use Sabre\DAV\MkCol; +use function array_map; class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { /** @var IL10N */ @@ -60,10 +60,10 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { private ?IGroupManager $groupManager; public function __construct(Backend\BackendInterface $carddavBackend, - string $principalUri, - PluginManager $pluginManager, - ?IUser $user, - ?IGroupManager $groupManager) { + string $principalUri, + PluginManager $pluginManager, + ?IUser $user, + ?IGroupManager $groupManager) { parent::__construct($carddavBackend, $principalUri); $this->pluginManager = $pluginManager; $this->user = $user; diff --git a/apps/dav/lib/Command/CreateAddressBook.php b/apps/dav/lib/Command/CreateAddressBook.php index 9dfc539a25d..27ecb5973e4 100644 --- a/apps/dav/lib/Command/CreateAddressBook.php +++ b/apps/dav/lib/Command/CreateAddressBook.php @@ -44,11 +44,11 @@ class CreateAddressBook extends Command { ->setName('dav:create-addressbook') ->setDescription('Create a dav addressbook') ->addArgument('user', - InputArgument::REQUIRED, - 'User for whom the addressbook will be created') + InputArgument::REQUIRED, + 'User for whom the addressbook will be created') ->addArgument('name', - InputArgument::REQUIRED, - 'Name of the addressbook'); + InputArgument::REQUIRED, + 'Name of the addressbook'); } protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/apps/dav/lib/Comments/CommentsPlugin.php b/apps/dav/lib/Comments/CommentsPlugin.php index 58de3e36139..1cfaa8b4e16 100644 --- a/apps/dav/lib/Comments/CommentsPlugin.php +++ b/apps/dav/lib/Comments/CommentsPlugin.php @@ -247,7 +247,7 @@ class CommentsPlugin extends ServerPlugin { throw new BadRequest('Invalid input values', 0, $e); } catch (\OCP\Comments\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 . \OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e); } } } diff --git a/apps/dav/lib/Connector/PublicAuth.php b/apps/dav/lib/Connector/PublicAuth.php index 6f58e89f1c0..d613a5a188f 100644 --- a/apps/dav/lib/Connector/PublicAuth.php +++ b/apps/dav/lib/Connector/PublicAuth.php @@ -51,9 +51,9 @@ class PublicAuth extends AbstractBasic { private IThrottler $throttler; public function __construct(IRequest $request, - IManager $shareManager, - ISession $session, - IThrottler $throttler) { + IManager $shareManager, + ISession $session, + IThrottler $throttler) { $this->request = $request; $this->shareManager = $shareManager; $this->session = $session; diff --git a/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php b/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php index 6c50f5682b7..db0f4e56b2e 100644 --- a/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php @@ -50,40 +50,37 @@ class AppleQuirksPlugin extends ServerPlugin { private $isMacOSDavAgent = false; /** - * Sets up the plugin. - * - * This method is automatically called by the server class. + * Sets up the plugin. + * + * This method is automatically called by the server class. * * @return void - */ - public function initialize(Server $server) - { + */ + public function initialize(Server $server) { $server->on('beforeMethod:REPORT', [$this, 'beforeReport'], 0); $server->on('report', [$this, 'report'], 0); } /** - * Triggered before any method is handled. + * Triggered before any method is handled. * * @return void - */ - public function beforeReport(RequestInterface $request, ResponseInterface $response) - { + */ + public function beforeReport(RequestInterface $request, ResponseInterface $response) { $userAgent = $request->getRawServerValue('HTTP_USER_AGENT') ?? 'unknown'; $this->isMacOSDavAgent = $this->isMacOSUserAgent($userAgent); } /** - * This method handles HTTP REPORT requests. - * - * @param string $reportName - * @param mixed $report - * @param mixed $path + * This method handles HTTP REPORT requests. + * + * @param string $reportName + * @param mixed $report + * @param mixed $path * * @return bool - */ - public function report($reportName, $report, $path) - { + */ + public function report($reportName, $report, $path) { if ($reportName == '{DAV:}principal-property-search' && $this->isMacOSDavAgent) { /** @var \Sabre\DAVACL\Xml\Request\PrincipalPropertySearchReport $report */ $report->applyToPrincipalCollectionSet = true; @@ -98,8 +95,7 @@ class AppleQuirksPlugin extends ServerPlugin { * * @return bool */ - protected function isMacOSUserAgent(string $userAgent):bool - { + protected function isMacOSUserAgent(string $userAgent):bool { return str_starts_with(self::OSX_AGENT_PREFIX, $userAgent); } @@ -110,8 +106,7 @@ class AppleQuirksPlugin extends ServerPlugin { * * @return null|array */ - protected function decodeMacOSAgentString(string $userAgent):?array - { + protected function decodeMacOSAgentString(string $userAgent):?array { // OSX agent string is like: macOS/13.2.1 (22D68) dataaccessd/1.0 if (preg_match('|^' . self::OSX_AGENT_PREFIX . '/([0-9]+)\\.([0-9]+)\\.([0-9]+)\s+\((\w+)\)\s+([^/]+)/([0-9]+)(?:\\.([0-9]+))?(?:\\.([0-9]+))?$|i', $userAgent, $matches)) { return [ diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index 29e39349704..243b92e63f7 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -61,11 +61,11 @@ class Auth extends AbstractBasic { private IThrottler $throttler; public function __construct(ISession $session, - Session $userSession, - IRequest $request, - Manager $twoFactorManager, - IThrottler $throttler, - string $principalPrefix = 'principals/users/') { + Session $userSession, + IRequest $request, + Manager $twoFactorManager, + IThrottler $throttler, + string $principalPrefix = 'principals/users/') { $this->session = $session; $this->userSession = $userSession; $this->twoFactorManager = $twoFactorManager; @@ -223,7 +223,7 @@ class Auth extends AbstractBasic { if (!$this->userSession->isLoggedIn() && in_array('XMLHttpRequest', explode(',', $request->getHeader('X-Requested-With') ?? ''))) { // do not re-authenticate over ajax, use dummy auth name to prevent browser popup - $response->addHeader('WWW-Authenticate','DummyBasic realm="' . $this->realm . '"'); + $response->addHeader('WWW-Authenticate', 'DummyBasic realm="' . $this->realm . '"'); $response->setStatus(401); throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls'); } diff --git a/apps/dav/lib/Connector/Sabre/BearerAuth.php b/apps/dav/lib/Connector/Sabre/BearerAuth.php index 5a69d07b002..4d9599b97a3 100644 --- a/apps/dav/lib/Connector/Sabre/BearerAuth.php +++ b/apps/dav/lib/Connector/Sabre/BearerAuth.php @@ -37,9 +37,9 @@ class BearerAuth extends AbstractBearer { private string $principalPrefix; public function __construct(IUserSession $userSession, - ISession $session, - IRequest $request, - $principalPrefix = 'principals/users/') { + ISession $session, + IRequest $request, + $principalPrefix = 'principals/users/') { $this->userSession = $userSession; $this->session = $session; $this->request = $request; diff --git a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php index 5d3f7104d6a..eda2399a780 100644 --- a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php +++ b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php @@ -27,9 +27,9 @@ namespace OCA\DAV\Connector\Sabre; use OCP\IConfig; use OCP\IRequest; +use Sabre\DAV\Server; use Sabre\DAV\ServerPlugin; use Sabre\HTTP\RequestInterface; -use Sabre\DAV\Server; /** * Class BlockLegacyClientPlugin is used to detect old legacy sync clients and diff --git a/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php b/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php index c222923bc8e..d68ced83616 100644 --- a/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php +++ b/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php @@ -23,10 +23,10 @@ declare(strict_types=1); namespace OCA\DAV\Connector\Sabre; +use Sabre\DAV\Server; use Sabre\DAV\ServerPlugin; use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; -use Sabre\DAV\Server; class ChecksumUpdatePlugin extends ServerPlugin { protected ?Server $server = null; diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php index eaa7f1bc2d2..94f9e167aae 100644 --- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php @@ -1,4 +1,5 @@ setAttribute('xmlns:o', self::NS_OWNCLOUD); // adding the retry node - $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true)); $errorNode->appendChild($error); // adding the message node - $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage()); $errorNode->appendChild($error); } } diff --git a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php index c504483d45a..9d1fda339a2 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php +++ b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php @@ -60,17 +60,17 @@ class InvalidPath extends Exception { * @param \DOMElement $errorNode * @return void */ - public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) { + public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) { // set ownCloud namespace $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); // adding the retry node - $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true)); $errorNode->appendChild($error); // adding the message node - $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage()); $errorNode->appendChild($error); } } diff --git a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php index ebf3e4021eb..a195b5722f5 100644 --- a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php +++ b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php @@ -42,7 +42,6 @@ use Sabre\DAV\Exception\NotFound; use Sabre\DAV\Exception\NotImplemented; use Sabre\DAV\Exception\PreconditionFailed; use Sabre\DAV\Exception\RequestedRangeNotSatisfiable; -use Sabre\DAV\Exception\ServiceUnavailable; class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin { protected $nonFatalExceptions = [ diff --git a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php index 7209450745c..b61e9dc0c39 100644 --- a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php @@ -125,7 +125,7 @@ class FakeLockerPlugin extends ServerPlugin { * @return bool */ public function fakeLockProvider(RequestInterface $request, - ResponseInterface $response) { + ResponseInterface $response) { $lockInfo = new LockInfo(); $lockInfo->token = md5($request->getPath()); $lockInfo->uri = $request->getPath(); @@ -151,7 +151,7 @@ class FakeLockerPlugin extends ServerPlugin { * @return bool */ public function fakeUnlockProvider(RequestInterface $request, - ResponseInterface $response) { + ResponseInterface $response) { $response->setStatus(204); $response->setHeader('Content-Length', '0'); return false; diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 8c467f11d0c..81cdfa464b5 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -105,12 +105,12 @@ class FilesPlugin extends ServerPlugin { private IPreview $previewManager; public function __construct(Tree $tree, - IConfig $config, - IRequest $request, - IPreview $previewManager, - IUserSession $userSession, - bool $isPublic = false, - bool $downloadAttachment = true) { + IConfig $config, + IRequest $request, + IPreview $previewManager, + IUserSession $userSession, + bool $isPublic = false, + bool $downloadAttachment = true) { $this->tree = $tree; $this->config = $config; $this->request = $request; diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index 18998d9c5cb..e43fb740cac 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -119,14 +119,14 @@ class FilesReportPlugin extends ServerPlugin { * @param IAppManager $appManager */ public function __construct(Tree $tree, - View $view, - ISystemTagManager $tagManager, - ISystemTagObjectMapper $tagMapper, - ITagManager $fileTagger, - IUserSession $userSession, - IGroupManager $groupManager, - Folder $userFolder, - IAppManager $appManager + View $view, + ISystemTagManager $tagManager, + ISystemTagObjectMapper $tagMapper, + ITagManager $fileTagger, + IUserSession $userSession, + IGroupManager $groupManager, + Folder $userFolder, + IAppManager $appManager ) { $this->tree = $tree; $this->fileView = $view; diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index 823eafe8fdb..df1de17fe20 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -100,16 +100,16 @@ class Principal implements BackendInterface { private $languageFactory; public function __construct(IUserManager $userManager, - IGroupManager $groupManager, - IAccountManager $accountManager, - IShareManager $shareManager, - IUserSession $userSession, - IAppManager $appManager, - ProxyMapper $proxyMapper, - KnownUserService $knownUserService, - IConfig $config, - IFactory $languageFactory, - string $principalPrefix = 'principals/users/') { + IGroupManager $groupManager, + IAccountManager $accountManager, + IShareManager $shareManager, + IUserSession $userSession, + IAppManager $appManager, + ProxyMapper $proxyMapper, + KnownUserService $knownUserService, + IConfig $config, + IFactory $languageFactory, + string $principalPrefix = 'principals/users/') { $this->userManager = $userManager; $this->groupManager = $groupManager; $this->accountManager = $accountManager; diff --git a/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php b/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php index b281a1053b8..df82db59f1d 100644 --- a/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php +++ b/apps/dav/lib/Connector/Sabre/RequestIdHeaderPlugin.php @@ -1,4 +1,6 @@ - * diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php index d0cc8aab5d0..828977fd812 100644 --- a/apps/dav/lib/Connector/Sabre/ServerFactory.php +++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php @@ -31,11 +31,11 @@ */ namespace OCA\DAV\Connector\Sabre; -use OCP\EventDispatcher\IEventDispatcher; -use OCP\Files\Folder; use OCA\DAV\AppInfo\PluginManager; use OCA\DAV\DAV\ViewOnlyPlugin; use OCA\DAV\Files\BrowserErrorPagePlugin; +use OCP\EventDispatcher\IEventDispatcher; +use OCP\Files\Folder; use OCP\Files\Mount\IMountManager; use OCP\IConfig; use OCP\IDBConnection; @@ -88,9 +88,9 @@ class ServerFactory { * @param callable $viewCallBack callback that should return the view for the dav endpoint */ public function createServer(string $baseUri, - string $requestUri, - Plugin $authPlugin, - callable $viewCallBack): Server { + string $requestUri, + Plugin $authPlugin, + callable $viewCallBack): Server { // Fire up server $objectTree = new \OCA\DAV\Connector\Sabre\ObjectTree(); $server = new \OCA\DAV\Connector\Sabre\Server($objectTree); diff --git a/apps/dav/lib/Connector/Sabre/SharesPlugin.php b/apps/dav/lib/Connector/Sabre/SharesPlugin.php index 3d52a44b6a6..4cda346af01 100644 --- a/apps/dav/lib/Connector/Sabre/SharesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/SharesPlugin.php @@ -33,11 +33,11 @@ use OCP\Files\Folder; use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\IUserSession; -use OCP\Share\IShare; use OCP\Share\IManager; +use OCP\Share\IShare; use Sabre\DAV\PropFind; -use Sabre\DAV\Tree; use Sabre\DAV\Server; +use Sabre\DAV\Tree; /** * Sabre Plugin to provide share-related properties diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index da5dd874905..dc2b6b0c339 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -222,7 +222,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { && $propFind->getDepth() !== 0 && (!is_null($propFind->getStatus(self::TAGS_PROPERTYNAME)) || !is_null($propFind->getStatus(self::FAVORITE_PROPERTYNAME)) - )) { + )) { // note: pre-fetching only supported for depth <= 1 $folderContent = $node->getChildren(); $fileIds[] = (int)$node->getId(); diff --git a/apps/dav/lib/Controller/BirthdayCalendarController.php b/apps/dav/lib/Controller/BirthdayCalendarController.php index 4305d6daaef..5df13cefe97 100644 --- a/apps/dav/lib/Controller/BirthdayCalendarController.php +++ b/apps/dav/lib/Controller/BirthdayCalendarController.php @@ -74,10 +74,10 @@ class BirthdayCalendarController extends Controller { * @param CalDavBackend $calDavBackend */ public function __construct($appName, IRequest $request, - IDBConnection $db, IConfig $config, - IJobList $jobList, - IUserManager $userManager, - CalDavBackend $calDavBackend) { + IDBConnection $db, IConfig $config, + IJobList $jobList, + IUserManager $userManager, + CalDavBackend $calDavBackend) { parent::__construct($appName, $request); $this->db = $db; $this->config = $config; diff --git a/apps/dav/lib/Controller/DirectController.php b/apps/dav/lib/Controller/DirectController.php index 1a7b3b57626..0f618e46b22 100644 --- a/apps/dav/lib/Controller/DirectController.php +++ b/apps/dav/lib/Controller/DirectController.php @@ -32,11 +32,10 @@ use OCA\DAV\Db\DirectMapper; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSBadRequestException; -use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\AppFramework\OCS\OCSForbiddenException; +use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\AppFramework\OCSController; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\EventDispatcher\GenericEvent; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Events\BeforeDirectFileDownloadEvent; use OCP\Files\File; @@ -69,14 +68,14 @@ class DirectController extends OCSController { private $eventDispatcher; public function __construct(string $appName, - IRequest $request, - IRootFolder $rootFolder, - string $userId, - DirectMapper $mapper, - ISecureRandom $random, - ITimeFactory $timeFactory, - IURLGenerator $urlGenerator, - IEventDispatcher $eventDispatcher) { + IRequest $request, + IRootFolder $rootFolder, + string $userId, + DirectMapper $mapper, + ISecureRandom $random, + ITimeFactory $timeFactory, + IURLGenerator $urlGenerator, + IEventDispatcher $eventDispatcher) { parent::__construct($appName, $request); $this->rootFolder = $rootFolder; diff --git a/apps/dav/lib/Controller/InvitationResponseController.php b/apps/dav/lib/Controller/InvitationResponseController.php index 0ec630883dc..69d6bea4e5b 100644 --- a/apps/dav/lib/Controller/InvitationResponseController.php +++ b/apps/dav/lib/Controller/InvitationResponseController.php @@ -60,8 +60,8 @@ class InvitationResponseController extends Controller { * @param InvitationResponseServer $responseServer */ public function __construct(string $appName, IRequest $request, - IDBConnection $db, ITimeFactory $timeFactory, - InvitationResponseServer $responseServer) { + IDBConnection $db, ITimeFactory $timeFactory, + InvitationResponseServer $responseServer) { parent::__construct($appName, $request); $this->db = $db; $this->timeFactory = $timeFactory; diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php index 9acc7c4b05b..8c126e6b71c 100644 --- a/apps/dav/lib/DAV/GroupPrincipalBackend.php +++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php @@ -104,7 +104,7 @@ class GroupPrincipalBackend implements BackendInterface { * @return array */ public function getPrincipalByPath($path) { - $elements = explode('/', $path, 3); + $elements = explode('/', $path, 3); if ($elements[0] !== 'principals') { return null; } diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index 74b34b81b22..b115ef61313 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -31,10 +31,10 @@ namespace OCA\DAV\DAV\Sharing; use OCA\DAV\Connector\Sabre\Principal; use OCP\AppFramework\Db\TTransactional; use OCP\Cache\CappedMemoryCache; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\IGroupManager; use OCP\IUserManager; -use OCP\DB\QueryBuilder\IQueryBuilder; class Backend { use TTransactional; @@ -211,7 +211,7 @@ class Backend { } public function preloadShares(array $resourceIds): void { - $resourceIds = array_filter($resourceIds, function(int $resourceId) { + $resourceIds = array_filter($resourceIds, function (int $resourceId) { return !isset($this->shareCache[$resourceId]); }); if (count($resourceIds) === 0) { diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php index c7d8691ab06..78e086bc907 100644 --- a/apps/dav/lib/DAV/Sharing/Plugin.php +++ b/apps/dav/lib/DAV/Sharing/Plugin.php @@ -113,7 +113,7 @@ class Plugin extends ServerPlugin { $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = Invite::class; $this->server->on('method:POST', [$this, 'httpPost']); - $this->server->on('propFind', [$this, 'propFind']); + $this->server->on('propFind', [$this, 'propFind']); } /** diff --git a/apps/dav/lib/DAV/ViewOnlyPlugin.php b/apps/dav/lib/DAV/ViewOnlyPlugin.php index 51e3622142d..27e4a06f718 100644 --- a/apps/dav/lib/DAV/ViewOnlyPlugin.php +++ b/apps/dav/lib/DAV/ViewOnlyPlugin.php @@ -26,10 +26,10 @@ use OCA\DAV\Connector\Sabre\File as DavFile; use OCA\Files_Versions\Sabre\VersionFile; use OCP\Files\NotFoundException; use Psr\Log\LoggerInterface; +use Sabre\DAV\Exception\NotFound; use Sabre\DAV\Server; use Sabre\DAV\ServerPlugin; use Sabre\HTTP\RequestInterface; -use Sabre\DAV\Exception\NotFound; /** * Sabre plugin for restricting file share receiver download: @@ -74,7 +74,7 @@ class ViewOnlyPlugin extends ServerPlugin { if ($davNode instanceof DavFile) { // Restrict view-only to nodes which are shared $node = $davNode->getNode(); - } else if ($davNode instanceof VersionFile) { + } elseif ($davNode instanceof VersionFile) { $node = $davNode->getVersion()->getSourceFile(); } else { return true; diff --git a/apps/dav/lib/Direct/ServerFactory.php b/apps/dav/lib/Direct/ServerFactory.php index ce689b1e88e..f9914a5cb36 100644 --- a/apps/dav/lib/Direct/ServerFactory.php +++ b/apps/dav/lib/Direct/ServerFactory.php @@ -53,12 +53,12 @@ class ServerFactory { } public function createServer(string $baseURI, - string $requestURI, - IRootFolder $rootFolder, - DirectMapper $mapper, - ITimeFactory $timeFactory, - IThrottler $throttler, - IRequest $request): Server { + string $requestURI, + IRootFolder $rootFolder, + DirectMapper $mapper, + ITimeFactory $timeFactory, + IThrottler $throttler, + IRequest $request): Server { $home = new DirectHome($rootFolder, $mapper, $timeFactory, $throttler, $request, $this->eventDispatcher); $server = new Server($home); diff --git a/apps/dav/lib/Events/AddressBookCreatedEvent.php b/apps/dav/lib/Events/AddressBookCreatedEvent.php index 86c4cd23640..396c246289c 100644 --- a/apps/dav/lib/Events/AddressBookCreatedEvent.php +++ b/apps/dav/lib/Events/AddressBookCreatedEvent.php @@ -49,7 +49,7 @@ class AddressBookCreatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $addressBookId, - array $addressBookData) { + array $addressBookData) { parent::__construct(); $this->addressBookId = $addressBookId; $this->addressBookData = $addressBookData; diff --git a/apps/dav/lib/Events/AddressBookDeletedEvent.php b/apps/dav/lib/Events/AddressBookDeletedEvent.php index 3c8da6b7bf0..79785f5f0fa 100644 --- a/apps/dav/lib/Events/AddressBookDeletedEvent.php +++ b/apps/dav/lib/Events/AddressBookDeletedEvent.php @@ -53,8 +53,8 @@ class AddressBookDeletedEvent extends Event { * @since 20.0.0 */ public function __construct(int $addressBookId, - array $addressBookData, - array $shares) { + array $addressBookData, + array $shares) { parent::__construct(); $this->addressBookId = $addressBookId; $this->addressBookData = $addressBookData; diff --git a/apps/dav/lib/Events/AddressBookShareUpdatedEvent.php b/apps/dav/lib/Events/AddressBookShareUpdatedEvent.php index f9f8ff99d40..da3c2701abd 100644 --- a/apps/dav/lib/Events/AddressBookShareUpdatedEvent.php +++ b/apps/dav/lib/Events/AddressBookShareUpdatedEvent.php @@ -61,10 +61,10 @@ class AddressBookShareUpdatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $addressBookId, - array $addressBookData, - array $oldShares, - array $added, - array $removed) { + array $addressBookData, + array $oldShares, + array $added, + array $removed) { parent::__construct(); $this->addressBookId = $addressBookId; $this->addressBookData = $addressBookData; diff --git a/apps/dav/lib/Events/AddressBookUpdatedEvent.php b/apps/dav/lib/Events/AddressBookUpdatedEvent.php index c632f1817a8..d651e569467 100644 --- a/apps/dav/lib/Events/AddressBookUpdatedEvent.php +++ b/apps/dav/lib/Events/AddressBookUpdatedEvent.php @@ -57,9 +57,9 @@ class AddressBookUpdatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $addressBookId, - array $addressBookData, - array $shares, - array $mutations) { + array $addressBookData, + array $shares, + array $mutations) { parent::__construct(); $this->addressBookId = $addressBookId; $this->addressBookData = $addressBookData; diff --git a/apps/dav/lib/Events/CachedCalendarObjectCreatedEvent.php b/apps/dav/lib/Events/CachedCalendarObjectCreatedEvent.php index 29e11ddc146..64d9b6dd2c7 100644 --- a/apps/dav/lib/Events/CachedCalendarObjectCreatedEvent.php +++ b/apps/dav/lib/Events/CachedCalendarObjectCreatedEvent.php @@ -57,9 +57,9 @@ class CachedCalendarObjectCreatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $subscriptionId, - array $subscriptionData, - array $shares, - array $objectData) { + array $subscriptionData, + array $shares, + array $objectData) { parent::__construct(); $this->subscriptionId = $subscriptionId; $this->subscriptionData = $subscriptionData; diff --git a/apps/dav/lib/Events/CachedCalendarObjectDeletedEvent.php b/apps/dav/lib/Events/CachedCalendarObjectDeletedEvent.php index eaf98df60bf..183e8e8bcf9 100644 --- a/apps/dav/lib/Events/CachedCalendarObjectDeletedEvent.php +++ b/apps/dav/lib/Events/CachedCalendarObjectDeletedEvent.php @@ -57,9 +57,9 @@ class CachedCalendarObjectDeletedEvent extends Event { * @since 20.0.0 */ public function __construct(int $subscriptionId, - array $subscriptionData, - array $shares, - array $objectData) { + array $subscriptionData, + array $shares, + array $objectData) { parent::__construct(); $this->subscriptionId = $subscriptionId; $this->subscriptionData = $subscriptionData; diff --git a/apps/dav/lib/Events/CachedCalendarObjectUpdatedEvent.php b/apps/dav/lib/Events/CachedCalendarObjectUpdatedEvent.php index d47d75ec1d8..62781483def 100644 --- a/apps/dav/lib/Events/CachedCalendarObjectUpdatedEvent.php +++ b/apps/dav/lib/Events/CachedCalendarObjectUpdatedEvent.php @@ -57,9 +57,9 @@ class CachedCalendarObjectUpdatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $subscriptionId, - array $subscriptionData, - array $shares, - array $objectData) { + array $subscriptionData, + array $shares, + array $objectData) { parent::__construct(); $this->subscriptionId = $subscriptionId; $this->subscriptionData = $subscriptionData; diff --git a/apps/dav/lib/Events/CalendarCreatedEvent.php b/apps/dav/lib/Events/CalendarCreatedEvent.php index ba51002f829..649a242a1d2 100644 --- a/apps/dav/lib/Events/CalendarCreatedEvent.php +++ b/apps/dav/lib/Events/CalendarCreatedEvent.php @@ -49,7 +49,7 @@ class CalendarCreatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $calendarId, - array $calendarData) { + array $calendarData) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarDeletedEvent.php b/apps/dav/lib/Events/CalendarDeletedEvent.php index d6207ac6ee2..97d522cde7c 100644 --- a/apps/dav/lib/Events/CalendarDeletedEvent.php +++ b/apps/dav/lib/Events/CalendarDeletedEvent.php @@ -53,8 +53,8 @@ class CalendarDeletedEvent extends Event { * @since 20.0.0 */ public function __construct(int $calendarId, - array $calendarData, - array $shares) { + array $calendarData, + array $shares) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarMovedToTrashEvent.php b/apps/dav/lib/Events/CalendarMovedToTrashEvent.php index c04b383d5bf..5fb2f48a75c 100644 --- a/apps/dav/lib/Events/CalendarMovedToTrashEvent.php +++ b/apps/dav/lib/Events/CalendarMovedToTrashEvent.php @@ -48,8 +48,8 @@ class CalendarMovedToTrashEvent extends Event { * @since 22.0.0 */ public function __construct(int $calendarId, - array $calendarData, - array $shares) { + array $calendarData, + array $shares) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarObjectCreatedEvent.php b/apps/dav/lib/Events/CalendarObjectCreatedEvent.php index 294c778335e..123f7fc229f 100644 --- a/apps/dav/lib/Events/CalendarObjectCreatedEvent.php +++ b/apps/dav/lib/Events/CalendarObjectCreatedEvent.php @@ -57,9 +57,9 @@ class CalendarObjectCreatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $objectData) { + array $calendarData, + array $shares, + array $objectData) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarObjectDeletedEvent.php b/apps/dav/lib/Events/CalendarObjectDeletedEvent.php index 7a621994b80..8c5834ff050 100644 --- a/apps/dav/lib/Events/CalendarObjectDeletedEvent.php +++ b/apps/dav/lib/Events/CalendarObjectDeletedEvent.php @@ -57,9 +57,9 @@ class CalendarObjectDeletedEvent extends Event { * @since 20.0.0 */ public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $objectData) { + array $calendarData, + array $shares, + array $objectData) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarObjectMovedEvent.php b/apps/dav/lib/Events/CalendarObjectMovedEvent.php index 0143dad9a96..402a9adf979 100644 --- a/apps/dav/lib/Events/CalendarObjectMovedEvent.php +++ b/apps/dav/lib/Events/CalendarObjectMovedEvent.php @@ -46,12 +46,12 @@ class CalendarObjectMovedEvent extends Event { * @since 25.0.0 */ public function __construct(int $sourceCalendarId, - array $sourceCalendarData, - int $targetCalendarId, - array $targetCalendarData, - array $sourceShares, - array $targetShares, - array $objectData) { + array $sourceCalendarData, + int $targetCalendarId, + array $targetCalendarData, + array $sourceShares, + array $targetShares, + array $objectData) { parent::__construct(); $this->sourceCalendarId = $sourceCalendarId; $this->sourceCalendarData = $sourceCalendarData; diff --git a/apps/dav/lib/Events/CalendarObjectMovedToTrashEvent.php b/apps/dav/lib/Events/CalendarObjectMovedToTrashEvent.php index d7a3b99de82..b963d1321a4 100644 --- a/apps/dav/lib/Events/CalendarObjectMovedToTrashEvent.php +++ b/apps/dav/lib/Events/CalendarObjectMovedToTrashEvent.php @@ -52,9 +52,9 @@ class CalendarObjectMovedToTrashEvent extends Event { * @since 22.0.0 */ public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $objectData) { + array $calendarData, + array $shares, + array $objectData) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarObjectRestoredEvent.php b/apps/dav/lib/Events/CalendarObjectRestoredEvent.php index 42f296e64cc..76589725986 100644 --- a/apps/dav/lib/Events/CalendarObjectRestoredEvent.php +++ b/apps/dav/lib/Events/CalendarObjectRestoredEvent.php @@ -52,9 +52,9 @@ class CalendarObjectRestoredEvent extends Event { * @since 22.0.0 */ public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $objectData) { + array $calendarData, + array $shares, + array $objectData) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarObjectUpdatedEvent.php b/apps/dav/lib/Events/CalendarObjectUpdatedEvent.php index 84157afd20a..45d66370137 100644 --- a/apps/dav/lib/Events/CalendarObjectUpdatedEvent.php +++ b/apps/dav/lib/Events/CalendarObjectUpdatedEvent.php @@ -57,9 +57,9 @@ class CalendarObjectUpdatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $objectData) { + array $calendarData, + array $shares, + array $objectData) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarPublishedEvent.php b/apps/dav/lib/Events/CalendarPublishedEvent.php index a95e9f294c1..b92d17901f7 100644 --- a/apps/dav/lib/Events/CalendarPublishedEvent.php +++ b/apps/dav/lib/Events/CalendarPublishedEvent.php @@ -48,8 +48,8 @@ class CalendarPublishedEvent extends Event { * @since 20.0.0 */ public function __construct(int $calendarId, - array $calendarData, - string $publicUri) { + array $calendarData, + string $publicUri) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarRestoredEvent.php b/apps/dav/lib/Events/CalendarRestoredEvent.php index ef477ac1d48..b44b3607969 100644 --- a/apps/dav/lib/Events/CalendarRestoredEvent.php +++ b/apps/dav/lib/Events/CalendarRestoredEvent.php @@ -48,8 +48,8 @@ class CalendarRestoredEvent extends Event { * @since 22.0.0 */ public function __construct(int $calendarId, - array $calendarData, - array $shares) { + array $calendarData, + array $shares) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarShareUpdatedEvent.php b/apps/dav/lib/Events/CalendarShareUpdatedEvent.php index dedd9f8a566..ebde62a8be2 100644 --- a/apps/dav/lib/Events/CalendarShareUpdatedEvent.php +++ b/apps/dav/lib/Events/CalendarShareUpdatedEvent.php @@ -61,10 +61,10 @@ class CalendarShareUpdatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $calendarId, - array $calendarData, - array $oldShares, - array $added, - array $removed) { + array $calendarData, + array $oldShares, + array $added, + array $removed) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarUnpublishedEvent.php b/apps/dav/lib/Events/CalendarUnpublishedEvent.php index b2536fc7aef..ede60aeb904 100644 --- a/apps/dav/lib/Events/CalendarUnpublishedEvent.php +++ b/apps/dav/lib/Events/CalendarUnpublishedEvent.php @@ -46,7 +46,7 @@ class CalendarUnpublishedEvent extends Event { * @since 20.0.0 */ public function __construct(int $calendarId, - array $calendarData) { + array $calendarData) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CalendarUpdatedEvent.php b/apps/dav/lib/Events/CalendarUpdatedEvent.php index ec33412b478..c39d22b281c 100644 --- a/apps/dav/lib/Events/CalendarUpdatedEvent.php +++ b/apps/dav/lib/Events/CalendarUpdatedEvent.php @@ -57,9 +57,9 @@ class CalendarUpdatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $calendarId, - array $calendarData, - array $shares, - array $mutations) { + array $calendarData, + array $shares, + array $mutations) { parent::__construct(); $this->calendarId = $calendarId; $this->calendarData = $calendarData; diff --git a/apps/dav/lib/Events/CardCreatedEvent.php b/apps/dav/lib/Events/CardCreatedEvent.php index 4c6b1714721..138cccd6862 100644 --- a/apps/dav/lib/Events/CardCreatedEvent.php +++ b/apps/dav/lib/Events/CardCreatedEvent.php @@ -57,9 +57,9 @@ class CardCreatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $addressBookId, - array $addressBookData, - array $shares, - array $cardData) { + array $addressBookData, + array $shares, + array $cardData) { parent::__construct(); $this->addressBookId = $addressBookId; $this->addressBookData = $addressBookData; diff --git a/apps/dav/lib/Events/CardDeletedEvent.php b/apps/dav/lib/Events/CardDeletedEvent.php index f4d7e21fab1..e0a92a2076a 100644 --- a/apps/dav/lib/Events/CardDeletedEvent.php +++ b/apps/dav/lib/Events/CardDeletedEvent.php @@ -57,9 +57,9 @@ class CardDeletedEvent extends Event { * @since 20.0.0 */ public function __construct(int $addressBookId, - array $addressBookData, - array $shares, - array $cardData) { + array $addressBookData, + array $shares, + array $cardData) { parent::__construct(); $this->addressBookId = $addressBookId; $this->addressBookData = $addressBookData; diff --git a/apps/dav/lib/Events/CardMovedEvent.php b/apps/dav/lib/Events/CardMovedEvent.php index 07139cfdecf..38a66ed08b6 100644 --- a/apps/dav/lib/Events/CardMovedEvent.php +++ b/apps/dav/lib/Events/CardMovedEvent.php @@ -46,12 +46,12 @@ class CardMovedEvent extends Event { * @since 27.0.0 */ public function __construct(int $sourceAddressBookId, - array $sourceAddressBookData, - int $targetAddressBookId, - array $targetAddressBookData, - array $sourceShares, - array $targetShares, - array $objectData) { + array $sourceAddressBookData, + int $targetAddressBookId, + array $targetAddressBookData, + array $sourceShares, + array $targetShares, + array $objectData) { parent::__construct(); $this->sourceAddressBookId = $sourceAddressBookId; $this->sourceAddressBookData = $sourceAddressBookData; diff --git a/apps/dav/lib/Events/CardUpdatedEvent.php b/apps/dav/lib/Events/CardUpdatedEvent.php index 213419d51a3..40f28713ce6 100644 --- a/apps/dav/lib/Events/CardUpdatedEvent.php +++ b/apps/dav/lib/Events/CardUpdatedEvent.php @@ -57,9 +57,9 @@ class CardUpdatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $addressBookId, - array $addressBookData, - array $shares, - array $cardData) { + array $addressBookData, + array $shares, + array $cardData) { parent::__construct(); $this->addressBookId = $addressBookId; $this->addressBookData = $addressBookData; diff --git a/apps/dav/lib/Events/SubscriptionCreatedEvent.php b/apps/dav/lib/Events/SubscriptionCreatedEvent.php index f7fc2101221..9932e70c4c8 100644 --- a/apps/dav/lib/Events/SubscriptionCreatedEvent.php +++ b/apps/dav/lib/Events/SubscriptionCreatedEvent.php @@ -49,7 +49,7 @@ class SubscriptionCreatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $subscriptionId, - array $subscriptionData) { + array $subscriptionData) { parent::__construct(); $this->subscriptionId = $subscriptionId; $this->subscriptionData = $subscriptionData; diff --git a/apps/dav/lib/Events/SubscriptionDeletedEvent.php b/apps/dav/lib/Events/SubscriptionDeletedEvent.php index fc31005ac0f..8aa36f4584b 100644 --- a/apps/dav/lib/Events/SubscriptionDeletedEvent.php +++ b/apps/dav/lib/Events/SubscriptionDeletedEvent.php @@ -53,8 +53,8 @@ class SubscriptionDeletedEvent extends Event { * @since 20.0.0 */ public function __construct(int $subscriptionId, - array $subscriptionData, - array $shares) { + array $subscriptionData, + array $shares) { parent::__construct(); $this->subscriptionId = $subscriptionId; $this->subscriptionData = $subscriptionData; diff --git a/apps/dav/lib/Events/SubscriptionUpdatedEvent.php b/apps/dav/lib/Events/SubscriptionUpdatedEvent.php index 29231d13a7f..eb90177a00d 100644 --- a/apps/dav/lib/Events/SubscriptionUpdatedEvent.php +++ b/apps/dav/lib/Events/SubscriptionUpdatedEvent.php @@ -57,9 +57,9 @@ class SubscriptionUpdatedEvent extends Event { * @since 20.0.0 */ public function __construct(int $subscriptionId, - array $subscriptionData, - array $shares, - array $mutations) { + array $subscriptionData, + array $shares, + array $mutations) { parent::__construct(); $this->subscriptionId = $subscriptionId; $this->subscriptionData = $subscriptionData; diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 419a0c5ed3b..fd45491da7e 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -39,7 +39,6 @@ use OCP\Files\Cache\ICacheEntry; use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\Node; -use OCP\Files\Search\ISearchComparison; use OCP\Files\Search\ISearchOperator; use OCP\Files\Search\ISearchOrder; use OCP\Files\Search\ISearchQuery; @@ -372,6 +371,7 @@ class FileSearchBackend implements ISearchBackend { throw new \InvalidArgumentException('Invalid argument 2 for ' . $trimmedType . ' operation, expected literal'); } $value = $operator->arguments[1]->value; + // no break case Operator::OPERATION_IS_DEFINED: if (!($operator->arguments[0] instanceof SearchPropertyDefinition)) { throw new \InvalidArgumentException('Invalid argument 1 for ' . $trimmedType . ' operation, expected property'); @@ -429,7 +429,7 @@ class FileSearchBackend implements ISearchBackend { return ''; } - switch ($property->dataType) { + switch ($property->dataType) { case SearchPropertyDefinition::DATATYPE_BOOLEAN: return $value === 'yes'; case SearchPropertyDefinition::DATATYPE_DECIMAL: diff --git a/apps/dav/lib/Files/LazySearchBackend.php b/apps/dav/lib/Files/LazySearchBackend.php index c3b2f27d72a..ccd6fde14e1 100644 --- a/apps/dav/lib/Files/LazySearchBackend.php +++ b/apps/dav/lib/Files/LazySearchBackend.php @@ -22,7 +22,6 @@ */ namespace OCA\DAV\Files; -use Sabre\DAV\INode; use SearchDAV\Backend\ISearchBackend; use SearchDAV\Query\Query; diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php index 9e923440e38..1e7990af32f 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -67,10 +67,10 @@ class HookManager { private $themingDefaults; public function __construct(IUserManager $userManager, - SyncService $syncService, - CalDavBackend $calDav, - CardDavBackend $cardDav, - Defaults $themingDefaults) { + SyncService $syncService, + CalDavBackend $calDav, + CardDavBackend $cardDav, + Defaults $themingDefaults) { $this->userManager = $userManager; $this->syncService = $syncService; $this->calDav = $calDav; diff --git a/apps/dav/lib/Listener/ActivityUpdaterListener.php b/apps/dav/lib/Listener/ActivityUpdaterListener.php index ea3ec49c14d..ba0d47f148f 100644 --- a/apps/dav/lib/Listener/ActivityUpdaterListener.php +++ b/apps/dav/lib/Listener/ActivityUpdaterListener.php @@ -53,7 +53,7 @@ class ActivityUpdaterListener implements IEventListener { private $logger; public function __construct(ActivityBackend $activityBackend, - LoggerInterface $logger) { + LoggerInterface $logger) { $this->activityBackend = $activityBackend; $this->logger = $logger; } diff --git a/apps/dav/lib/Listener/AddressbookListener.php b/apps/dav/lib/Listener/AddressbookListener.php index 3c17d399d4e..489a814d158 100644 --- a/apps/dav/lib/Listener/AddressbookListener.php +++ b/apps/dav/lib/Listener/AddressbookListener.php @@ -44,7 +44,7 @@ class AddressbookListener implements IEventListener { private $logger; public function __construct(ActivityBackend $activityBackend, - LoggerInterface $logger) { + LoggerInterface $logger) { $this->activityBackend = $activityBackend; $this->logger = $logger; } diff --git a/apps/dav/lib/Listener/CalendarContactInteractionListener.php b/apps/dav/lib/Listener/CalendarContactInteractionListener.php index b27aa53aa11..6787d9316e9 100644 --- a/apps/dav/lib/Listener/CalendarContactInteractionListener.php +++ b/apps/dav/lib/Listener/CalendarContactInteractionListener.php @@ -64,10 +64,10 @@ class CalendarContactInteractionListener implements IEventListener { private $logger; public function __construct(IEventDispatcher $dispatcher, - IUserSession $userSession, - Principal $principalConnector, - IMailer $mailer, - LoggerInterface $logger) { + IUserSession $userSession, + Principal $principalConnector, + IMailer $mailer, + LoggerInterface $logger) { $this->dispatcher = $dispatcher; $this->userSession = $userSession; $this->principalConnector = $principalConnector; diff --git a/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php b/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php index 42dd0dfc0a7..23835f1626e 100644 --- a/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php +++ b/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php @@ -44,7 +44,7 @@ class CalendarDeletionDefaultUpdaterListener implements IEventListener { private $logger; public function __construct(IConfig $config, - LoggerInterface $logger) { + LoggerInterface $logger) { $this->config = $config; $this->logger = $logger; } diff --git a/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php b/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php index 3c168f6105c..8b723b95527 100644 --- a/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php +++ b/apps/dav/lib/Listener/CalendarObjectReminderUpdaterListener.php @@ -57,9 +57,9 @@ class CalendarObjectReminderUpdaterListener implements IEventListener { private $logger; public function __construct(ReminderBackend $reminderBackend, - ReminderService $reminderService, - CalDavBackend $calDavBackend, - LoggerInterface $logger) { + ReminderService $reminderService, + CalDavBackend $calDavBackend, + LoggerInterface $logger) { $this->reminderBackend = $reminderBackend; $this->reminderService = $reminderService; $this->calDavBackend = $calDavBackend; diff --git a/apps/dav/lib/Listener/CalendarPublicationListener.php b/apps/dav/lib/Listener/CalendarPublicationListener.php index 1453694d6fb..e86bfa73c55 100644 --- a/apps/dav/lib/Listener/CalendarPublicationListener.php +++ b/apps/dav/lib/Listener/CalendarPublicationListener.php @@ -37,7 +37,7 @@ class CalendarPublicationListener implements IEventListener { private LoggerInterface $logger; public function __construct(Backend $activityBackend, - LoggerInterface $logger) { + LoggerInterface $logger) { $this->activityBackend = $activityBackend; $this->logger = $logger; } diff --git a/apps/dav/lib/Listener/CalendarShareUpdateListener.php b/apps/dav/lib/Listener/CalendarShareUpdateListener.php index dd046ddd66a..3f4f6f0a316 100644 --- a/apps/dav/lib/Listener/CalendarShareUpdateListener.php +++ b/apps/dav/lib/Listener/CalendarShareUpdateListener.php @@ -36,7 +36,7 @@ class CalendarShareUpdateListener implements IEventListener { private LoggerInterface $logger; public function __construct(Backend $activityBackend, - LoggerInterface $logger) { + LoggerInterface $logger) { $this->activityBackend = $activityBackend; $this->logger = $logger; } diff --git a/apps/dav/lib/Listener/CardListener.php b/apps/dav/lib/Listener/CardListener.php index 0281127c858..69398435958 100644 --- a/apps/dav/lib/Listener/CardListener.php +++ b/apps/dav/lib/Listener/CardListener.php @@ -25,8 +25,8 @@ declare(strict_types=1); */ namespace OCA\DAV\Listener; -use OCA\DAV\CardDAV\Activity\Provider\Card; use OCA\DAV\CardDAV\Activity\Backend as ActivityBackend; +use OCA\DAV\CardDAV\Activity\Provider\Card; use OCA\DAV\Events\CardCreatedEvent; use OCA\DAV\Events\CardDeletedEvent; use OCA\DAV\Events\CardUpdatedEvent; @@ -44,7 +44,7 @@ class CardListener implements IEventListener { private $logger; public function __construct(ActivityBackend $activityBackend, - LoggerInterface $logger) { + LoggerInterface $logger) { $this->activityBackend = $activityBackend; $this->logger = $logger; } diff --git a/apps/dav/lib/Listener/OutOfOfficeListener.php b/apps/dav/lib/Listener/OutOfOfficeListener.php index 645a01a35cf..609c32f5067 100644 --- a/apps/dav/lib/Listener/OutOfOfficeListener.php +++ b/apps/dav/lib/Listener/OutOfOfficeListener.php @@ -53,8 +53,8 @@ use function rewind; */ class OutOfOfficeListener implements IEventListener { public function __construct(private ServerFactory $serverFactory, - private IConfig $appConfig, - private LoggerInterface $logger) { + private IConfig $appConfig, + private LoggerInterface $logger) { } public function handle(Event $event): void { @@ -80,7 +80,7 @@ class OutOfOfficeListener implements IEventListener { } finally { fclose($stream); } - } else if ($event instanceof OutOfOfficeChangedEvent) { + } elseif ($event instanceof OutOfOfficeChangedEvent) { $userId = $event->getData()->getUser()->getUID(); $principal = "principals/users/$userId"; @@ -107,7 +107,7 @@ class OutOfOfficeListener implements IEventListener { fclose($stream); } } - } else if ($event instanceof OutOfOfficeClearedEvent) { + } elseif ($event instanceof OutOfOfficeClearedEvent) { $userId = $event->getData()->getUser()->getUID(); $principal = "principals/users/$userId"; diff --git a/apps/dav/lib/Listener/SubscriptionListener.php b/apps/dav/lib/Listener/SubscriptionListener.php index 36db234aa05..c7e1bbfecda 100644 --- a/apps/dav/lib/Listener/SubscriptionListener.php +++ b/apps/dav/lib/Listener/SubscriptionListener.php @@ -42,7 +42,7 @@ class SubscriptionListener implements IEventListener { private LoggerInterface $logger; public function __construct(IJobList $jobList, RefreshWebcalService $refreshWebcalService, ReminderBackend $reminderBackend, - LoggerInterface $logger) { + LoggerInterface $logger) { $this->jobList = $jobList; $this->refreshWebcalService = $refreshWebcalService; $this->reminderBackend = $reminderBackend; diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php index c8a649f3449..fc9a6d9a559 100644 --- a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php +++ b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php @@ -49,8 +49,8 @@ class BuildCalendarSearchIndex implements IRepairStep { * @param IConfig $config */ public function __construct(IDBConnection $db, - IJobList $jobList, - IConfig $config) { + IJobList $jobList, + IConfig $config) { $this->db = $db; $this->jobList = $jobList; $this->config = $config; diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php index 6a315f2a150..a816e2619a3 100644 --- a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php @@ -55,10 +55,10 @@ class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { * @param ITimeFactory $timeFactory */ public function __construct(IDBConnection $db, - CalDavBackend $calDavBackend, - ILogger $logger, - IJobList $jobList, - ITimeFactory $timeFactory) { + CalDavBackend $calDavBackend, + ILogger $logger, + IJobList $jobList, + ITimeFactory $timeFactory) { $this->db = $db; $this->calDavBackend = $calDavBackend; $this->logger = $logger; diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndex.php b/apps/dav/lib/Migration/BuildSocialSearchIndex.php index ae2eb084e2b..f3872acc3ab 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndex.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndex.php @@ -46,8 +46,8 @@ class BuildSocialSearchIndex implements IRepairStep { * @param IConfig $config */ public function __construct(IDBConnection $db, - IJobList $jobList, - IConfig $config) { + IJobList $jobList, + IConfig $config) { $this->db = $db; $this->jobList = $jobList; $this->config = $config; diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php index 98afecc3b7d..231749521be 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php @@ -54,10 +54,10 @@ class BuildSocialSearchIndexBackgroundJob extends QueuedJob { * @param ITimeFactory $timeFactory */ public function __construct(IDBConnection $db, - CardDavBackend $davBackend, - ILogger $logger, - IJobList $jobList, - ITimeFactory $timeFactory) { + CardDavBackend $davBackend, + ILogger $logger, + IJobList $jobList, + ITimeFactory $timeFactory) { $this->db = $db; $this->davBackend = $davBackend; $this->logger = $logger; diff --git a/apps/dav/lib/Migration/ChunkCleanup.php b/apps/dav/lib/Migration/ChunkCleanup.php index 918023552da..8a4ad5664a4 100644 --- a/apps/dav/lib/Migration/ChunkCleanup.php +++ b/apps/dav/lib/Migration/ChunkCleanup.php @@ -48,9 +48,9 @@ class ChunkCleanup implements IRepairStep { private $jobList; public function __construct(IConfig $config, - IUserManager $userManager, - IRootFolder $rootFolder, - IJobList $jobList) { + IUserManager $userManager, + IRootFolder $rootFolder, + IJobList $jobList) { $this->config = $config; $this->userManager = $userManager; $this->rootFolder = $rootFolder; diff --git a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php index 29547b09ff7..a8138d876e9 100644 --- a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php +++ b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php @@ -42,7 +42,7 @@ class RegenerateBirthdayCalendars implements IRepairStep { * @param IConfig $config */ public function __construct(IJobList $jobList, - IConfig $config) { + IConfig $config) { $this->jobList = $jobList; $this->config = $config; } diff --git a/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php b/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php index f488d85bde2..0b5062fcf3e 100644 --- a/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php @@ -60,8 +60,8 @@ class RegisterBuildReminderIndexBackgroundJob implements IRepairStep { * @param IConfig $config */ public function __construct(IDBConnection $db, - IJobList $jobList, - IConfig $config) { + IJobList $jobList, + IConfig $config) { $this->db = $db; $this->jobList = $jobList; $this->config = $config; diff --git a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php index 4789a74d98a..a36d43d29df 100644 --- a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php +++ b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php @@ -53,23 +53,23 @@ class RemoveOrphanEventsAndContacts implements IRepairStep { * @inheritdoc */ public function run(IOutput $output) { - $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendars', 'calendarid'); + $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendars', 'calendarid'); $output->info(sprintf('%d events without a calendar have been cleaned up', $orphanItems)); - $orphanItems = $this->removeOrphanChildren('calendarobjects_props', 'calendarobjects', 'objectid'); + $orphanItems = $this->removeOrphanChildren('calendarobjects_props', 'calendarobjects', 'objectid'); $output->info(sprintf('%d properties without an events have been cleaned up', $orphanItems)); - $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendars', 'calendarid'); + $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendars', 'calendarid'); $output->info(sprintf('%d changes without a calendar have been cleaned up', $orphanItems)); - $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendarsubscriptions', 'calendarid'); + $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendarsubscriptions', 'calendarid'); $output->info(sprintf('%d cached events without a calendar subscription have been cleaned up', $orphanItems)); - $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendarsubscriptions', 'calendarid'); + $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendarsubscriptions', 'calendarid'); $output->info(sprintf('%d changes without a calendar subscription have been cleaned up', $orphanItems)); - $orphanItems = $this->removeOrphanChildren('cards', 'addressbooks', 'addressbookid'); + $orphanItems = $this->removeOrphanChildren('cards', 'addressbooks', 'addressbookid'); $output->info(sprintf('%d contacts without an addressbook have been cleaned up', $orphanItems)); - $orphanItems = $this->removeOrphanChildren('cards_properties', 'cards', 'cardid'); + $orphanItems = $this->removeOrphanChildren('cards_properties', 'cards', 'cardid'); $output->info(sprintf('%d properties without a contact have been cleaned up', $orphanItems)); - $orphanItems = $this->removeOrphanChildren('addressbookchanges', 'addressbooks', 'addressbookid'); + $orphanItems = $this->removeOrphanChildren('addressbookchanges', 'addressbooks', 'addressbookid'); $output->info(sprintf('%d changes without an addressbook have been cleaned up', $orphanItems)); } diff --git a/apps/dav/lib/Migration/Version1005Date20180413093149.php b/apps/dav/lib/Migration/Version1005Date20180413093149.php index 1ee767ce547..6609b2396dd 100644 --- a/apps/dav/lib/Migration/Version1005Date20180413093149.php +++ b/apps/dav/lib/Migration/Version1005Date20180413093149.php @@ -27,8 +27,8 @@ declare(strict_types=1); */ namespace OCA\DAV\Migration; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -48,7 +48,7 @@ class Version1005Date20180413093149 extends SimpleMigrationStep { if (!$schema->hasTable('directlink')) { $table = $schema->createTable('directlink'); - $table->addColumn('id',Types::BIGINT, [ + $table->addColumn('id', Types::BIGINT, [ 'autoincrement' => true, 'notnull' => true, 'length' => 11, diff --git a/apps/dav/lib/Migration/Version1005Date20180530124431.php b/apps/dav/lib/Migration/Version1005Date20180530124431.php index ae057f74599..9b0868f9374 100644 --- a/apps/dav/lib/Migration/Version1005Date20180530124431.php +++ b/apps/dav/lib/Migration/Version1005Date20180530124431.php @@ -26,8 +26,8 @@ */ namespace OCA\DAV\Migration; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/dav/lib/Migration/Version1006Date20180619154313.php b/apps/dav/lib/Migration/Version1006Date20180619154313.php index c607a14c2a9..36e35f615ac 100644 --- a/apps/dav/lib/Migration/Version1006Date20180619154313.php +++ b/apps/dav/lib/Migration/Version1006Date20180619154313.php @@ -26,8 +26,8 @@ */ namespace OCA\DAV\Migration; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/dav/lib/Migration/Version1006Date20180628111625.php b/apps/dav/lib/Migration/Version1006Date20180628111625.php index 7ce2edccc28..8c3a8e4938c 100644 --- a/apps/dav/lib/Migration/Version1006Date20180628111625.php +++ b/apps/dav/lib/Migration/Version1006Date20180628111625.php @@ -29,8 +29,8 @@ declare(strict_types=1); */ namespace OCA\DAV\Migration; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/dav/lib/Migration/Version1008Date20181030113700.php b/apps/dav/lib/Migration/Version1008Date20181030113700.php index 694f096ff3e..e9751159913 100644 --- a/apps/dav/lib/Migration/Version1008Date20181030113700.php +++ b/apps/dav/lib/Migration/Version1008Date20181030113700.php @@ -30,8 +30,8 @@ namespace OCA\DAV\Migration; use Closure; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/dav/lib/Migration/Version1008Date20181105104826.php b/apps/dav/lib/Migration/Version1008Date20181105104826.php index 86ce4c33ce5..7b0c9861a98 100644 --- a/apps/dav/lib/Migration/Version1008Date20181105104826.php +++ b/apps/dav/lib/Migration/Version1008Date20181105104826.php @@ -29,8 +29,8 @@ declare(strict_types=1); namespace OCA\DAV\Migration; use Closure; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/dav/lib/Migration/Version1008Date20181105110300.php b/apps/dav/lib/Migration/Version1008Date20181105110300.php index e275b2a8e1e..9a69d106412 100644 --- a/apps/dav/lib/Migration/Version1008Date20181105110300.php +++ b/apps/dav/lib/Migration/Version1008Date20181105110300.php @@ -29,8 +29,8 @@ declare(strict_types=1); namespace OCA\DAV\Migration; use Closure; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/dav/lib/Migration/Version1011Date20190725113607.php b/apps/dav/lib/Migration/Version1011Date20190725113607.php index 1191f0e8878..a6673378259 100644 --- a/apps/dav/lib/Migration/Version1011Date20190725113607.php +++ b/apps/dav/lib/Migration/Version1011Date20190725113607.php @@ -28,8 +28,8 @@ declare(strict_types=1); */ namespace OCA\DAV\Migration; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/dav/lib/Migration/Version1011Date20190806104428.php b/apps/dav/lib/Migration/Version1011Date20190806104428.php index a6f8772ec08..7c41bce87f5 100644 --- a/apps/dav/lib/Migration/Version1011Date20190806104428.php +++ b/apps/dav/lib/Migration/Version1011Date20190806104428.php @@ -29,8 +29,8 @@ declare(strict_types=1); namespace OCA\DAV\Migration; use Closure; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/dav/lib/Migration/Version1012Date20190808122342.php b/apps/dav/lib/Migration/Version1012Date20190808122342.php index 7bb39db6bf1..e72b552cac1 100644 --- a/apps/dav/lib/Migration/Version1012Date20190808122342.php +++ b/apps/dav/lib/Migration/Version1012Date20190808122342.php @@ -29,8 +29,8 @@ declare(strict_types=1); */ namespace OCA\DAV\Migration; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -47,8 +47,8 @@ class Version1012Date20190808122342 extends SimpleMigrationStep { * @since 17.0.0 */ public function changeSchema(IOutput $output, - \Closure $schemaClosure, - array $options):?ISchemaWrapper { + \Closure $schemaClosure, + array $options):?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1027Date20230504122946.php b/apps/dav/lib/Migration/Version1027Date20230504122946.php index b1aaec0559b..28361011436 100644 --- a/apps/dav/lib/Migration/Version1027Date20230504122946.php +++ b/apps/dav/lib/Migration/Version1027Date20230504122946.php @@ -33,16 +33,15 @@ use OCP\IConfig; use OCP\IUserManager; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; -use Psr\Container\ContainerExceptionInterface; -use Psr\Container\NotFoundExceptionInterface; use Psr\Log\LoggerInterface; use Throwable; class Version1027Date20230504122946 extends SimpleMigrationStep { public function __construct(private SyncService $syncService, - private LoggerInterface $logger, - private IUserManager $userManager, - private IConfig $config) {} + private LoggerInterface $logger, + private IUserManager $userManager, + private IConfig $config) { + } /** * @param IOutput $output * @param Closure(): ISchemaWrapper $schemaClosure diff --git a/apps/dav/lib/Profiler/ProfilerPlugin.php b/apps/dav/lib/Profiler/ProfilerPlugin.php index 672ca4010b7..cc65c2b75e1 100644 --- a/apps/dav/lib/Profiler/ProfilerPlugin.php +++ b/apps/dav/lib/Profiler/ProfilerPlugin.php @@ -1,4 +1,6 @@ - * diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php index 90be581a2a9..c751a4babf5 100644 --- a/apps/dav/lib/RootCollection.php +++ b/apps/dav/lib/RootCollection.php @@ -50,7 +50,6 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\IRootFolder; use OCP\IConfig; -use OCP\IGroupManager; use Psr\Log\LoggerInterface; use Sabre\DAV\SimpleCollection; diff --git a/apps/dav/lib/Search/ACalendarSearchProvider.php b/apps/dav/lib/Search/ACalendarSearchProvider.php index 91904d5e8d6..82c15efec64 100644 --- a/apps/dav/lib/Search/ACalendarSearchProvider.php +++ b/apps/dav/lib/Search/ACalendarSearchProvider.php @@ -61,9 +61,9 @@ abstract class ACalendarSearchProvider implements IProvider { * @param CalDavBackend $backend */ public function __construct(IAppManager $appManager, - IL10N $l10n, - IURLGenerator $urlGenerator, - CalDavBackend $backend) { + IL10N $l10n, + IURLGenerator $urlGenerator, + CalDavBackend $backend) { $this->appManager = $appManager; $this->l10n = $l10n; $this->urlGenerator = $urlGenerator; diff --git a/apps/dav/lib/Search/EventsSearchProvider.php b/apps/dav/lib/Search/EventsSearchProvider.php index 4a2447c25f9..0cf01742672 100644 --- a/apps/dav/lib/Search/EventsSearchProvider.php +++ b/apps/dav/lib/Search/EventsSearchProvider.php @@ -153,7 +153,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering ); $searchResultIndex = array_combine( - array_map(fn($event) => $event['calendarid'] . '-' . $event['uri'], $searchResults), + array_map(fn ($event) => $event['calendarid'] . '-' . $event['uri'], $searchResults), array_fill(0, count($searchResults), null), ); foreach ($attendeeSearchResults as $attendeeResult) { diff --git a/apps/dav/lib/Service/AbsenceService.php b/apps/dav/lib/Service/AbsenceService.php index b31a910c4d2..b50dd32e925 100644 --- a/apps/dav/lib/Service/AbsenceService.php +++ b/apps/dav/lib/Service/AbsenceService.php @@ -110,4 +110,3 @@ class AbsenceService { $this->eventDispatcher->dispatchTyped(new OutOfOfficeClearedEvent($eventData)); } } - diff --git a/apps/dav/lib/Settings/AvailabilitySettings.php b/apps/dav/lib/Settings/AvailabilitySettings.php index c48ebe0255e..f8986ffe5d1 100644 --- a/apps/dav/lib/Settings/AvailabilitySettings.php +++ b/apps/dav/lib/Settings/AvailabilitySettings.php @@ -42,11 +42,11 @@ class AvailabilitySettings implements ISettings { protected ?string $userId; public function __construct(IConfig $config, - IInitialState $initialState, - ?string $userId, - private LoggerInterface $logger, - private IAvailabilityCoordinator $coordinator, - private AbsenceMapper $absenceMapper) { + IInitialState $initialState, + ?string $userId, + private LoggerInterface $logger, + private IAvailabilityCoordinator $coordinator, + private AbsenceMapper $absenceMapper) { $this->config = $config; $this->initialState = $initialState; $this->userId = $userId; diff --git a/apps/dav/lib/Settings/CalDAVSettings.php b/apps/dav/lib/Settings/CalDAVSettings.php index 1938d20c9f5..2985c9fc888 100644 --- a/apps/dav/lib/Settings/CalDAVSettings.php +++ b/apps/dav/lib/Settings/CalDAVSettings.php @@ -27,8 +27,8 @@ namespace OCA\DAV\Settings; use OCA\DAV\AppInfo\Application; use OCP\AppFramework\Http\TemplateResponse; -use OCP\IConfig; use OCP\AppFramework\Services\IInitialState; +use OCP\IConfig; use OCP\IURLGenerator; use OCP\Settings\IDelegatedSettings; diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index 58f61c13232..34b71ae40f2 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -353,11 +353,11 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { } } - $tags = array_filter(array_map(function(string $tagId) { + $tags = array_filter(array_map(function (string $tagId) { return $this->cachedTags[$tagId] ?? null; }, $tagIds)); - $uncachedTagIds = array_filter($tagIds, function(string $tagId): bool { + $uncachedTagIds = array_filter($tagIds, function (string $tagId): bool { return !isset($this->cachedTags[$tagId]); }); @@ -369,7 +369,7 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { $tags += $retrievedTags; } - return array_filter($tags, function(ISystemTag $tag) use ($user) { + return array_filter($tags, function (ISystemTag $tag) use ($user) { return $this->tagManager->canUserSeeTag($tag, $user); }); } diff --git a/apps/dav/lib/Upload/RootCollection.php b/apps/dav/lib/Upload/RootCollection.php index e3ae22af5e9..e05c154c8ea 100644 --- a/apps/dav/lib/Upload/RootCollection.php +++ b/apps/dav/lib/Upload/RootCollection.php @@ -35,8 +35,8 @@ class RootCollection extends AbstractPrincipalCollection { private $cleanupService; public function __construct(PrincipalBackend\BackendInterface $principalBackend, - string $principalPrefix, - CleanupService $cleanupService) { + string $principalPrefix, + CleanupService $cleanupService) { parent::__construct($principalBackend, $principalPrefix); $this->cleanupService = $cleanupService; } diff --git a/apps/dav/lib/UserMigration/CalendarMigrator.php b/apps/dav/lib/UserMigration/CalendarMigrator.php index 7666dc99eea..14ea4459435 100644 --- a/apps/dav/lib/UserMigration/CalendarMigrator.php +++ b/apps/dav/lib/UserMigration/CalendarMigrator.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCA\DAV\UserMigration; -use function substr; use OCA\DAV\AppInfo\Application; use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CalDAV\ICSExportPlugin\ICSExportPlugin; @@ -53,6 +52,7 @@ use Sabre\VObject\UUIDUtil; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\OutputInterface; use Throwable; +use function substr; class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { diff --git a/apps/dav/lib/UserMigration/ContactsMigrator.php b/apps/dav/lib/UserMigration/ContactsMigrator.php index 53aac0a4cfa..879642b9dc1 100644 --- a/apps/dav/lib/UserMigration/ContactsMigrator.php +++ b/apps/dav/lib/UserMigration/ContactsMigrator.php @@ -26,8 +26,6 @@ declare(strict_types=1); namespace OCA\DAV\UserMigration; -use function sort; -use function substr; use OCA\DAV\AppInfo\Application; use OCA\DAV\CardDAV\CardDavBackend; use OCA\DAV\CardDAV\Plugin as CardDAVPlugin; @@ -49,6 +47,8 @@ use Sabre\VObject\UUIDUtil; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\OutputInterface; use Throwable; +use function sort; +use function substr; class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { diff --git a/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php b/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php index 3efc5ab1473..92554016376 100644 --- a/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php +++ b/apps/dav/tests/integration/UserMigration/CalendarMigratorTest.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCA\DAV\Tests\integration\UserMigration; -use function scandir; use OCA\DAV\AppInfo\Application; use OCA\DAV\UserMigration\CalendarMigrator; use OCP\AppFramework\App; @@ -38,6 +37,7 @@ use Sabre\VObject\Reader as VObjectReader; use Sabre\VObject\UUIDUtil; use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; +use function scandir; /** * @group DB diff --git a/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php b/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php index 3fa043df285..0eb4801f570 100644 --- a/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php +++ b/apps/dav/tests/integration/UserMigration/ContactsMigratorTest.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCA\DAV\Tests\integration\UserMigration; -use function scandir; use OCA\DAV\AppInfo\Application; use OCA\DAV\UserMigration\ContactsMigrator; use OCP\AppFramework\App; @@ -38,6 +37,7 @@ use Sabre\VObject\Splitter\VCard as VCardSplitter; use Sabre\VObject\UUIDUtil; use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; +use function scandir; /** * @group DB diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php index b4a414297d7..4dd61c6e307 100644 --- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php +++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php @@ -27,6 +27,7 @@ */ namespace OCA\DAV\Tests\unit\CalDAV; +use OC\KnownUser\KnownUserService; use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CalDAV\Proxy\ProxyMapper; use OCA\DAV\Connector\Sabre\Principal; @@ -40,7 +41,6 @@ use OCP\IUserSession; use OCP\L10N\IFactory; use OCP\Security\ISecureRandom; use OCP\Share\IManager as ShareManager; -use OC\KnownUser\KnownUserService; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet; diff --git a/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php b/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php index e7bd2cc0b95..e0fdf16bc39 100644 --- a/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php +++ b/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php @@ -9,7 +9,6 @@ use OCP\Calendar\ICreateFromString; use OCP\Constants; use PHPUnit\Framework\MockObject\MockObject; use Sabre\VObject\Component\VCalendar; -use Sabre\VObject\Component\VEvent; use Test\TestCase; class CalendarObjectTest extends TestCase { @@ -145,7 +144,7 @@ class CalendarObjectTest extends TestCase { $backend->expects($this->once()) ->method('createFromString') - ->with('someid.ics', self::callback(fn($data): bool => preg_match('/BEGIN:VEVENT(.|\r\n)+STATUS:CANCELLED/', $data) === 1)); + ->with('someid.ics', self::callback(fn ($data): bool => preg_match('/BEGIN:VEVENT(.|\r\n)+STATUS:CANCELLED/', $data) === 1)); $calendarObject->delete(); } diff --git a/apps/dav/tests/unit/CalDAV/EventComparisonServiceTest.php b/apps/dav/tests/unit/CalDAV/EventComparisonServiceTest.php index c21be3065c5..efc9ef32afc 100644 --- a/apps/dav/tests/unit/CalDAV/EventComparisonServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/EventComparisonServiceTest.php @@ -28,21 +28,17 @@ namespace OCA\DAV\Tests\unit\CalDAV; use OCA\DAV\CalDAV\EventComparisonService; use Sabre\VObject\Component\VCalendar; -use Sabre\VObject\Component\VEvent; use Test\TestCase; -class EventComparisonServiceTest extends TestCase -{ +class EventComparisonServiceTest extends TestCase { /** @var EventComparisonService */ private $eventComparisonService; - protected function setUp(): void - { + protected function setUp(): void { $this->eventComparisonService = new EventComparisonService(); } - public function testNoModifiedEvent(): void - { + public function testNoModifiedEvent(): void { $vCalendarOld = new VCalendar(); $vCalendarNew = new VCalendar(); @@ -73,8 +69,7 @@ class EventComparisonServiceTest extends TestCase $this->assertEmpty($result['new']); } - public function testNewEvent(): void - { + public function testNewEvent(): void { $vCalendarOld = null; $vCalendarNew = new VCalendar(); @@ -94,8 +89,7 @@ class EventComparisonServiceTest extends TestCase $this->assertEquals([$vEventNew], $result['new']); } - public function testModifiedUnmodifiedEvent(): void - { + public function testModifiedUnmodifiedEvent(): void { $vCalendarOld = new VCalendar(); $vCalendarNew = new VCalendar(); diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php index c409ff92aa4..12a5aa0123b 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php @@ -68,7 +68,7 @@ class PublicCalendarTest extends CalendarTest { $config = $this->createMock(IConfig::class); /** @var MockObject | LoggerInterface $logger */ $logger = $this->createMock(LoggerInterface::class); - $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config,$logger); + $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config, $logger); $children = $c->getChildren(); $this->assertEquals(2, count($children)); $children = $c->getMultipleChildren(['event-0', 'event-1', 'event-2']); @@ -156,7 +156,7 @@ EOD; $config = $this->createMock(IConfig::class); /** @var MockObject | LoggerInterface $logger */ $logger = $this->createMock(LoggerInterface::class); - $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config,$logger); + $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config, $logger); $this->assertEquals(count($c->getChildren()), 2); diff --git a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php index 5ff9dc36cf0..68f1d26f1ba 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php @@ -563,7 +563,8 @@ EOD; $this->timeFactory->expects($this->once()) ->method('getDateTime') ->with() - ->willReturn(DateTime::createFromFormat(DateTime::ATOM, '2023-02-03T13:28:00+00:00'));; + ->willReturn(DateTime::createFromFormat(DateTime::ATOM, '2023-02-03T13:28:00+00:00')); + ; $this->reminderService->onCalendarObjectCreate($objectData); } diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php index c5092e5f483..0e459418ae0 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php @@ -45,7 +45,6 @@ use Psr\Log\LoggerInterface; use Sabre\VObject\Component\VCalendar; use Sabre\VObject\Component\VEvent; use Sabre\VObject\ITip\Message; -use Sabre\VObject\Property; use Test\TestCase; use function array_merge; @@ -233,7 +232,7 @@ class IMipPluginTest extends TestCase { ->willReturn('yes'); $this->service->expects(self::once()) ->method('createInvitationToken') - ->with($message,$newVevent, '1496912700') + ->with($message, $newVevent, '1496912700') ->willReturn('token'); $this->service->expects(self::once()) ->method('addResponseButtons') diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php index 000476050c7..14273109826 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php @@ -44,8 +44,7 @@ use Sabre\VObject\Component\VEvent; use Sabre\VObject\Property\ICalendar\DateTime; use Test\TestCase; -class IMipServiceTest extends TestCase -{ +class IMipServiceTest extends TestCase { /** @var URLGenerator|MockObject */ private $urlGenerator; @@ -67,8 +66,7 @@ class IMipServiceTest extends TestCase /** @var IMipService */ private $service; - protected function setUp(): void - { + protected function setUp(): void { $this->urlGenerator = $this->createMock(URLGenerator::class); $this->config = $this->createMock(IConfig::class); $this->db = $this->createMock(IDBConnection::class); @@ -91,8 +89,7 @@ class IMipServiceTest extends TestCase ); } - public function testGetFrom(): void - { + public function testGetFrom(): void { $senderName = "Detective McQueen"; $default = "Twin Lakes Police Department - Darkside Division"; $expected = "Detective McQueen via Twin Lakes Police Department - Darkside Division"; @@ -105,8 +102,7 @@ class IMipServiceTest extends TestCase $this->assertEquals($expected, $actual); } - public function testBuildBodyDataCreated(): void - { + public function testBuildBodyDataCreated(): void { $vCalendar = new VCalendar(); $oldVevent = null; $newVevent = new VEvent($vCalendar, 'two', [ @@ -132,8 +128,7 @@ class IMipServiceTest extends TestCase $this->assertEquals($expected, $actual); } - public function testBuildBodyDataUpdate(): void - { + public function testBuildBodyDataUpdate(): void { $vCalendar = new VCalendar(); $oldVevent = new VEvent($vCalendar, 'two', [ 'UID' => 'uid-1234', @@ -201,8 +196,7 @@ class IMipServiceTest extends TestCase $this->assertEquals($expected, $actual); } - public function testGetLastOccurrenceRRULE(): void - { + public function testGetLastOccurrenceRRULE(): void { $vCalendar = new VCalendar(); $vCalendar->add('VEVENT', [ 'UID' => 'uid-1234', @@ -217,8 +211,7 @@ class IMipServiceTest extends TestCase $this->assertEquals(1454284800, $occurrence); } - public function testGetLastOccurrenceEndDate(): void - { + public function testGetLastOccurrenceEndDate(): void { $vCalendar = new VCalendar(); $vCalendar->add('VEVENT', [ 'UID' => 'uid-1234', @@ -233,8 +226,7 @@ class IMipServiceTest extends TestCase $this->assertEquals(1483228800, $occurrence); } - public function testGetLastOccurrenceDuration(): void - { + public function testGetLastOccurrenceDuration(): void { $vCalendar = new VCalendar(); $vCalendar->add('VEVENT', [ 'UID' => 'uid-1234', @@ -249,8 +241,7 @@ class IMipServiceTest extends TestCase $this->assertEquals(1458864000, $occurrence); } - public function testGetLastOccurrenceAllDay(): void - { + public function testGetLastOccurrenceAllDay(): void { $vCalendar = new VCalendar(); $vEvent = $vCalendar->add('VEVENT', [ 'UID' => 'uid-1234', @@ -267,8 +258,7 @@ class IMipServiceTest extends TestCase $this->assertEquals(1451692800, $occurrence); } - public function testGetLastOccurrenceFallback(): void - { + public function testGetLastOccurrenceFallback(): void { $vCalendar = new VCalendar(); $vCalendar->add('VEVENT', [ 'UID' => 'uid-1234', diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php index 06d81662a42..f9cba4e6a83 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php @@ -29,7 +29,6 @@ namespace OCA\DAV\Tests\unit\CardDAV; use OCA\DAV\CardDAV\AddressBook; use OCA\DAV\CardDAV\Card; use OCA\DAV\CardDAV\CardDavBackend; -use OCA\DAV\DAV\CustomPropertiesBackend; use OCP\IL10N; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php index 7205cf56654..2f413876831 100644 --- a/apps/dav/tests/unit/CardDAV/ConverterTest.php +++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php @@ -34,8 +34,8 @@ use OCA\DAV\CardDAV\Converter; use OCP\Accounts\IAccount; use OCP\Accounts\IAccountManager; use OCP\Accounts\IAccountProperty; -use OCP\IURLGenerator; use OCP\IImage; +use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; use PHPUnit\Framework\MockObject\MockObject; diff --git a/apps/dav/tests/unit/Connector/PublicAuthTest.php b/apps/dav/tests/unit/Connector/PublicAuthTest.php index 25cad495ce9..4a2ebb496b0 100644 --- a/apps/dav/tests/unit/Connector/PublicAuthTest.php +++ b/apps/dav/tests/unit/Connector/PublicAuthTest.php @@ -164,9 +164,9 @@ class PublicAuthTest extends \Test\TestCase { $this->shareManager->expects($this->once()) ->method('checkPassword')->with( - $this->equalTo($share), - $this->equalTo('password') - )->willReturn(true); + $this->equalTo($share), + $this->equalTo('password') + )->willReturn(true); $result = $this->invokePrivate($this->auth, 'validateUserPass', ['username', 'password']); diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php index 616e9796ab4..cecd115710d 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php @@ -31,8 +31,8 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin; use OCP\IConfig; use PHPUnit\Framework\MockObject\MockObject; -use Test\TestCase; use Sabre\HTTP\RequestInterface; +use Test\TestCase; /** * Class BlockLegacyClientPluginTest diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php index 65a420589f0..4182ebc2f37 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php @@ -28,9 +28,9 @@ class ForbiddenTest extends \Test\TestCase { public function testSerialization(): void { // create xml doc - $DOM = new \DOMDocument('1.0','utf-8'); + $DOM = new \DOMDocument('1.0', 'utf-8'); $DOM->formatOutput = true; - $error = $DOM->createElementNS('DAV:','d:error'); + $error = $DOM->createElementNS('DAV:', 'd:error'); $error->setAttribute('xmlns:s', \Sabre\DAV\Server::NS_SABREDAV); $DOM->appendChild($error); diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php index f202bf573de..b115f72ca79 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php @@ -29,9 +29,9 @@ class InvalidPathTest extends \Test\TestCase { public function testSerialization(): void { // create xml doc - $DOM = new \DOMDocument('1.0','utf-8'); + $DOM = new \DOMDocument('1.0', 'utf-8'); $DOM->formatOutput = true; - $error = $DOM->createElementNS('DAV:','d:error'); + $error = $DOM->createElementNS('DAV:', 'd:error'); $error->setAttribute('xmlns:s', \Sabre\DAV\Server::NS_SABREDAV); $DOM->appendChild($error); diff --git a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php index c198df16f08..8c66c9f3f86 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php @@ -28,14 +28,12 @@ */ namespace OCA\DAV\Tests\unit\Connector\Sabre; -use OC\Log; use OC\SystemConfig; use OCA\DAV\Connector\Sabre\Exception\InvalidPath; use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin; use OCA\DAV\Exception\ServerMaintenanceMode; use Psr\Log\LoggerInterface; use Sabre\DAV\Exception\NotFound; -use Sabre\DAV\Exception\ServiceUnavailable; use Sabre\DAV\Server; use Test\TestCase; diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php index 83765d338f2..3f73e956fde 100644 --- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php @@ -39,7 +39,6 @@ use OCP\Files\Cache\ICacheEntry; use OCP\Files\Mount\IMountPoint; use OCP\Files\Storage; use OCP\ICache; -use OCP\Share\IAttributes; use OCP\Share\IManager; use OCP\Share\IShare; @@ -87,7 +86,7 @@ class NodeTest extends \Test\TestCase { $info->method('getInternalPath') ->willReturn($internalPath); $info->method('getMountPoint') - ->willReturnCallback(function() use ($shared) { + ->willReturnCallback(function () use ($shared) { if ($shared) { return $this->createMock(SharedMount::class); } else { diff --git a/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php b/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php index e0f6f1302a5..00dde60d234 100644 --- a/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php +++ b/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php @@ -20,11 +20,12 @@ */ namespace OCA\DAV\Tests\unit\DAV; +use OCA\DAV\Connector\Sabre\Exception\Forbidden; +use OCA\DAV\Connector\Sabre\File as DavFile; use OCA\DAV\DAV\ViewOnlyPlugin; use OCA\Files_Sharing\SharedStorage; -use OCA\DAV\Connector\Sabre\File as DavFile; -use OCA\Files_Versions\Versions\IVersion; use OCA\Files_Versions\Sabre\VersionFile; +use OCA\Files_Versions\Versions\IVersion; use OCP\Files\File; use OCP\Files\Storage\IStorage; use OCP\Share\IAttributes; @@ -32,9 +33,8 @@ use OCP\Share\IShare; use Psr\Log\LoggerInterface; use Sabre\DAV\Server; use Sabre\DAV\Tree; -use Test\TestCase; use Sabre\HTTP\RequestInterface; -use OCA\DAV\Connector\Sabre\Exception\Forbidden; +use Test\TestCase; class ViewOnlyPluginTest extends TestCase { diff --git a/apps/dav/tests/unit/Files/FileSearchBackendTest.php b/apps/dav/tests/unit/Files/FileSearchBackendTest.php index ea841140201..0240fac3621 100644 --- a/apps/dav/tests/unit/Files/FileSearchBackendTest.php +++ b/apps/dav/tests/unit/Files/FileSearchBackendTest.php @@ -30,10 +30,10 @@ namespace OCA\DAV\Tests\Files; use OC\Files\Search\SearchComparison; use OC\Files\Search\SearchQuery; use OC\Files\View; -use OCA\DAV\Connector\Sabre\ObjectTree; use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\File; use OCA\DAV\Connector\Sabre\FilesPlugin; +use OCA\DAV\Connector\Sabre\ObjectTree; use OCA\DAV\Files\FileSearchBackend; use OCP\Files\FileInfo; use OCP\Files\Folder; diff --git a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php index 4c470f49595..d131ad8e182 100644 --- a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php +++ b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php @@ -22,8 +22,8 @@ namespace OCA\DAV\Tests\unit\DAV; -use Test\TestCase; use \OCA\DAV\BulkUpload\MultipartRequestParser; +use Test\TestCase; class MultipartRequestParserTest extends TestCase { private function getValidBodyObject() { @@ -65,7 +65,7 @@ class MultipartRequestParserTest extends TestCase { $body .= '--'.$boundary."--"; - $stream = fopen('php://temp','r+'); + $stream = fopen('php://temp', 'r+'); fwrite($stream, $body); rewind($stream); diff --git a/apps/dav/tests/unit/Search/EventsSearchProviderTest.php b/apps/dav/tests/unit/Search/EventsSearchProviderTest.php index f012c4a44be..095c995ad9f 100644 --- a/apps/dav/tests/unit/Search/EventsSearchProviderTest.php +++ b/apps/dav/tests/unit/Search/EventsSearchProviderTest.php @@ -295,7 +295,7 @@ class EventsSearchProviderTest extends TestCase { $user->method('getUID')->willReturn('john.doe'); $query = $this->createMock(ISearchQuery::class); $seachTermFilter = $this->createMock(IFilter::class); - $query->method('getFilter')->willReturnCallback(function($name) use ($seachTermFilter) { + $query->method('getFilter')->willReturnCallback(function ($name) use ($seachTermFilter) { return match ($name) { 'term' => $seachTermFilter, default => null, diff --git a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php index 296f6f9ef8c..03940cd2458 100644 --- a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php +++ b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php @@ -27,8 +27,8 @@ namespace OCA\DAV\Tests\Unit\DAV\Settings; use OCA\DAV\Settings\CalDAVSettings; use OCP\AppFramework\Http\TemplateResponse; -use OCP\IConfig; use OCP\AppFramework\Services\IInitialState; +use OCP\IConfig; use OCP\IURLGenerator; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; @@ -58,11 +58,11 @@ class CalDAVSettingsTest extends TestCase { public function testGetForm(): void { $this->config->method('getAppValue') ->withConsecutive( - ['dav', 'sendInvitations', 'yes'], - ['dav', 'generateBirthdayCalendar', 'yes'], - ['dav', 'sendEventReminders', 'yes'], - ['dav', 'sendEventRemindersToSharedUsers', 'yes'], - ['dav', 'sendEventRemindersPush', 'yes'], + ['dav', 'sendInvitations', 'yes'], + ['dav', 'generateBirthdayCalendar', 'yes'], + ['dav', 'sendEventReminders', 'yes'], + ['dav', 'sendEventRemindersToSharedUsers', 'yes'], + ['dav', 'sendEventRemindersPush', 'yes'], ) ->will($this->onConsecutiveCalls('yes', 'no', 'yes', 'yes', 'yes')); $this->urlGenerator diff --git a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php index 7dd051f859f..d39aec0915e 100644 --- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php +++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php @@ -78,9 +78,9 @@ class AssemblyStreamTest extends \Test\TestCase { $tonofnodes = []; $tonofdata = ""; for ($i = 0; $i < 101; $i++) { - $thisdata = rand(0,100); // variable length and content + $thisdata = rand(0, 100); // variable length and content $tonofdata .= $thisdata; - array_push($tonofnodes, $this->buildNode($i,$thisdata)); + array_push($tonofnodes, $this->buildNode($i, $thisdata)); } return[ diff --git a/apps/encryption/lib/Command/DisableMasterKey.php b/apps/encryption/lib/Command/DisableMasterKey.php index 6000d6021c8..5a07e294248 100644 --- a/apps/encryption/lib/Command/DisableMasterKey.php +++ b/apps/encryption/lib/Command/DisableMasterKey.php @@ -49,8 +49,8 @@ class DisableMasterKey extends Command { * @param QuestionHelper $questionHelper */ public function __construct(Util $util, - IConfig $config, - QuestionHelper $questionHelper) { + IConfig $config, + QuestionHelper $questionHelper) { $this->util = $util; $this->config = $config; $this->questionHelper = $questionHelper; diff --git a/apps/encryption/lib/Command/EnableMasterKey.php b/apps/encryption/lib/Command/EnableMasterKey.php index 031f6e3fa4e..7c49988c7fb 100644 --- a/apps/encryption/lib/Command/EnableMasterKey.php +++ b/apps/encryption/lib/Command/EnableMasterKey.php @@ -48,8 +48,8 @@ class EnableMasterKey extends Command { * @param QuestionHelper $questionHelper */ public function __construct(Util $util, - IConfig $config, - QuestionHelper $questionHelper) { + IConfig $config, + QuestionHelper $questionHelper) { $this->util = $util; $this->config = $config; $this->questionHelper = $questionHelper; diff --git a/apps/encryption/lib/Command/FixKeyLocation.php b/apps/encryption/lib/Command/FixKeyLocation.php index b961b40f572..5001da4bb92 100644 --- a/apps/encryption/lib/Command/FixKeyLocation.php +++ b/apps/encryption/lib/Command/FixKeyLocation.php @@ -30,8 +30,8 @@ use OC\Files\View; use OCP\Encryption\IManager; use OCP\Files\Config\ICachedMountInfo; use OCP\Files\Config\IUserMountCache; -use OCP\Files\Folder; use OCP\Files\File; +use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\IUser; diff --git a/apps/encryption/lib/Command/RecoverUser.php b/apps/encryption/lib/Command/RecoverUser.php index d3dd4a3612d..97a26b1d404 100644 --- a/apps/encryption/lib/Command/RecoverUser.php +++ b/apps/encryption/lib/Command/RecoverUser.php @@ -52,9 +52,9 @@ class RecoverUser extends Command { * @param QuestionHelper $questionHelper */ public function __construct(Util $util, - IConfig $config, - IUserManager $userManager, - QuestionHelper $questionHelper) { + IConfig $config, + IUserManager $userManager, + QuestionHelper $questionHelper) { $this->util = $util; $this->questionHelper = $questionHelper; $this->userManager = $userManager; diff --git a/apps/encryption/lib/Command/ScanLegacyFormat.php b/apps/encryption/lib/Command/ScanLegacyFormat.php index 85a99a17845..8e0178af486 100644 --- a/apps/encryption/lib/Command/ScanLegacyFormat.php +++ b/apps/encryption/lib/Command/ScanLegacyFormat.php @@ -57,9 +57,9 @@ class ScanLegacyFormat extends Command { * @param QuestionHelper $questionHelper */ public function __construct(Util $util, - IConfig $config, - QuestionHelper $questionHelper, - IUserManager $userManager) { + IConfig $config, + QuestionHelper $questionHelper, + IUserManager $userManager) { parent::__construct(); $this->util = $util; diff --git a/apps/encryption/lib/Controller/RecoveryController.php b/apps/encryption/lib/Controller/RecoveryController.php index c5f8a7e8d72..743e17e5eff 100644 --- a/apps/encryption/lib/Controller/RecoveryController.php +++ b/apps/encryption/lib/Controller/RecoveryController.php @@ -56,10 +56,10 @@ class RecoveryController extends Controller { * @param Recovery $recovery */ public function __construct($AppName, - IRequest $request, - IConfig $config, - IL10N $l10n, - Recovery $recovery) { + IRequest $request, + IConfig $config, + IL10N $l10n, + Recovery $recovery) { parent::__construct($AppName, $request); $this->config = $config; $this->l = $l10n; diff --git a/apps/encryption/lib/Controller/SettingsController.php b/apps/encryption/lib/Controller/SettingsController.php index eedbaea9d9d..fa4c3d2ae2b 100644 --- a/apps/encryption/lib/Controller/SettingsController.php +++ b/apps/encryption/lib/Controller/SettingsController.php @@ -75,16 +75,16 @@ class SettingsController extends Controller { * @param Util $util */ public function __construct($AppName, - IRequest $request, - IL10N $l10n, - IUserManager $userManager, - IUserSession $userSession, - KeyManager $keyManager, - Crypt $crypt, - Session $session, - ISession $ocSession, - Util $util -) { + IRequest $request, + IL10N $l10n, + IUserManager $userManager, + IUserSession $userSession, + KeyManager $keyManager, + Crypt $crypt, + Session $session, + ISession $ocSession, + Util $util + ) { parent::__construct($AppName, $request); $this->l = $l10n; $this->userSession = $userSession; diff --git a/apps/encryption/lib/Controller/StatusController.php b/apps/encryption/lib/Controller/StatusController.php index d07b4da794a..29582a66ad3 100644 --- a/apps/encryption/lib/Controller/StatusController.php +++ b/apps/encryption/lib/Controller/StatusController.php @@ -52,11 +52,11 @@ class StatusController extends Controller { * @param IManager $encryptionManager */ public function __construct($AppName, - IRequest $request, - IL10N $l10n, - Session $session, - IManager $encryptionManager - ) { + IRequest $request, + IL10N $l10n, + Session $session, + IManager $encryptionManager + ) { parent::__construct($AppName, $request); $this->l = $l10n; $this->session = $session; diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php index ee01d632be8..2d212c1f055 100644 --- a/apps/encryption/lib/Crypto/Crypt.php +++ b/apps/encryption/lib/Crypto/Crypt.php @@ -41,8 +41,8 @@ use OCP\Encryption\Exceptions\GenericEncryptionException; use OCP\IConfig; use OCP\IL10N; use OCP\IUserSession; -use Psr\Log\LoggerInterface; use phpseclib\Crypt\RC4; +use Psr\Log\LoggerInterface; /** * Class Crypt provides the encryption implementation of the default Nextcloud diff --git a/apps/encryption/lib/Hooks/UserHooks.php b/apps/encryption/lib/Hooks/UserHooks.php index 27eba0ad781..487e1089495 100644 --- a/apps/encryption/lib/Hooks/UserHooks.php +++ b/apps/encryption/lib/Hooks/UserHooks.php @@ -210,9 +210,9 @@ class UserHooks implements IHook { $this->logger->error('Encryption could not update users encryption password'); } - // NOTE: Session does not need to be updated as the - // private key has not changed, only the passphrase - // used to decrypt it has changed + // NOTE: Session does not need to be updated as the + // private key has not changed, only the passphrase + // used to decrypt it has changed } else { // admin changed the password for a different user, create new keys and re-encrypt file keys $userId = $params['uid']; $this->initMountPoints($userId); diff --git a/apps/encryption/lib/Recovery.php b/apps/encryption/lib/Recovery.php index 25738dabf89..66ad59266a5 100644 --- a/apps/encryption/lib/Recovery.php +++ b/apps/encryption/lib/Recovery.php @@ -69,11 +69,11 @@ class Recovery { * @param View $view */ public function __construct(IUserSession $userSession, - Crypt $crypt, - KeyManager $keyManager, - IConfig $config, - IFile $file, - View $view) { + Crypt $crypt, + KeyManager $keyManager, + IConfig $config, + IFile $file, + View $view) { $this->user = ($userSession->isLoggedIn()) ? $userSession->getUser() : null; $this->crypt = $crypt; $this->keyManager = $keyManager; diff --git a/apps/encryption/lib/Users/Setup.php b/apps/encryption/lib/Users/Setup.php index c28a83d8115..8b0ddaa8cd0 100644 --- a/apps/encryption/lib/Users/Setup.php +++ b/apps/encryption/lib/Users/Setup.php @@ -37,7 +37,7 @@ class Setup { private $keyManager; public function __construct(Crypt $crypt, - KeyManager $keyManager) { + KeyManager $keyManager) { $this->crypt = $crypt; $this->keyManager = $keyManager; } diff --git a/apps/encryption/templates/settings-admin.php b/apps/encryption/templates/settings-admin.php index 1ae93dfb0e2..e9e9a97b900 100644 --- a/apps/encryption/templates/settings-admin.php +++ b/apps/encryption/templates/settings-admin.php @@ -12,8 +12,8 @@ style('encryption', 'settings-admin');

/> + print_unescaped('checked="checked"'); + } ?> />
t("Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted")); ?>

@@ -44,8 +44,8 @@ style('encryption', 'settings-admin');

> + print_unescaped('class="hidden"'); + }?>> t("Change recovery key password:")); ?>
diff --git a/apps/encryption/templates/settings-personal.php b/apps/encryption/templates/settings-personal.php index 899ba4a1747..d44b78b545b 100644 --- a/apps/encryption/templates/settings-personal.php +++ b/apps/encryption/templates/settings-personal.php @@ -1,6 +1,6 @@

@@ -19,7 +19,7 @@ script('encryption', 'settings-personal');
t("Set your old private key password to your current log-in password:")); ?> t(" If you don't remember your old password you can ask your administrator to recover your files.")); + p($l->t(" If you don't remember your old password you can ask your administrator to recover your files.")); endif; ?>
addCloudFederationProvider('file', 'Federated Files Sharing', function () use ($appContainer): CloudFederationProviderFiles { diff --git a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php index 98fe20bf46e..1cbf21741d8 100644 --- a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php +++ b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php @@ -50,7 +50,7 @@ class RetryJob extends Job { private int $interval = 600; public function __construct(Notifications $notifications, - ITimeFactory $time) { + ITimeFactory $time) { parent::__construct($time); $this->notifications = $notifications; } diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php index 1f1334e7aee..5855d98f34e 100644 --- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php +++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php @@ -30,11 +30,11 @@ namespace OCA\FederatedFileSharing\Controller; use OCA\FederatedFileSharing\AddressHandler; use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\FederatedFileSharing\Notifications; +use OCP\App\IAppManager; use OCP\AppFramework\Http; use OCP\AppFramework\OCS\OCSBadRequestException; use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCSController; -use OCP\App\IAppManager; use OCP\Constants; use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\Exceptions\ProviderCouldNotAddShareException; @@ -89,18 +89,18 @@ class RequestHandlerController extends OCSController { private $eventDispatcher; public function __construct(string $appName, - IRequest $request, - FederatedShareProvider $federatedShareProvider, - IDBConnection $connection, - Share\IManager $shareManager, - Notifications $notifications, - AddressHandler $addressHandler, - IUserManager $userManager, - ICloudIdManager $cloudIdManager, - LoggerInterface $logger, - ICloudFederationFactory $cloudFederationFactory, - ICloudFederationProviderManager $cloudFederationProviderManager, - IEventDispatcher $eventDispatcher + IRequest $request, + FederatedShareProvider $federatedShareProvider, + IDBConnection $connection, + Share\IManager $shareManager, + Notifications $notifications, + AddressHandler $addressHandler, + IUserManager $userManager, + ICloudIdManager $cloudIdManager, + LoggerInterface $logger, + ICloudFederationFactory $cloudFederationFactory, + ICloudFederationProviderManager $cloudFederationProviderManager, + IEventDispatcher $eventDispatcher ) { parent::__construct($appName, $request); @@ -175,9 +175,9 @@ class RequestHandlerController extends OCSController { $provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file'); $provider->shareReceived($share); if ($sharedByFederatedId === $ownerFederatedId) { - $this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('A new federated share with "%s" was created by "%s" and shared with "%s"', [$name, $ownerFederatedId, $shareWith])); + $this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('A new federated share with "%s" was created by "%s" and shared with "%s"', [$name, $ownerFederatedId, $shareWith])); } else { - $this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('A new federated share with "%s" was shared by "%s" (resource owner is: "%s") and shared with "%s"', [$name, $sharedByFederatedId, $ownerFederatedId, $shareWith])); + $this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('A new federated share with "%s" was shared by "%s" (resource owner is: "%s") and shared with "%s"', [$name, $sharedByFederatedId, $ownerFederatedId, $shareWith])); } } catch (ProviderDoesNotExistsException $e) { throw new OCSException('Server does not support federated cloud sharing', 503); diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 6157bad0335..479b636fd40 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -75,18 +75,18 @@ class FederatedShareProvider implements IShareProvider { * DefaultShareProvider constructor. */ public function __construct( - private IDBConnection $dbConnection, - private AddressHandler $addressHandler, - private Notifications $notifications, - private TokenHandler $tokenHandler, - private IL10N $l, - private IRootFolder $rootFolder, - private IConfig $config, - private IUserManager $userManager, - private ICloudIdManager $cloudIdManager, - private \OCP\GlobalScale\IConfig $gsConfig, - private ICloudFederationProviderManager $cloudFederationProviderManager, - private LoggerInterface $logger, + private IDBConnection $dbConnection, + private AddressHandler $addressHandler, + private Notifications $notifications, + private TokenHandler $tokenHandler, + private IL10N $l, + private IRootFolder $rootFolder, + private IConfig $config, + private IUserManager $userManager, + private ICloudIdManager $cloudIdManager, + private \OCP\GlobalScale\IConfig $gsConfig, + private ICloudFederationProviderManager $cloudFederationProviderManager, + private LoggerInterface $logger, ) { } diff --git a/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php b/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php index 9e491f0c533..511b69d4245 100644 --- a/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php +++ b/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php @@ -28,8 +28,8 @@ declare(strict_types=1); namespace OCA\FederatedFileSharing\Migration; use Closure; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -55,7 +55,7 @@ class Version1010Date20200630191755 extends SimpleMigrationStep { 'default' => '', ]); $table->setPrimaryKey(['share_id'], 'federated_res_pk'); -// $table->addUniqueIndex(['share_id'], 'share_id_index'); + // $table->addUniqueIndex(['share_id'], 'share_id_index'); } return $schema; } diff --git a/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php index c1ff209b9c6..3a431872d22 100644 --- a/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php +++ b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php @@ -28,8 +28,8 @@ namespace OCA\FederatedFileSharing\Migration; use Closure; use Doctrine\DBAL\Types\Type; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/federatedfilesharing/lib/Settings/Personal.php b/apps/federatedfilesharing/lib/Settings/Personal.php index 18189f4cde7..944b2f84ab1 100644 --- a/apps/federatedfilesharing/lib/Settings/Personal.php +++ b/apps/federatedfilesharing/lib/Settings/Personal.php @@ -33,8 +33,8 @@ use OCA\FederatedFileSharing\FederatedShareProvider; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\Defaults; -use OCP\IUserSession; use OCP\IURLGenerator; +use OCP\IUserSession; use OCP\Settings\ISettings; class Personal implements ISettings { diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index de0a8d259c1..8cfe758a364 100644 --- a/apps/federatedfilesharing/tests/AddressHandlerTest.php +++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php @@ -30,11 +30,11 @@ namespace OCA\FederatedFileSharing\Tests; use OC\Federation\CloudIdManager; use OCA\FederatedFileSharing\AddressHandler; use OCP\Contacts\IManager; +use OCP\EventDispatcher\IEventDispatcher; use OCP\ICacheFactory; use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUserManager; -use OCP\EventDispatcher\IEventDispatcher; class AddressHandlerTest extends \Test\TestCase { /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php index 7cc788d3a6c..1508300f685 100644 --- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php @@ -48,8 +48,8 @@ use OCP\IUserManager; use OCP\IUserSession; use OCP\Share\IManager; use OCP\Share\IShare; -use Psr\Log\LoggerInterface; use PHPUnit\Framework\MockObject\MockObject; +use Psr\Log\LoggerInterface; class MountPublicLinkControllerTest extends \Test\TestCase { /** @var IContactsManager|MockObject */ @@ -145,13 +145,13 @@ class MountPublicLinkControllerTest extends \Test\TestCase { * @param string $expectedReturnData */ public function testCreateFederatedShare($shareWith, - $outgoingSharesAllowed, - $validShareWith, - $token, - $validToken, - $createSuccessful, - $expectedReturnData, - $permissions + $outgoingSharesAllowed, + $validShareWith, + $token, + $validToken, + $createSuccessful, + $expectedReturnData, + $permissions ) { $this->federatedShareProvider->expects($this->any()) ->method('isOutgoingServer2serverShareEnabled') diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php index 22e80f875d7..7f9abae1e85 100644 --- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php @@ -29,12 +29,12 @@ namespace OCA\FederatedFileSharing\Tests; use OCA\FederatedFileSharing\Controller\RequestHandlerController; use OCP\AppFramework\Http\DataResponse; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\ICloudFederationFactory; use OCP\Federation\ICloudFederationProvider; use OCP\Federation\ICloudFederationProviderManager; use OCP\Federation\ICloudFederationShare; use OCP\Federation\ICloudIdManager; -use OCP\EventDispatcher\IEventDispatcher; use OCP\IDBConnection; use OCP\IRequest; use OCP\IUserManager; @@ -153,17 +153,17 @@ class RequestHandlerControllerTest extends \Test\TestCase { public function testCreateShare() { $this->cloudFederationFactory->expects($this->once())->method('getCloudFederationShare') ->with( - $this->user2, - 'name', - '', - 1, - $this->ownerCloudId, - $this->owner, - $this->user1CloudId, - $this->user1, - 'token', - 'user', - 'file' + $this->user2, + 'name', + '', + 1, + $this->ownerCloudId, + $this->owner, + $this->user1CloudId, + $this->user1, + 'token', + 'user', + 'file' )->willReturn($this->cloudFederationShare); /** @var ICloudFederationProvider|\PHPUnit\Framework\MockObject\MockObject $provider */ diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php index 1f81773cd4d..b4ad46febc2 100644 --- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php @@ -113,7 +113,7 @@ class GetSharedSecret extends Job { $deadline = $currentTime - $this->maxLifespan; if ($created < $deadline) { $this->retainJob = false; - $this->trustedServers->setServerStatus($target,TrustedServers::STATUS_FAILURE); + $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); return; } @@ -172,8 +172,8 @@ class GetSharedSecret extends Job { $result = json_decode($body, true); if (isset($result['ocs']['data']['sharedSecret'])) { $this->trustedServers->addSharedSecret( - $target, - $result['ocs']['data']['sharedSecret'] + $target, + $result['ocs']['data']['sharedSecret'] ); } else { $this->logger->error( diff --git a/apps/federation/lib/Command/SyncFederationAddressBooks.php b/apps/federation/lib/Command/SyncFederationAddressBooks.php index adb0b613680..614dd108a2a 100644 --- a/apps/federation/lib/Command/SyncFederationAddressBooks.php +++ b/apps/federation/lib/Command/SyncFederationAddressBooks.php @@ -24,11 +24,11 @@ */ namespace OCA\Federation\Command; +use OCA\Federation\SyncFederationAddressBooks as SyncService; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use OCA\Federation\SyncFederationAddressBooks as SyncService; class SyncFederationAddressBooks extends Command { private SyncService $syncService; diff --git a/apps/federation/lib/Controller/SettingsController.php b/apps/federation/lib/Controller/SettingsController.php index 8bcdc769de9..85fabb4c7ff 100644 --- a/apps/federation/lib/Controller/SettingsController.php +++ b/apps/federation/lib/Controller/SettingsController.php @@ -35,9 +35,9 @@ class SettingsController extends Controller { private TrustedServers $trustedServers; public function __construct(string $AppName, - IRequest $request, - IL10N $l10n, - TrustedServers $trustedServers + IRequest $request, + IL10N $l10n, + TrustedServers $trustedServers ) { parent::__construct($AppName, $request); $this->l = $l10n; diff --git a/apps/federation/lib/DbHandler.php b/apps/federation/lib/DbHandler.php index b91c9963f80..9e63f65986b 100644 --- a/apps/federation/lib/DbHandler.php +++ b/apps/federation/lib/DbHandler.php @@ -28,10 +28,10 @@ namespace OCA\Federation; use OC\Files\Filesystem; -use OCP\HintException; -use OCP\IDBConnection; use OCP\DB\Exception as DBException; use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\HintException; +use OCP\IDBConnection; use OCP\IL10N; /** diff --git a/apps/federation/lib/Migration/Version1010Date20200630191302.php b/apps/federation/lib/Migration/Version1010Date20200630191302.php index c98d7da137a..d9f2214f96e 100644 --- a/apps/federation/lib/Migration/Version1010Date20200630191302.php +++ b/apps/federation/lib/Migration/Version1010Date20200630191302.php @@ -27,8 +27,8 @@ declare(strict_types=1); namespace OCA\Federation\Migration; use Closure; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/federation/lib/SyncFederationAddressBooks.php b/apps/federation/lib/SyncFederationAddressBooks.php index e718e1638de..2c598241131 100644 --- a/apps/federation/lib/SyncFederationAddressBooks.php +++ b/apps/federation/lib/SyncFederationAddressBooks.php @@ -38,9 +38,9 @@ class SyncFederationAddressBooks { private LoggerInterface $logger; public function __construct(DbHandler $dbHandler, - SyncService $syncService, - IDiscoveryService $ocsDiscoveryService, - LoggerInterface $logger + SyncService $syncService, + IDiscoveryService $ocsDiscoveryService, + LoggerInterface $logger ) { $this->syncService = $syncService; $this->dbHandler = $dbHandler; diff --git a/apps/federation/lib/SyncJob.php b/apps/federation/lib/SyncJob.php index 82063311f10..d084b73c021 100644 --- a/apps/federation/lib/SyncJob.php +++ b/apps/federation/lib/SyncJob.php @@ -25,8 +25,8 @@ */ namespace OCA\Federation; -use OCP\BackgroundJob\TimedJob; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; use Psr\Log\LoggerInterface; class SyncJob extends TimedJob { diff --git a/apps/federation/lib/TrustedServers.php b/apps/federation/lib/TrustedServers.php index 272161fd881..c27529bd12c 100644 --- a/apps/federation/lib/TrustedServers.php +++ b/apps/federation/lib/TrustedServers.php @@ -31,13 +31,12 @@ use OCA\Federation\BackgroundJob\RequestSharedSecret; use OCP\AppFramework\Http; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; +use OCP\EventDispatcher\IEventDispatcher; +use OCP\Federation\Events\TrustedServerRemovedEvent; use OCP\HintException; use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\Security\ISecureRandom; -use OCP\DB\Exception as DBException; -use OCP\EventDispatcher\IEventDispatcher; -use OCP\Federation\Events\TrustedServerRemovedEvent; use Psr\Log\LoggerInterface; class TrustedServers { diff --git a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php index dd1ad500384..43333137e65 100644 --- a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php +++ b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php @@ -31,8 +31,8 @@ use OCA\Federation\Middleware\AddServerMiddleware; use OCP\AppFramework\Http; use OCP\HintException; use OCP\IL10N; -use Test\TestCase; use Psr\Log\LoggerInterface; +use Test\TestCase; class AddServerMiddlewareTest extends TestCase { diff --git a/apps/federation/tests/SyncFederationAddressbooksTest.php b/apps/federation/tests/SyncFederationAddressbooksTest.php index a5da446b931..782ca52322a 100644 --- a/apps/federation/tests/SyncFederationAddressbooksTest.php +++ b/apps/federation/tests/SyncFederationAddressbooksTest.php @@ -28,11 +28,11 @@ */ namespace OCA\Federation\Tests; -use Psr\Log\LoggerInterface; use OC\OCS\DiscoveryService; use OCA\Federation\DbHandler; use OCA\Federation\SyncFederationAddressBooks; use PHPUnit\Framework\MockObject\MockObject; +use Psr\Log\LoggerInterface; class SyncFederationAddressbooksTest extends \Test\TestCase { diff --git a/apps/federation/tests/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php index 5b4e303b266..c5c056c7031 100644 --- a/apps/federation/tests/TrustedServersTest.php +++ b/apps/federation/tests/TrustedServersTest.php @@ -31,14 +31,14 @@ use OCA\Federation\DbHandler; use OCA\Federation\TrustedServers; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Http\Client\IClient; use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; use OCP\IConfig; use OCP\Security\ISecureRandom; -use OCP\EventDispatcher\IEventDispatcher; -use Test\TestCase; use Psr\Log\LoggerInterface; +use Test\TestCase; class TrustedServersTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject | TrustedServers */ diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php index 2cfd48ede3b..8b817f92c1e 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -77,13 +77,13 @@ class Provider implements IProvider { protected $fileIsEncrypted = false; public function __construct(IFactory $languageFactory, - IURLGenerator $url, - IManager $activityManager, - IUserManager $userManager, - IRootFolder $rootFolder, - ICloudIdManager $cloudIdManager, - IContactsManager $contactsManager, - IEventMerger $eventMerger) { + IURLGenerator $url, + IManager $activityManager, + IUserManager $userManager, + IRootFolder $rootFolder, + ICloudIdManager $cloudIdManager, + IContactsManager $contactsManager, + IEventMerger $eventMerger) { $this->languageFactory = $languageFactory; $this->url = $url; $this->activityManager = $activityManager; diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index 9099dbaceb2..5934bc1c7ce 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -40,7 +40,6 @@ use OCA\Files\Collaboration\Resources\Listener; use OCA\Files\Collaboration\Resources\ResourceProvider; use OCA\Files\Controller\ApiController; use OCA\Files\DirectEditingCapabilities; -use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCA\Files\Event\LoadSidebar; use OCA\Files\Listener\LoadSidebarListener; use OCA\Files\Listener\RenderReferenceEventListener; @@ -58,10 +57,9 @@ use OCP\Collaboration\Reference\RenderReferenceEvent; use OCP\Collaboration\Resources\IProviderManager; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; -use OCP\IL10N; use OCP\IPreview; -use OCP\ISearch; use OCP\IRequest; +use OCP\ISearch; use OCP\IServerContainer; use OCP\ITagManager; use OCP\IUserSession; diff --git a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php index a9b5b1446b2..2f700b8773e 100644 --- a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php +++ b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php @@ -36,7 +36,7 @@ class CleanupDirectEditingTokens extends TimedJob { private IManager $manager; public function __construct(ITimeFactory $time, - IManager $manager) { + IManager $manager) { parent::__construct($time); $this->interval = self::INTERVAL_MINUTES; $this->manager = $manager; diff --git a/apps/files/lib/BackgroundJob/CleanupFileLocks.php b/apps/files/lib/BackgroundJob/CleanupFileLocks.php index e0ad72eaaf0..7ff28a50155 100644 --- a/apps/files/lib/BackgroundJob/CleanupFileLocks.php +++ b/apps/files/lib/BackgroundJob/CleanupFileLocks.php @@ -23,9 +23,9 @@ */ namespace OCA\Files\BackgroundJob; +use OC\Lock\DBLockingProvider; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\TimedJob; -use OC\Lock\DBLockingProvider; /** * Clean up all file locks that are expired for the DB file locking provider diff --git a/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php b/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php index d96728fc713..9839bcde5b7 100644 --- a/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php +++ b/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCA\Files\BackgroundJob; -use OCA\Files\Controller\OpenLocalEditorController; use OCA\Files\Db\OpenLocalEditorMapper; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJob; diff --git a/apps/files/lib/BackgroundJob/TransferOwnership.php b/apps/files/lib/BackgroundJob/TransferOwnership.php index 9103c307b76..1f182b5e999 100644 --- a/apps/files/lib/BackgroundJob/TransferOwnership.php +++ b/apps/files/lib/BackgroundJob/TransferOwnership.php @@ -48,7 +48,7 @@ class TransferOwnership extends QueuedJob { private NotificationManager $notificationManager, private TransferOwnershipMapper $mapper, private IRootFolder $rootFolder, - ) { + ) { parent::__construct($timeFactory); } diff --git a/apps/files/lib/Collaboration/Resources/Listener.php b/apps/files/lib/Collaboration/Resources/Listener.php index e37bf0e9610..a368016523d 100644 --- a/apps/files/lib/Collaboration/Resources/Listener.php +++ b/apps/files/lib/Collaboration/Resources/Listener.php @@ -25,9 +25,9 @@ declare(strict_types=1); */ namespace OCA\Files\Collaboration\Resources; +use OCP\Collaboration\Resources\IManager; use OCP\EventDispatcher\IEventDispatcher; use OCP\Server; -use OCP\Collaboration\Resources\IManager; use OCP\Share\Events\ShareCreatedEvent; use OCP\Share\Events\ShareDeletedEvent; use OCP\Share\Events\ShareDeletedFromSelfEvent; diff --git a/apps/files/lib/Collaboration/Resources/ResourceProvider.php b/apps/files/lib/Collaboration/Resources/ResourceProvider.php index 841a2bdd4f7..4c5afc76b2b 100644 --- a/apps/files/lib/Collaboration/Resources/ResourceProvider.php +++ b/apps/files/lib/Collaboration/Resources/ResourceProvider.php @@ -49,8 +49,8 @@ class ResourceProvider implements IProvider { protected $nodes = []; public function __construct(IRootFolder $rootFolder, - IPreview $preview, - IURLGenerator $urlGenerator) { + IPreview $preview, + IURLGenerator $urlGenerator) { $this->rootFolder = $rootFolder; $this->preview = $preview; $this->urlGenerator = $urlGenerator; diff --git a/apps/files/lib/Command/Copy.php b/apps/files/lib/Command/Copy.php index 678c82a138f..e9a9f764d94 100644 --- a/apps/files/lib/Command/Copy.php +++ b/apps/files/lib/Command/Copy.php @@ -25,7 +25,6 @@ namespace OCA\Files\Command; use OC\Core\Command\Info\FileUtils; use OCP\Files\Folder; -use OCP\Files\File; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputArgument; diff --git a/apps/files/lib/Command/Get.php b/apps/files/lib/Command/Get.php index 6b21f94e8cf..e46ce29f08d 100644 --- a/apps/files/lib/Command/Get.php +++ b/apps/files/lib/Command/Get.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace OCA\Files\Command; - use OC\Core\Command\Info\FileUtils; use OCP\Files\File; use Symfony\Component\Console\Command\Command; diff --git a/apps/files/lib/Command/Move.php b/apps/files/lib/Command/Move.php index ac84dfa19b3..af97563c816 100644 --- a/apps/files/lib/Command/Move.php +++ b/apps/files/lib/Command/Move.php @@ -24,8 +24,8 @@ declare(strict_types=1); namespace OCA\Files\Command; use OC\Core\Command\Info\FileUtils; -use OCP\Files\Folder; use OCP\Files\File; +use OCP\Files\Folder; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputArgument; diff --git a/apps/files/lib/Command/Object/Delete.php b/apps/files/lib/Command/Object/Delete.php index 5000eeb6ee5..527292725ab 100644 --- a/apps/files/lib/Command/Object/Delete.php +++ b/apps/files/lib/Command/Object/Delete.php @@ -23,8 +23,6 @@ declare(strict_types=1); namespace OCA\Files\Command\Object; -use OCP\DB\QueryBuilder\IQueryBuilder; -use OCP\IDBConnection; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputArgument; diff --git a/apps/files/lib/Command/Object/Get.php b/apps/files/lib/Command/Object/Get.php index cad1f3d98ac..dfd44341638 100644 --- a/apps/files/lib/Command/Object/Get.php +++ b/apps/files/lib/Command/Object/Get.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace OCA\Files\Command\Object; -use OCP\Files\File; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; diff --git a/apps/files/lib/Command/Object/Put.php b/apps/files/lib/Command/Object/Put.php index 852d7c2225e..b4a7389fb82 100644 --- a/apps/files/lib/Command/Object/Put.php +++ b/apps/files/lib/Command/Object/Put.php @@ -46,7 +46,8 @@ class Put extends Command { ->setDescription('Write a file to the object store') ->addArgument('input', InputArgument::REQUIRED, "Source local path, use - to read from STDIN") ->addArgument('object', InputArgument::REQUIRED, "Object to write") - ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket where to store the object, only required in cases where it can't be determined from the config");; + ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket where to store the object, only required in cases where it can't be determined from the config"); + ; } public function execute(InputInterface $input, OutputInterface $output): int { diff --git a/apps/files/lib/Command/Put.php b/apps/files/lib/Command/Put.php index 73261e47fb6..5539c25665a 100644 --- a/apps/files/lib/Command/Put.php +++ b/apps/files/lib/Command/Put.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace OCA\Files\Command; - use OC\Core\Command\Info\FileUtils; use OCP\Files\File; use OCP\Files\Folder; diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index a78b6cbe8b1..31c410241cf 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -163,13 +163,13 @@ class Scan extends Base { ++$this->errorsCounter; }); - $this->eventDispatcher->addListener(NodeAddedToCache::class, function() { + $this->eventDispatcher->addListener(NodeAddedToCache::class, function () { ++$this->newCounter; }); - $this->eventDispatcher->addListener(FileCacheUpdated::class, function() { + $this->eventDispatcher->addListener(FileCacheUpdated::class, function () { ++$this->updatedCounter; }); - $this->eventDispatcher->addListener(NodeRemovedFromCache::class, function() { + $this->eventDispatcher->addListener(NodeRemovedFromCache::class, function () { ++$this->removedCounter; }); diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php index 2007c23f256..64f7fbbb95e 100644 --- a/apps/files/lib/Command/TransferOwnership.php +++ b/apps/files/lib/Command/TransferOwnership.php @@ -36,9 +36,9 @@ namespace OCA\Files\Command; use OCA\Files\Exception\TransferOwnershipException; use OCA\Files\Service\OwnershipTransferService; +use OCP\IConfig; use OCP\IUser; use OCP\IUserManager; -use OCP\IConfig; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -85,7 +85,7 @@ class TransferOwnership extends Command { InputOption::VALUE_OPTIONAL, 'transfer incoming user file shares to destination user. Usage: --transfer-incoming-shares=1 (value required)', '2' - ); + ); } protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index 6e64d68588f..a82fe7078af 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -74,15 +74,15 @@ class ApiController extends Controller { private ViewConfig $viewConfig; public function __construct(string $appName, - IRequest $request, - IUserSession $userSession, - TagService $tagService, - IPreview $previewManager, - IManager $shareManager, - IConfig $config, - ?Folder $userFolder, - UserConfig $userConfig, - ViewConfig $viewConfig) { + IRequest $request, + IUserSession $userSession, + TagService $tagService, + IPreview $previewManager, + IManager $shareManager, + IConfig $config, + ?Folder $userFolder, + UserConfig $userConfig, + ViewConfig $viewConfig) { parent::__construct($appName, $request); $this->userSession = $userSession; $this->tagService = $tagService; diff --git a/apps/files/lib/Controller/DirectEditingController.php b/apps/files/lib/Controller/DirectEditingController.php index a4b83af3c29..5d2162c69e0 100644 --- a/apps/files/lib/Controller/DirectEditingController.php +++ b/apps/files/lib/Controller/DirectEditingController.php @@ -46,7 +46,7 @@ class DirectEditingController extends OCSController { private IManager $directEditingManager, private DirectEditingService $directEditingService, private LoggerInterface $logger - ) { + ) { parent::__construct($appName, $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge); } diff --git a/apps/files/lib/Controller/TemplateController.php b/apps/files/lib/Controller/TemplateController.php index 1b5873e8fe6..697541fec3b 100644 --- a/apps/files/lib/Controller/TemplateController.php +++ b/apps/files/lib/Controller/TemplateController.php @@ -103,7 +103,7 @@ class TemplateController extends OCSController { $templatePath = $this->templateManager->initializeTemplateDirectory($templatePath, null, $copySystemTemplates); return new DataResponse([ 'template_path' => $templatePath, - 'templates' => array_map(fn(TemplateFileCreator $creator) => $creator->jsonSerialize(), $this->templateManager->listCreators()), + 'templates' => array_map(fn (TemplateFileCreator $creator) => $creator->jsonSerialize(), $this->templateManager->listCreators()), ]); } catch (\Exception $e) { throw new OCSForbiddenException($e->getMessage()); diff --git a/apps/files/lib/Controller/TransferOwnershipController.php b/apps/files/lib/Controller/TransferOwnershipController.php index ce68b28349e..2c46b85f9a0 100644 --- a/apps/files/lib/Controller/TransferOwnershipController.php +++ b/apps/files/lib/Controller/TransferOwnershipController.php @@ -30,13 +30,13 @@ namespace OCA\Files\Controller; use OCA\Files\BackgroundJob\TransferOwnership; use OCA\Files\Db\TransferOwnership as TransferOwnershipEntity; use OCA\Files\Db\TransferOwnershipMapper; -use OCP\Files\IHomeStorage; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; +use OCP\Files\IHomeStorage; use OCP\Files\IRootFolder; use OCP\IRequest; use OCP\IUserManager; @@ -60,14 +60,14 @@ class TransferOwnershipController extends OCSController { private $rootFolder; public function __construct(string $appName, - IRequest $request, - string $userId, - NotificationManager $notificationManager, - ITimeFactory $timeFactory, - IJobList $jobList, - TransferOwnershipMapper $mapper, - IUserManager $userManager, - IRootFolder $rootFolder) { + IRequest $request, + string $userId, + NotificationManager $notificationManager, + ITimeFactory $timeFactory, + IJobList $jobList, + TransferOwnershipMapper $mapper, + IUserManager $userManager, + IRootFolder $rootFolder) { parent::__construct($appName, $request); $this->userId = $userId; diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 38e3858cd38..ca9ac80b9e2 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -35,7 +35,6 @@ */ namespace OCA\Files\Controller; -use OC\AppFramework\Http; use OCA\Files\Activity\Helper; use OCA\Files\AppInfo\Application; use OCA\Files\Event\LoadAdditionalScriptsEvent; @@ -214,7 +213,8 @@ class ViewController extends Controller { if ($fileid !== null && $view !== 'trashbin') { try { return $this->redirectToFileIfInTrashbin((int) $fileid); - } catch (NotFoundException $e) {} + } catch (NotFoundException $e) { + } } // Load the files we need @@ -248,7 +248,7 @@ class ViewController extends Controller { try { // If view is files, we use the directory, otherwise we use the root storage - $storageInfo = $this->getStorageInfo(($view === 'files' && $dir) ? $dir : '/'); + $storageInfo = $this->getStorageInfo(($view === 'files' && $dir) ? $dir : '/'); } catch(\Exception $e) { $storageInfo = $this->getStorageInfo(); } @@ -399,7 +399,8 @@ class ViewController extends Controller { try { $this->redirectToFileIfInTrashbin($fileId); - } catch (NotFoundException $e) {} + } catch (NotFoundException $e) { + } if (!empty($nodes)) { $node = current($nodes); diff --git a/apps/files/lib/Event/LoadAdditionalScriptsEvent.php b/apps/files/lib/Event/LoadAdditionalScriptsEvent.php index 1e2080622f4..2e9e4764807 100644 --- a/apps/files/lib/Event/LoadAdditionalScriptsEvent.php +++ b/apps/files/lib/Event/LoadAdditionalScriptsEvent.php @@ -34,4 +34,5 @@ use OCP\EventDispatcher\Event; * * @since 17.0.0 */ -class LoadAdditionalScriptsEvent extends Event {} \ No newline at end of file +class LoadAdditionalScriptsEvent extends Event { +} diff --git a/apps/files/lib/Migration/Version12101Date20221011153334.php b/apps/files/lib/Migration/Version12101Date20221011153334.php index 0c1093f50a6..587616ff2d5 100644 --- a/apps/files/lib/Migration/Version12101Date20221011153334.php +++ b/apps/files/lib/Migration/Version12101Date20221011153334.php @@ -38,7 +38,7 @@ class Version12101Date20221011153334 extends SimpleMigrationStep { $schema = $schemaClosure(); $table = $schema->createTable('open_local_editor'); - $table->addColumn('id',Types::BIGINT, [ + $table->addColumn('id', Types::BIGINT, [ 'autoincrement' => true, 'notnull' => true, 'length' => 20, diff --git a/apps/files/lib/Notification/Notifier.php b/apps/files/lib/Notification/Notifier.php index 90784749b27..0968ae15f54 100644 --- a/apps/files/lib/Notification/Notifier.php +++ b/apps/files/lib/Notification/Notifier.php @@ -56,11 +56,11 @@ class Notifier implements INotifier, IDismissableNotifier { private $timeFactory; public function __construct(IFactory $l10nFactory, - IURLGenerator $urlGenerator, - TransferOwnershipMapper $mapper, - IManager $notificationManager, - IUserManager $userManager, - ITimeFactory $timeFactory) { + IURLGenerator $urlGenerator, + TransferOwnershipMapper $mapper, + IManager $notificationManager, + IUserManager $userManager, + ITimeFactory $timeFactory) { $this->l10nFactory = $l10nFactory; $this->urlGenerator = $urlGenerator; $this->mapper = $mapper; diff --git a/apps/files/lib/ResponseDefinitions.php b/apps/files/lib/ResponseDefinitions.php index 8a27ec4bb2f..9d1e5db61e5 100644 --- a/apps/files/lib/ResponseDefinitions.php +++ b/apps/files/lib/ResponseDefinitions.php @@ -1,4 +1,5 @@ encryptionManager = $manager; $this->shareManager = $shareManager; $this->mountManager = $mountManager; @@ -96,12 +96,12 @@ class OwnershipTransferService { * @throws \OC\User\NoUserException */ public function transfer(IUser $sourceUser, - IUser $destinationUser, - string $path, - ?OutputInterface $output = null, - bool $move = false, - bool $firstLogin = false, - bool $transferIncomingShares = false): void { + IUser $destinationUser, + string $path, + ?OutputInterface $output = null, + bool $move = false, + bool $firstLogin = false, + bool $transferIncomingShares = false): void { $output = $output ?? new NullOutput(); $sourceUid = $sourceUser->getUID(); $destinationUid = $destinationUser->getUID(); @@ -234,10 +234,10 @@ class OwnershipTransferService { * @throws \Exception */ protected function analyse(string $sourceUid, - string $destinationUid, - string $sourcePath, - View $view, - OutputInterface $output): void { + string $destinationUid, + string $sourcePath, + View $view, + OutputInterface $output): void { $output->writeln('Validating quota'); $size = $view->getFileInfo($sourcePath, false)->getSize(false); $freeSpace = $view->free_space($destinationUid . '/files/'); @@ -281,9 +281,9 @@ class OwnershipTransferService { } private function collectUsersShares(string $sourceUid, - OutputInterface $output, - View $view, - string $path): array { + OutputInterface $output, + View $view, + string $path): array { $output->writeln("Collecting all share information for files and folders of $sourceUid ..."); $shares = []; @@ -325,9 +325,9 @@ class OwnershipTransferService { } private function collectIncomingShares(string $sourceUid, - OutputInterface $output, - View $view, - bool $addKeys = false): array { + OutputInterface $output, + View $view, + bool $addKeys = false): array { $output->writeln("Collecting all incoming share information for files and folders of $sourceUid ..."); $shares = []; @@ -363,10 +363,10 @@ class OwnershipTransferService { * @throws TransferOwnershipException */ protected function transferFiles(string $sourceUid, - string $sourcePath, - string $finalTarget, - View $view, - OutputInterface $output): void { + string $sourcePath, + string $finalTarget, + View $view, + OutputInterface $output): void { $output->writeln("Transferring files to $finalTarget ..."); // This change will help user to transfer the folder specified using --path option. @@ -385,9 +385,9 @@ class OwnershipTransferService { } private function restoreShares(string $sourceUid, - string $destinationUid, - array $shares, - OutputInterface $output) { + string $destinationUid, + array $shares, + OutputInterface $output) { $output->writeln("Restoring shares ..."); $progress = new ProgressBar($output, count($shares)); @@ -436,13 +436,13 @@ class OwnershipTransferService { } private function transferIncomingShares(string $sourceUid, - string $destinationUid, - array $sourceShares, - array $destinationShares, - OutputInterface $output, - string $path, - string $finalTarget, - bool $move): void { + string $destinationUid, + array $sourceShares, + array $destinationShares, + OutputInterface $output, + string $path, + string $finalTarget, + bool $move): void { $output->writeln("Restoring incoming shares ..."); $progress = new ProgressBar($output, count($sourceShares)); $prefix = "$destinationUid/files"; diff --git a/apps/files/lib/Service/UserConfig.php b/apps/files/lib/Service/UserConfig.php index be32dce0d63..00569dc6aeb 100644 --- a/apps/files/lib/Service/UserConfig.php +++ b/apps/files/lib/Service/UserConfig.php @@ -28,7 +28,7 @@ use OCP\IUser; use OCP\IUserSession; class UserConfig { - const ALLOWED_CONFIGS = [ + public const ALLOWED_CONFIGS = [ [ // Whether to crop the files previews or not in the files list 'key' => 'crop_image_previews', @@ -68,7 +68,7 @@ class UserConfig { * @return string[] */ public function getAllowedConfigKeys(): array { - return array_map(function($config) { + return array_map(function ($config) { return $config['key']; }, self::ALLOWED_CONFIGS); } @@ -142,7 +142,7 @@ class UserConfig { } $userId = $this->user->getUID(); - $userConfigs = array_map(function(string $key) use ($userId) { + $userConfigs = array_map(function (string $key) use ($userId) { $value = $this->config->getUserValue($userId, Application::APP_ID, $key, $this->getDefaultConfigValue($key)); // If the default is expected to be a boolean, we need to cast the value if (is_bool($this->getDefaultConfigValue($key)) && is_string($value)) { diff --git a/apps/files/lib/Service/ViewConfig.php b/apps/files/lib/Service/ViewConfig.php index 51d90ffdb4e..fefc3f6a7de 100644 --- a/apps/files/lib/Service/ViewConfig.php +++ b/apps/files/lib/Service/ViewConfig.php @@ -28,8 +28,8 @@ use OCP\IUser; use OCP\IUserSession; class ViewConfig { - const CONFIG_KEY = 'files_views_configs'; - const ALLOWED_CONFIGS = [ + public const CONFIG_KEY = 'files_views_configs'; + public const ALLOWED_CONFIGS = [ [ // The default sorting key for the files list view 'key' => 'sorting_mode', @@ -64,7 +64,7 @@ class ViewConfig { * @return string[] */ public function getAllowedConfigKeys(): array { - return array_map(function($config) { + return array_map(function ($config) { return $config['key']; }, self::ALLOWED_CONFIGS); } @@ -155,7 +155,7 @@ class ViewConfig { } // Extend undefined values with defaults - return array_reduce(self::ALLOWED_CONFIGS, function($carry, $config) use ($view, $configs) { + return array_reduce(self::ALLOWED_CONFIGS, function ($carry, $config) use ($view, $configs) { $key = $config['key']; $carry[$key] = $configs[$view][$key] ?? $this->getDefaultConfigValue($key); return $carry; @@ -176,7 +176,7 @@ class ViewConfig { $configs = json_decode($this->config->getUserValue($userId, Application::APP_ID, self::CONFIG_KEY, '[]'), true); $views = array_keys($configs); - return array_reduce($views, function($carry, $view) use ($configs) { + return array_reduce($views, function ($carry, $view) use ($configs) { $carry[$view] = $this->getConfig($view); return $carry; }, []); diff --git a/apps/files/list.php b/apps/files/list.php index c4b93b2e145..5f1bc07f499 100644 --- a/apps/files/list.php +++ b/apps/files/list.php @@ -22,10 +22,10 @@ * along with this program. If not, see * */ -use OCP\Share\IManager; -use OCP\Server; use OCP\IConfig; use OCP\IUserSession; +use OCP\Server; +use OCP\Share\IManager; $config = Server::get(IConfig::class); $userSession = Server::get(IUserSession::class); diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index 17409bdb189..d2b57b03eca 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -3,9 +3,9 @@
@@ -31,8 +31,8 @@ function NavigationListElements($item, $l, $pinned) { data-expandedstate="" class="nav- + p($item['classes']); + } ?> open" folderposition="" > @@ -42,7 +42,7 @@ function NavigationListElements($item, $l, $pinned) {