| Server IP : 172.173.179.141 / Your IP : 216.73.216.196 Web Server : Apache System : Linux mail.lomejor.cr 6.8.0-1059-azure #65~22.04.1-Ubuntu SMP Thu May 28 16:59:19 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.2.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/mailsvr/padmin/model/ |
Upload File : |
<?php
# $Id$
/**
* class to handle 'delete' in Cli
*/
class CliDelete extends Shell {
/**
* Execution method always used for tasks
*/
public function execute() {
if (empty($this->args)) {
return $this->__interactive();
}
if (!empty($this->args[0])) {
return $this->__handle($this->args[0]);
}
}
/**
* Interactive mode
*/
protected function __interactive() {
$module = preg_replace('/Handler$/', '', $this->handler_to_use);
$module = strtolower($module);
$question = "Which $module do you want to delete?";
$address = $this->in($question);
$question = "Do you really want to delete '$address'?";
$create = $this->in($question, array('y','n'));
if ($create == 'y') {
return $this->__handle($address);
}
}
/**
* actually delete something
*
* @param string address to delete
*/
protected function __handle($address) {
$handler = new $this->handler_to_use($this->new);
if (!$handler->init($address)) {
$this->err($handler->errormsg);
return 1;
}
if (!$handler->delete()) {
$this->err($handler->errormsg);
return 1;
}
$this->out($handler->infomsg);
return 0;
}
/**
* Display help contents
*
* @access public
*/
public function help() {
$module = preg_replace('/Handler$/', '', $this->handler_to_use);
$module = strtolower($module);
$this->out(
"Usage:
postfixadmin-cli $module delete
Deletes $module in interactive mode.
- or -
postfixadmin-cli $module delete <address>
Deletes $module <address> in non-interactive mode.
"
);
$this->_stop(1);
}
}
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */