diff options
author | Pellaeon Lin <nfsmwlin@gmail.com> | 2013-05-12 22:32:22 +0800 |
---|---|---|
committer | Pellaeon Lin <nfsmwlin@gmail.com> | 2013-05-12 22:32:22 +0800 |
commit | 935675ab4964e7cabc1de2f31cafbca6548c88b3 (patch) | |
tree | ee353aaa2e5d018c4f4b4abb8d02b5c609f456f6 /apps/files_versions/lib/versions.php | |
parent | 340940389350747c14acad89ced6ae5f731a6e65 (diff) | |
parent | c5cb3f957761ffbbc615a6806d84ad0a9d0cec13 (diff) | |
download | nextcloud-server-935675ab4964e7cabc1de2f31cafbca6548c88b3.tar.gz nextcloud-server-935675ab4964e7cabc1de2f31cafbca6548c88b3.zip |
Merge remote-tracking branch 'upstream/master' into pr-langcode
Diffstat (limited to 'apps/files_versions/lib/versions.php')
-rw-r--r-- | apps/files_versions/lib/versions.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index c38ba688fe0..5fdbef27743 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -184,11 +184,12 @@ class Storage { /** * rollback to an old version of a file. */ - public static function rollback($filename, $revision) { + public static function rollback($file, $revision) { if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { - list($uid, $filename) = self::getUidAndFilename($filename); + list($uid, $filename) = self::getUidAndFilename($file); $users_view = new \OC\Files\View('/'.$uid); + $files_view = new \OC\Files\View('/'.\OCP\User::getUser().'/files'); $versionCreated = false; //first create a new version @@ -199,9 +200,9 @@ class Storage { } // rollback - if( @$users_view->copy('files_versions'.$filename.'.v'.$revision, 'files'.$filename) ) { - $users_view->touch('files'.$filename, $revision); - Storage::expire($filename); + if( @$users_view->rename('files_versions'.$filename.'.v'.$revision, 'files'.$filename) ) { + $files_view->touch($file, $revision); + Storage::expire($file); return true; }else if ( $versionCreated ) { |