From 85aa142308f5a8a36ef1263ec826c01ecf703ab3 Mon Sep 17 00:00:00 2001 From: Tobias Vorwachs Date: Thu, 10 Nov 2016 13:10:44 +0100 Subject: [PATCH 1/2] more options for create webspace --- src/PleskX/Api/Operator/Webspace.php | 35 ++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/PleskX/Api/Operator/Webspace.php b/src/PleskX/Api/Operator/Webspace.php index d3f8e055..3d6353e0 100644 --- a/src/PleskX/Api/Operator/Webspace.php +++ b/src/PleskX/Api/Operator/Webspace.php @@ -26,18 +26,45 @@ public function getPhysicalHostingDescriptor() } /** - * @param array $properties + * @param array $properties // see https://docs.plesk.com/en-US/12.5/api-rpc/reference/managing-subscriptions-webspaces/subscription-settings/general-subscription-information/node-gen_setup.33858/ + * @param array $more_prop // see https://docs.plesk.com/en-US/12.5/api-rpc/reference/managing-subscriptions-webspaces/creating-a-subscription-webspace.33892/ + * @param string $ftp_login // ftp login + * @param string $ftp_pass // ftp password + * @param string $ip // IP address of webspace * @return Struct\Info */ - public function create($properties) + public function create($properties, $more_prop = null, $ftp_login = "", $ftp_pass = "", $ip = "") { $packet = $this->_client->getPacket(); - $info = $packet->addChild('webspace')->addChild('add')->addChild('gen_setup'); + $info = $packet->addChild('webspace')->addChild('add'); + + $info_setup = $info->addChild('gen_setup'); foreach ($properties as $name => $value) { - $info->addChild($name, $value); + $info_setup->addChild($name, $value); } + $info_props = $info->addChild('hosting')->addChild('vrt_hst'); + + if($ftp_login != "" && $ftp_pass != "") + { + $prop_ftp_user = $info_props->addChild('property'); + $prop_ftp_user->addChild("name", 'ftp_login'); + $prop_ftp_user->addChild("value", $ftp_login); + + + $prop_ftp_pass = $info_props->addChild('property'); + $prop_ftp_pass->addChild("name", 'ftp_password'); + $prop_ftp_pass->addChild("value", $ftp_pass); + } + + if($ip != "") + $info_props->addChild("ip_address", $ip); + + if($more_prop) + foreach ($more_prop as $name => $value) + $info->addChild($name, $value); + $response = $this->_client->request($packet); return new Struct\Info($response); } From 0702a349b37da1d1d83cd765b71cecd73ce53bfe Mon Sep 17 00:00:00 2001 From: Tobias Vorwachs Date: Thu, 10 Nov 2016 13:14:46 +0100 Subject: [PATCH 2/2] corect spaces --- src/PleskX/Api/Operator/Webspace.php | 34 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/PleskX/Api/Operator/Webspace.php b/src/PleskX/Api/Operator/Webspace.php index 3d6353e0..2648af61 100644 --- a/src/PleskX/Api/Operator/Webspace.php +++ b/src/PleskX/Api/Operator/Webspace.php @@ -27,10 +27,10 @@ public function getPhysicalHostingDescriptor() /** * @param array $properties // see https://docs.plesk.com/en-US/12.5/api-rpc/reference/managing-subscriptions-webspaces/subscription-settings/general-subscription-information/node-gen_setup.33858/ - * @param array $more_prop // see https://docs.plesk.com/en-US/12.5/api-rpc/reference/managing-subscriptions-webspaces/creating-a-subscription-webspace.33892/ - * @param string $ftp_login // ftp login - * @param string $ftp_pass // ftp password - * @param string $ip // IP address of webspace + * @param array $more_prop // see https://docs.plesk.com/en-US/12.5/api-rpc/reference/managing-subscriptions-webspaces/creating-a-subscription-webspace.33892/ + * @param string $ftp_login // ftp login + * @param string $ftp_pass // ftp password + * @param string $ip // IP address of webspace * @return Struct\Info */ public function create($properties, $more_prop = null, $ftp_login = "", $ftp_pass = "", $ip = "") @@ -46,24 +46,24 @@ public function create($properties, $more_prop = null, $ftp_login = "", $ftp_pas $info_props = $info->addChild('hosting')->addChild('vrt_hst'); - if($ftp_login != "" && $ftp_pass != "") - { - $prop_ftp_user = $info_props->addChild('property'); - $prop_ftp_user->addChild("name", 'ftp_login'); - $prop_ftp_user->addChild("value", $ftp_login); + if($ftp_login != "" && $ftp_pass != "") + { + $prop_ftp_user = $info_props->addChild('property'); + $prop_ftp_user->addChild("name", 'ftp_login'); + $prop_ftp_user->addChild("value", $ftp_login); - $prop_ftp_pass = $info_props->addChild('property'); - $prop_ftp_pass->addChild("name", 'ftp_password'); - $prop_ftp_pass->addChild("value", $ftp_pass); - } + $prop_ftp_pass = $info_props->addChild('property'); + $prop_ftp_pass->addChild("name", 'ftp_password'); + $prop_ftp_pass->addChild("value", $ftp_pass); + } if($ip != "") - $info_props->addChild("ip_address", $ip); + $info_props->addChild("ip_address", $ip); - if($more_prop) - foreach ($more_prop as $name => $value) - $info->addChild($name, $value); + if($more_prop) + foreach ($more_prop as $name => $value) + $info->addChild($name, $value); $response = $this->_client->request($packet); return new Struct\Info($response);