preserve mtime if file gets encrypted/decrypted

This commit is contained in:
Bjoern Schiessle 2013-08-12 14:30:43 +02:00
parent b982868c14
commit 0bab8935c9
1 changed files with 13 additions and 1 deletions

View File

@ -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(