diff --git a/src/PleskX/Api/Operator/Webspace.php b/src/PleskX/Api/Operator/Webspace.php index d3f8e055..2648af61 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); }