Correct CliController for user namespace. Turn off error handler.
This commit is contained in:
@ -23,8 +23,8 @@ class CliController
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
ErrorHandler::init();
|
||||
$this->error_stream = Config::get('ErrorStream', 'php://stderr');
|
||||
//\Majestic\Exception\ErrorHandler::init();
|
||||
$this->error_stream = \Majestic\Config::get('ErrorStream', 'php://stderr');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,14 +53,14 @@ class CliController
|
||||
|
||||
/**
|
||||
* @param iCli|string $cli
|
||||
* @throws ErrorException|GeneralException
|
||||
* @throws \ErrorException|\Majestic\Exception\GeneralException
|
||||
*/
|
||||
public function execute($cli)
|
||||
{
|
||||
try {
|
||||
$this->run($cli);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
catch (\Exception $e) {
|
||||
$this->exception($e);
|
||||
}
|
||||
}
|
||||
@ -69,18 +69,18 @@ class CliController
|
||||
{
|
||||
if (is_string($cli)) {
|
||||
if (!class_exists($cli)) {
|
||||
throw new GeneralException('Action class "' . $cli . '" not found.');
|
||||
throw new \Majestic\Exception\GeneralException('Action class "' . $cli . '" not found.');
|
||||
}
|
||||
$cli = new $cli;
|
||||
}
|
||||
if (!in_array('iCli', class_implements($cli))) {
|
||||
throw new ErrorException('Runner "' . get_class($cli) . '" need implement of "iCli" interface.');
|
||||
if (!in_array('Majestic\App\iCli', class_implements($cli))) {
|
||||
throw new \ErrorException('Runner "' . get_class($cli) . '" need implement of "iCli" interface.');
|
||||
}
|
||||
$cli->run();
|
||||
if (Config::get('PROFILER')) {
|
||||
$profile = Profiler::getInstance()->getCli();
|
||||
if (Config::get('LOGGING')) {
|
||||
Logger::getInstance()->log($profile);
|
||||
if (\Majestic\Config::get('PROFILER')) {
|
||||
$profile = \Majestic\Util\Profiler\Profiler::getInstance()->getCli();
|
||||
if (\Majestic\Config::get('LOGGING')) {
|
||||
\Majestic\Logger\Logger::getInstance()->log($profile);
|
||||
} else {
|
||||
echo $profile;
|
||||
}
|
||||
@ -90,7 +90,7 @@ class CliController
|
||||
protected function exception($e)
|
||||
{
|
||||
$code = $e->getCode();
|
||||
if ($e instanceof ErrorException) {
|
||||
if ($e instanceof \ErrorException) {
|
||||
$code = $e->getSeverity();
|
||||
}
|
||||
file_put_contents($this->error_stream, PHP_EOL . 'Error ' . '#' . $code . ': ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||
|
Reference in New Issue
Block a user