mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-22 21:03:01 +09:00
Update Service.php
This commit is contained in:
1 parent
df141caed4
commit
6eb3bfdaf1
1 file changed
+20
-20
@@ -47,7 +47,7 @@ class Service implements InjectionAwareInterface
|
||||
|
||||
return $product->title;
|
||||
}
|
||||
|
||||
|
||||
public function validateOrderData(array &$data)
|
||||
{
|
||||
if(!isset($data['server_id'])) {
|
||||
@@ -80,7 +80,7 @@ class Service implements InjectionAwareInterface
|
||||
|
||||
$hp = $this->di['db']->getExistingModelById('ServiceHostingHp', $c['hosting_plan_id'], 'Hosting plan from order configuration was not found');
|
||||
|
||||
$model = $this->di['db']->dispense('ServiceHostingServer');
|
||||
$model = $this->di['db']->dispense('ServiceHosting');
|
||||
$model->client_id = $order->client_id;
|
||||
$model->service_hosting_server_id = $server->id;
|
||||
$model->service_hosting_hp_id = $hp->id;
|
||||
@@ -108,13 +108,13 @@ class Service implements InjectionAwareInterface
|
||||
if(isset($c['password']) && !empty($c['password'])) {
|
||||
$pass = $c['password'];
|
||||
}
|
||||
|
||||
|
||||
if(isset($c['username']) && !empty($c['username'])) {
|
||||
$username = $c['username'];
|
||||
} else {
|
||||
$username = $this->_generateUsername($model->sld.$model->tld);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$model->username = $username;
|
||||
$model->pass = $pass;
|
||||
$this->di['db']->store($model);
|
||||
@@ -123,7 +123,7 @@ class Service implements InjectionAwareInterface
|
||||
list($adapter, $account) = $this->_getAM($model);
|
||||
$adapter->createAccount($account);
|
||||
}
|
||||
|
||||
|
||||
return array(
|
||||
'username' => $username,
|
||||
'password' => $pass,
|
||||
@@ -266,7 +266,7 @@ class Service implements InjectionAwareInterface
|
||||
list($adapter, $account) = $this->_getAM($model);
|
||||
$adapter->changeAccountUsername($account, $u);
|
||||
}
|
||||
|
||||
|
||||
$model->username = $u;
|
||||
$model->updated_at = date('Y-m-d H:i:s');
|
||||
$this->di['db']->store($model);
|
||||
@@ -287,7 +287,7 @@ class Service implements InjectionAwareInterface
|
||||
list($adapter, $account) = $this->_getAM($model);
|
||||
$adapter->changeAccountIp($account, $ip);
|
||||
}
|
||||
|
||||
|
||||
$model->ip = $ip;
|
||||
$model->updated_at = date('Y-m-d H:i:s');
|
||||
$this->di['db']->store($model);
|
||||
@@ -309,7 +309,7 @@ class Service implements InjectionAwareInterface
|
||||
list($adapter, $account) = $this->_getAM($model);
|
||||
$adapter->changeAccountDomain($account, $sld.$tld);
|
||||
}
|
||||
|
||||
|
||||
$model->sld = $sld;
|
||||
$model->tld = $tld;
|
||||
$model->updated_at = date('Y-m-d H:i:s');
|
||||
@@ -351,7 +351,7 @@ class Service implements InjectionAwareInterface
|
||||
if($account->getIp() != $updated->getIp()) {
|
||||
$model->ip = $updated->getIp();
|
||||
}
|
||||
|
||||
|
||||
$model->updated_at = date('Y-m-d H:i:s');
|
||||
$this->di['db']->store($model);
|
||||
$this->di['logger']->info('Synchronizing hosting account %s with server', $model->id);
|
||||
@@ -378,7 +378,7 @@ class Service implements InjectionAwareInterface
|
||||
{
|
||||
return ($order->status != \Model_ClientOrder::STATUS_FAILED_SETUP);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate username by domain
|
||||
*
|
||||
@@ -444,7 +444,7 @@ class Service implements InjectionAwareInterface
|
||||
|
||||
public function toApiArray(\Model_ServiceHosting $model, $deep = false, $identity = null)
|
||||
{
|
||||
$serviceHostingServerModel = $this->di['db']->load('ServiceHosting', $model->service_hosting_server_id);
|
||||
$serviceHostingServerModel = $this->di['db']->load('ServiceHostingServer', $model->service_hosting_server_id);
|
||||
$serviceHostingHpModel = $this->di['db']->load('ServiceHostingHp', $model->service_hosting_hp_id);
|
||||
$server = $this->toHostingServerApiArray($serviceHostingServerModel, $deep, $identity);
|
||||
$hp = $this->toHostingHpApiArray($serviceHostingHpModel, $deep, $identity);
|
||||
@@ -462,9 +462,9 @@ class Service implements InjectionAwareInterface
|
||||
);
|
||||
}
|
||||
|
||||
public function toHostingServerApiArray(\Model_ServiceHosting $model, $deep = false, $identity = null)
|
||||
public function toHostingServerApiArray(\Model_ServiceHostingServer $model, $deep = false, $identity = null)
|
||||
{
|
||||
list($cpanel_url, $whm_url) = $this->getManagerUrls($model);
|
||||
list($cpanel_url, $whm_url) = $this->getMangerUrls($model);
|
||||
$result = array(
|
||||
'name' => $model->name,
|
||||
'hostname' => $model->hostname,
|
||||
@@ -652,7 +652,7 @@ class Service implements InjectionAwareInterface
|
||||
return $newId;
|
||||
}
|
||||
|
||||
public function deleteServer(\Model_ServiceHosting $model)
|
||||
public function deleteServer(\Model_ServiceHostingServer $model)
|
||||
{
|
||||
$id = $model->id;
|
||||
$this->di['db']->trash($model);
|
||||
@@ -660,7 +660,7 @@ class Service implements InjectionAwareInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
public function updateServer(\Model_ServiceHosting $model, array $data)
|
||||
public function updateServer(\Model_ServiceHostingServer $model, array $data)
|
||||
{
|
||||
$model->name = $this->di['array_get']($data, 'name', $model->name);
|
||||
$model->ip = $this->di['array_get']($data, 'ip', $model->ip);
|
||||
@@ -696,7 +696,7 @@ class Service implements InjectionAwareInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getServerManager(\Model_ServiceHosting $model)
|
||||
public function getServerManager(\Model_ServiceHostingServer $model)
|
||||
{
|
||||
if(empty($model->manager)) {
|
||||
throw new \Box_Exception('Invalid server manager. Server was not configured properly.', null, 654);
|
||||
@@ -720,7 +720,7 @@ class Service implements InjectionAwareInterface
|
||||
return $manager;
|
||||
}
|
||||
|
||||
public function testConnection(\Model_ServiceHosting $model)
|
||||
public function testConnection(\Model_ServiceHostingServer $model)
|
||||
{
|
||||
$m = $this->getServerManager($model);
|
||||
return $m->testConnection();
|
||||
@@ -871,7 +871,7 @@ class Service implements InjectionAwareInterface
|
||||
return $p;
|
||||
}
|
||||
|
||||
public function getServerManagerWithLog(\Model_ServiceHosting $model, \Model_ClientOrder $order)
|
||||
public function getServerManagerWithLog(\Model_ServiceHostingServer $model, \Model_ClientOrder $order)
|
||||
{
|
||||
$manager = $this->getServerManager($model);
|
||||
|
||||
@@ -881,7 +881,7 @@ class Service implements InjectionAwareInterface
|
||||
return $manager;
|
||||
}
|
||||
|
||||
public function getManagerUrls(\Model_ServiceHosting $model)
|
||||
public function getMangerUrls(\Model_ServiceHostingServer $model)
|
||||
{
|
||||
try {
|
||||
$m = $this->getServerManager($model);
|
||||
|
||||
Reference in new issue
Block a user