Implemented changes requested by WebComponent
This commit is contained in:
parent
d670e9676b
commit
5a6b52f93d
|
@ -151,9 +151,11 @@ class Configurator
|
|||
*/
|
||||
public function addComponent(iComponent $component): Configurator
|
||||
{
|
||||
$this->components[] = $component;
|
||||
$component->onAddComponent($this);
|
||||
if (in_array($component, $this->components))
|
||||
return $this;
|
||||
|
||||
$component->onAddComponent($this);
|
||||
$this->components[] = $component;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -212,6 +214,18 @@ class Configurator
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the template that FuzeWorks should use to parse debug logs
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @var string Name of the template file
|
||||
*/
|
||||
public static function setLoggerTemplate($templateName)
|
||||
{
|
||||
Logger::setLoggerTemplate($templateName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default timezone.
|
||||
* @param string $timezone
|
||||
|
|
|
@ -43,7 +43,6 @@ use FuzeWorks\Exception\EventException;
|
|||
*
|
||||
* Holds all the modules and starts the framework. Allows for starting and managing modules
|
||||
*
|
||||
* @todo Test directory priorities in separate components
|
||||
* @author TechFuze <contact@techfuze.net>
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
*/
|
||||
|
@ -71,13 +70,6 @@ class Core
|
|||
|
||||
public static $logDir;
|
||||
|
||||
/**
|
||||
* The HTTP status code of the current request
|
||||
*
|
||||
* @var int $http_status_code Status code
|
||||
*/
|
||||
public static $http_status_code = 200;
|
||||
|
||||
/**
|
||||
* Initializes the core.
|
||||
*
|
||||
|
|
|
@ -129,7 +129,6 @@ class Logger {
|
|||
// Set the environment variables
|
||||
self::$log_last_request = $cfg_error->get('log_last_request_to_file');
|
||||
self::$log_errors_to_file = $cfg_error->get('log_errors_to_file');
|
||||
self::$logger_template = $cfg_error->get('logger_template');
|
||||
self::newLevel('Logger Initiated');
|
||||
}
|
||||
|
||||
|
@ -262,8 +261,9 @@ class Logger {
|
|||
* Please note that most of the user-defined exceptions will be caught in the router, and handled with the error-controller.
|
||||
*
|
||||
* @param Exception $exception The occured exception.
|
||||
* @param bool $haltExecution. Defaults to true
|
||||
*/
|
||||
public static function exceptionHandler($exception)
|
||||
public static function exceptionHandler($exception, bool $haltExecution = true)
|
||||
{
|
||||
$LOG = array('type' => 'EXCEPTION',
|
||||
'message' => $exception->getMessage(),
|
||||
|
@ -274,7 +274,8 @@ class Logger {
|
|||
self::$logs[] = $LOG;
|
||||
|
||||
// And return a 500 because this error was fatal
|
||||
self::haltExecution($LOG);
|
||||
if ($haltExecution)
|
||||
self::haltExecution($LOG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -573,9 +574,9 @@ class Logger {
|
|||
*
|
||||
* Used for debugging timings in FuzeWorks
|
||||
*
|
||||
* @return int Time passed since FuzeWorks init
|
||||
* @return float Time passed since FuzeWorks init
|
||||
*/
|
||||
private static function getRelativeTime(): int
|
||||
private static function getRelativeTime(): float
|
||||
{
|
||||
$startTime = STARTTIME;
|
||||
$time = microtime(true) - $startTime;
|
||||
|
|
|
@ -133,7 +133,7 @@ class Plugins
|
|||
// If a header file exists, use it
|
||||
$file = $pluginPath . DS . $pluginFolder . DS . 'header.php';
|
||||
$pluginFolder = ucfirst($pluginFolder);
|
||||
$className = '\FuzeWorks\Plugins\\'.$pluginFolder.'Header';
|
||||
$className = '\Application\Plugin\\'.$pluginFolder.'Header';
|
||||
if (file_exists($file))
|
||||
{
|
||||
// Load the header file
|
||||
|
|
|
@ -44,6 +44,10 @@ foreach ($logs as $log) {
|
|||
} elseif ($log['type'] == 'LEVEL_STOP') {
|
||||
--$layer;
|
||||
$string .= '</div>';
|
||||
} elseif ($log['type'] == 'EXCEPTION') {
|
||||
$string .= '<div style="' . ($layer == 0 ? 'padding-left: 21px;' : '') . 'font-size: 11pt; background-color:#f56954;">[' . $log['type'] . '] ' . $log['message'] . '
|
||||
<span style="float: right">' . (!empty($log['logFile']) ? $log['logFile'] : '') . ' : ' . (!empty($log['logLine']) ? $log['logLine'] : '') . '(' . round($log['runtime'] * 1000, 4) . ' ms)</span></div>';
|
||||
$string .= '<div style="' . ($layer == 0 ? 'padding-left: 21px;' : '') . 'font-size: 11pt; background-color:#f56954;">' . (!empty($log['context']) && is_string($log['context']) ? '<u>[' . $log['context'] . ']</u>' : '') . '</div>';
|
||||
} elseif ($log['type'] == 'ERROR') {
|
||||
$string .= '<div style="' . ($layer == 0 ? 'padding-left: 21px;' : '') . 'font-size: 11pt; background-color:#f56954;">[' . $log['type'] . ']' . (!empty($log['context']) && is_string($log['context']) ? '<u>[' . $log['context'] . ']</u>' : '') . ' ' . $log['message'] . '
|
||||
<span style="float: right">' . (!empty($log['logFile']) ? $log['logFile'] : '') . ' : ' . (!empty($log['logLine']) ? $log['logLine'] : '') . '(' . round($log['runtime'] * 1000, 4) . ' ms)</span></div>';
|
||||
|
|
|
@ -63,9 +63,6 @@ abstract class CoreTestAbstract extends TestCase
|
|||
// Re-enable events, in case they have been disabled
|
||||
Events::enable();
|
||||
|
||||
// Reset the HTTP status code
|
||||
Core::$http_status_code = 200;
|
||||
|
||||
// Remove Config overrides
|
||||
Config::$configOverrides = [];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue