scripts/shells/alias.php, mailbox.php, domain.php:

- various fixes to make deleting aliases / mailboxes / domains work


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1458 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 11 years ago
parent 7862cca6a2
commit 85fb572db7

@ -61,8 +61,8 @@ class DeleteTask extends Shell {
function execute() {
if (empty($this->args)) {
$this->help();
//$this->__interactive();
# $this->help();
$this->__interactive();
}
if (!empty($this->args[0])) {
@ -75,12 +75,12 @@ class DeleteTask extends Shell {
* @access private
*/
function __interactive() {
$question[] = "Which Address do you want to view?";
$question[] = "Which Address do you want to delete?";
$address = $this->in(join("\n", $question));
$question = "Do you really want to delete mailbox of '$address'?";
$question = "Do you really want to delete the alias '$address'?";
$create = $this->in($question, array('y','n'));
@ -99,19 +99,14 @@ class DeleteTask extends Shell {
*/
function __handle($address) {
### TODO: don't use MailboxHandler, instead add delete function to AliasHandler (if not already there)
### using MailboxHandler for deleting aliases is like taking a sledgehammer to crack a nut
### (and will probably cause some error messages that I added today ;-)
### Implemented check it please!
$handler = new AliasHandler();
$handler->init($address);
$status = $handler->delete();
if ($status == true) {
$this->out("Mailbox of '$address' was deleted.");
$this->out("Alias '$address' was deleted.");
} else {
$this->error("Error:", join("\n", $handler->errormsg));
$this->err($handler->errormsg);
}
return;
@ -195,6 +190,7 @@ class ViewTask extends Shell {
if( $result['on_vacation'] ) {
$this->out("This alias is a vacation address!");
}
$this->out("Active: " . $result['active']);
}
return;

@ -92,7 +92,7 @@ class DeleteTask extends Shell {
$question = "Do you really want to delete domain '$address'?";
$create = $this->in($question, array('y','n'));
$this->__handle($address);
if ($create == 'y') $this->__handle($address);
}
/**
* Interactive
@ -102,7 +102,7 @@ class DeleteTask extends Shell {
function __handle($address) {
$handler = new DomainHandler();
if (!$handler->init($address)) {
$this->error("Error:",join("\n", $handler->errormsg));
$this->err($handler->errormsg);
return;
}
@ -111,7 +111,7 @@ class DeleteTask extends Shell {
$this->out("Domain '$address' was deleted.");
} else {
$this->error("Error:", join("\n", $handler->errormsg));
$this->err($handler->errormsg);
}
return;

@ -84,7 +84,7 @@ class DeleteTask extends Shell {
$create = $this->in($question, array('y','n'));
$create == 'y' ? $random = true : $random = false;
$create == 'y' ? $create = true : $create = false;
if ($create)
$this->__handle($address);
@ -104,7 +104,7 @@ class DeleteTask extends Shell {
$status = $handler->delete();
if ( ! $status ) {
$this->error("Error:", join("\n", $handler->errormsg));
$this->err($handler->errormsg);
} else {
$this->out("Mailbox of '$address' was deleted.");

Loading…
Cancel
Save