andre 7 місяців тому
батько
коміт
e39272b16e
2 змінених файлів з 26 додано та 36 видалено
  1. 19 33
      api/sitebuilder.php
  2. 7 3
      siteBuilder.php

+ 19 - 33
api/sitebuilder.php

@@ -45,8 +45,8 @@ class ApiClient {
      *            stored locally for the Single Sign on from whcms plugin
      *
      */
-    public function deployDev($username, $domain, $adminName, $adminPassword) {
-        $url = "$this->apiUrl/deploydev/$username/$domain";
+    public function deploy($username, $domain, $adminName, $adminPassword) {
+        $url = "$this->apiUrl/deploy/$username/$domain";
         $data = [
             'admin_name' => $adminName,
             'admin_password' => $adminPassword
@@ -55,7 +55,7 @@ class ApiClient {
     }
   
     /**
-     * Revert the development site for the customer
+     * Initially deploy the placeholder site and config for the customer
      *
      * @param username:        The username under which the domain is deployed
      * @param domain:          The Domain to migrate
@@ -69,17 +69,17 @@ class ApiClient {
      *            stored locally for the Single Sign on from whcms plugin
      *
      */
-    public function revertDev($username, $domain, $adminName, $adminPassword) {
-        $url = "$this->apiUrl/revertdev/$username/$domain";
+    public function init($username, $domain, $adminName, $adminPassword) {
+        $url = "$this->apiUrl/init/$username/$domain";
         $data = [
             'admin_name' => $adminName,
             'admin_password' => $adminPassword
         ];
         return $this->sendRequest('POST', $url, $data);
     }
- 
+  
     /**
-     * Removes the development site for the customer
+     * Revert the development site for the customer
      *
      * @param username:        The username under which the domain is deployed
      * @param domain:          The Domain to migrate
@@ -93,8 +93,8 @@ class ApiClient {
      *            stored locally for the Single Sign on from whcms plugin
      *
      */
-    public function undeployDev($username, $domain, $adminName, $adminPassword) {
-        $url = "$this->apiUrl/undeploydev/$username/$domain";
+    public function revert($username, $domain, $adminName, $adminPassword) {
+        $url = "$this->apiUrl/revert/$username/$domain";
         $data = [
             'admin_name' => $adminName,
             'admin_password' => $adminPassword
@@ -117,8 +117,8 @@ class ApiClient {
      *            stored locally for the Single Sign on from whcms plugin
      *
      */
-    public function undeployProd($username, $domain, $adminName, $adminPassword) {
-        $url = "$this->apiUrl/undeployprod/$username/$domain";
+    public function undeploy($username, $domain, $adminName, $adminPassword) {
+        $url = "$this->apiUrl/undeploy/$username/$domain";
         $data = [
             'admin_name' => $adminName,
             'admin_password' => $adminPassword
@@ -140,8 +140,8 @@ class ApiClient {
      * Attention: The given parameters adminName and adminPassword must be stored locally for the
      *            Single Sign on from whcms plugin
      */
-    public function migrateprod($username, $domain, $adminName, $adminPassword) {
-        $url = "$this->apiUrl/migrateprod/$username/$domain";
+    public function migrate($username, $domain, $adminName, $adminPassword) {
+        $url = "$this->apiUrl/migrate/$username/$domain";
         $data = [
             'admin_name' => $adminName,
             'admin_password' => $adminPassword
@@ -158,8 +158,8 @@ class ApiClient {
      * @return                  a json with ['status' => $httpCode,'response' => ['success' => 'Text']];
      *                          or a json with ['status' => $httpCode,'response' => ['error' => 'Error-Description']];
      */
-    public function disableprod($domain,$username) {
-        $url = "$this->apiUrl/disableprod/$username/$domain";
+    public function disable($domain,$username) {
+        $url = "$this->apiUrl/disable/$username/$domain";
         return $this->sendRequest('GET', $url);
     }
   
@@ -195,20 +195,6 @@ class ApiClient {
         return $this->sendRequest('GET', $url);
     }
   
-    /**
-     * Deletes the webpage (dev & prod)
-     *
-     * @param username:        The username under which the domain is deployed
-     * @param domain:          The Domain to delete
-     *
-     * @return                  a json with ['status' => $httpCode,'response' => ['success' => 'Text']];
-     *                          or a json with ['status' => $httpCode,'response' => ['error' => 'Error-Description']];
-     */
-    public function delete($domain,$username) {
-        $url = "$this->apiUrl/delete/$username/$domain";
-        return $this->sendRequest('GET', $url);
-    }
-  
     /**
      * Enables the prod webpage
      *
@@ -218,8 +204,8 @@ class ApiClient {
      * @return                  a json with ['status' => $httpCode,'response' => ['isenabled' => 'YES']];
      *                          or a json with ['status' => $httpCode,'response' => ['isenabled' => 'NO']];
      */
-    public function enableprod($domain,$username) {
-        $url = "$this->apiUrl/enableprod/$username/$domain";
+    public function enable($domain,$username) {
+        $url = "$this->apiUrl/enable/$username/$domain";
         return $this->sendRequest('GET', $url);
     }
   
@@ -233,8 +219,8 @@ class ApiClient {
      * @return                  a json with ['status' => $httpCode,'response' => ['success' => 'Text']];
      *                          or a json with ['status' => $httpCode,'response' => ['error' => 'Error-Description']];
      */
-    public function isprodenabled($domain,$username) {
-        $url = "$this->apiUrl/isprodenabled/$username/$domain";
+    public function isenabled($domain,$username) {
+        $url = "$this->apiUrl/isenabled/$username/$domain";
         return $this->sendRequest('GET', $url);
     }
   

+ 7 - 3
siteBuilder.php

@@ -143,6 +143,10 @@ function siteBuilder_CreateAccount($params) {
 	if($response['status'] != '200') {
 		return 'Error: ' . $response['response'];
 	}
+	$response = $siteBuilder->init($params['domain'],$params['username'], $params['serverusername'], $params['serverpassword']);
+	if($response['status'] != '200') {
+		return 'Error: ' . $response['response'];
+	}
 	return 'success';
 }
 
@@ -168,7 +172,7 @@ function siteBuilder_TerminateAccount($params) {
 			'siteBuilder',
 			__FUNCTION__,
 			$params,
-			'Error: could remove account from database',
+			'Error: could find account in database',
 			$e->getMessage()
 			);
 		return 'Error: could remove account from database';
@@ -248,10 +252,10 @@ function siteBuilder_SuspendAccount($params) {
 			'siteBuilder',
 			__FUNCTION__,
 			$params,
-			'Error: could remove account from database',
+			'Error: could not disable account in database',
 			$e->getMessage()
 			);
-		return 'Error: could remove account from database';
+		return 'Error: could not disable account in database';
 	}	
 	return 'success';
 }