summaryrefslogtreecommitdiffstats
path: root/lib/files/cache/permissions.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-05-29 15:25:42 +0200
committerRobin Appelman <icewind@owncloud.com>2013-05-29 15:25:42 +0200
commit44d217c42529c3f4a0df0a56255887450d37e00b (patch)
treeee0aa97f1214bac23c707cbb9c34208f1747e7e0 /lib/files/cache/permissions.php
parent7c0c6bd779cb73c4fdc9993f6dc78f9dd1138a88 (diff)
downloadnextcloud-server-44d217c42529c3f4a0df0a56255887450d37e00b.tar.gz
nextcloud-server-44d217c42529c3f4a0df0a56255887450d37e00b.zip
Cache: provide a function to get the permissions of all files in a folder with one query
Diffstat (limited to 'lib/files/cache/permissions.php')
-rw-r--r--lib/files/cache/permissions.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/files/cache/permissions.php b/lib/files/cache/permissions.php
index faa5ff5eacc..73473142c74 100644
--- a/lib/files/cache/permissions.php
+++ b/lib/files/cache/permissions.php
@@ -86,6 +86,25 @@ class Permissions {
}
/**
+ * get the permissions for all files in a folder
+ *
+ * @param int $parentId
+ * @return int[]
+ */
+ public function getDirectoryPermissions($parentId) {
+ $query = \OC_DB::prepare('SELECT `*PREFIX*permissions`.`fileid`, `permissions`
+ FROM `*PREFIX*permissions` INNER JOIN `*PREFIX*filecache` ON `*PREFIX*permissions`.fileid = `*PREFIX*filecache`.fileid
+ WHERE `*PREFIX*filecache`.parent = ?');
+
+ $result = $query->execute(array($parentId));
+ $filePermissions = array();
+ while ($row = $result->fetchRow()) {
+ $filePermissions[$row['fileid']] = $row['permissions'];
+ }
+ return $filePermissions;
+ }
+
+ /**
* remove the permissions for a file
*
* @param int $fileId