Fixed exception placeholders (#2036)

This commit is contained in:
Belle Aerni authored and GitHub committed 2024-01-03 20:22:39 -08:00
1 parent 50dde58963
commit cf0cc98d76
8 files changed
+32 -32

No files matched your search

+1 -1
View File
@@ -166,7 +166,7 @@ class Registrar_Adapter_Internetbs extends Registrar_AdapterAbstract
if ($result['status'] == 'SUCCESS'){
return $this->_createDomainObj($result, $domain);
} else {
$placeholders = ['action' => __trans('get domain details'), 'type' => 'Internetbs'];
$placeholders = [':action:' => __trans('get domain details'), ':type:' => 'Internetbs'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
}
+8 -8
View File
@@ -167,13 +167,13 @@ class Registrar_Adapter_Namecheap extends Registrar_AdapterAbstract
if (isset($result['status']) && strtolower($result['status']) == 'error') {
error_log("Namecheap error: " . PHP_EOL . $result['error']);
$placeholders = ['action' => $params['Command'], 'type' => 'Namecheap'];
$placeholders = [':action:' => $params['Command'], ':type:' => 'Namecheap'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
if (isset($result['status']) && strtolower($result['status']) == 'failed') {
error_log("Namecheap error: " . PHP_EOL . $result['actionstatusdesc']);
$placeholders = ['action' => $params['Command'], 'type' => 'Namecheap'];
$placeholders = [':action:' => $params['Command'], ':type:' => 'Namecheap'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
@@ -244,7 +244,7 @@ class Registrar_Adapter_Namecheap extends Registrar_AdapterAbstract
// problem here: FOSSBilling doesn't display our error and will display 'nameservers updates' evern when this fails
if (!isset($result->CommandResponse->DomainDNSSetCustomResult['Updated']) && $result->CommandResponse->DomainDNSSetCustomResult['Updated'] != 'true') {
$placeholders = ['action' => __trans('update nameservers'), 'type' => 'Namecheap'];
$placeholders = [':action:' => __trans('update nameservers'), ':type:' => 'Namecheap'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
return True;
@@ -341,7 +341,7 @@ class Registrar_Adapter_Namecheap extends Registrar_AdapterAbstract
$result = $this->_makeRequest($params);
if (!isset($result->CommandResponse->DomainContactsResult)) {
$placeholders = ['action' => __trans('retrieve domain details'), 'type' => 'Namecheap'];
$placeholders = [':action:' => __trans('retrieve domain details'), ':type:' => 'Namecheap'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
@@ -586,7 +586,7 @@ class Registrar_Adapter_Namecheap extends Registrar_AdapterAbstract
'id' => (string)$result->CommandResponse->DomainGetInfoResult->Whoisguard->ID
);
}
$placeholders = ['action' => __trans('retrieve privacy information'), 'type' => 'Namecheap'];
$placeholders = [':action:' => __trans('retrieve privacy information'), ':type:' => 'Namecheap'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
@@ -649,7 +649,7 @@ class Registrar_Adapter_Namecheap extends Registrar_AdapterAbstract
);
$result = $this->_makeRequest($params);
if (!isset($result->CommandResponse->DomainGetRegistrarLockResult['RegistrarLockStatus'])) {
$placeholders = ['action' => __trans('get the domain lock status'), 'type' => 'Namecheap'];
$placeholders = [':action:' => __trans('get the domain lock status'), ':type:' => 'Namecheap'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
return $result->CommandResponse->DomainGetRegistrarLockResult['RegistrarLockStatus'] == 'true';
@@ -673,7 +673,7 @@ class Registrar_Adapter_Namecheap extends Registrar_AdapterAbstract
$result = $this->_makeRequest($params);
if (!isset($result->CommandResponse->DomainSetRegistrarLockResult['IsSuccess'])) {
$placeholders = ['action' => __trans('set the domain lock status'), 'type' => 'Namecheap'];
$placeholders = [':action:' => __trans('set the domain lock status'), ':type:' => 'Namecheap'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
if ($result->CommandResponse->DomainGetRegistrarLockResult['IsSuccess'] == 'true') {
@@ -701,7 +701,7 @@ class Registrar_Adapter_Namecheap extends Registrar_AdapterAbstract
$result = $this->_makeRequest($params);
if (!isset($result->CommandResponse->DomainSetRegistrarLockResult['IsSuccess'])) {
$placeholders = ['action' => __trans('set the domain lock status'), 'type' => 'Namecheap'];
$placeholders = [':action:' => __trans('set the domain lock status'), ':type:' => 'Namecheap'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
if ($result->CommandResponse->DomainGetRegistrarLockResult['IsSuccess'] == 'true') {
@@ -395,7 +395,7 @@ class Registrar_Adapter_Resellerclub extends Registrar_AdapterAbstract
);
$data = $this->_makeRequest('domains/details', $params);
if(!isset($data['domsecret'])) {
$placeholders = ['action' => __trans('get the transfer code'), 'type' => 'ResellerClub'];
$placeholders = [':action:' => __trans('get the transfer code'), ':type:' => 'ResellerClub'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
return $data['domsecret'];
@@ -701,19 +701,19 @@ class Registrar_Adapter_Resellerclub extends Registrar_AdapterAbstract
if(isset($json['status']) && $json['status'] == 'ERROR') {
error_log("ResellerClub error: " . $json['message']);
$placeholders = ['action' => $url, 'type' => 'ResellerClub'];
$placeholders = [':action:' => $url, ':type:' => 'ResellerClub'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
if(isset($json['status']) && $json['status'] == 'error') {
error_log("ResellerClub error: " . $json['error']);
$placeholders = ['action' => $url, 'type' => 'ResellerClub'];
$placeholders = [':action"' => $url, ':type:' => 'ResellerClub'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
if(isset($json['status']) && $json['status'] == 'Failed') {
error_log("ResellerClub error: " . $json['actionstatusdesc']);
$placeholders = ['action' => $url, 'type' => 'ResellerClub'];
$placeholders = [':action:' => $url, ':type:' => 'ResellerClub'];
throw new Registrar_Exception('Failed to :action: with the :type: registrar, check the error logs for further details', $placeholders);
}
+5 -5
View File
@@ -140,7 +140,7 @@ class Server_Manager_CWP extends Server_Manager
if ($this->makeAPIRequest('account', $data)) {
return true;
} else {
$placeholders = ['action' => __trans('create account'), 'type' => 'CWP'];
$placeholders = [':action:' => __trans('create account'), ':type:' => 'CWP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
}
@@ -174,7 +174,7 @@ class Server_Manager_CWP extends Server_Manager
if ($this->makeAPIRequest('account', $data)) {
return true;
} else {
$placeholders = ['action' => __trans('unsuspend account'), 'type' => 'CWP'];
$placeholders = [':action:' => __trans('unsuspend account'), ':type:' => 'CWP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
}
@@ -194,7 +194,7 @@ class Server_Manager_CWP extends Server_Manager
if ($this->makeAPIRequest('account', $data)) {
return true;
} else {
$placeholders = ['action' => __trans('cancel account'), 'type' => 'CWP'];
$placeholders = [':action:' => __trans('cancel account'), ':type:' => 'CWP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
}
@@ -214,7 +214,7 @@ class Server_Manager_CWP extends Server_Manager
if ($this->makeAPIRequest('changepack', $data)) {
return true;
} else {
$placeholders = ['action' => __trans('change account package'), 'type' => 'CWP'];
$placeholders = [':action:' => __trans('change account package'), ':type:' => 'CWP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
}
@@ -232,7 +232,7 @@ class Server_Manager_CWP extends Server_Manager
if ($this->makeAPIRequest('changepass', $data)) {
return true;
} else {
$placeholders = ['action' => __trans('change account password'), 'type' => 'CWP'];
$placeholders = [':action:' => __trans('change account password'), ':type:' => 'CWP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
}
+1 -1
View File
@@ -440,7 +440,7 @@ class Server_Manager_Directadmin extends Server_Manager
$r = $this->_parseResponse($data);
if(isset($r['error']) && $r['error'] == 1) {
$placeholders = ['action' => $command, 'type' => 'DirectAdmin'];
$placeholders = [':action:' => $command, ':type:' => 'DirectAdmin'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
+8 -8
View File
@@ -195,7 +195,7 @@ class Server_Manager_Hestia extends Server_Manager
];
$result2 = $this->_makeRequest($postvars2);
} else {
$placeholders = ['action' => __trans('create user'), 'type' => 'HestiaCP'];
$placeholders = [':action:' => __trans('create user'), ':type:' => 'HestiaCP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
if (0 !== intval($result2)) {
@@ -206,10 +206,10 @@ class Server_Manager_Hestia extends Server_Manager
];
$result3 = $this->_makeRequest($postvars3);
if (0 !== intval($result3)) {
$placeholders = ['action1' => __trans('delete domain'), 'action2' => __trans('create domain'), 'type' => 'HestiaCP'];
$placeholders = [':action1:' => __trans('delete domain'), ':action2:' => __trans('create domain'), ':type:' => 'HestiaCP'];
throw new Server_Exception('Failed to :action1: on the :type: server after failed to :action2:, check the error logs for further details', $placeholders);
}
$placeholders = ['action' => __trans('create domain'), 'type' => 'HestiaCP'];
$placeholders = [':action:' => __trans('create domain'), ':type:' => 'HestiaCP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
@@ -236,7 +236,7 @@ class Server_Manager_Hestia extends Server_Manager
return true;
}
if (0 !== intval($result)) {
$placeholders = ['action' => __trans('suspend account'), 'type' => 'HestiaCP'];
$placeholders = [':action:' => __trans('suspend account'), ':type:' => 'HestiaCP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
@@ -261,7 +261,7 @@ class Server_Manager_Hestia extends Server_Manager
$result = $this->_makeRequest($postvars);
if (0 !== intval($result)) {
$placeholders = ['action' => __trans('unsuspend account'), 'type' => 'HestiaCP'];
$placeholders = [':action:' => __trans('unsuspend account'), ':type:' => 'HestiaCP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
@@ -290,7 +290,7 @@ class Server_Manager_Hestia extends Server_Manager
if ('3' == intval($result)) {
return true;
} elseif (0 !== intval($result)) {
$placeholders = ['action' => __trans('cancel account'), 'type' => 'HestiaCP'];
$placeholders = [':action:' => __trans('cancel account'), ':type:' => 'HestiaCP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
@@ -320,7 +320,7 @@ class Server_Manager_Hestia extends Server_Manager
// Make request and change package
$result = $this->_makeRequest($postvars);
if (0 !== intval($result)) {
$placeholders = ['action' => __trans('change account package'), 'type' => 'HestiaCP'];
$placeholders = [':action:' => __trans('change account package'), ':type:' => 'HestiaCP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
@@ -363,7 +363,7 @@ class Server_Manager_Hestia extends Server_Manager
// Make request and change password
$result = $this->_makeRequest($postvars);
if (0 !== intval($result)) {
$placeholders = ['action' => __trans('change account password'), 'type' => 'HestiaCP'];
$placeholders = [':action:' => __trans('change account password'), ':type:' => 'HestiaCP'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
+1 -1
View File
@@ -86,7 +86,7 @@ class Server_Manager_Plesk extends Server_Manager
$id = $this->_createClient($a);
$client = $a->getClient();
if (!$id) {
$placeholders = ['action' => __trans('create account'), 'type' => 'Plesk'];
$placeholders = [':action:' => __trans('create account'), ':type"' => 'Plesk'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
} else {
$client->setId((string)$id);
+4 -4
View File
@@ -417,7 +417,7 @@ class Server_Manager_Whm extends Server_Manager
$msg = sprintf('Function call "%s" response is invalid, body: %s', $action, $body);
$this->getLog()->crit($msg);
$placeholders = ['action' => $action, 'type' => 'cPanel'];
$placeholders = [':action:' => $action, ':type:' => 'cPanel'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
if(isset($json->cpanelresult) && isset($json->cpanelresult->error)) {
@@ -427,17 +427,17 @@ class Server_Manager_Whm extends Server_Manager
}
if(isset($json->data) && isset($json->data->result) && $json->data->result == '0') {
$this->getLog()->crit(sprintf('WHM server response error calling action %s: "%s"', $action, $json->data->reason));
$placeholders = ['action' => $action, 'type' => 'cPanel'];
$placeholders = [':action:' => $action, ':type:' => 'cPanel'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
if(isset($json->result) && is_array($json->result) && $json->result[0]->status == 0) {
$this->getLog()->crit(sprintf('WHM server response error calling action %s: "%s"',$action, $json->result[0]->statusmsg));
$placeholders = ['action' => $action, 'type' => 'cPanel'];
$placeholders = [':action:' => $action, ':type:' => 'cPanel'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}
if(isset($json->status) && $json->status != '1') {
$this->getLog()->crit(sprintf('WHM server response error calling action %s: "%s"',$action, $json->statusmsg));
$placeholders = ['action' => $action, 'type' => 'cPanel'];
$placeholders = [':action:' => $action, ':type:' => 'cPanel'];
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
}