mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-10-30 07:43:59 +01:00
Upgrade CakePHP from 2.2.5 to 2.9.5
This commit is contained in:
parent
5a580df460
commit
235a541597
793 changed files with 60746 additions and 23753 deletions
|
|
@ -2,19 +2,19 @@
|
|||
/**
|
||||
* ErrorHandler for Console Shells
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @since CakePHP(tm) v 2.0
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('ErrorHandler', 'Error');
|
||||
App::uses('ConsoleOutput', 'Console');
|
||||
App::uses('CakeLog', 'Log');
|
||||
|
|
@ -40,35 +40,37 @@ class ConsoleErrorHandler {
|
|||
* @return ConsoleOutput
|
||||
*/
|
||||
public static function getStderr() {
|
||||
if (empty(self::$stderr)) {
|
||||
self::$stderr = new ConsoleOutput('php://stderr');
|
||||
if (empty(static::$stderr)) {
|
||||
static::$stderr = new ConsoleOutput('php://stderr');
|
||||
}
|
||||
return self::$stderr;
|
||||
return static::$stderr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a exception in the console environment. Prints a message to stderr.
|
||||
* Handle an exception in the console environment. Prints a message to stderr.
|
||||
*
|
||||
* @param Exception $exception The exception to handle
|
||||
* @param Exception|ParserError $exception The exception to handle
|
||||
* @return void
|
||||
*/
|
||||
public function handleException(Exception $exception) {
|
||||
$stderr = self::getStderr();
|
||||
public function handleException($exception) {
|
||||
$stderr = static::getStderr();
|
||||
$stderr->write(__d('cake_console', "<error>Error:</error> %s\n%s",
|
||||
$exception->getMessage(),
|
||||
$exception->getTraceAsString()
|
||||
));
|
||||
$this->_stop($exception->getCode() ? $exception->getCode() : 1);
|
||||
$code = $exception->getCode();
|
||||
$code = ($code && is_int($code)) ? $code : 1;
|
||||
return $this->_stop($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle errors in the console environment. Writes errors to stderr,
|
||||
* and logs messages if Configure::read('debug') is 0.
|
||||
*
|
||||
* @param integer $code Error code
|
||||
* @param int $code Error code
|
||||
* @param string $description Description of the error.
|
||||
* @param string $file The file the error occurred in.
|
||||
* @param integer $line The line the error occurred on.
|
||||
* @param int $line The line the error occurred on.
|
||||
* @param array $context The backtrace of the error.
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -76,24 +78,25 @@ class ConsoleErrorHandler {
|
|||
if (error_reporting() === 0) {
|
||||
return;
|
||||
}
|
||||
$stderr = self::getStderr();
|
||||
$stderr = static::getStderr();
|
||||
list($name, $log) = ErrorHandler::mapErrorCode($code);
|
||||
$message = __d('cake_console', '%s in [%s, line %s]', $description, $file, $line);
|
||||
$stderr->write(__d('cake_console', "<error>%s Error:</error> %s\n", $name, $message));
|
||||
|
||||
if (Configure::read('debug') == 0) {
|
||||
if (!Configure::read('debug')) {
|
||||
CakeLog::write($log, $message);
|
||||
}
|
||||
|
||||
if ($log === LOG_ERR) {
|
||||
$this->_stop(1);
|
||||
return $this->_stop(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for exit(), used for testing.
|
||||
*
|
||||
* @param $code int The exit code.
|
||||
* @param int $code The exit code.
|
||||
* @return void
|
||||
*/
|
||||
protected function _stop($code = 0) {
|
||||
exit($code);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue