diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-05-13 18:40:35 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-05-13 18:40:35 +0200 |
commit | 033b3dac9268276a49d025a9dc1e32614473847a (patch) | |
tree | 900c2cab562e6de4b63c1c1dae38da43895456e9 /apps/files_versions | |
parent | 4789e87a5378776738706b48d0db1cf1d989709a (diff) | |
download | nextcloud-server-033b3dac9268276a49d025a9dc1e32614473847a.tar.gz nextcloud-server-033b3dac9268276a49d025a9dc1e32614473847a.zip |
Use owner when expiring versions, not the logged in user
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/lib/storage.php | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php index 45f96ee776b..98e486690b6 100644 --- a/apps/files_versions/lib/storage.php +++ b/apps/files_versions/lib/storage.php @@ -158,7 +158,7 @@ class Storage { // 1.5 times as large as the current version -> 2.5 $neededSpace = $files_view->filesize($filename) * 2.5; - self::scheduleExpire($filename, $versionsSize, $neededSpace); + self::scheduleExpire($uid, $filename, $versionsSize, $neededSpace); // store a new version of a file $mtime = $users_view->filemtime('files/' . $filename); @@ -276,7 +276,7 @@ class Storage { // if we moved versions directly for a file, schedule expiration check for that file if (!$rootView->is_dir('/' . $targetOwner . '/files/' . $targetPath)) { - self::scheduleExpire($targetPath); + self::scheduleExpire($targetOwner, $targetPath); } } @@ -309,7 +309,7 @@ class Storage { // rollback if (self::copyFileContents($users_view, 'files_versions' . $filename . '.v' . $revision, 'files' . $filename)) { $files_view->touch($file, $revision); - Storage::scheduleExpire($file); + Storage::scheduleExpire($uid, $file); return true; } else if ($versionCreated) { self::deleteVersion($users_view, $version); @@ -532,12 +532,15 @@ class Storage { } /** - * @param string $fileName - * @param int|null $versionsSize - * @param int $neededSpace + * Schedule versions expiration for the given file + * + * @param string $uid owner of the file + * @param string $fileName file/folder for which to schedule expiration + * @param int|null $versionsSize current versions size + * @param int $neededSpace requested versions size */ - private static function scheduleExpire($fileName, $versionsSize = null, $neededSpace = 0) { - $command = new Expire(\OC::$server->getUserSession()->getUser()->getUID(), $fileName, $versionsSize, $neededSpace); + private static function scheduleExpire($uid, $fileName, $versionsSize = null, $neededSpace = 0) { + $command = new Expire($uid, $fileName, $versionsSize, $neededSpace); \OC::$server->getCommandBus()->push($command); } |