diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-10-26 15:01:58 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-11-03 18:23:22 +0100 |
commit | 0397871f7e205683b839faec99a723630ecdaf0a (patch) | |
tree | c70df9a44c4413452233865a7f0fe1131a789f4b /apps | |
parent | 5a25f1c2a0b77e42db6881a3c5c5ca49fb39b563 (diff) | |
download | nextcloud-server-0397871f7e205683b839faec99a723630ecdaf0a.tar.gz nextcloud-server-0397871f7e205683b839faec99a723630ecdaf0a.zip |
Split checkUpdate
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/watcher.php | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/apps/files_sharing/lib/watcher.php b/apps/files_sharing/lib/watcher.php index dc95dde480e..3af6f733b51 100644 --- a/apps/files_sharing/lib/watcher.php +++ b/apps/files_sharing/lib/watcher.php @@ -29,41 +29,41 @@ namespace OC\Files\Cache; * check the storage backends for updates and change the cache accordingly */ class Shared_Watcher extends Watcher { + /** + * @var \OC\Files\Storage\Shared $storage + */ + protected $storage; /** - * check $path for updates + * Update the cache for changes to $path * * @param string $path - * @param array $cachedEntry - * @return boolean true if path was updated + * @param array $cachedData */ - public function checkUpdate($path, $cachedEntry = null) { - if (parent::checkUpdate($path, $cachedEntry) === true) { - // since checkUpdate() has already updated the size of the subdirs, - // only apply the update to the owner's parent dirs - - // find last parent before reaching the shared storage root, - // which is the actual shared dir from the owner - $sepPos = strpos($path, '/'); - if ($sepPos > 0) { - $baseDir = substr($path, 0, $sepPos); - } else { - $baseDir = $path; - } + public function update($path, $cachedData) { + parent::update($path, $cachedData); + // since parent::update() has already updated the size of the subdirs, + // only apply the update to the owner's parent dirs - // find the path relative to the data dir - $file = $this->storage->getFile($baseDir); - $view = new \OC\Files\View('/' . $file['fileOwner']); + // find last parent before reaching the shared storage root, + // which is the actual shared dir from the owner + $sepPos = strpos($path, '/'); + if ($sepPos > 0) { + $baseDir = substr($path, 0, $sepPos); + } else { + $baseDir = $path; + } - // find the owner's storage and path - list($storage, $internalPath) = $view->resolvePath($file['path']); + // find the path relative to the data dir + $file = $this->storage->getFile($baseDir); + $view = new \OC\Files\View('/' . $file['fileOwner']); - // update the parent dirs' sizes in the owner's cache - $storage->getCache()->correctFolderSize(dirname($internalPath)); + // find the owner's storage and path + /** @var \OC\Files\Storage\Storage $storage */ + list($storage, $internalPath) = $view->resolvePath($file['path']); - return true; - } - return false; + // update the parent dirs' sizes in the owner's cache + $storage->getCache()->correctFolderSize(dirname($internalPath)); } /** |