From cb1aa5f1b8ad3bd0d9584ed026f46fda0fb4a7f0 Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Wed, 22 Aug 2012 12:19:06 -0400
Subject: [PATCH] - Added remoting functions for vhost subdomains - Added plugin for vhost subdomains to catch onafterinsert/update
---
interface/lib/classes/remoting.inc.php | 69 ++++++++++++++++++++++++++++++++++
1 files changed, 69 insertions(+), 0 deletions(-)
diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index e5b1c98..2eff849 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -1474,6 +1474,75 @@
return $affected_rows;
}
+ // ----------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function sites_web_vhost_subdomain_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'sites_web_subdomain_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../sites/form/web_vhost_subdomain.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function sites_web_vhost_subdomain_add($session_id, $client_id, $params)
+ {
+ global $app;
+ if(!$this->checkPerm($session_id, 'sites_web_subdomain_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+
+ //* Set a few params to "not empty" values which get overwritten by the sites_web_domain_plugin
+ if($params['document_root'] == '') $params['document_root'] = '-';
+ if($params['system_user'] == '') $params['system_user'] = '-';
+ if($params['system_group'] == '') $params['system_group'] = '-';
+
+ //* Set a few defaults for nginx servers
+ if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
+ if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
+ if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
+ if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
+
+ $domain_id = $this->insertQuery('../sites/form/web_vhost_subdomain.tform.php',$client_id,$params, 'sites:web_vhost_subdomain:on_after_insert');
+ return $domain_id;
+ }
+
+ //* Update a record
+ public function sites_web_vhost_subdomain_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_subdomain_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+
+ //* Set a few defaults for nginx servers
+ if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
+ if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
+ if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
+ if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
+
+ $affected_rows = $this->updateQuery('../sites/form/web_vhost_subdomain.tform.php',$client_id,$primary_id,$params, 'sites:web_vhost_subdomain:on_after_insert');
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function sites_web_vhost_subdomain_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_subdomain_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../sites/form/web_vhost_subdomain.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
// -----------------------------------------------------------------------------------------------
//* Get record details
--
Gitblit v1.9.1