hide map for Character groups Quest Stations when there are no stations
This commit is contained in:
commit
df14dfafc3
4371 changed files with 1220224 additions and 0 deletions
63
www/analytics/core/ExceptionHandler.php
Normal file
63
www/analytics/core/ExceptionHandler.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik;
|
||||
|
||||
use Piwik\API\ResponseBuilder;
|
||||
use Piwik\Plugin;
|
||||
|
||||
/**
|
||||
* Contains Piwik's uncaught exception handler and log file formatting for exception
|
||||
* instances.
|
||||
*/
|
||||
class ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* The backtrace string to use when testing.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $debugBacktraceForTests = null;
|
||||
|
||||
public static function setUp()
|
||||
{
|
||||
Piwik::addAction('Log.formatFileMessage', array('\\Piwik\\ExceptionHandler', 'formatFileAndDBLogMessage'));
|
||||
Piwik::addAction('Log.formatDatabaseMessage', array('\\Piwik\\ExceptionHandler', 'formatFileAndDBLogMessage'));
|
||||
Piwik::addAction('Log.formatScreenMessage', array('\\Piwik\\ExceptionHandler', 'formatScreenMessage'));
|
||||
|
||||
set_exception_handler(array('\\Piwik\\ExceptionHandler', 'logException'));
|
||||
}
|
||||
|
||||
public static function formatFileAndDBLogMessage(&$message, $level, $tag, $datetime, $log)
|
||||
{
|
||||
if ($message instanceof \Exception) {
|
||||
$message = sprintf("%s(%d): %s\n%s", $message->getFile(), $message->getLine(), $message->getMessage(),
|
||||
self::$debugBacktraceForTests ? : $message->getTraceAsString());
|
||||
|
||||
$message = $log->formatMessage($level, $tag, $datetime, $message);
|
||||
}
|
||||
}
|
||||
|
||||
public static function formatScreenMessage(&$message, $level, $tag, $datetime, $log)
|
||||
{
|
||||
if ($message instanceof \Exception) {
|
||||
if (!Common::isPhpCliMode()) {
|
||||
@header('Content-Type: text/html; charset=utf-8');
|
||||
}
|
||||
|
||||
$outputFormat = strtolower(Common::getRequestVar('format', 'html', 'string'));
|
||||
$response = new ResponseBuilder($outputFormat);
|
||||
$message = $response->getResponseException(new \Exception($message->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
public static function logException(\Exception $exception)
|
||||
{
|
||||
Log::error($exception);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue