diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/files_sharing | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files_sharing')
63 files changed, 53 insertions, 157 deletions
diff --git a/apps/files_sharing/lib/Activity/Providers/Downloads.php b/apps/files_sharing/lib/Activity/Providers/Downloads.php index 91ad8322e6f..23c55e08a26 100644 --- a/apps/files_sharing/lib/Activity/Providers/Downloads.php +++ b/apps/files_sharing/lib/Activity/Providers/Downloads.php @@ -26,8 +26,6 @@ namespace OCA\Files_Sharing\Activity\Providers; use OCP\Activity\IEvent; class Downloads extends Base { - - const SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED = 'public_shared_file_downloaded'; const SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED = 'public_shared_folder_downloaded'; diff --git a/apps/files_sharing/lib/Activity/Providers/Groups.php b/apps/files_sharing/lib/Activity/Providers/Groups.php index 70e3c177e66..c6115a8dba0 100644 --- a/apps/files_sharing/lib/Activity/Providers/Groups.php +++ b/apps/files_sharing/lib/Activity/Providers/Groups.php @@ -35,7 +35,6 @@ use OCP\IUserManager; use OCP\L10N\IFactory; class Groups extends Base { - const SUBJECT_SHARED_GROUP_SELF = 'shared_group_self'; const SUBJECT_RESHARED_GROUP_BY = 'reshared_group_by'; diff --git a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php index 97fc66eaf69..0ebe6cdec0f 100644 --- a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php @@ -26,7 +26,6 @@ namespace OCA\Files_Sharing\Activity\Providers; use OCP\Activity\IEvent; class PublicLinks extends Base { - const SUBJECT_SHARED_LINK_SELF = 'shared_link_self'; const SUBJECT_RESHARED_LINK_BY = 'reshared_link_by'; const SUBJECT_UNSHARED_LINK_SELF = 'unshared_link_self'; @@ -55,7 +54,6 @@ class PublicLinks extends Base { $subject = $this->l->t('{actor} removed public link'); } elseif ($event->getSubject() === self::SUBJECT_LINK_BY_EXPIRED) { $subject = $this->l->t('Public link of {actor} expired'); - } else { throw new \InvalidArgumentException(); } @@ -91,7 +89,6 @@ class PublicLinks extends Base { $subject = $this->l->t('{actor} removed public link for {file}'); } elseif ($event->getSubject() === self::SUBJECT_LINK_BY_EXPIRED) { $subject = $this->l->t('Public link of {actor} for {file} expired'); - } else { throw new \InvalidArgumentException(); } @@ -127,5 +124,4 @@ class PublicLinks extends Base { } return []; } - } diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php index b56100b6be9..2604288d448 100644 --- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php +++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php @@ -33,7 +33,6 @@ use OCP\IUserManager; use OCP\L10N\IFactory; class RemoteShares extends Base { - const SUBJECT_REMOTE_SHARE_ACCEPTED = 'remote_share_accepted'; const SUBJECT_REMOTE_SHARE_DECLINED = 'remote_share_declined'; const SUBJECT_REMOTE_SHARE_RECEIVED = 'remote_share_received'; diff --git a/apps/files_sharing/lib/Activity/Providers/Users.php b/apps/files_sharing/lib/Activity/Providers/Users.php index 4274e551899..aff5feddc01 100644 --- a/apps/files_sharing/lib/Activity/Providers/Users.php +++ b/apps/files_sharing/lib/Activity/Providers/Users.php @@ -28,8 +28,6 @@ namespace OCA\Files_Sharing\Activity\Providers; use OCP\Activity\IEvent; class Users extends Base { - - const SUBJECT_SHARED_USER_SELF = 'shared_user_self'; const SUBJECT_RESHARED_USER_BY = 'reshared_user_by'; const SUBJECT_UNSHARED_USER_SELF = 'unshared_user_self'; @@ -115,7 +113,6 @@ class Users extends Base { $subject = $this->l->t('Share for file {file} with {user} expired'); } elseif ($event->getSubject() === self::SUBJECT_EXPIRED) { $subject = $this->l->t('Share for file {file} expired'); - } else { throw new \InvalidArgumentException(); } diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index 2539b436592..2902b820af3 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -65,7 +65,6 @@ use OCP\Util; use Symfony\Component\EventDispatcher\GenericEvent; class Application extends App { - const APP_ID = 'files_sharing'; public function __construct(array $urlParams = []) { diff --git a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php index 30530f15a5c..41f1d36ccf6 100644 --- a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php +++ b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php @@ -51,7 +51,7 @@ class FederatedSharesDiscoverJob extends TimedJob { ->from('share_external'); $result = $qb->execute(); - while($row = $result->fetch()) { + while ($row = $result->fetch()) { $this->discoveryService->discover($row['remote'], 'FEDERATED_SHARING', true); } $result->closeCursor(); diff --git a/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php b/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php index 6dc0e06d6c6..f5eff5be0cc 100644 --- a/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php +++ b/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php @@ -51,23 +51,23 @@ class ShareRecipientSorter implements ISorter { public function sort(array &$sortArray, array $context) { // let's be tolerant. Comments uses "files" by default, other usages are often singular - if($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { + if ($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { return; } $user = $this->userSession->getUser(); - if($user === null) { + if ($user === null) { return; } $userFolder = $this->rootFolder->getUserFolder($user->getUID()); /** @var Node[] $nodes */ $nodes = $userFolder->getById((int)$context['itemId']); - if(count($nodes) === 0) { + if (count($nodes) === 0) { return; } $al = $this->shareManager->getAccessList($nodes[0]); foreach ($sortArray as $type => &$byType) { - if(!isset($al[$type]) || !is_array($al[$type])) { + if (!isset($al[$type]) || !is_array($al[$type])) { continue; } @@ -80,7 +80,7 @@ class ShareRecipientSorter implements ISorter { usort($workArray, function ($a, $b) use ($al, $type) { $result = $this->compare($a[1], $b[1], $al[$type]); - if($result === 0) { + if ($result === 0) { $result = $a[0] - $b[0]; } return $result; diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php index 309f882e65c..2eb79f87762 100644 --- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php +++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php @@ -60,7 +60,6 @@ class CleanupRemoteStorages extends Command { } public function execute(InputInterface $input, OutputInterface $output) { - $remoteStorages = $this->getRemoteStorages(); $output->writeln(count($remoteStorages) . ' remote storage(s) need(s) to be checked'); @@ -138,7 +137,6 @@ class CleanupRemoteStorages extends Command { } public function getRemoteStorages() { - $queryBuilder = $this->connection->getQueryBuilder(); $queryBuilder->select(['id', 'numeric_id']) ->from('storages') @@ -166,7 +164,6 @@ class CleanupRemoteStorages extends Command { } public function getRemoteShareIds() { - $queryBuilder = $this->connection->getQueryBuilder(); $queryBuilder->select(['id', 'share_token', 'remote']) ->from('share_external'); diff --git a/apps/files_sharing/lib/Command/ExiprationNotification.php b/apps/files_sharing/lib/Command/ExiprationNotification.php index e228975a9b5..6fd04bcdccc 100644 --- a/apps/files_sharing/lib/Command/ExiprationNotification.php +++ b/apps/files_sharing/lib/Command/ExiprationNotification.php @@ -95,6 +95,4 @@ class ExiprationNotification extends Command { $this->notificationManager->notify($notification); } } - - } diff --git a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php index fc58b5d1209..89a5e0e02aa 100644 --- a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php +++ b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php @@ -93,7 +93,6 @@ class DeletedShareAPIController extends OCSController { * @suppress PhanUndeclaredClassMethod */ private function formatShare(IShare $share): array { - $result = [ 'id' => $share->getFullId(), 'share_type' => $share->getShareType(), @@ -154,7 +153,6 @@ class DeletedShareAPIController extends OCSController { } return $result; - } /** diff --git a/apps/files_sharing/lib/Controller/ExternalSharesController.php b/apps/files_sharing/lib/Controller/ExternalSharesController.php index 0a26f8f9f56..c5dd21cda30 100644 --- a/apps/files_sharing/lib/Controller/ExternalSharesController.php +++ b/apps/files_sharing/lib/Controller/ExternalSharesController.php @@ -151,5 +151,4 @@ class ExternalSharesController extends Controller { return new DataResponse(false); } } - } diff --git a/apps/files_sharing/lib/Controller/PublicPreviewController.php b/apps/files_sharing/lib/Controller/PublicPreviewController.php index d0c2296f0db..0e58057351f 100644 --- a/apps/files_sharing/lib/Controller/PublicPreviewController.php +++ b/apps/files_sharing/lib/Controller/PublicPreviewController.php @@ -96,7 +96,6 @@ class PublicPreviewController extends PublicShareController { int $y = 32, $a = false ) { - if ($token === '' || $x === 0 || $y === 0) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 40a9a387dde..37dc76faaaf 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -270,7 +270,8 @@ class ShareAPIController extends OCSController { try { $result = array_merge($result, $this->getRoomShareHelper()->formatShare($share)); - } catch (QueryException $e) {} + } catch (QueryException $e) { + } } @@ -594,7 +595,6 @@ class ShareAPIController extends OCSController { * @return array */ private function getSharedWithMe($node, bool $includeTags): array { - $userShares = $this->shareManager->getSharedWith($this->currentUser, Share::SHARE_TYPE_USER, $node, -1, 0); $groupShares = $this->shareManager->getSharedWith($this->currentUser, Share::SHARE_TYPE_GROUP, $node, -1, 0); $circleShares = $this->shareManager->getSharedWith($this->currentUser, Share::SHARE_TYPE_CIRCLE, $node, -1, 0); @@ -709,7 +709,6 @@ class ShareAPIController extends OCSController { string $path = '', string $include_tags = 'false' ): DataResponse { - $node = null; if ($path !== '') { $userFolder = $this->rootFolder->getUserFolder($this->currentUser); @@ -754,7 +753,6 @@ class ShareAPIController extends OCSController { string $viewer, $node = null, bool $sharedWithMe = false, bool $reShares = false, bool $subFiles = false, bool $includeTags = false ): array { - if ($sharedWithMe) { return $this->getSharedWithMe($node, $includeTags); } @@ -1463,7 +1461,6 @@ class ShareAPIController extends OCSController { * @return IShare[] */ private function getSharesFromNode(string $viewer, $node, bool $reShares): array { - $providers = [ Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, @@ -1580,7 +1577,6 @@ class ShareAPIController extends OCSController { if ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE && \OC::$server->getAppManager()->isEnabledForUser('circles') && class_exists('\OCA\Circles\Api\v1\Circles')) { - $hasCircleId = (substr($share->getSharedWith(), -1) === ']'); $shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0); $shareWithLength = ($hasCircleId ? -1 : strpos($share->getSharedWith(), ' ')); @@ -1655,5 +1651,4 @@ class ShareAPIController extends OCSController { } } } - } diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index 48914e27771..2ea57068f25 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -250,7 +250,7 @@ class ShareController extends AuthPublicShareController { $itemType = $itemSource = $uidOwner = ''; $token = $share; $exception = null; - if($share instanceof \OCP\Share\IShare) { + if ($share instanceof \OCP\Share\IShare) { try { $token = $share->getToken(); $uidOwner = $share->getSharedBy(); @@ -269,7 +269,7 @@ class ShareController extends AuthPublicShareController { 'errorCode' => $errorCode, 'errorMessage' => $errorMessage, ]); - if(!is_null($exception)) { + if (!is_null($exception)) { throw $exception; } } @@ -366,7 +366,6 @@ class ShareController extends AuthPublicShareController { $hideFileList = false; if ($shareNode instanceof \OCP\Files\Folder) { - $shareIsFolder = true; try { @@ -553,7 +552,7 @@ class ShareController extends AuthPublicShareController { $share = $this->shareManager->getShareByToken($token); - if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { + if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { return new \OCP\AppFramework\Http\DataResponse('Share is read-only'); } @@ -676,7 +675,6 @@ class ShareController extends AuthPublicShareController { $subNode = $node->get($file); $this->singleFileDownloaded($share, $subNode); } - } /** @@ -738,7 +736,6 @@ class ShareController extends AuthPublicShareController { $affectedUser, $fileId, $filePath) { - $event = $this->activityManager->generateEvent(); $event->setApp('files_sharing') ->setType('public_links') @@ -747,6 +744,4 @@ class ShareController extends AuthPublicShareController { ->setObject('files', $fileId, $filePath); $this->activityManager->publish($event); } - - } diff --git a/apps/files_sharing/lib/Controller/ShareInfoController.php b/apps/files_sharing/lib/Controller/ShareInfoController.php index 31f98f91c03..315a562abef 100644 --- a/apps/files_sharing/lib/Controller/ShareInfoController.php +++ b/apps/files_sharing/lib/Controller/ShareInfoController.php @@ -88,7 +88,6 @@ class ShareInfoController extends ApiController { try { $node = $node->get($dir); } catch (NotFoundException $e) { - } } diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index a8cd2196629..557a92d0fca 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -212,7 +212,7 @@ class ShareesAPIController extends OCSController { list($result, $hasMoreResults) = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset); // extra treatment for 'exact' subarray, with a single merge expected keys might be lost - if(isset($result['exact'])) { + if (isset($result['exact'])) { $result['exact'] = array_merge($this->result['exact'], $result['exact']); } $this->result = array_merge($this->result, $result); diff --git a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php index 33267a94c4e..8438b6ac4f7 100644 --- a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php +++ b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php @@ -62,5 +62,4 @@ class DeleteOrphanedSharesJob extends TimedJob { $deletedEntries = $connection->executeUpdate($sql); $logger->debug("$deletedEntries orphaned share(s) deleted", ['app' => 'DeleteOrphanedSharesJob']); } - } diff --git a/apps/files_sharing/lib/Exceptions/SharingRightsException.php b/apps/files_sharing/lib/Exceptions/SharingRightsException.php index 02d197d4034..db346774bdb 100644 --- a/apps/files_sharing/lib/Exceptions/SharingRightsException.php +++ b/apps/files_sharing/lib/Exceptions/SharingRightsException.php @@ -33,5 +33,4 @@ use Exception; * @package OCA\Files_Sharing\Exceptions */ class SharingRightsException extends Exception { - } diff --git a/apps/files_sharing/lib/ExpireSharesJob.php b/apps/files_sharing/lib/ExpireSharesJob.php index ef90a04dba1..19684ec8964 100644 --- a/apps/files_sharing/lib/ExpireSharesJob.php +++ b/apps/files_sharing/lib/ExpireSharesJob.php @@ -68,10 +68,9 @@ class ExpireSharesJob extends TimedJob { ); $shares = $qb->execute(); - while($share = $shares->fetch()) { + while ($share = $shares->fetch()) { \OC\Share\Share::unshare($share['item_type'], $share['file_source'], \OCP\Share::SHARE_TYPE_LINK, null, $share['uid_owner']); } $shares->closeCursor(); } - } diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php index ee547ce9114..3923fdf09d3 100644 --- a/apps/files_sharing/lib/External/Manager.php +++ b/apps/files_sharing/lib/External/Manager.php @@ -151,12 +151,11 @@ class Manager { * @throws \Doctrine\DBAL\DBALException */ public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted=false, $user = null, $remoteId = -1, $parent = -1) { - $user = $user ? $user : $this->uid; $accepted = $accepted ? IShare::STATUS_ACCEPTED : IShare::STATUS_PENDING; $name = Filesystem::normalizePath('/' . $name); - if ($accepted !== IShare::STATUS_ACCEPTED) { + if ($accepted !== IShare::STATUS_ACCEPTED) { // To avoid conflicts with the mount point generation later, // we only use a temporary mount point name here. The real // mount point name will be generated when accepting the share, @@ -258,7 +257,6 @@ class Manager { } return false; - } /** @@ -268,7 +266,6 @@ class Manager { * @return bool True if the share could be accepted, false otherwise */ public function acceptShare($id) { - $share = $this->getShare($id); $result = false; @@ -280,7 +277,7 @@ class Manager { $hash = md5($mountPoint); $userShareAccepted = false; - if((int)$share['share_type'] === Share::SHARE_TYPE_USER) { + if ((int)$share['share_type'] === Share::SHARE_TYPE_USER) { $acceptShare = $this->connection->prepare(' UPDATE `*PREFIX*share_external` SET `accepted` = ?, @@ -321,7 +318,6 @@ class Manager { * @return bool True if the share could be declined, false otherwise */ public function declineShare($id) { - $share = $this->getShare($id); $result = false; @@ -374,10 +370,9 @@ class Manager { * @return boolean */ private function sendFeedbackToRemote($remote, $token, $remoteId, $feedback) { - $result = $this->tryOCMEndPoint($remote, $token, $remoteId, $feedback); - if($result === true) { + if ($result === true) { return true; } @@ -446,7 +441,6 @@ class Manager { } return false; - } @@ -509,7 +503,6 @@ class Manager { } public function removeShare($mountPoint) { - $mountPointObj = $this->mountManager->find($mountPoint); $id = $mountPointObj->getStorage()->getCache()->getId(''); @@ -545,7 +538,7 @@ class Manager { $result = (bool)$query->execute([0, (int)$share['id']]); } - if($result) { + if ($result) { $this->removeReShares($id); } @@ -590,7 +583,7 @@ class Manager { if ($result) { $shares = $getShare->fetchAll(); - foreach($shares as $share) { + foreach ($shares as $share) { $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); } } diff --git a/apps/files_sharing/lib/External/Scanner.php b/apps/files_sharing/lib/External/Scanner.php index afa8687d280..8962bb68c07 100644 --- a/apps/files_sharing/lib/External/Scanner.php +++ b/apps/files_sharing/lib/External/Scanner.php @@ -37,7 +37,7 @@ class Scanner extends \OC\Files\Cache\Scanner { /** {@inheritDoc} */ public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) { - if(!$this->storage->remoteIsOwnCloud()) { + if (!$this->storage->remoteIsOwnCloud()) { return parent::scan($path, $recursive, $recursive, $lock); } diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php index 1390c0a4f56..0d5f620ddf2 100644 --- a/apps/files_sharing/lib/External/Storage.php +++ b/apps/files_sharing/lib/External/Storage.php @@ -266,7 +266,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage { */ private function testRemoteUrl($url) { $cache = $this->memcacheFactory->createDistributed('files_sharing_remote_url'); - if($cache->hasKey($url)) { + if ($cache->hasKey($url)) { return (bool)$cache->get($url); } @@ -297,7 +297,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage { * @return bool */ public function remoteIsOwnCloud() { - if(defined('PHPUNIT_RUN') || !$this->testRemoteUrl($this->getRemote() . '/status.php')) { + if (defined('PHPUNIT_RUN') || !$this->testRemoteUrl($this->getRemote() . '/status.php')) { return false; } return true; @@ -315,7 +315,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage { $password = $this->getPassword(); // If remote is not an ownCloud do not try to get any share info - if(!$this->remoteIsOwnCloud()) { + if (!$this->remoteIsOwnCloud()) { return ['status' => 'unsupported']; } @@ -387,7 +387,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage { try { $ocmPermissions = json_decode($ocmPermissions); $ncPermissions = 0; - foreach($ocmPermissions as $permission) { + foreach ($ocmPermissions as $permission) { switch (strtolower($permission)) { case 'read': $ncPermissions += Constants::PERMISSION_READ; diff --git a/apps/files_sharing/lib/Helper.php b/apps/files_sharing/lib/Helper.php index 3efb4e25eef..d3c6deeec2e 100644 --- a/apps/files_sharing/lib/Helper.php +++ b/apps/files_sharing/lib/Helper.php @@ -31,7 +31,6 @@ use OC\Files\Filesystem; use OC\Files\View; class Helper { - public static function registerHooks() { \OCP\Util::connectHook('OC_Filesystem', 'post_rename', '\OCA\Files_Sharing\Updater', 'renameHook'); \OCP\Util::connectHook('OC_Filesystem', 'post_delete', '\OCA\Files_Sharing\Hooks', 'unshareChildren'); @@ -86,7 +85,6 @@ class Helper { } return $shareFolder; - } /** @@ -97,5 +95,4 @@ class Helper { public static function setShareFolder($shareFolder) { \OC::$server->getConfig()->setSystemValue('share_folder', $shareFolder); } - } diff --git a/apps/files_sharing/lib/Hooks.php b/apps/files_sharing/lib/Hooks.php index 9b547ea295e..a37a497f2bd 100644 --- a/apps/files_sharing/lib/Hooks.php +++ b/apps/files_sharing/lib/Hooks.php @@ -30,7 +30,6 @@ namespace OCA\Files_Sharing; use OC\Files\Filesystem; class Hooks { - public static function deleteUser($params) { $manager = new External\Manager( \OC::$server->getDatabaseConnection(), diff --git a/apps/files_sharing/lib/ISharedStorage.php b/apps/files_sharing/lib/ISharedStorage.php index 2f0888589ca..0b7444deb0b 100644 --- a/apps/files_sharing/lib/ISharedStorage.php +++ b/apps/files_sharing/lib/ISharedStorage.php @@ -23,6 +23,5 @@ namespace OCA\Files_Sharing; -interface ISharedStorage{ - +interface ISharedStorage { } diff --git a/apps/files_sharing/lib/Listener/LoadSidebarListener.php b/apps/files_sharing/lib/Listener/LoadSidebarListener.php index ba2ce54eeb4..636a8c7757e 100644 --- a/apps/files_sharing/lib/Listener/LoadSidebarListener.php +++ b/apps/files_sharing/lib/Listener/LoadSidebarListener.php @@ -40,5 +40,4 @@ class LoadSidebarListener implements IEventListener { Util::addScript(Application::APP_ID, 'dist/files_sharing_tab'); } - } diff --git a/apps/files_sharing/lib/Listener/ShareInteractionListener.php b/apps/files_sharing/lib/Listener/ShareInteractionListener.php index 0e409773e54..e698d16d823 100644 --- a/apps/files_sharing/lib/Listener/ShareInteractionListener.php +++ b/apps/files_sharing/lib/Listener/ShareInteractionListener.php @@ -37,7 +37,6 @@ use OCP\Share\IShare; use function in_array; class ShareInteractionListener implements IEventListener { - private const SUPPORTED_SHARE_TYPES = [ IShare::TYPE_USER, IShare::TYPE_EMAIL, @@ -92,5 +91,4 @@ class ShareInteractionListener implements IEventListener { $this->dispatcher->dispatchTyped($interactionEvent); } - } diff --git a/apps/files_sharing/lib/Listener/UserAddedToGroupListener.php b/apps/files_sharing/lib/Listener/UserAddedToGroupListener.php index a1a20ad5f47..623591da310 100644 --- a/apps/files_sharing/lib/Listener/UserAddedToGroupListener.php +++ b/apps/files_sharing/lib/Listener/UserAddedToGroupListener.php @@ -80,5 +80,4 @@ class UserAddedToGroupListener implements IEventListener { $acceptDefault = $this->config->getUserValue($userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes'; return (!$this->config->getSystemValueBool('sharing.force_share_accept', false) && $acceptDefault); } - } diff --git a/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php b/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php index 758138bb7f0..ec7bc5b86fe 100644 --- a/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php +++ b/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php @@ -72,7 +72,6 @@ class UserShareAcceptanceListener implements IEventListener { $this->handleAutoAccept($share, $user->getUID()); } } - } private function handleAutoAccept(IShare $share, string $userId) { @@ -82,5 +81,4 @@ class UserShareAcceptanceListener implements IEventListener { $this->shareManager->acceptShare($share, $userId); } } - } diff --git a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php index 63a67bb5b48..24f1899a312 100644 --- a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php +++ b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php @@ -93,7 +93,7 @@ class SharingCheckMiddleware extends Middleware { * @throws ShareNotFound */ public function beforeController($controller, $methodName) { - if(!$this->isSharingEnabled()) { + if (!$this->isSharingEnabled()) { throw new NotFoundException('Sharing is disabled.'); } @@ -113,7 +113,7 @@ class SharingCheckMiddleware extends Middleware { * @throws \Exception */ public function afterException($controller, $methodName, \Exception $exception) { - if(is_a($exception, NotFoundException::class)) { + if (is_a($exception, NotFoundException::class)) { return new NotFoundResponse(); } @@ -129,7 +129,6 @@ class SharingCheckMiddleware extends Middleware { * @return bool */ private function externalSharesChecks() { - if (!$this->reflector->hasAnnotation('NoIncomingFederatedSharingRequired') && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') !== 'yes') { return false; @@ -150,13 +149,10 @@ class SharingCheckMiddleware extends Middleware { private function isSharingEnabled() { // FIXME: This check is done here since the route is globally defined and not inside the files_sharing app // Check whether the sharing application is enabled - if(!$this->appManager->isEnabledForUser($this->appName)) { + if (!$this->appManager->isEnabledForUser($this->appName)) { return false; } return true; } - - - } diff --git a/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php b/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php index 9b0fee38bac..237c6aca243 100644 --- a/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php +++ b/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php @@ -79,5 +79,4 @@ class OwncloudGuestShareType implements IRepairStep { return $appVersion === '0.10.0' || $this->config->getAppValue('core', 'vendor', '') === 'owncloud'; } - } diff --git a/apps/files_sharing/lib/Migration/SetAcceptedStatus.php b/apps/files_sharing/lib/Migration/SetAcceptedStatus.php index a48ca8fa6a8..386f7299d40 100644 --- a/apps/files_sharing/lib/Migration/SetAcceptedStatus.php +++ b/apps/files_sharing/lib/Migration/SetAcceptedStatus.php @@ -77,5 +77,4 @@ class SetAcceptedStatus implements IRepairStep { $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); return version_compare($appVersion, '1.10.1', '<'); } - } diff --git a/apps/files_sharing/lib/Migration/SetPasswordColumn.php b/apps/files_sharing/lib/Migration/SetPasswordColumn.php index a666aa4dd3e..5580bd46a5b 100644 --- a/apps/files_sharing/lib/Migration/SetPasswordColumn.php +++ b/apps/files_sharing/lib/Migration/SetPasswordColumn.php @@ -86,12 +86,10 @@ class SetPasswordColumn implements IRepairStep { ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK))); $clearQuery->execute(); - } protected function shouldRun() { $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); return version_compare($appVersion, '1.4.0', '<'); } - } diff --git a/apps/files_sharing/lib/MountProvider.php b/apps/files_sharing/lib/MountProvider.php index dd880d13306..c318d18ed82 100644 --- a/apps/files_sharing/lib/MountProvider.php +++ b/apps/files_sharing/lib/MountProvider.php @@ -74,7 +74,6 @@ class MountProvider implements IMountProvider { * @return \OCP\Files\Mount\IMountPoint[] */ public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) { - $shares = $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_USER, null, -1); $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_GROUP, null, -1)); $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_CIRCLE, null, -1)); diff --git a/apps/files_sharing/lib/Notification/Notifier.php b/apps/files_sharing/lib/Notification/Notifier.php index 07c41882917..6db19d3bd5f 100644 --- a/apps/files_sharing/lib/Notification/Notifier.php +++ b/apps/files_sharing/lib/Notification/Notifier.php @@ -149,7 +149,6 @@ class Notifier implements INotifier { } protected function parseShareInvitation(IShare $share, INotification $notification, IL10N $l): INotification { - if ($share->getShareType() === IShare::TYPE_USER) { if ($share->getStatus() !== IShare::STATUS_PENDING) { throw new AlreadyProcessedException(); diff --git a/apps/files_sharing/lib/Settings/Personal.php b/apps/files_sharing/lib/Settings/Personal.php index 3e83869a582..bfca0b46e07 100644 --- a/apps/files_sharing/lib/Settings/Personal.php +++ b/apps/files_sharing/lib/Settings/Personal.php @@ -64,5 +64,4 @@ class Personal implements ISettings { public function getPriority(): int { return 90; } - } diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php index fdbd0da96a3..2db6c374c85 100644 --- a/apps/files_sharing/lib/ShareBackend/File.php +++ b/apps/files_sharing/lib/ShareBackend/File.php @@ -37,7 +37,6 @@ namespace OCA\Files_Sharing\ShareBackend; use OCA\FederatedFileSharing\FederatedShareProvider; class File implements \OCP\Share_Backend_File_Dependent { - const FORMAT_SHARED_STORAGE = 0; const FORMAT_GET_FOLDER_CONTENTS = 1; const FORMAT_FILE_APP_ROOT = 2; diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php index 7713c8b6b11..c51740cd6d0 100644 --- a/apps/files_sharing/lib/ShareBackend/Folder.php +++ b/apps/files_sharing/lib/ShareBackend/Folder.php @@ -109,7 +109,6 @@ class Folder extends File implements \OCP\Share_Backend_Collection { $mimetype = -1; } while (!empty($parents)) { - $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $parents = array_map(function ($parent) use ($qb) { @@ -136,5 +135,4 @@ class Folder extends File implements \OCP\Share_Backend_Collection { } return $children; } - } diff --git a/apps/files_sharing/lib/SharedMount.php b/apps/files_sharing/lib/SharedMount.php index 91f3c39ba05..487011584c7 100644 --- a/apps/files_sharing/lib/SharedMount.php +++ b/apps/files_sharing/lib/SharedMount.php @@ -89,7 +89,6 @@ class SharedMount extends MountPoint implements MoveableMount { * @return string */ private function verifyMountPoint(\OCP\Share\IShare $share, array $mountpoints, CappedMemoryCache $folderExistCache) { - $mountPoint = basename($share->getTarget()); $parent = dirname($share->getTarget()); @@ -193,7 +192,6 @@ class SharedMount extends MountPoint implements MoveableMount { * @return bool */ public function moveMount($target) { - $relTargetPath = $this->stripUserFilesPath($target); $share = $this->storage->getShare(); diff --git a/apps/files_sharing/lib/Updater.php b/apps/files_sharing/lib/Updater.php index 652ff171880..828453be765 100644 --- a/apps/files_sharing/lib/Updater.php +++ b/apps/files_sharing/lib/Updater.php @@ -91,7 +91,6 @@ class Updater { * @param string $newPath new path relative to data/user/files */ static private function renameChildren($oldPath, $newPath) { - $absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $newPath); $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $oldPath); @@ -105,5 +104,4 @@ class Updater { } } } - } diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index 5c462b51aa6..751303e8109 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -50,7 +50,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size); <!-- ONLY if this is a folder, we show the grid toggle button --> <?php if (empty($_['dir']) === false) { ?> <input type="checkbox" class="hidden-visually" id="showgridview" - <?php if($_['showgridview']) { ?>checked="checked" <?php } ?>/> + <?php if ($_['showgridview']) { ?>checked="checked" <?php } ?>/> <label id="view-toggle" for="showgridview" class="button <?php p($_['showgridview'] ? 'icon-toggle-filelist' : 'icon-toggle-pictures') ?>" title="<?php p($l->t('Toggle grid view'))?>"></label> <?php } ?> diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index b8d5a21a739..2d262a0104a 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -53,7 +53,6 @@ use OCP\Share\IShare; * TODO: convert to real intergration tests */ class ApiTest extends TestCase { - const TEST_FOLDER_NAME = '/folder_share_api_test'; const APP_NAME = 'files_sharing'; @@ -91,7 +90,7 @@ class ApiTest extends TestCase { } protected function tearDown(): void { - if($this->view instanceof \OC\Files\View) { + if ($this->view instanceof \OC\Files\View) { $this->view->unlink($this->filename); $this->view->deleteAll($this->folder); } @@ -163,7 +162,6 @@ class ApiTest extends TestCase { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $ocs->deleteShare($data['id']); $ocs->cleanup(); - } @@ -197,7 +195,6 @@ class ApiTest extends TestCase { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $ocs->deleteShare($data['id']); $ocs->cleanup(); - } public function testCreateShareLink() { @@ -249,7 +246,6 @@ class ApiTest extends TestCase { } function testEnforceLinkPassword() { - $password = md5(time()); $config = \OC::$server->getConfig(); $config->setAppValue('core', 'shareapi_enforce_links_password', 'yes'); @@ -259,7 +255,6 @@ class ApiTest extends TestCase { $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK); $this->fail(); } catch (OCSForbiddenException $e) { - } $ocs->cleanup(); @@ -268,7 +263,6 @@ class ApiTest extends TestCase { $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', ''); $this->fail(); } catch (OCSForbiddenException $e) { - } $ocs->cleanup(); @@ -290,7 +284,6 @@ class ApiTest extends TestCase { $ocs->updateShare($data['id']); $this->fail(); } catch (OCSBadRequestException $e) { - } $ocs->cleanup(); @@ -933,7 +926,6 @@ class ApiTest extends TestCase { * @depends testCreateShareLink */ function testUpdateShare() { - $password = md5(time()); $node1 = $this->userFolder->get($this->filename); @@ -1054,7 +1046,6 @@ class ApiTest extends TestCase { $ocs->updateShare($share1->getId()); $this->fail(); } catch (OCSBadRequestException $e) { - } $ocs->cleanup(); @@ -1069,7 +1060,6 @@ class ApiTest extends TestCase { $ocs->updateShare($share1->getId()); $this->fail(); } catch (OCSBadRequestException $e) { - } $ocs->cleanup(); @@ -1372,7 +1362,7 @@ class ApiTest extends TestCase { try { $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d')); $this->fail(); - } catch(OCSException $e) { + } catch (OCSException $e) { $this->assertEquals(404, $e->getCode()); $this->assertEquals('Expiration date is in the past', $e->getMessage()); } diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 94e5504aece..355a1a8bb1b 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -129,7 +129,7 @@ class CacheTest extends TestCase { } protected function tearDown(): void { - if($this->sharedCache) { + if ($this->sharedCache) { $this->sharedCache->clear(); } @@ -219,7 +219,6 @@ class CacheTest extends TestCase { $this->verifyFiles($expectedFiles, $results); } - } /** * Test searching by mime type diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php index e4c15887636..a49074cb60e 100644 --- a/apps/files_sharing/tests/CapabilitiesTest.php +++ b/apps/files_sharing/tests/CapabilitiesTest.php @@ -285,5 +285,4 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertArrayHasKey('federation', $result); $this->assertFalse($result['federation']['outgoing']); } - } diff --git a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php index 9be1141f35f..dd03ffc6668 100644 --- a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php +++ b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php @@ -191,6 +191,5 @@ class CleanupRemoteStoragesTest extends TestCase { $this->assertFalse($this->doesStorageExist($this->storages[3]['numeric_id'])); $this->assertTrue($this->doesStorageExist($this->storages[4]['numeric_id'])); $this->assertFalse($this->doesStorageExist($this->storages[5]['numeric_id'])); - } } diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index a43c050634b..2f1df959afb 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -162,7 +162,9 @@ class ShareControllerTest extends \Test\TestCase { \OC_User::setUserId(''); Filesystem::tearDown(); $user = \OC::$server->getUserManager()->get($this->user); - if ($user !== null) { $user->delete(); } + if ($user !== null) { + $user->delete(); + } \OC_User::setIncognitoMode(false); \OC::$server->getSession()->set('public_link_authenticated', ''); @@ -208,7 +210,6 @@ class ShareControllerTest extends \Test\TestCase { public function testShowShare() { - $note = 'personal note'; $this->shareController->setToken('token'); @@ -356,7 +357,6 @@ class ShareControllerTest extends \Test\TestCase { } public function testShowShareWithPrivateName() { - $note = 'personal note'; $this->shareController->setToken('token'); diff --git a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php index 0ed98f27cd3..a885750a566 100644 --- a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php +++ b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php @@ -100,11 +100,11 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase { $userManager = \OC::$server->getUserManager(); $user1 = $userManager->get($this->user1); - if($user1) { + if ($user1) { $user1->delete(); } $user2 = $userManager->get($this->user2); - if($user2) { + if ($user2) { $user2->delete(); } diff --git a/apps/files_sharing/tests/EncryptedSizePropagationTest.php b/apps/files_sharing/tests/EncryptedSizePropagationTest.php index 23f552260d6..9a8ff29d70a 100644 --- a/apps/files_sharing/tests/EncryptedSizePropagationTest.php +++ b/apps/files_sharing/tests/EncryptedSizePropagationTest.php @@ -42,5 +42,4 @@ class EncryptedSizePropagationTest extends SizePropagationTest { $this->loginWithEncryption($name); return new View('/' . $name . '/files'); } - } diff --git a/apps/files_sharing/tests/ExpireSharesJobTest.php b/apps/files_sharing/tests/ExpireSharesJobTest.php index 4fe1ccc7719..f8bf900cb79 100644 --- a/apps/files_sharing/tests/ExpireSharesJobTest.php +++ b/apps/files_sharing/tests/ExpireSharesJobTest.php @@ -78,11 +78,11 @@ class ExpireSharesJobTest extends \Test\TestCase { $userManager = \OC::$server->getUserManager(); $user1 = $userManager->get($this->user1); - if($user1) { + if ($user1) { $user1->delete(); } $user2 = $userManager->get($this->user2); - if($user2) { + if ($user2) { $user2->delete(); } @@ -213,5 +213,4 @@ class ExpireSharesJobTest extends \Test\TestCase { $shares = $this->getShares(); $this->assertCount(1, $shares); } - } diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php index 466806e09cb..be8911961df 100644 --- a/apps/files_sharing/tests/External/CacheTest.php +++ b/apps/files_sharing/tests/External/CacheTest.php @@ -130,5 +130,4 @@ class CacheTest extends TestCase { $results[0]['displayname_owner'] ); } - } diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index 5a1e8ad14e1..9c84cb668ef 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -123,7 +123,6 @@ class ManagerTest extends TestCase { } public function testAddShare() { - $shareData1 = [ 'remote' => 'http://localhost', 'token' => 'token1', diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php index f2bf5738f36..fa8df930a4e 100644 --- a/apps/files_sharing/tests/ExternalStorageTest.php +++ b/apps/files_sharing/tests/ExternalStorageTest.php @@ -39,7 +39,6 @@ use OCP\Http\Client\IResponse; * @group DB */ class ExternalStorageTest extends \Test\TestCase { - function optionsProvider() { return [ [ @@ -125,7 +124,6 @@ class ExternalStorageTest extends \Test\TestCase { * Dummy subclass to make it possible to access private members */ class TestSharingExternalStorage extends \OCA\Files_Sharing\External\Storage { - public function getBaseUri() { return $this->createBaseUri(); } diff --git a/apps/files_sharing/tests/HelperTest.php b/apps/files_sharing/tests/HelperTest.php index 4a27ca4afec..a4311f908b3 100644 --- a/apps/files_sharing/tests/HelperTest.php +++ b/apps/files_sharing/tests/HelperTest.php @@ -47,7 +47,5 @@ class HelperTest extends TestCase { // cleanup \OC::$server->getConfig()->deleteSystemValue('share_folder'); - } - } diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php index bb50cc5bd38..c6a799f64a6 100644 --- a/apps/files_sharing/tests/LockingTest.php +++ b/apps/files_sharing/tests/LockingTest.php @@ -104,7 +104,6 @@ class LockingTest extends TestCase { } public function testChangeLock() { - Filesystem::initMountPoints($this->recipientUid); $recipientView = new View('/' . $this->recipientUid . '/files'); $recipientView->lockFile('bar.txt', ILockingProvider::LOCK_SHARED); diff --git a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php index 08d8e6e1486..c290183d046 100644 --- a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php @@ -154,5 +154,4 @@ class ShareInfoMiddlewareTest extends TestCase { } class ShareInfoMiddlewareTestController extends Controller { - } diff --git a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php index 29dafb5762d..2c33f5617b7 100644 --- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php @@ -101,14 +101,12 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { } public function externalSharesChecksDataProvider() { - $data = []; foreach ([false, true] as $annIn) { foreach ([false, true] as $annOut) { foreach ([false, true] as $confIn) { foreach ([false, true] as $confOut) { - $res = true; if (!$annIn && !$confIn) { $res = false; @@ -186,7 +184,6 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { } public function testBeforeControllerWithShareControllerWithSharingEnabled() { - $share = $this->createMock(IShare::class); $this->appManager @@ -229,6 +226,4 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { public function testAfterExceptionWithS2SException() { $this->assertEquals(new JSONResponse('My Exception message', 405), $this->sharingCheckMiddleware->afterException($this->controllerMock, 'myMethod', new S2SException('My Exception message'))); } - - } diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index 63c2f2d19e3..313c8d8ac56 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -34,7 +34,6 @@ namespace OCA\Files_Sharing\Tests; * @group DB */ class ShareTest extends TestCase { - const TEST_FOLDER_NAME = '/folder_share_api_test'; private static $tempStorage; @@ -128,7 +127,6 @@ class ShareTest extends TestCase { } public function testShareWithDifferentShareFolder() { - $fileinfo = $this->view->getFileInfo($this->filename); $folderinfo = $this->view->getFileInfo($this->folder); @@ -203,7 +201,6 @@ class ShareTest extends TestCase { * @dataProvider dataProviderTestFileSharePermissions */ public function testFileSharePermissions($permission, $expectedvalid) { - $pass = true; try { $this->share( @@ -237,7 +234,6 @@ class ShareTest extends TestCase { } public function testFileOwner() { - $this->share( \OCP\Share::SHARE_TYPE_USER, $this->filename, diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index f3fe96d2c3d..59c0e3b76af 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -287,7 +287,9 @@ class SharedMountTest extends TestCase { foreach ($allPermissions as $before) { foreach ($allPermissions as $after) { - if ($before === $after) { continue; } + if ($before === $after) { + continue; + } $data[] = [ 'file', @@ -309,7 +311,9 @@ class SharedMountTest extends TestCase { foreach ($allPermissions as $before) { foreach ($allPermissions as $after) { - if ($before === $after) { continue; } + if ($before === $after) { + continue; + } $data[] = [ 'folder', @@ -331,7 +335,6 @@ class SharedMountTest extends TestCase { * @dataProvider dataPermissionMovedGroupShare */ public function testPermissionMovedGroupShare($type, $beforePerm, $afterPerm) { - if ($type === 'file') { $path = $this->filename; } elseif ($type === 'folder') { @@ -456,7 +459,6 @@ class SharedMountTest extends TestCase { $testGroup->removeUser($user2); $testGroup->removeUser($user3); } - } class DummyTestClassSharedMount extends \OCA\Files_Sharing\SharedMount { diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 936295f45b7..7d20d98585f 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -40,7 +40,6 @@ use OCP\Share\IShare; * @group DB */ class SharedStorageTest extends TestCase { - protected function setUp(): void { parent::setUp(); \OCA\Files_Trashbin\Trashbin::registerHooks(); @@ -565,7 +564,6 @@ class SharedStorageTest extends TestCase { $this->view->unlink($this->folder); $this->shareManager->deleteShare($share); - } public function testInitWithNonExistingUser() { diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php index c9f024cd67a..323fc06f321 100644 --- a/apps/files_sharing/tests/TestCase.php +++ b/apps/files_sharing/tests/TestCase.php @@ -130,11 +130,17 @@ abstract class TestCase extends \Test\TestCase { public static function tearDownAfterClass(): void { // cleanup users $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER1); - if ($user !== null) { $user->delete(); } + if ($user !== null) { + $user->delete(); + } $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER2); - if ($user !== null) { $user->delete(); } + if ($user !== null) { + $user->delete(); + } $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER3); - if ($user !== null) { $user->delete(); } + if ($user !== null) { + $user->delete(); + } // delete group $group = \OC::$server->getGroupManager()->get(self::TEST_FILES_SHARING_API_GROUP1); @@ -161,7 +167,6 @@ abstract class TestCase extends \Test\TestCase { * @param bool $password */ protected static function loginHelper($user, $create = false, $password = false) { - if ($password === false) { $password = $user; } @@ -218,7 +223,6 @@ abstract class TestCase extends \Test\TestCase { $result->closeCursor(); return $share; - } /** diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php index d12bda4006c..56fdeb44a30 100644 --- a/apps/files_sharing/tests/UnshareChildrenTest.php +++ b/apps/files_sharing/tests/UnshareChildrenTest.php @@ -35,7 +35,6 @@ namespace OCA\Files_Sharing\Tests; * @package OCA\Files_Sharing\Tests */ class UnshareChildrenTest extends TestCase { - protected $subsubfolder; const TEST_FOLDER_NAME = '/folder_share_api_test'; @@ -75,7 +74,6 @@ class UnshareChildrenTest extends TestCase { * @medium */ public function testUnshareChildren() { - $fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder); $this->share( diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php index 7ca883c78f8..0abc76df433 100644 --- a/apps/files_sharing/tests/UpdaterTest.php +++ b/apps/files_sharing/tests/UpdaterTest.php @@ -36,7 +36,6 @@ namespace OCA\Files_Sharing\Tests; * @group DB */ class UpdaterTest extends TestCase { - const TEST_FOLDER_NAME = '/folder_share_updater_test'; public static function setUpBeforeClass(): void { @@ -199,7 +198,6 @@ class UpdaterTest extends TestCase { * if a folder gets renamed all children mount points should be renamed too */ public function testRename() { - $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder); $share = $this->share( @@ -234,5 +232,4 @@ class UpdaterTest extends TestCase { // cleanup $this->shareManager->deleteShare($share); } - } |