Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
+13
-66
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Exception class for database errors
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 18 Feb 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -46,73 +46,10 @@ class _Exception extends \RuntimeException
|
||||
*/
|
||||
public function __construct( $message = null, $code = 0, $previous = null, $query=NULL, $binds=array() )
|
||||
{
|
||||
/* Store these for the extraLogData() method */
|
||||
$this->query = $query;
|
||||
$this->binds = $binds;
|
||||
|
||||
if ( \IPS\Dispatcher::hasInstance() and \IPS\Dispatcher::i()->controllerLocation !== 'setup' )
|
||||
{
|
||||
$log = array( $message );
|
||||
|
||||
if ( ! empty( $query ) )
|
||||
{
|
||||
$log[] = $query;
|
||||
}
|
||||
|
||||
if ( count( $binds ) )
|
||||
{
|
||||
$log[] = print_r( $binds, TRUE );
|
||||
}
|
||||
|
||||
$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS );
|
||||
$_error_string = '';
|
||||
|
||||
if ( count( $backtrace ) )
|
||||
{
|
||||
$_error_string = "\n | File | Function | Line No. |";
|
||||
$_error_string .= "\n |----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------|";
|
||||
|
||||
foreach( $backtrace as $i => $data )
|
||||
{
|
||||
if ( !isset( $data['file'] ) )
|
||||
{
|
||||
$data['file'] = '';
|
||||
}
|
||||
|
||||
if ( !isset( $data['line'] ) )
|
||||
{
|
||||
$data['line'] = '';
|
||||
}
|
||||
|
||||
if ( !isset( $data['class'] ) )
|
||||
{
|
||||
$data['class'] = '';
|
||||
}
|
||||
|
||||
if ( defined('IPS\\ROOT_PATH') )
|
||||
{
|
||||
$data['file'] = str_replace( \IPS\ROOT_PATH, '', $data['file'] );
|
||||
}
|
||||
|
||||
/* Reset */
|
||||
$data['func'] = "[" . $data['class'] . '].' . $data['function'];
|
||||
|
||||
/* Pad right */
|
||||
$data['file'] = str_pad( $data['file'], 75 );
|
||||
$data['func'] = str_pad( $data['func'], 78 );
|
||||
$data['line'] = str_pad( $data['line'], 18 );
|
||||
|
||||
$_error_string .= "\n | " . $data['file'] . "| " . $data['func'] . '| ' . $data['line'] . '|';
|
||||
$_error_string .= "\n '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'";
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
\IPS\Log::i( ( $this->isServerError() ? LOG_EMERG : LOG_ERR ) )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( implode( "\n", $log ) . $_error_string, 'sql' );
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
}
|
||||
|
||||
return parent::__construct( $message, $code, $previous );
|
||||
}
|
||||
|
||||
@@ -137,4 +74,14 @@ class _Exception extends \RuntimeException
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional log data?
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function extraLogData()
|
||||
{
|
||||
return \IPS\Db::_replaceBinds( $this->query, $this->binds );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user