change package
This commit is contained in:
parent
51d58ef6a4
commit
81347af721
1 changed files with 31 additions and 4 deletions
|
@ -140,7 +140,7 @@ class Server_Manager_Mailcow extends Server_Manager
|
||||||
$p = $a->getPackage();
|
$p = $a->getPackage();
|
||||||
$client = $a->getClient();
|
$client = $a->getClient();
|
||||||
// Prepare POST query
|
// Prepare POST query
|
||||||
$domaindata = [
|
$domainData = [
|
||||||
'json' => [
|
'json' => [
|
||||||
"active" => "1",
|
"active" => "1",
|
||||||
"aliases" => $p->getMaxSubdomains(),
|
"aliases" => $p->getMaxSubdomains(),
|
||||||
|
@ -158,7 +158,7 @@ class Server_Manager_Mailcow extends Server_Manager
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
// Create domain on mailcow
|
// Create domain on mailcow
|
||||||
$result1 = $this->_makeRequest('POST', 'add/domain', $domaindata);
|
$result1 = $this->_makeRequest('POST', 'add/domain', $domainData);
|
||||||
if (str_contains($result1, 'success') {
|
if (str_contains($result1, 'success') {
|
||||||
// Create Domain Admin in mailcow
|
// Create Domain Admin in mailcow
|
||||||
$domainAdminData = [
|
$domainAdminData = [
|
||||||
|
@ -237,13 +237,13 @@ class Server_Manager_Mailcow extends Server_Manager
|
||||||
$p = $a->getPackage();
|
$p = $a->getPackage();
|
||||||
$client = $a->getClient();
|
$client = $a->getClient();
|
||||||
// Prepare POST query
|
// Prepare POST query
|
||||||
$domaindata = [
|
$domainData = [
|
||||||
'body' => [
|
'body' => [
|
||||||
$a->getDomain(),
|
$a->getDomain(),
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
// Delete domain on mailcow
|
// Delete domain on mailcow
|
||||||
$result1 = $this->_makeRequest('POST', 'delete/domain', $domaindata);
|
$result1 = $this->_makeRequest('POST', 'delete/domain', $domainData);
|
||||||
if (str_contains($result1, 'success') {
|
if (str_contains($result1, 'success') {
|
||||||
// Delete Domain Admin in mailcow
|
// Delete Domain Admin in mailcow
|
||||||
$domainAdminData = [
|
$domainAdminData = [
|
||||||
|
@ -266,4 +266,31 @@ class Server_Manager_Mailcow extends Server_Manager
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change account package on server.
|
||||||
|
*/
|
||||||
|
public function changeAccountPackage(Server_Account $a, Server_Package $p)
|
||||||
|
{
|
||||||
|
// Prepare POST query
|
||||||
|
$pacakgeData = [
|
||||||
|
'json' => [
|
||||||
|
"attr" => [
|
||||||
|
"aliases" => $p->getMaxSubdomains(),
|
||||||
|
"defquota" => $p->getQuota(),
|
||||||
|
"mailboxes" => $p->getMaxPop(),
|
||||||
|
],
|
||||||
|
"items" => $a->getDomain(),
|
||||||
|
]
|
||||||
|
];
|
||||||
|
// Edit domain on mailcow
|
||||||
|
$result = $this->_makeRequest('POST', 'edit/domain', $domainData);
|
||||||
|
if (!str_contains($result, 'success')) {
|
||||||
|
$placeholders = [':action:' => __trans('change account package'), ':type:' => 'Mailcow'];
|
||||||
|
|
||||||
|
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue