Provision working

This commit is contained in:
Deon George 2012-07-23 18:26:14 +10:00
parent dabdad9179
commit 25602454b7
2 changed files with 21 additions and 29 deletions

View File

@ -186,11 +186,11 @@ class Controller_Task_Host extends Controller_Task {
if (isset($f[strtolower(get_class($this->hpo))][$b])) { if (isset($f[strtolower(get_class($this->hpo))][$b])) {
switch ($f[strtolower(get_class($this->hpo))][$b]) { switch ($f[strtolower(get_class($this->hpo))][$b]) {
case 'NODOMAIN': case 'NODOMAIN':
$rec[$b] = preg_replace('/.?'.$so->plugin()->name().'.$/i','',$rec[$b]); $rec[$b] = preg_replace('/\.?'.$so->plugin()->name().'\.$/i','',$rec[$b]);
break; break;
case 'NOTRAILDOT': case 'NOTRAILDOT':
$rec[$b] = preg_replace('/.$/','',$rec[$b]); $rec[$b] = preg_replace('/\.$/','',$rec[$b]);
break; break;
default: default:
@ -252,6 +252,8 @@ class Controller_Task_Host extends Controller_Task {
*/ */
public function action_provision() { public function action_provision() {
$result = $this->hpo->provision($this->so); $result = $this->hpo->provision($this->so);
$this->action_setexpire();
print_r((string)$result); print_r((string)$result);
} }

View File

@ -123,43 +123,28 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk {
* @todo To implement * @todo To implement
*/ */
public function provision(Model_Service $so) { public function provision(Model_Service $so) {
/*
$ro = clone $this->cmd_getreseller($so); $ro = clone $this->cmd_getreseller($so);
// Make sure our reseller exists // Make sure our reseller exists
if ($ro AND ! $ro->id->value()) if ($ro AND ! $ro->id->value())
throw new Kohana_Exception('Add Reseller - Not Implemented'); throw new Kohana_Exception('Add Reseller - Not Implemented');
// @todo If client already exists, skip this part...
$result = $this->add_client($so); $result = $this->add_client($so);
if (! $result->loaded()) if (! $result->loaded()) {
print_r(array('x'=>(string)$result->_xml,'o'=>(string)$result->_object));
throw new Kohana_Exception('Failed to Add Client?'); throw new Kohana_Exception('Failed to Add Client?');
*/ }
// Provision Domain // Provision Domain
$result = $this->add_domain($so); $result = $this->add_domain($so);
if (! $this->loaded()) if (! $result->loaded()) {
print_r(array('x'=>(string)$result->_xml,'o'=>(string)$result->_object));
throw new Kohana_Exception('Failed to Add Domain?'); throw new Kohana_Exception('Failed to Add Domain?');
}
print_r(array('r'=>(string)$result,'t'=>$this)); echo (string)$result->_object;
// Create Client Account
throw new Kohana_Exception('Not Implemented');
/*
// Next need to get the ID from the account call to set the IP
$result = $this->hs->setip(35); // @todo change this number
print_r((string)$result);
// Set Limits
$result = $this->hs->setlimits($so);
print_r((string)$result);
// Next need to get the ID for the domain to disable mail
$result = $this->hs->disablemail(43);
print_r((string)$result);
*/
} }
public function add_client(Model_Service $so) { public function add_client(Model_Service $so) {
@ -199,6 +184,9 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk {
if (! $co->loaded()) if (! $co->loaded())
throw new Kohana_Exception('Unable to load Plesk Customer?'); throw new Kohana_Exception('Unable to load Plesk Customer?');
if (! $so->plugin()->ftp_username)
throw new KOhana_Exception('FTP Username cannot be blank');
$this->init(); $this->init();
$domain = $this->packet->add_node('webspace'); $domain = $this->packet->add_node('webspace');
$add = $domain->add_node('add'); $add = $domain->add_node('add');
@ -214,9 +202,11 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk {
$property = $vrt_host->add_node('property'); $property = $vrt_host->add_node('property');
$property->add_node('name','ftp_login'); $property->add_node('name','ftp_login');
$property->add_node('value',$so->plugin()->ftp_username); $property->add_node('value',$so->plugin()->ftp_username);
$property = $vrt_host->add_node('property'); if ($so->plugin()->ftp_password) {
$property->add_node('name','ftp_password'); $property = $vrt_host->add_node('property');
$property->add_node('value',$so->plugin()->ftp_password); $property->add_node('name','ftp_password');
$property->add_node('value',$so->plugin()->ftp_password);
}
$vrt_host->add_node('ip_address',$ip); $vrt_host->add_node('ip_address',$ip);
$add->add_node('plan-name',$plan); $add->add_node('plan-name',$plan);