Improved Error Handler

This commit is contained in:
kremsy 2017-06-28 14:38:21 +02:00
parent 884d0306dd
commit 84af711e5d
2 changed files with 25 additions and 0 deletions

View File

@ -137,11 +137,15 @@ class ErrorHandler {
$isPluginError = true; $isPluginError = true;
} }
} }
$report['PluginId'] = $pluginId;
$report['PluginVersion'] = PluginManager::getPluginVersion($sourceClass);
} }
if ($traceString) { if ($traceString) {
$report['Backtrace'] = $traceString; $report['Backtrace'] = $traceString;
} }
$report['OperatingSystem'] = php_uname(); $report['OperatingSystem'] = php_uname();
$report['PHPVersion'] = phpversion(); $report['PHPVersion'] = phpversion();
@ -476,6 +480,7 @@ class ErrorHandler {
$report['FileLine'] = self::stripBaseDir($exception->getFile()) . ': ' . $exception->getLine(); $report['FileLine'] = self::stripBaseDir($exception->getFile()) . ': ' . $exception->getLine();
$report['SourceClass'] = $sourceClass; $report['SourceClass'] = $sourceClass;
$report['PluginId'] = PluginManager::getPluginId($sourceClass); $report['PluginId'] = PluginManager::getPluginId($sourceClass);
$report['PluginVersion'] = PluginManager::getPluginVersion($sourceClass);
$report['Backtrace'] = $traceString; $report['Backtrace'] = $traceString;
$report['OperatingSystem'] = php_uname(); $report['OperatingSystem'] = php_uname();
$report['PHPVersion'] = phpversion(); $report['PHPVersion'] = phpversion();

View File

@ -94,6 +94,7 @@ class PluginManager {
/** /**
* Get the Plugin Id if the given Class is a Plugin * Get the Plugin Id if the given Class is a Plugin
* *
* @api
* @param string $pluginClass * @param string $pluginClass
* @return int * @return int
*/ */
@ -105,9 +106,26 @@ class PluginManager {
return null; return null;
} }
/**
* Get the Plugin version if a given Class is a Plugin
*
* @api
* @param $pluginClass
* @return null|int
*/
public static function getPluginVersion($pluginClass) {
if (self::isPluginClass($pluginClass)) {
/** @var Plugin $pluginClass */
return $pluginClass::getVersion();
}
return null;
}
/** /**
* Check if the given class implements the plugin interface * Check if the given class implements the plugin interface
* *
* @api
* @param string $pluginClass * @param string $pluginClass
* @return bool * @return bool
*/ */
@ -216,6 +234,7 @@ class PluginManager {
/** /**
* Get the Class of the Plugin * Get the Class of the Plugin
* *
* @api
* @param mixed $pluginClass * @param mixed $pluginClass
* @return string * @return string
*/ */
@ -230,6 +249,7 @@ class PluginManager {
/** /**
* Check if the Plugin is currently running * Check if the Plugin is currently running
* *
* @api
* @param string $pluginClass * @param string $pluginClass
* @return bool * @return bool
*/ */