*/
private $cache;
- /**
- * @var \OC\Files\Cache\Permissions $permissionsCache
- */
- private $permissionsCache;
-
const SCAN_RECURSIVE = true;
const SCAN_SHALLOW = false;
$this->storage = $storage;
$this->storageId = $this->storage->getId();
$this->cache = $storage->getCache();
- $this->permissionsCache = $storage->getPermissionsCache();
}
/**
$data['mtime'] = $this->storage->filemtime($path);
if ($data['mimetype'] == 'httpd/unix-directory') {
$data['size'] = -1; //unknown
- $data['permissions'] = $this->storage->getPermissions($path . '/');
} else {
$data['size'] = $this->storage->filesize($path);
- $data['permissions'] = $this->storage->getPermissions($path);
}
return $data;
}
}
}
$id = $this->cache->put($file, $data);
- $this->permissionsCache->set($id, \OC_User::getUser(), $data['permissions']);
}
return $data;
}
list($storage, $internalPath) = Filesystem::resolvePath($path);
if ($storage) {
$cache = $storage->getCache($internalPath);
+ $permissionsCache = $storage->getPermissionsCache($internalPath);
+ $user = \OC_User::getUser();
if (!$cache->inCache($internalPath)) {
$scanner = $storage->getScanner($internalPath);
}
}
- $permissionsCache = $storage->getPermissionsCache($internalPath);
- $data['permissions'] = $permissionsCache->get($data['fileid'], \OC_User::getUser());
+ $permissions = $permissionsCache->get($data['fileid'], $user);
+ if ($permissions === -1) {
+ $permissions = $storage->getPermissions($internalPath);
+ $permissionsCache->set($data['fileid'], $user, $permissions);
+ }
+ $data['permissions'] = $permissions;
}
}
return $data;
list($storage, $internalPath) = Filesystem::resolvePath($path);
if ($storage) {
$cache = $storage->getCache($internalPath);
+ $permissionsCache = $storage->getPermissionsCache($internalPath);
+ $user = \OC_User::getUser();
if ($cache->getStatus($internalPath) < Cache\Cache::COMPLETE) {
$scanner = $storage->getScanner($internalPath);
foreach ($files as $i => $file) {
$files[$i]['type'] = $file['mimetype'] === 'httpd/unix-directory' ? 'dir' : 'file';
$ids[] = $file['fileid'];
- }
- $permissionsCache = $storage->getPermissionsCache($internalPath);
- $permissions = $permissionsCache->getMultiple($ids, \OC_User::getUser());
- foreach ($files as $i => $file) {
- $files[$i]['permissions'] = $permissions[$file['fileid']];
+ $permissions = $permissionsCache->get($file['fileid'], $user);
+ if ($permissions === -1) {
+ $permissions = $storage->getPermissions($file['path']);
+ $permissionsCache->set($file['fileid'], $user, $permissions);
+ }
+ $files[$i]['permissions'] = $permissions;
}
//add a folder for any mountpoint in this directory and add the sizes of other mountpoints to the folders
$rootEntry['name'] = $relativePath;
$rootEntry['type'] = $rootEntry['mimetype'] === 'httpd/unix-directory' ? 'dir' : 'file';
$subPermissionsCache = $subStorage->getPermissionsCache('');
- $rootEntry['permissions'] = $subPermissionsCache->get($rootEntry['fileid'], \OC_User::getUser());
+ $permissions = $subPermissionsCache->get($rootEntry['fileid'], $user);
+ if ($permissions === -1) {
+ $permissions = $subStorage->getPermissions($rootEntry['path']);
+ $subPermissionsCache->set($rootEntry['fileid'], $user, $permissions);
+ }
+ $rootEntry['permissions'] = $subPermissionsCache;
$files[] = $rootEntry;
}
}