|
@@ -220,9 +220,11 @@ function zimbraSingle_ClientArea($params) {
|
|
|
* @see https://developers.whmcs.com/provisioning-modules/usage-update/
|
|
* @see https://developers.whmcs.com/provisioning-modules/usage-update/
|
|
|
*/
|
|
*/
|
|
|
function zimbraSingle_UsageUpdate($params) {
|
|
function zimbraSingle_UsageUpdate($params) {
|
|
|
|
|
+ error_log("Zimbra Single: Update: Staring Usage Update");
|
|
|
$api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
|
|
$api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
|
|
|
$login = $api->login();
|
|
$login = $api->login();
|
|
|
if(is_a($login, 'Exception')) {
|
|
if(is_a($login, 'Exception')) {
|
|
|
|
|
+ error_log("Zimbra Single: Update: Cannot Login to server: " . $params['severhostname'] . " width " . $params['severusername']);
|
|
|
logModuleCall(
|
|
logModuleCall(
|
|
|
'zimbrasingle',
|
|
'zimbrasingle',
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
@@ -232,6 +234,7 @@ function zimbraSingle_UsageUpdate($params) {
|
|
|
);
|
|
);
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
$apiAccountManager = new Zm_Account($api);
|
|
$apiAccountManager = new Zm_Account($api);
|
|
|
$productsObj = Capsule::table('tblhosting')
|
|
$productsObj = Capsule::table('tblhosting')
|
|
|
->select('*')
|
|
->select('*')
|
|
@@ -242,6 +245,7 @@ function zimbraSingle_UsageUpdate($params) {
|
|
|
foreach($productArray as $product) {
|
|
foreach($productArray as $product) {
|
|
|
$accountQuota = $apiAccountManager->getQuota($product->username);
|
|
$accountQuota = $apiAccountManager->getQuota($product->username);
|
|
|
if(is_a($accountQuota, 'Exception')) {
|
|
if(is_a($accountQuota, 'Exception')) {
|
|
|
|
|
+ error_log("Zimbra Single: Update: Error while getting quota for: " . $product->username);
|
|
|
logModuleCall(
|
|
logModuleCall(
|
|
|
'zimbrasingle',
|
|
'zimbrasingle',
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
@@ -253,6 +257,7 @@ function zimbraSingle_UsageUpdate($params) {
|
|
|
}
|
|
}
|
|
|
$mboxInfo = $apiAccountManager->getMailbox($product->username);
|
|
$mboxInfo = $apiAccountManager->getMailbox($product->username);
|
|
|
if(is_a($mboxInfo, 'Exception')) {
|
|
if(is_a($mboxInfo, 'Exception')) {
|
|
|
|
|
+ error_log("Zimbra Single: Update: Error while getting mailbox info for: " . $product->username);
|
|
|
logModuleCall(
|
|
logModuleCall(
|
|
|
'zimbrasingle',
|
|
'zimbrasingle',
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
@@ -262,7 +267,7 @@ function zimbraSingle_UsageUpdate($params) {
|
|
|
);
|
|
);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- $mboxSize = $mboxInfo['S'];
|
|
|
|
|
|
|
+ $mboxSize = $mboxInfo['GETMAILBOXRESPONSE']['MBOX']['S'];
|
|
|
try {
|
|
try {
|
|
|
Capsule::table('tblhosting')
|
|
Capsule::table('tblhosting')
|
|
|
->where('id', '=', $product->id)
|
|
->where('id', '=', $product->id)
|
|
@@ -396,7 +401,7 @@ function zimbraSingle_CreateAccount($params) {
|
|
|
return 'Error: could not find serviceclass ' . $params['configoption1'];
|
|
return 'Error: could not find serviceclass ' . $params['configoption1'];
|
|
|
}
|
|
}
|
|
|
$attrs['zimbraCOSId'] = $cosID;
|
|
$attrs['zimbraCOSId'] = $cosID;
|
|
|
- $baseQuota = $params['configoption2'] ? $params['configoption2'] : 1;
|
|
|
|
|
|
|
+ $baseQuota = $params['configoption2'] ? $params['configoption2'] : 1;
|
|
|
$addonQuota = $params['configoptions']['addonQuota'] ? $params['configoptions']['addonQuota'] : 0;
|
|
$addonQuota = $params['configoptions']['addonQuota'] ? $params['configoptions']['addonQuota'] : 0;
|
|
|
$newAddQuota = $params['configoptions']['newAddQuota'] ? $params['configoptions']['newAddQuota'] : 0;
|
|
$newAddQuota = $params['configoptions']['newAddQuota'] ? $params['configoptions']['newAddQuota'] : 0;
|
|
|
$attrs['zimbraMailQuota'] = ($baseQuota + $addonQuota + $newAddQuota) * 1073741824;
|
|
$attrs['zimbraMailQuota'] = ($baseQuota + $addonQuota + $newAddQuota) * 1073741824;
|
|
@@ -556,9 +561,10 @@ function zimbraSingle_TerminateAccount($params) {
|
|
|
);
|
|
);
|
|
|
return 'Error : account ' . $params['username'] . ' Name could not verified';
|
|
return 'Error : account ' . $params['username'] . ' Name could not verified';
|
|
|
}
|
|
}
|
|
|
- if ($accountStatus != 'locked') {
|
|
|
|
|
- return 'Account '. $params['username'] . ' is active, suspend account first!';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //if ($accountStatus != 'locked') {
|
|
|
|
|
+ // return 'Account '. $params['username'] . ' is active, suspend account first!';
|
|
|
|
|
+ //}
|
|
|
$response = $apiAccountManager->deleteAccount($params['username']);
|
|
$response = $apiAccountManager->deleteAccount($params['username']);
|
|
|
if(is_a($response, 'Exception')) {
|
|
if(is_a($response, 'Exception')) {
|
|
|
logModuleCall(
|
|
logModuleCall(
|
|
@@ -614,7 +620,7 @@ function zimbraSingle_ChangePackage($params) {
|
|
|
);
|
|
);
|
|
|
return 'Error: could not set class of service for '. $params['username'];
|
|
return 'Error: could not set class of service for '. $params['username'];
|
|
|
}
|
|
}
|
|
|
- $baseQuota = $params['configoption2'] ? $params['configoption2'] : 1;
|
|
|
|
|
|
|
+ $baseQuota = $params['configoption2'] ? $params['configoption2'] : 1;
|
|
|
$addonQuota = $params['configoptions']['addonQuota'] ? $params['configoptions']['addonQuota'] : 0;
|
|
$addonQuota = $params['configoptions']['addonQuota'] ? $params['configoptions']['addonQuota'] : 0;
|
|
|
$newAddQuota = $params['configoptions']['newAddQuota'] ? $params['configoptions']['newAddQuota'] : 0;
|
|
$newAddQuota = $params['configoptions']['newAddQuota'] ? $params['configoptions']['newAddQuota'] : 0;
|
|
|
$attrs['zimbraMailQuota'] = ($baseQuota + $addonQuota + $newAddQuota) * 1073741824;
|
|
$attrs['zimbraMailQuota'] = ($baseQuota + $addonQuota + $newAddQuota) * 1073741824;
|