diff options
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/appinfo/routes.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/lib/Activity/Providers/RemoteShares.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/Capabilities.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/Command/CleanupRemoteStorages.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/lib/ExpireSharesJob.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/ShareBackend/Folder.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/tests/BackendTest.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/tests/CapabilitiesTest.php | 3 | ||||
-rw-r--r-- | apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/tests/HelperTest.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/tests/MountProviderTest.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/tests/SharedMountTest.php | 18 | ||||
-rw-r--r-- | apps/files_sharing/tests/SizePropagationTest.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/tests/UnshareChildrenTest.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/tests/UpdaterTest.php | 8 |
16 files changed, 26 insertions, 37 deletions
diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php index 56eece341a9..7a5f5650fc5 100644 --- a/apps/files_sharing/appinfo/routes.php +++ b/apps/files_sharing/appinfo/routes.php @@ -26,8 +26,6 @@ * */ -use OCP\API; - $application = new \OCA\Files_Sharing\AppInfo\Application(); $application->registerRoutes($this, [ 'resources' => [ @@ -127,7 +125,3 @@ $application->registerRoutes($this, [ /** @var $this \OCP\Route\IRouter */ $this->create('sharing_external_shareinfo', '/shareinfo') ->actionInclude('files_sharing/ajax/shareinfo.php'); - -// OCS API - -//TODO: SET: mail notification, waiting for PR #4689 to be accepted diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php index cf4954800e8..f89fb0b0052 100644 --- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php +++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php @@ -23,9 +23,7 @@ namespace OCA\Files_Sharing\Activity\Providers; use OCP\Activity\IEvent; use OCP\Activity\IManager; -use OCP\Activity\IProvider; use OCP\Federation\ICloudIdManager; -use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUserManager; use OCP\L10N\IFactory; diff --git a/apps/files_sharing/lib/Capabilities.php b/apps/files_sharing/lib/Capabilities.php index 22a8a8a0a3d..e8e6a4c26f3 100644 --- a/apps/files_sharing/lib/Capabilities.php +++ b/apps/files_sharing/lib/Capabilities.php @@ -71,7 +71,7 @@ class Capabilities implements ICapability { $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes'; $public['upload_files_drop'] = $public['upload']; } - $res["public"] = $public; + $res['public'] = $public; $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes'; diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php index 504caba1417..389b0dc4985 100644 --- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php +++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php @@ -60,11 +60,11 @@ class CleanupRemoteStorages extends Command { $remoteStorages = $this->getRemoteStorages(); - $output->writeln(count($remoteStorages) . " remote storage(s) need(s) to be checked"); + $output->writeln(count($remoteStorages) . ' remote storage(s) need(s) to be checked'); $remoteShareIds = $this->getRemoteShareIds(); - $output->writeln(count($remoteShareIds) . " remote share(s) exist"); + $output->writeln(count($remoteShareIds) . ' remote share(s) exist'); foreach ($remoteShareIds as $id => $remoteShareId) { if (isset($remoteStorages[$remoteShareId])) { @@ -79,7 +79,7 @@ class CleanupRemoteStorages extends Command { } if (empty($remoteStorages)) { - $output->writeln("<info>no storages deleted</info>"); + $output->writeln('<info>no storages deleted</info>'); } else { $dryRun = $input->getOption('dry-run'); foreach ($remoteStorages as $id => $numericId) { diff --git a/apps/files_sharing/lib/ExpireSharesJob.php b/apps/files_sharing/lib/ExpireSharesJob.php index 19c0606dc46..212b7fa008e 100644 --- a/apps/files_sharing/lib/ExpireSharesJob.php +++ b/apps/files_sharing/lib/ExpireSharesJob.php @@ -44,7 +44,6 @@ class ExpireSharesJob extends TimedJob { */ public function run($argument) { $connection = \OC::$server->getDatabaseConnection(); - $logger = \OC::$server->getLogger(); //Current time $now = new \DateTime(); diff --git a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php index 5712b96b97d..9dd8d2e5ae9 100644 --- a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php +++ b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php @@ -37,6 +37,7 @@ use OCA\Files_Sharing\Exceptions\S2SException; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; use OCP\Share\IManager; +use OCP\Share\Exceptions\ShareNotFound; /** * Checks whether the "sharing check" is enabled @@ -88,6 +89,7 @@ class SharingCheckMiddleware extends Middleware { * @param string $methodName * @throws NotFoundException * @throws S2SException + * @throws ShareNotFound */ public function beforeController($controller, $methodName) { if(!$this->isSharingEnabled()) { diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php index 4929bebf40b..07e353cc6a6 100644 --- a/apps/files_sharing/lib/ShareBackend/Folder.php +++ b/apps/files_sharing/lib/ShareBackend/Folder.php @@ -50,8 +50,8 @@ class Folder extends File implements \OCP\Share_Backend_Collection { $share['file_path'] = $name; $displayNameOwner = \OCP\User::getDisplayName($share['uid_owner']); $displayNameShareWith = \OCP\User::getDisplayName($share['share_with']); - $share['displayname_owner'] = ($displayNameOwner) ? $displayNameOwner : $share['uid_owner']; - $share['share_with_displayname'] = ($displayNameShareWith) ? $displayNameShareWith : $share['uid_owner']; + $share['displayname_owner'] = $displayNameOwner ? $displayNameOwner : $share['uid_owner']; + $share['share_with_displayname'] = $displayNameShareWith ? $displayNameShareWith : $share['uid_owner']; $result[] = $share; } @@ -72,7 +72,7 @@ class Folder extends File implements \OCP\Share_Backend_Collection { $query = \OCP\DB::prepare('SELECT `parent` FROM `*PREFIX*filecache` WHERE `fileid` = ?'); $result = $query->execute(array($child)); $row = $result->fetchRow(); - $parent = ($row) ? $row['parent'] : null; + $parent = $row ? $row['parent'] : null; return $parent; } diff --git a/apps/files_sharing/tests/BackendTest.php b/apps/files_sharing/tests/BackendTest.php index cea8762a5b4..b9c7f0e813d 100644 --- a/apps/files_sharing/tests/BackendTest.php +++ b/apps/files_sharing/tests/BackendTest.php @@ -68,7 +68,7 @@ class BackendTest extends TestCase { parent::tearDown(); } - function testGetParents() { + public function testGetParents() { $fileinfo1 = $this->view->getFileInfo($this->folder); $fileinfo2 = $this->view->getFileInfo($this->folder . $this->subfolder . $this->subsubfolder); diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php index 663adc1f271..1747bbc4ed2 100644 --- a/apps/files_sharing/tests/CapabilitiesTest.php +++ b/apps/files_sharing/tests/CapabilitiesTest.php @@ -24,8 +24,7 @@ namespace OCA\Files_Sharing\Tests; use OCA\Files_Sharing\Capabilities; -use OCA\Files_Sharing\Tests\TestCase; -use OCP\App\IAppManager; + /** * Class CapabilitiesTest diff --git a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php index 5dcf7f83105..827fcc15797 100644 --- a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php +++ b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php @@ -22,7 +22,6 @@ namespace OCA\Files_Sharing\Tests\Command; use OCA\Files_Sharing\Command\CleanupRemoteStorages; -use OCP\DB\QueryBuilder\IQueryBuilder; use Test\TestCase; /** diff --git a/apps/files_sharing/tests/HelperTest.php b/apps/files_sharing/tests/HelperTest.php index d5fe83f44e2..e1e73ee82c2 100644 --- a/apps/files_sharing/tests/HelperTest.php +++ b/apps/files_sharing/tests/HelperTest.php @@ -35,7 +35,7 @@ class HelperTest extends TestCase { /** * test set and get share folder */ - function testSetGetShareFolder() { + public function testSetGetShareFolder() { $this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder()); \OCA\Files_Sharing\Helper::setShareFolder('/Shared/Folder'); diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index b700d417ad4..04476987a32 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -33,7 +33,6 @@ use OCP\IUser; use OCP\IUserManager; use OCP\Share\IShare; use OCP\Share\IManager; -use OCP\Files\Mount\IMountPoint; /** * @group DB diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index 72cc891e368..6f21bd3b92d 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -54,8 +54,8 @@ class SharedMountTest extends TestCase { $this->view->mkdir($this->folder); // save file with content - $this->view->file_put_contents($this->filename, "root file"); - $this->view->file_put_contents($this->folder . $this->filename, "file in subfolder"); + $this->view->file_put_contents($this->filename, 'root file'); + $this->view->file_put_contents($this->folder . $this->filename, 'file in subfolder'); $this->groupManager = \OC::$server->getGroupManager(); $this->userManager = \OC::$server->getUserManager(); @@ -204,18 +204,18 @@ class SharedMountTest extends TestCase { $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename)); - \OC\Files\Filesystem::rename($this->filename, "newFileName"); + \OC\Files\Filesystem::rename($this->filename, 'newFileName'); $this->assertTrue(\OC\Files\Filesystem::file_exists('newFileName')); $this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename)); self::loginHelper(self::TEST_FILES_SHARING_API_USER3); $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename)); - $this->assertFalse(\OC\Files\Filesystem::file_exists("newFileName")); + $this->assertFalse(\OC\Files\Filesystem::file_exists('newFileName')); self::loginHelper(self::TEST_FILES_SHARING_API_USER3); $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename)); - $this->assertFalse(\OC\Files\Filesystem::file_exists("newFileName")); + $this->assertFalse(\OC\Files\Filesystem::file_exists('newFileName')); //cleanup self::loginHelper(self::TEST_FILES_SHARING_API_USER1); @@ -240,7 +240,7 @@ class SharedMountTest extends TestCase { if ($exception) { $this->assertSame(10, $e->getCode()); } else { - $this->assertTrue(false, "Exception catched, but expected: " . $expectedResult); + $this->assertTrue(false, 'Exception catched, but expected: ' . $expectedResult); } } } @@ -323,7 +323,7 @@ class SharedMountTest extends TestCase { * * @dataProvider dataPermissionMovedGroupShare */ - function testPermissionMovedGroupShare($type, $beforePerm, $afterPerm) { + public function testPermissionMovedGroupShare($type, $beforePerm, $afterPerm) { if ($type === 'file') { $path = $this->filename; @@ -355,7 +355,7 @@ class SharedMountTest extends TestCase { $this->assertEquals($beforePerm, $result->getPermissions()); // Now move the item forcing a new entry in the share table - \OC\Files\Filesystem::rename($path, "newPath"); + \OC\Files\Filesystem::rename($path, 'newPath'); $this->assertTrue(\OC\Files\Filesystem::file_exists('newPath')); $this->assertFalse(\OC\Files\Filesystem::file_exists($path)); @@ -388,7 +388,7 @@ class SharedMountTest extends TestCase { * If the permissions on a group share are upgraded be sure to still respect * removed shares by a member of that group */ - function testPermissionUpgradeOnUserDeletedGroupShare() { + public function testPermissionUpgradeOnUserDeletedGroupShare() { $testGroup = $this->groupManager->createGroup('testGroup'); $user1 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER1); $user2 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER2); diff --git a/apps/files_sharing/tests/SizePropagationTest.php b/apps/files_sharing/tests/SizePropagationTest.php index 9d80633b46a..f7ad9057959 100644 --- a/apps/files_sharing/tests/SizePropagationTest.php +++ b/apps/files_sharing/tests/SizePropagationTest.php @@ -26,7 +26,6 @@ namespace OCA\Files_Sharing\Tests; use OC\Files\View; -use Test\Traits\MountProviderTrait; use Test\Traits\UserTrait; /** diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php index 2bde37af20e..ce7767d1920 100644 --- a/apps/files_sharing/tests/UnshareChildrenTest.php +++ b/apps/files_sharing/tests/UnshareChildrenTest.php @@ -74,7 +74,7 @@ class UnshareChildrenTest extends TestCase { /** * @medium */ - function testUnshareChildren() { + public function testUnshareChildren() { $fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder); diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php index bb320336d48..c35bcf1a08c 100644 --- a/apps/files_sharing/tests/UpdaterTest.php +++ b/apps/files_sharing/tests/UpdaterTest.php @@ -69,7 +69,7 @@ class UpdaterTest extends TestCase { * points should be unshared before the folder gets deleted so * that the mount point doesn't end up at the trash bin */ - function testDeleteParentFolder() { + public function testDeleteParentFolder() { $status = \OC_App::isEnabled('files_trashbin'); (new \OC_App())->enable('files_trashbin'); @@ -96,8 +96,8 @@ class UpdaterTest extends TestCase { $foldersShared = \OCP\Share::getItemsSharedWith('folder'); $this->assertSame(1, count($foldersShared)); - $view->mkdir("localFolder"); - $view->file_put_contents("localFolder/localFile.txt", "local file"); + $view->mkdir('localFolder'); + $view->file_put_contents('localFolder/localFile.txt', 'local file'); $view->rename($this->folder, 'localFolder/' . $this->folder); @@ -196,7 +196,7 @@ class UpdaterTest extends TestCase { /** * if a folder gets renamed all children mount points should be renamed too */ - function testRename() { + public function testRename() { $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder); |