Reuse the folder id in View->getFolderContents

This commit is contained in:
Robin Appelman 2014-02-19 10:46:02 +01:00
parent e517e642be
commit 1331de554c
2 changed files with 8 additions and 4 deletions

View File

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

View File

@ -880,12 +880,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) {