@@ -1474,6 +1474,75 @@ public function sites_web_domain_delete($session_id, $primary_id)
14741474 return $ affected_rows ;
14751475 }
14761476
1477+ // ----------------------------------------------------------------------------------------------------------
1478+
1479+ //* Get record details
1480+ public function sites_web_vhost_subdomain_get ($ session_id , $ primary_id )
1481+ {
1482+ global $ app ;
1483+
1484+ if (!$ this ->checkPerm ($ session_id , 'sites_web_subdomain_get ' )) {
1485+ $ this ->server ->fault ('permission_denied ' , 'You do not have the permissions to access this function. ' );
1486+ return false ;
1487+ }
1488+ $ app ->uses ('remoting_lib ' );
1489+ $ app ->remoting_lib ->loadFormDef ('../sites/form/web_vhost_subdomain.tform.php ' );
1490+ return $ app ->remoting_lib ->getDataRecord ($ primary_id );
1491+ }
1492+
1493+ //* Add a record
1494+ public function sites_web_vhost_subdomain_add ($ session_id , $ client_id , $ params )
1495+ {
1496+ global $ app ;
1497+ if (!$ this ->checkPerm ($ session_id , 'sites_web_subdomain_add ' )) {
1498+ $ this ->server ->fault ('permission_denied ' , 'You do not have the permissions to access this function. ' );
1499+ return false ;
1500+ }
1501+
1502+ //* Set a few params to "not empty" values which get overwritten by the sites_web_domain_plugin
1503+ if ($ params ['document_root ' ] == '' ) $ params ['document_root ' ] = '- ' ;
1504+ if ($ params ['system_user ' ] == '' ) $ params ['system_user ' ] = '- ' ;
1505+ if ($ params ['system_group ' ] == '' ) $ params ['system_group ' ] = '- ' ;
1506+
1507+ //* Set a few defaults for nginx servers
1508+ if ($ params ['pm_max_children ' ] == '' ) $ params ['pm_max_children ' ] = 1 ;
1509+ if ($ params ['pm_start_servers ' ] == '' ) $ params ['pm_start_servers ' ] = 1 ;
1510+ if ($ params ['pm_min_spare_servers ' ] == '' ) $ params ['pm_min_spare_servers ' ] = 1 ;
1511+ if ($ params ['pm_max_spare_servers ' ] == '' ) $ params ['pm_max_spare_servers ' ] = 1 ;
1512+
1513+ $ domain_id = $ this ->insertQuery ('../sites/form/web_vhost_subdomain.tform.php ' ,$ client_id ,$ params , 'sites:web_vhost_subdomain:on_after_insert ' );
1514+ return $ domain_id ;
1515+ }
1516+
1517+ //* Update a record
1518+ public function sites_web_vhost_subdomain_update ($ session_id , $ client_id , $ primary_id , $ params )
1519+ {
1520+ if (!$ this ->checkPerm ($ session_id , 'sites_web_subdomain_update ' )) {
1521+ $ this ->server ->fault ('permission_denied ' , 'You do not have the permissions to access this function. ' );
1522+ return false ;
1523+ }
1524+
1525+ //* Set a few defaults for nginx servers
1526+ if ($ params ['pm_max_children ' ] == '' ) $ params ['pm_max_children ' ] = 1 ;
1527+ if ($ params ['pm_start_servers ' ] == '' ) $ params ['pm_start_servers ' ] = 1 ;
1528+ if ($ params ['pm_min_spare_servers ' ] == '' ) $ params ['pm_min_spare_servers ' ] = 1 ;
1529+ if ($ params ['pm_max_spare_servers ' ] == '' ) $ params ['pm_max_spare_servers ' ] = 1 ;
1530+
1531+ $ affected_rows = $ this ->updateQuery ('../sites/form/web_vhost_subdomain.tform.php ' ,$ client_id ,$ primary_id ,$ params , 'sites:web_vhost_subdomain:on_after_insert ' );
1532+ return $ affected_rows ;
1533+ }
1534+
1535+ //* Delete a record
1536+ public function sites_web_vhost_subdomain_delete ($ session_id , $ primary_id )
1537+ {
1538+ if (!$ this ->checkPerm ($ session_id , 'sites_web_subdomain_delete ' )) {
1539+ $ this ->server ->fault ('permission_denied ' , 'You do not have the permissions to access this function. ' );
1540+ return false ;
1541+ }
1542+ $ affected_rows = $ this ->deleteQuery ('../sites/form/web_vhost_subdomain.tform.php ' ,$ primary_id );
1543+ return $ affected_rows ;
1544+ }
1545+
14771546 // -----------------------------------------------------------------------------------------------
14781547
14791548 //* Get record details
0 commit comments