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

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
This commit is contained in:
Christian Boltz
2013-05-01 18:57:33 +00:00
parent 7862cca6a2
commit 85fb572db7
3 changed files with 12 additions and 16 deletions

View File

@@ -61,8 +61,8 @@ class DeleteTask extends Shell {
function execute() { function execute() {
if (empty($this->args)) { if (empty($this->args)) {
$this->help(); # $this->help();
//$this->__interactive(); $this->__interactive();
} }
if (!empty($this->args[0])) { if (!empty($this->args[0])) {
@@ -75,12 +75,12 @@ class DeleteTask extends Shell {
* @access private * @access private
*/ */
function __interactive() { function __interactive() {
$question[] = "Which Address do you want to view?"; $question[] = "Which Address do you want to delete?";
$address = $this->in(join("\n", $question)); $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')); $create = $this->in($question, array('y','n'));
@@ -99,19 +99,14 @@ class DeleteTask extends Shell {
*/ */
function __handle($address) { 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 = new AliasHandler();
$handler->init($address); $handler->init($address);
$status = $handler->delete(); $status = $handler->delete();
if ($status == true) { if ($status == true) {
$this->out("Mailbox of '$address' was deleted."); $this->out("Alias '$address' was deleted.");
} else { } else {
$this->error("Error:", join("\n", $handler->errormsg)); $this->err($handler->errormsg);
} }
return; return;
@@ -195,6 +190,7 @@ class ViewTask extends Shell {
if( $result['on_vacation'] ) { if( $result['on_vacation'] ) {
$this->out("This alias is a vacation address!"); $this->out("This alias is a vacation address!");
} }
$this->out("Active: " . $result['active']);
} }
return; return;

View File

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

View File

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