diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-12-12 11:18:35 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-12-12 11:18:35 +0100 |
commit | 15ecb28d50e5b8ce4100075caa52d96d4f00ae13 (patch) | |
tree | 02ca5b15c2a09afaa6a44a71fcf14d3c53184200 /lib/private/files/node/folder.php | |
parent | 25dde7e93bc648ec8cd14b8f2711d50f77d8d1bf (diff) | |
download | nextcloud-server-15ecb28d50e5b8ce4100075caa52d96d4f00ae13.tar.gz nextcloud-server-15ecb28d50e5b8ce4100075caa52d96d4f00ae13.zip |
Make $userId mandatory for searchByTags
$userId is now a mandatory parameter for searchByTags.
Also fixed some places in the code where the argument was missing (Node
API and View)
Diffstat (limited to 'lib/private/files/node/folder.php')
-rw-r--r-- | lib/private/files/node/folder.php | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php index a65e641388d..bdfb2346716 100644 --- a/lib/private/files/node/folder.php +++ b/lib/private/files/node/folder.php @@ -223,7 +223,7 @@ class Folder extends Node implements \OCP\Files\Folder { * @return \OC\Files\Node\Node[] */ public function search($query) { - return $this->searchCommon('%' . $query . '%', 'search'); + return $this->searchCommon('search', array('%' . $query . '%')); } /** @@ -233,25 +233,26 @@ class Folder extends Node implements \OCP\Files\Folder { * @return Node[] */ public function searchByMime($mimetype) { - return $this->searchCommon($mimetype, 'searchByMime'); + return $this->searchCommon('searchByMime', array($mimetype)); } /** * search for files by tag * - * @param string $tag + * @param string|int $tag name or tag id + * @param string $userId owner of the tags * @return Node[] */ - public function searchByTag($tag) { - return $this->searchCommon($tag, 'searchByTag'); + public function searchByTag($tag, $userId) { + return $this->searchCommon('searchByTag', array($tag, $userId)); } /** - * @param string $query - * @param string $method + * @param string $method cache method + * @param array $args call args * @return \OC\Files\Node\Node[] */ - private function searchCommon($query, $method) { + private function searchCommon($method, $args) { $files = array(); $rootLength = strlen($this->path); /** @@ -262,7 +263,7 @@ class Folder extends Node implements \OCP\Files\Folder { $cache = $storage->getCache(''); - $results = $cache->$method($query); + $results = call_user_func_array(array($cache, $method), $args); foreach ($results as $result) { if ($internalRootLength === 0 or substr($result['path'], 0, $internalRootLength) === $internalPath) { $result['internalPath'] = $result['path']; @@ -279,7 +280,7 @@ class Folder extends Node implements \OCP\Files\Folder { $cache = $storage->getCache(''); $relativeMountPoint = substr($mount->getMountPoint(), $rootLength); - $results = $cache->$method($query); + $results = call_user_func_array(array($cache, $method), $args); foreach ($results as $result) { $result['internalPath'] = $result['path']; $result['path'] = $relativeMountPoint . $result['path']; |