]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix quota calculation
authorBjörn Schießle <schiessle@owncloud.com>
Mon, 25 Feb 2013 15:12:44 +0000 (16:12 +0100)
committerBjörn Schießle <schiessle@owncloud.com>
Mon, 25 Feb 2013 15:12:44 +0000 (16:12 +0100)
apps/files_trashbin/lib/trash.php
apps/files_versions/lib/versions.php

index a04545e3261b497cfcdfc5be3d36ea0144cae6f7..d4d5ad96cfaa0295e0bd8d4ab53b0220ccb258ff 100644 (file)
@@ -96,20 +96,21 @@ class Trashbin {
                                        $view->rename($keyfile.'.key', 'files_trashbin/keyfiles/'. $deleted.'.key.d'.$timestamp);
                                }
                        }
-
                } else {
                        \OC_Log::write('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin', \OC_log::ERROR);
                }
                
                // get available disk space for user
-               $quota = \OCP\Util::computerFileSize(\OC_Preferences::getValue($user, 'files', 'quota'));
+               $quota = \OC_Preferences::getValue($user, 'files', 'quota');
                if ( $quota === null ) {
-                       $quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota'));
+                       $quota = \OC_Appconfig::getValue('files', 'default_quota');
                }
                if ( $quota === null ) {
                        $quota = \OC\Files\Filesystem::free_space('/') / count(\OCP\User::getUsers());
+               } else {
+                       $quota = \OCP\Util::computerFileSize($quota);
                }
-
+               
                // calculate available space for trash bin
                $rootInfo = $view->getFileInfo('/files');
                $free = $quota-$rootInfo['size']; // remaining free space for user
@@ -118,7 +119,6 @@ class Trashbin {
                } else {
                        $availableSpace = $free-$trashbinSize;
                }
-
                $trashbinSize -= self::expire($availableSpace);
                
                self::setTrashbinSize($user, $trashbinSize);
index 05c1bf53e434f3052b3e2650d9ddfa319a0e19ec..778fefd8a729da082d0023d6764106edd7d2c039 100644 (file)
@@ -350,12 +350,14 @@ class Storage {
                        $versions_fileview = new \OC\Files\View('/'.$uid.'/files_versions');
 
                        // get available disk space for user
-                       $quota = \OCP\Util::computerFileSize(\OC_Preferences::getValue($uid, 'files', 'quota'));
-                       if ( $quota == null ) {
-                               $quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota'));
+                       $quota = \OC_Preferences::getValue($uid, 'files', 'quota');
+                       if ( $quota === null ) {
+                               $quota = \OC_Appconfig::getValue('files', 'default_quota');
                        }
-                       if ( $quota == null ) {
+                       if ( $quota === null ) {
                                $quota = \OC\Files\Filesystem::free_space('/') / count(\OCP\User::getUsers());
+                       } else {
+                               $quota = \OCP\Util::computerFileSize($quota);
                        }
 
                        // make sure that we have the current size of the version history