summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-02-20 15:14:32 +0100
committerBjörn Schießle <schiessle@owncloud.com>2013-02-20 15:14:32 +0100
commitc49e73d43cd0e775ec653fa59811381b70e3efe7 (patch)
tree8a6e7bf26bb94bb09d41aeb4c2537954d436113a /apps
parent4d0df9614b3aed23920f99645fed7a4385034525 (diff)
downloadnextcloud-server-c49e73d43cd0e775ec653fa59811381b70e3efe7.tar.gz
nextcloud-server-c49e73d43cd0e775ec653fa59811381b70e3efe7.zip
restore filekeys from trash bin
Diffstat (limited to 'apps')
-rw-r--r--apps/files_trashbin/lib/trash.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php
index b54805c63e5..cde388015e5 100644
--- a/apps/files_trashbin/lib/trash.php
+++ b/apps/files_trashbin/lib/trash.php
@@ -82,10 +82,11 @@ class Trashbin {
}
}
- // Take care of encryption keys
- if ( \OCP\App::isEnabled('files_encryption') ) {
- $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_encryption/keyfiles/'.$file_path));
- $view->rename('files_encryption'.$file_path, 'files_trashbin/keyfiles'. $deleted.'.d'.$timestamp);
+ // Take care of encryption keys
+ $keyfile = \OC_Filesystem::normalizePath('files_encryption/keyfiles/'.$file_path.'.key');
+ if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) {
+ $trashbinSize += $view->filesize($keyfile);
+ $view->rename($keyfile, 'files_trashbin/keyfiles/'. $deleted.'.d'.$timestamp);
}
} else {
@@ -187,7 +188,18 @@ class Trashbin {
}
}
}
-
+
+ // Take care of encryption keys
+ $keyfile = 'files_trashbin/keyfiles/'.$file;
+ if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) {
+ if ( $result[0]['type'] == 'dir' ) {
+ $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile));
+ } else {
+ $trashbinSize -= $view->filesize($keyfile);
+ }
+ $view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename.'.key');
+ }
+
if ( $timestamp ) {
$query = \OC_DB::prepare('DELETE FROM *PREFIX*files_trash WHERE user=? AND id=? AND timestamp=?');
$query->execute(array($user,$filename,$timestamp));