]> source.dussan.org Git - nextcloud-server.git/commitdiff
only add filesize to trashbin size if the file was moved to the trash bin successfully
authorBjörn Schießle <schiessle@owncloud.com>
Tue, 9 Apr 2013 13:16:15 +0000 (15:16 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Wed, 10 Apr 2013 08:09:22 +0000 (10:09 +0200)
apps/files_trashbin/lib/trash.php

index d68d157158b9fe89655cffe0c9dcccc653328c64..35a2e1a8a1e8480e508372095a8a4904764b5401 100644 (file)
@@ -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.