diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-02-08 20:35:33 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-02-09 23:43:27 +0100 |
commit | 5ccb9dfa7e35d78d61d7a973ee2a5fddfda7d766 (patch) | |
tree | c0d45ac7af479ba32dc2fdbd492999489fa62a94 /apps/files_versions | |
parent | 3badf5caf579f8ff10c9917f62cb41cd9b0c68f8 (diff) | |
download | nextcloud-server-5ccb9dfa7e35d78d61d7a973ee2a5fddfda7d766.tar.gz nextcloud-server-5ccb9dfa7e35d78d61d7a973ee2a5fddfda7d766.zip |
Use database for keeping track of the version
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/lib/storage.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php index 47acec1d763..0b121c344f9 100644 --- a/apps/files_versions/lib/storage.php +++ b/apps/files_versions/lib/storage.php @@ -165,7 +165,15 @@ class Storage { $mtime = $users_view->filemtime('files/' . $filename); $users_view->copy('files/' . $filename, 'files_versions/' . $filename . '.v' . $mtime); // call getFileInfo to enforce a file cache entry for the new version - $users_view->getFileInfo('files_versions/' . $filename . '.v' . $mtime); + $newFileInfo = $users_view->getFileInfo('files_versions/' . $filename . '.v' . $mtime); + + // Keep the "encrypted" value of the original file + $oldVersion = $files_view->getFileInfo($filename)->getEncryptedVersion(); + $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + $qb->update('filecache') + ->set('encrypted', $qb->createNamedParameter($oldVersion)) + ->where($qb->expr()->eq('fileid', $qb->createNamedParameter($newFileInfo->getId()))) + ->execute(); } } |