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

View File

@ -123,43 +123,28 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk {
* @todo To implement
*/
public function provision(Model_Service $so) {
/*
$ro = clone $this->cmd_getreseller($so);
// Make sure our reseller exists
if ($ro AND ! $ro->id->value())
throw new Kohana_Exception('Add Reseller - Not Implemented');
// @todo If client already exists, skip this part...
$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?');
*/
}
// Provision Domain
$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?');
}
print_r(array('r'=>(string)$result,'t'=>$this));
// 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);
*/
echo (string)$result->_object;
}
public function add_client(Model_Service $so) {
@ -199,6 +184,9 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk {
if (! $co->loaded())
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();
$domain = $this->packet->add_node('webspace');
$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->add_node('name','ftp_login');
$property->add_node('value',$so->plugin()->ftp_username);
if ($so->plugin()->ftp_password) {
$property = $vrt_host->add_node('property');
$property->add_node('name','ftp_password');
$property->add_node('value',$so->plugin()->ftp_password);
}
$vrt_host->add_node('ip_address',$ip);
$add->add_node('plan-name',$plan);