Browse Source

add usageUpdate

andre 5 years ago
parent
commit
8dff7d8405
2 changed files with 30 additions and 0 deletions
  1. 28 0
      zimbraSingle.inc
  2. 2 0
      zimbraSingle.php

+ 28 - 0
zimbraSingle.inc

@@ -516,6 +516,34 @@ function zimbraSingleCreateCustomFields($packageconfigoption)
     );
 }
 
+function zimbraSingleUsageUpdate($params) {
+    $accessData = zimbraSingleGetAccess();
+    $api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
+    $login = $api->login();
+    if(is_a($login, "Exception")) {
+        logModuleCall(
+            'zimbrasingle',
+            __FUNCTION__,
+            $params,
+            "Error : cannot login to " . $accessData['zimbraServer'],
+            ""
+        );
+        return false;
+    }
+    $apiAccountManager = new Zm_Account($api);
+    $response = $apiAccountManager->getAllCos();
+    if(is_a($response, "Exception")) {
+        logModuleCall(
+            'zimbrasingle',
+            __FUNCTION__,
+            $params,
+            "Error : could not fetch classes of service",
+            ""
+        );
+        return false;
+    }
+}
+
 function recursiveFindAll($haystack, $needle)
 {
     $values = array();

+ 2 - 0
zimbraSingle.php

@@ -41,6 +41,8 @@ function zimbraSingle_TestConnection($params)
 
 function zimbraSingle_UsageUpdate($params)
 {
+    $response = zimbraSingleUsageUpdate($params);
+    return $response;
 }
 
 function zimbraSingle_ClientArea($params)