summaryrefslogtreecommitdiffstats
path: root/lib/private/files/cache
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-10-29 15:08:12 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2013-10-29 15:08:12 +0100
commitfcfac51aa18bdd81be004e63fb98683e2cc780a0 (patch)
tree3ea5b8896fc502bdb2d443dd34dc203d9ef06834 /lib/private/files/cache
parentb0b76fe064860d2074c91897a29e0f9ac5705db8 (diff)
downloadnextcloud-server-fcfac51aa18bdd81be004e63fb98683e2cc780a0.tar.gz
nextcloud-server-fcfac51aa18bdd81be004e63fb98683e2cc780a0.zip
backport of https://github.com/owncloud/core/pull/5513
Diffstat (limited to 'lib/private/files/cache')
-rw-r--r--lib/private/files/cache/updater.php48
1 files changed, 36 insertions, 12 deletions
diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php
index 1f30173a8f8..6d016f9deac 100644
--- a/lib/private/files/cache/updater.php
+++ b/lib/private/files/cache/updater.php
@@ -95,6 +95,24 @@ class Updater {
}
/**
+ * @brief get file owner and path
+ * @param string $filename
+ * @return array with the oweners uid and the owners path
+ */
+ public static function getUidAndFilename($filename) {
+
+ $uid = \OC\Files\Filesystem::getOwner($filename);
+ \OC\Files\Filesystem::initMountPoints($uid);
+
+ if ($uid != \OCP\User::getUser()) {
+ $info = \OC\Files\Filesystem::getFileInfo($filename);
+ $ownerView = new \OC\Files\View('/' . $uid . '/files');
+ $filename = $ownerView->getPath($info['fileid']);
+ }
+ return array($uid, '/files/' . $filename);
+ }
+
+ /**
* Update the mtime and ETag of all parent folders
*
* @param string $path
@@ -102,23 +120,29 @@ class Updater {
*/
static public function correctFolder($path, $time) {
if ($path !== '' && $path !== '/') {
- $parent = dirname($path);
- if ($parent === '.' || $parent === '\\') {
- $parent = '';
- }
+
+ list($owner, $realPath) = self::getUidAndFilename(dirname($path));
+
/**
* @var \OC\Files\Storage\Storage $storage
* @var string $internalPath
*/
- list($storage, $internalPath) = self::resolvePath($parent);
- if ($storage) {
- $cache = $storage->getCache();
- $id = $cache->getId($internalPath);
- if ($id !== -1) {
- $cache->update($id, array('mtime' => $time, 'etag' => $storage->getETag($internalPath)));
- self::correctFolder($parent, $time);
+ $view = new \OC\Files\View('/' . $owner);
+
+ list($storage, $internalPath) = $view->resolvePath($realPath);
+ $cache = $storage->getCache();
+ $id = $cache->getId($internalPath);
+
+ while ($id !== -1) {
+ $cache->update($id, array('mtime' => $time, 'etag' => $storage->getETag($internalPath)));
+ $realPath = dirname($realPath);
+ // check storage for parent in case we change the storage in this step
+ list($storage, $internalPath) = $view->resolvePath($realPath);
+ if ($internalPath) {
+ $cache = $storage->getCache();
+ $id = $cache->getId($internalPath);
} else {
- Util::writeLog('core', 'Path not in cache: '.$internalPath, Util::ERROR);
+ $id = -1;
}
}
}