summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-04-09 15:16:15 +0200
committerBjörn Schießle <schiessle@owncloud.com>2013-04-09 15:16:15 +0200
commitf26a4e0b800b5a9dd13da2b0fc1bbf8d57bb8a30 (patch)
treee32dfc446a657aa86895fc3a8aeef392540186d2 /apps/files_trashbin
parentb52666567aa27a05c78c7b731aef7700901567d3 (diff)
downloadnextcloud-server-f26a4e0b800b5a9dd13da2b0fc1bbf8d57bb8a30.tar.gz
nextcloud-server-f26a4e0b800b5a9dd13da2b0fc1bbf8d57bb8a30.zip
only add filesize to trashbin size if the file was moved to the trash bin successfully
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/lib/trash.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php
index d68d157158b..35a2e1a8a1e 100644
--- a/apps/files_trashbin/lib/trash.php
+++ b/apps/files_trashbin/lib/trash.php
@@ -61,9 +61,11 @@ class Trashbin {
if ( $trashbinSize === false || $trashbinSize < 0 ) {
$trashbinSize = self::calculateSize(new \OC\Files\View('/'. $user.'/files_trashbin'));
}
- $trashbinSize += self::copy_recursive($file_path, 'files_trashbin/files/'.$deleted.'.d'.$timestamp, $view);
-
+
+ $sizeOfAddedFiles = self::copy_recursive($file_path, 'files_trashbin/files/'.$deleted.'.d'.$timestamp, $view);
+
if ( $view->file_exists('files_trashbin/files/'.$deleted.'.d'.$timestamp) ) {
+ $trashbinSize += $sizeOfAddedFiles;
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`type`,`mime`,`user`) VALUES (?,?,?,?,?,?)");
$result = $query->execute(array($deleted, $timestamp, $location, $type, $mime, $user));
if ( !$result ) { // if file couldn't be added to the database than also don't store it in the trash bin.