1
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2025-07-29 22:41:11 +03:00

some CLI cleanup

postfixadmin-cli.php:
- better error message for unknown modules or tasks
- remove unused variables
- __bootstrap(): require_once() common.php is enough
  (and inflector.php no longer exists)

shells/shell.php:
- remove unused variables
- no longer print the path in _welcome()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1578 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
Christian Boltz
2013-11-14 21:48:52 +00:00
parent 72f0818391
commit 9decae80e9
2 changed files with 7 additions and 53 deletions

View File

@ -97,20 +97,6 @@ class PostfixAdmin {
* @access public
*/
var $shellCommand = null;
/**
* The path locations of shells.
*
* @var array
* @access public
*/
var $shellPaths = array();
/**
* The path to the current shell location.
*
* @var string
* @access public
*/
var $shellPath = null;
/**
* The name of the shell in camelized.
*
@ -174,7 +160,6 @@ class PostfixAdmin {
if (basename(__FILE__) != basename($this->args[0])) {
$this->stderr("\nCakePHP Console: ");
$this->stderr('Warning: the dispatcher may have been loaded incorrectly, which could lead to unexpected results...');
if ($this->getInput('Continue anyway?', array('y', 'n'), 'y') == 'n') {
exit();
@ -203,18 +188,10 @@ class PostfixAdmin {
return false;
}
$includes = array(
PATH.'/config.inc.php',
PATH.'/functions.inc.php',
PATH.'/common.php',
CORE_INCLUDE_PATH.'/inflector.php',
);
foreach ($includes as $inc) {
if (!require_once($inc)) {
$this->stderr("Failed to load {$inc}");
return false;
}
if (!require_once(PATH . '/common.php')) {
$this->stderr("Failed to load " . PATH . '/common.php');
return false;
}
return true;
@ -260,7 +237,7 @@ class PostfixAdmin {
}
if (!class_exists($this->shellClass)) {
$this->stderr('Class '.$this->shellClass.' could not be loaded');
$this->stderr('Unknown task ' . $this->shellCommand);
return;
}
@ -269,7 +246,7 @@ class PostfixAdmin {
$shell->handler_to_use = ucfirst($this->shell) . 'Handler';
if (!class_exists($shell->handler_to_use)) {
$this->stderr('Class '.$shell->handler_to_use.' could not be loaded');
$this->stderr('Unknown module ' . $this->shell);
return;
}
@ -504,7 +481,7 @@ class PostfixAdmin {
function commands() {
# TODO: this list is incomplete
return array(
'mailbox' => array(
'add'=> 'Adds a new mailbox.',