summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-02-20 17:58:04 +0100
committerBjörn Schießle <schiessle@owncloud.com>2013-02-20 17:58:04 +0100
commit4b5a662e09e1f1d0b7885b546e7b278fe263be34 (patch)
tree57d8e42d9f1585151dc4e7454fe820ba0a2a9a6f /apps/files_trashbin
parentc49e73d43cd0e775ec653fa59811381b70e3efe7 (diff)
downloadnextcloud-server-4b5a662e09e1f1d0b7885b546e7b278fe263be34.tar.gz
nextcloud-server-4b5a662e09e1f1d0b7885b546e7b278fe263be34.zip
delete keyfiles if file in trash bin gets deleted permanently
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/lib/trash.php25
1 files changed, 20 insertions, 5 deletions
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php
index cde388015e5..5c0cf36f5b3 100644
--- a/apps/files_trashbin/lib/trash.php
+++ b/apps/files_trashbin/lib/trash.php
@@ -83,10 +83,14 @@ class Trashbin {
}
// 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);
+ $keyfile = \OC_Filesystem::normalizePath('files_encryption/keyfiles/'.$file_path);
+ if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile.'.key') ) {
+ if ( $view->is_dir('files'.$file_path) ) {
+ $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile));
+ } else {
+ $trashbinSize += $view->filesize($keyfile.'.key');
+ }
+ $view->rename($keyfile.'.key', 'files_trashbin/keyfiles/'. $deleted.'.d'.$timestamp);
}
} else {
@@ -190,7 +194,7 @@ class Trashbin {
}
// Take care of encryption keys
- $keyfile = 'files_trashbin/keyfiles/'.$file;
+ $keyfile = \OC_Filesystem::normalizePath('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));
@@ -252,6 +256,17 @@ class Trashbin {
}
}
}
+ }
+
+ // Take care of encryption keys
+ $keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$file);
+ if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) {
+ if ( $result[0]['type'] == 'dir' ) {
+ $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile));
+ } else {
+ $size += $view->filesize($keyfile);
+ }
+ $view->unlink($keyfile);
}
if ($view->is_dir('/files_trashbin/files/'.$file)) {