summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-05-14 19:58:19 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-05-26 14:09:11 +0200
commitd33834f07a274889cb174f4117dccd6f0e5f61d3 (patch)
tree4550463ce8bac2e6dd3c1ca9733c255e864a0679 /apps/files_versions
parent043acfebab11e4fdfdda9f412543f3d08b30c33c (diff)
downloadnextcloud-server-d33834f07a274889cb174f4117dccd6f0e5f61d3.tar.gz
nextcloud-server-d33834f07a274889cb174f4117dccd6f0e5f61d3.zip
Delete the previews when a version is restored
Fixes #9469 When a version of a file is restored the previews are no longer valid. Thus we should remove them so they are regenerated. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/Storage.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index 4c76c5340fa..fb4b067b8bc 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -337,6 +337,9 @@ class Storage {
return false;
}
+ // Fetch the userfolder to trigger view hooks
+ $userFolder = \OC::$server->getUserFolder($uid);
+
$users_view = new View('/'.$uid);
$files_view = new View('/'. User::getUser().'/files');
@@ -375,9 +378,14 @@ class Storage {
if (self::copyFileContents($users_view, $fileToRestore, 'files' . $filename)) {
$files_view->touch($file, $revision);
Storage::scheduleExpire($uid, $file);
+
+ $node = $userFolder->get($file);
+
+ // TODO: move away from those legacy hooks!
\OC_Hook::emit('\OCP\Versions', 'rollback', array(
'path' => $filename,
'revision' => $revision,
+ 'node' => $node,
));
return true;
} else if ($versionCreated) {