Code

Fixed cyrus mail method to support MB intead of KB quotas.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 May 2006 10:11:04 +0000 (10:11 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 May 2006 10:11:04 +0000 (10:11 +0000)
Don't touch the quota value 2147483647.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3578 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_mail-methods-cyrus.inc

index edb4d794121010a2f0db43bf3a7d7eac18b1853e..6eab34624149c8839487f202fed8ec6e1ac8cb32 100644 (file)
@@ -70,12 +70,22 @@ class mailMethodCyrus extends mailMethod
     if(is_array($quota_value)) {
       if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){
         /* use for PHP >= 4.3 */
-        $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
-        $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024);
+        if($quota_value["STORAGE"]['limit'] == 2147483647){
+          $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
+          $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] );
+        }else{
+          $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
+          $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024);
+        }
       } else {
         /* backward icompatible */
-        $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
-        $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024);
+        if($quota_value['usage'] == 2147483647){
+          $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
+          $result['gosaMailQuota']= (int) ($quota_value['limit'] );
+        }else{
+          $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
+          $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024);
+        }
       }
     }elseif(!$quota_value){
       return(false);
@@ -124,7 +134,7 @@ class mailMethodCyrus extends mailMethod
   function setQuota($folder, $gosaMailQuota)
   {
     /* Workaround for the php imap extension */
-    if ($gosaMailQuota == ""){
+    if (($gosaMailQuota == "") || ($gosaMailQuota== "2147483647")){
       $gosaMailQuota= "2147483647";
     }elseif($gosaMailQuota > 0){
       $gosaMailQuota = $gosaMailQuota *1024;