diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/files_sharing/lib | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) |
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/lib')
41 files changed, 27 insertions, 98 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 { } } } - } |