Merge pull request #7279 from owncloud/folderid-reuse

Reuse the folder id in View->getFolderContents
This commit is contained in:
icewind1991 2014-02-26 12:18:34 +01:00
commit 59df3ffdf4
2 changed files with 13 additions and 2 deletions

View File

@ -166,6 +166,16 @@ class Cache {
*/
public function getFolderContents($folder) {
$fileId = $this->getId($folder);
return $this->getFolderContentsById($fileId);
}
/**
* get the metadata of all files stored in $folder
*
* @param int $fileId the file id of the folder
* @return array
*/
public function getFolderContentsById($fileId) {
if ($fileId > -1) {
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
`storage_mtime`, `encrypted`, `unencrypted_size`, `etag`

View File

@ -882,12 +882,13 @@ class View {
$watcher->checkUpdate($internalPath);
}
$folderId = $cache->getId($internalPath);
$files = array();
$contents = $cache->getFolderContents($internalPath); //TODO: mimetype_filter
$contents = $cache->getFolderContents($internalPath, $folderId); //TODO: mimetype_filter
foreach ($contents as $content) {
$files[] = new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content);
}
$permissions = $permissionsCache->getDirectoryPermissions($cache->getId($internalPath), $user);
$permissions = $permissionsCache->getDirectoryPermissions($folderId, $user);
$ids = array();
foreach ($files as $i => $file) {