Bladeren bron

bugfix usageupdate

andre 4 jaren geleden
bovenliggende
commit
c1f67e8c4b
1 gewijzigde bestanden met toevoegingen van 7 en 15 verwijderingen
  1. 7 15
      zimbraSingle.php

+ 7 - 15
zimbraSingle.php

@@ -239,33 +239,25 @@ function zimbraSingle_UsageUpdate($params) {
         ->where('domainstatus', '=', 'Active')
         ->get();
     foreach((array)$productsObj as $productArray) {
-        foreach($productArray as $productObj) {
-            $product = get_object_vars($productObj);
-            logModuleCall(
-                'zimbrasingle',
-                __FUNCTION__,
-                $productObj,
-                'Debug',
-                $product
-            );
-            $accountQuota = $apiAccountManager->getQuota($product['username']);
+        foreach($productArray as $product) {
+            $accountQuota = $apiAccountManager->getQuota($product->username);
             if(is_a($accountQuota, 'Exception')) {
                 logModuleCall(
                     'zimbrasingle',
                     __FUNCTION__,
                     $params,
-                    'Error : could not find quota for ' . $product['username'],
+                    'Error : could not find quota for ' . $product->username,
                     $accountQuota
                 );
                 continue;
             }
-            $mboxInfo = $apiAccountManager->getMailbox($product['username']);
+            $mboxInfo = $apiAccountManager->getMailbox($product->username);
             if(is_a($mboxInfo, 'Exception')) {
                 logModuleCall(
                     'zimbrasingle',
                     __FUNCTION__,
                     $params,
-                    'Error: could not fetch mailbox info for ' . $product['username'],
+                    'Error: could not fetch mailbox info for ' . $product->username,
                     $mboxInfo
                 );
                 continue;
@@ -273,7 +265,7 @@ function zimbraSingle_UsageUpdate($params) {
             $mboxSize = $mboxInfo['S'];
             try {
                 Capsule::table('tblhosting')
-                    ->where('id', '=', $product['id'])
+                    ->where('id', '=', $product->id)
                     ->update(
                         array(
                             'diskusage' => round($mboxSize / 1048576),
@@ -286,7 +278,7 @@ function zimbraSingle_UsageUpdate($params) {
                     'zimbrasingle',
                     __FUNCTION__,
                     $params,
-                    'Error: could update usage information for ' . $product['username'],
+                    'Error: could update usage information for ' . $product->username,
                     $e->getMessage()
                 );
             }