diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-08-12 14:30:43 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-08-12 14:30:43 +0200 |
commit | 0bab8935c95c249405f5b12f4724d189c4ec648b (patch) | |
tree | d6191da120c3e04f11dbd2788d9fbd0ae1f4e99b /apps/files_encryption | |
parent | b982868c14ea66f0241b4a801f92fdd594fcca3b (diff) | |
download | nextcloud-server-0bab8935c95c249405f5b12f4724d189c4ec648b.tar.gz nextcloud-server-0bab8935c95c249405f5b12f4724d189c4ec648b.zip |
preserve mtime if file gets encrypted/decrypted
Diffstat (limited to 'apps/files_encryption')
-rw-r--r-- | apps/files_encryption/lib/util.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 8819b0f972a..9d351983e2a 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -777,6 +777,9 @@ class Util { //relative to /data $rawPath = $encryptedFile['path']; + //get timestamp + $timestamp = $this->view->filemtime($rawPath); + //enable proxy to use OC\Files\View to access the original file \OC_FileProxy::$enabled = true; @@ -818,6 +821,9 @@ class Util { $this->view->chroot($fakeRoot); + //set timestamp + $this->view->touch($rawPath, $timestamp); + // Add the file to the cache \OC\Files\Filesystem::putFileInfo($relPath, array( 'encrypted' => false, @@ -875,10 +881,13 @@ class Util { //relative to data/<user>/file $relPath = $plainFile['path']; - + //relative to /data $rawPath = '/' . $this->userId . '/files/' . $plainFile['path']; + // keep timestamp + $timestamp = $this->view->filemtime($rawPath); + // Open plain file handle for binary reading $plainHandle = $this->view->fopen($rawPath, 'rb'); @@ -897,6 +906,9 @@ class Util { $this->view->rename($relPath . '.part', $relPath); $this->view->chroot($fakeRoot); + + // set timestamp + $this->view->touch($rawPath, $timestamp); // Add the file to the cache \OC\Files\Filesystem::putFileInfo($relPath, array( |