|
|
@@ -238,56 +238,58 @@ function zimbraSingle_UsageUpdate($params) {
|
|
|
->where('server', '=', $params['serverid'])
|
|
|
->where('domainstatus', '=', 'Active')
|
|
|
->get();
|
|
|
- foreach((array)$productsObj as $productObj) {
|
|
|
- $product = get_object_vars($productObj[0]);
|
|
|
- logModuleCall(
|
|
|
- 'zimbrasingle',
|
|
|
- __FUNCTION__,
|
|
|
- $productObj,
|
|
|
- 'Debug',
|
|
|
- $product
|
|
|
- );
|
|
|
- $accountQuota = $apiAccountManager->getQuota($product['username']);
|
|
|
- if(is_a($accountQuota, 'Exception')) {
|
|
|
- logModuleCall(
|
|
|
- 'zimbrasingle',
|
|
|
- __FUNCTION__,
|
|
|
- $params,
|
|
|
- 'Error : could not find quota for ' . $product['username'],
|
|
|
- $accountQuota
|
|
|
- );
|
|
|
- continue;
|
|
|
- }
|
|
|
- $mboxInfo = $apiAccountManager->getMailbox($product['username']);
|
|
|
- if(is_a($mboxInfo, 'Exception')) {
|
|
|
+ foreach((array)$productsObj as $productArray) {
|
|
|
+ foreach($productArray as $productObj) {
|
|
|
+ $product = get_object_vars($productObj[0]);
|
|
|
logModuleCall(
|
|
|
'zimbrasingle',
|
|
|
__FUNCTION__,
|
|
|
- $params,
|
|
|
- 'Error: could not fetch mailbox info for ' . $product['username'],
|
|
|
- $mboxInfo
|
|
|
+ $productObj,
|
|
|
+ 'Debug',
|
|
|
+ $product
|
|
|
);
|
|
|
- continue;
|
|
|
- }
|
|
|
- $mboxSize = $mboxInfo['S'];
|
|
|
- try {
|
|
|
- Capsule::table('tblhosting')
|
|
|
- ->where('id', '=', $product['id'])
|
|
|
- ->update(
|
|
|
- array(
|
|
|
- 'diskusage' => round($mboxSize / 1048576),
|
|
|
- 'disklimit' => round($accountQuota / 1048576),
|
|
|
- 'lastupdate' => Capsule::raw('now()')
|
|
|
- )
|
|
|
+ $accountQuota = $apiAccountManager->getQuota($product['username']);
|
|
|
+ if(is_a($accountQuota, 'Exception')) {
|
|
|
+ logModuleCall(
|
|
|
+ 'zimbrasingle',
|
|
|
+ __FUNCTION__,
|
|
|
+ $params,
|
|
|
+ 'Error : could not find quota for ' . $product['username'],
|
|
|
+ $accountQuota
|
|
|
);
|
|
|
- } catch (\Exception $e) {
|
|
|
- logModuleCall(
|
|
|
- 'zimbrasingle',
|
|
|
- __FUNCTION__,
|
|
|
- $params,
|
|
|
- 'Error: could update usage information for ' . $product['username'],
|
|
|
- $e->getMessage()
|
|
|
- );
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $mboxInfo = $apiAccountManager->getMailbox($product['username']);
|
|
|
+ if(is_a($mboxInfo, 'Exception')) {
|
|
|
+ logModuleCall(
|
|
|
+ 'zimbrasingle',
|
|
|
+ __FUNCTION__,
|
|
|
+ $params,
|
|
|
+ 'Error: could not fetch mailbox info for ' . $product['username'],
|
|
|
+ $mboxInfo
|
|
|
+ );
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $mboxSize = $mboxInfo['S'];
|
|
|
+ try {
|
|
|
+ Capsule::table('tblhosting')
|
|
|
+ ->where('id', '=', $product['id'])
|
|
|
+ ->update(
|
|
|
+ array(
|
|
|
+ 'diskusage' => round($mboxSize / 1048576),
|
|
|
+ 'disklimit' => round($accountQuota / 1048576),
|
|
|
+ 'lastupdate' => Capsule::raw('now()')
|
|
|
+ )
|
|
|
+ );
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ logModuleCall(
|
|
|
+ 'zimbrasingle',
|
|
|
+ __FUNCTION__,
|
|
|
+ $params,
|
|
|
+ 'Error: could update usage information for ' . $product['username'],
|
|
|
+ $e->getMessage()
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|