1
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2025-08-09 05:02:44 +03:00

shells/domain.php:

- *Task / __handle(): check $handler->result after calling "new"
- AddTask / __handle():
  - don't set domain in $values - it's already included in the "new" call
  - hardcode "active" to 1 - before, it accidently got the value of "aliases"
  - use $handler->set() and $handler->store instead of $handler->add()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1211 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
Christian Boltz
2011-10-16 23:41:38 +00:00
parent 78d15b084d
commit 23e6dee1b2

View File

@@ -142,8 +142,12 @@ class AddTask extends Shell {
$handler = new DomainHandler($domain, 1); $handler = new DomainHandler($domain, 1);
if (!$handler->result()) {
$this->error("Error:",join("\n", $handler->errormsg));
return;
}
$values = array( $values = array(
'domain' => $domain,
'description' => $desc, 'description' => $desc,
'aliases' => $a, 'aliases' => $a,
'mailboxes' => $m, 'mailboxes' => $m,
@@ -151,12 +155,15 @@ class AddTask extends Shell {
'quota' => $d, 'quota' => $d,
'transport' => $handler->getTransport($t), 'transport' => $handler->getTransport($t),
'backupmx' => $backup, 'backupmx' => $backup,
'active' => $a, 'active' => 1,
'default_aliases' => $default, 'default_aliases' => $default,
); );
$return = $handler->add($values);
if(!$return) { if (!$handler->set($values)) {
$this->error("Error:", join("\n", $handler->errormsg));
}
if (!$handler->store()) {
$this->error("Error:", join("\n", $handler->errormsg)); $this->error("Error:", join("\n", $handler->errormsg));
} else { } else {
$this->out(""); $this->out("");
@@ -263,6 +270,11 @@ class DeleteTask extends Shell {
*/ */
function __handle($address) { function __handle($address) {
$handler = new DomainHandler($address); $handler = new DomainHandler($address);
if (!$handler->result()) {
$this->error("Error:",join("\n", $handler->errormsg));
return;
}
$status = $handler->delete(); $status = $handler->delete();
if ($status == true) { if ($status == true) {
$this->out("Domain '$address' was deleted."); $this->out("Domain '$address' was deleted.");
@@ -334,6 +346,11 @@ class ViewTask extends Shell {
$handler = new DomainHandler($domain); $handler = new DomainHandler($domain);
if (!$handler->result()) {
$this->error("Error:",join("\n", $handler->errormsg));
return;
}
$status = $handler->view(); $status = $handler->view();
if (!$status) { if (!$status) {
$this->error("Error:",join("\n", $handler->errormsg)); $this->error("Error:",join("\n", $handler->errormsg));