summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-08-16 08:55:06 +0200
committerGitHub <noreply@github.com>2017-08-16 08:55:06 +0200
commit4c558c99f326d4b399cc503c8c1a43e1099ba9d9 (patch)
tree2a86f93aa7b4549cdd95ff7acf3f0e0008a57f2b
parentd7406e515952bfa2c2659ecd44599bb0e5afbeec (diff)
parenta55e794bfdafc3719b0053709dbefd506692fa1b (diff)
downloadnextcloud-server-4c558c99f326d4b399cc503c8c1a43e1099ba9d9.tar.gz
nextcloud-server-4c558c99f326d4b399cc503c8c1a43e1099ba9d9.zip
Merge pull request #6130 from nextcloud/cleanup-unused-methods
Cleanup unused methods
-rw-r--r--apps/files_sharing/lib/Controller/ShareesAPIController.php2
-rw-r--r--apps/files_sharing/lib/ExpireSharesJob.php2
-rw-r--r--apps/files_sharing/tests/SharedStorageTest.php2
-rw-r--r--apps/files_sharing/tests/UpdaterTest.php4
-rw-r--r--lib/public/Share.php57
-rw-r--r--tests/lib/Files/ViewTest.php2
-rw-r--r--tests/lib/Share/Backend.php2
-rw-r--r--tests/lib/Share/ShareTest.php26
8 files changed, 20 insertions, 77 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php
index a2ab03bd853..94a4854dbde 100644
--- a/apps/files_sharing/lib/Controller/ShareesAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php
@@ -506,7 +506,7 @@ class ShareesAPIController extends OCSController {
*/
protected function isRemoteSharingAllowed($itemType) {
try {
- $backend = Share::getBackend($itemType);
+ $backend = \OC\Share\Share::getBackend($itemType);
return $backend->isShareTypeAllowed(Share::SHARE_TYPE_REMOTE);
} catch (\Exception $e) {
return false;
diff --git a/apps/files_sharing/lib/ExpireSharesJob.php b/apps/files_sharing/lib/ExpireSharesJob.php
index 212b7fa008e..e7e10b30c12 100644
--- a/apps/files_sharing/lib/ExpireSharesJob.php
+++ b/apps/files_sharing/lib/ExpireSharesJob.php
@@ -68,7 +68,7 @@ class ExpireSharesJob extends TimedJob {
$shares = $qb->execute();
while($share = $shares->fetch()) {
- \OCP\Share::unshare($share['item_type'], $share['file_source'], \OCP\Share::SHARE_TYPE_LINK, null, $share['uid_owner']);
+ \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/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php
index 7d007cb6414..c443aa9c45f 100644
--- a/apps/files_sharing/tests/SharedStorageTest.php
+++ b/apps/files_sharing/tests/SharedStorageTest.php
@@ -298,7 +298,7 @@ class SharedStorageTest extends TestCase {
//cleanup
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
- $result = \OCP\Share::unshare('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ $result = \OC\Share\Share::unshare('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER,
self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue($result);
}
diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php
index c35bcf1a08c..63000152b5a 100644
--- a/apps/files_sharing/tests/UpdaterTest.php
+++ b/apps/files_sharing/tests/UpdaterTest.php
@@ -93,7 +93,7 @@ class UpdaterTest extends TestCase {
// check if user2 can see the shared folder
$this->assertTrue($view->file_exists($this->folder));
- $foldersShared = \OCP\Share::getItemsSharedWith('folder');
+ $foldersShared = \OC\Share\Share::getItemsSharedWith('folder');
$this->assertSame(1, count($foldersShared));
$view->mkdir('localFolder');
@@ -110,7 +110,7 @@ class UpdaterTest extends TestCase {
$this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
// shared folder should be unshared
- $foldersShared = \OCP\Share::getItemsSharedWith('folder');
+ $foldersShared = \OC\Share\Share::getItemsSharedWith('folder');
$this->assertTrue(empty($foldersShared));
// trashbin should contain the local file but not the mount point
diff --git a/lib/public/Share.php b/lib/public/Share.php
index 8007068abc9..8e73fb15f0f 100644
--- a/lib/public/Share.php
+++ b/lib/public/Share.php
@@ -53,39 +53,6 @@ namespace OCP;
class Share extends \OC\Share\Constants {
/**
- * Get the items of item type shared with the current user
- * @param string $itemType
- * @param int $format (optional) Format type must be defined by the backend
- * @param mixed $parameters (optional)
- * @param int $limit Number of items to return (optional) Returns all by default
- * @param bool $includeCollections (optional)
- * @return mixed Return depends on format
- * @since 5.0.0
- */
- public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE,
- $parameters = null, $limit = -1, $includeCollections = false) {
-
- return \OC\Share\Share::getItemsSharedWith($itemType, $format, $parameters, $limit, $includeCollections);
- }
-
- /**
- * Get the items of item type shared with a user
- * @param string $itemType
- * @param string $user for which user we want the shares
- * @param int $format (optional) Format type must be defined by the backend
- * @param mixed $parameters (optional)
- * @param int $limit Number of items to return (optional) Returns all by default
- * @param bool $includeCollections (optional)
- * @return mixed Return depends on format
- * @since 7.0.0
- */
- public static function getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE,
- $parameters = null, $limit = -1, $includeCollections = false) {
-
- return \OC\Share\Share::getItemsSharedWithUser($itemType, $user, $format, $parameters, $limit, $includeCollections);
- }
-
- /**
* Get the item of item type shared with a given user by source
* @param string $itemType
* @param string $itemSource
@@ -168,20 +135,6 @@ class Share extends \OC\Share\Constants {
}
/**
- * Unshare an item from a user, group, or delete a private link
- * @param string $itemType
- * @param string $itemSource
- * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
- * @param string $shareWith User or group the item is being shared with
- * @param string $owner owner of the share, if null the current user is used
- * @return boolean true on success or false on failure
- * @since 5.0.0 - parameter $owner was added in 8.0.0
- */
- public static function unshare($itemType, $itemSource, $shareType, $shareWith, $owner = null) {
- return \OC\Share\Share::unshare($itemType, $itemSource, $shareType, $shareWith, $owner);
- }
-
- /**
* sent status if users got informed by mail about share
* @param string $itemType
* @param string $itemSource
@@ -193,14 +146,4 @@ class Share extends \OC\Share\Constants {
public static function setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status) {
return \OC\Share\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status);
}
-
- /**
- * Get the backend class for the specified item type
- * @param string $itemType
- * @return Share_Backend
- * @since 5.0.0
- */
- public static function getBackend($itemType) {
- return \OC\Share\Share::getBackend($itemType);
- }
}
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 410c2ade847..cab8bd62739 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -1672,7 +1672,7 @@ class ViewTest extends \Test\TestCase {
$this->assertFalse($view->rename('mount1', 'shareddir/sub'), 'Cannot move mount point into shared folder');
$this->assertFalse($view->rename('mount1', 'shareddir/sub/sub2'), 'Cannot move mount point into shared subfolder');
- $this->assertTrue(Share::unshare('folder', $fileId, Share::SHARE_TYPE_USER, 'test2'));
+ $this->assertTrue(\OC\Share\Share::unshare('folder', $fileId, Share::SHARE_TYPE_USER, 'test2'));
$userObject->delete();
}
diff --git a/tests/lib/Share/Backend.php b/tests/lib/Share/Backend.php
index c5007d1583b..13a86bfae30 100644
--- a/tests/lib/Share/Backend.php
+++ b/tests/lib/Share/Backend.php
@@ -47,7 +47,7 @@ class Backend implements \OCP\Share_Backend {
}
- $shares = \OCP\Share::getItemsSharedWithUser('test', $shareWith);
+ $shares = \OC\Share\Share::getItemsSharedWithUser('test', $shareWith);
$knownTargets = array();
foreach ($shares as $share) {
diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php
index 4f929446da0..e93b0f553cd 100644
--- a/tests/lib/Share/ShareTest.php
+++ b/tests/lib/Share/ShareTest.php
@@ -164,10 +164,10 @@ class ShareTest extends \Test\TestCase {
$result = \OCP\Share::getItemShared('folder', $fileId, Backend::FORMAT_SOURCE);
$this->assertNotEmpty($result);
- $result = \OCP\Share::getItemSharedWithUser('folder', $fileId, $this->user2->getUID());
+ $result = \OC\Share\Share::getItemSharedWithUser('folder', $fileId, $this->user2->getUID());
$this->assertNotEmpty($result);
- $result = \OCP\Share::getItemsSharedWithUser('folder', $this->user2->getUID());
+ $result = \OC\Share\Share::getItemsSharedWithUser('folder', $this->user2->getUID());
$this->assertNotEmpty($result);
// move to trash (keeps file id)
@@ -176,10 +176,10 @@ class ShareTest extends \Test\TestCase {
$result = \OCP\Share::getItemShared('folder', $fileId, Backend::FORMAT_SOURCE);
$this->assertEmpty($result, 'Share must not be returned for files outside of "files"');
- $result = \OCP\Share::getItemSharedWithUser('folder', $fileId, $this->user2->getUID());
+ $result = \OC\Share\Share::getItemSharedWithUser('folder', $fileId, $this->user2->getUID());
$this->assertEmpty($result, 'Share must not be returned for files outside of "files"');
- $result = \OCP\Share::getItemsSharedWithUser('folder', $this->user2->getUID());
+ $result = \OC\Share\Share::getItemsSharedWithUser('folder', $this->user2->getUID());
$this->assertEmpty($result, 'Share must not be returned for files outside of "files"');
}
@@ -242,7 +242,7 @@ class ShareTest extends \Test\TestCase {
'Failed asserting that user 1 successfully shared "test/sub1/file.txt" with user 2.'
);
- $result = \OCP\Share::getItemsSharedWithUser('file', $this->user2->getUID());
+ $result = \OC\Share\Share::getItemsSharedWithUser('file', $this->user2->getUID());
$this->assertCount(2, $result);
foreach ($result as $share) {
@@ -270,7 +270,7 @@ class ShareTest extends \Test\TestCase {
foreach($targetUsers as $targetUser) {
\OC_User::setUserId($targetUser);
- $items = \OCP\Share::getItemsSharedWithUser(
+ $items = \OC\Share\Share::getItemsSharedWithUser(
'test',
$targetUser,
Backend::FORMAT_TARGET
@@ -279,7 +279,7 @@ class ShareTest extends \Test\TestCase {
}
\OC_User::setUserId($this->user5->getUID());
- \OCP\Share::unshare(
+ \OC\Share\Share::unshare(
'test',
'test.txt',
\OCP\Share::SHARE_TYPE_GROUP,
@@ -289,7 +289,7 @@ class ShareTest extends \Test\TestCase {
// verify that all were deleted
foreach($targetUsers as $targetUser) {
\OC_User::setUserId($targetUser);
- $items = \OCP\Share::getItemsSharedWithUser(
+ $items = \OC\Share\Share::getItemsSharedWithUser(
'test',
$targetUser,
Backend::FORMAT_TARGET
@@ -403,7 +403,7 @@ class ShareTest extends \Test\TestCase {
public function testGetShareSubItemsWhenUserNotInGroup() {
\OC\Share\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), \OCP\Constants::PERMISSION_READ);
- $result = \OCP\Share::getItemsSharedWithUser('test', $this->user2->getUID());
+ $result = \OC\Share\Share::getItemsSharedWithUser('test', $this->user2->getUID());
$this->assertCount(1, $result);
$groupShareId = array_keys($result)[0];
@@ -412,7 +412,7 @@ class ShareTest extends \Test\TestCase {
$userObject = \OC::$server->getUserManager()->get($this->user2->getUID());
\OC::$server->getGroupManager()->get($this->group1->getGID())->removeUser($userObject);
- $result = \OCP\Share::getItemsSharedWithUser('test', $this->user2->getUID());
+ $result = \OC\Share\Share::getItemsSharedWithUser('test', $this->user2->getUID());
$this->assertCount(0, $result);
// test with buggy data
@@ -431,7 +431,7 @@ class ShareTest extends \Test\TestCase {
'stime' => $qb->expr()->literal(time()),
])->execute();
- $result = \OCP\Share::getItemsSharedWithUser('test', $this->user2->getUID());
+ $result = \OC\Share\Share::getItemsSharedWithUser('test', $this->user2->getUID());
$this->assertCount(0, $result);
$qb->delete('share')->execute();
@@ -585,7 +585,7 @@ class ShareTest extends \Test\TestCase {
->with($this->stringStartsWith('http://' . $urlHost . '/ocs/v2.php/cloud/shares/' . $share['id'] . '/unshare'), $this->anything())
->willReturn(['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 100]]])]);
- \OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, $shareWith);
+ \OC\Share\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, $shareWith);
$this->restoreService('HTTPHelper');
}
@@ -697,7 +697,7 @@ class ShareTest extends \Test\TestCase {
->with($this->stringStartsWith('https://localhost/ocs/v2.php/cloud/shares/' . $share['id'] . '/unshare'), $this->anything())
->willReturn(['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 100]]])]);
- \OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, 'foo@localhost');
+ \OC\Share\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, 'foo@localhost');
$this->restoreService('HTTPHelper');
}