Release version 1.2.3, changing the boot order.

This commit is contained in:
Abel Hoogeveen 2020-05-13 19:03:39 +02:00
parent 6f2e941eb1
commit d4bf138533
No known key found for this signature in database
GPG Key ID: 96C2234920BF4292
3 changed files with 47 additions and 35 deletions

View File

@ -347,18 +347,17 @@ class Configurator
// Then prepare the debugger
$debug = ($this->parameters['debugEnabled'] && $this->parameters['debugMatch'] ? true : false);
// Define environment constants
// Then load the framework
$container = Core::init();
Logger::newLevel("Creating container...");
if ($debug == true)
{
define('ENVIRONMENT', 'DEVELOPMENT');
Logger::enable();
}
else
define('ENVIRONMENT', 'PRODUCTION');
// Load the Framework
$container = Core::init();
if ($debug)
Logger::enable();
Logger::newLevel("Creating container...");
// Load components
foreach ($this->components as $componentSuperClass => $component)
@ -382,21 +381,6 @@ class Configurator
$component->onCreateContainer($container);
}
// Add directories to Components
foreach ($this->directories as $component => $priorityArray)
{
Logger::logDebug("Adding directories for '" . $component . "'");
if (method_exists($container->{$component}, 'setDirectories'))
$container->{$component}->setDirectories($priorityArray);
}
// Initialize all components
foreach ($container as $component)
{
if (method_exists($component, 'init'))
$component->init();
}
// Invoke deferredComponentClass on FuzeWorks\Core classes
foreach ($this->deferredComponentClassMethods as $componentClass => $deferredComponentClasses)
{
@ -414,6 +398,14 @@ class Configurator
}
}
// Add directories to Components
foreach ($this->directories as $component => $priorityArray)
{
Logger::logDebug("Adding directories for '" . $component . "'");
if (method_exists($container->{$component}, 'setDirectories'))
$container->{$component}->setDirectories($priorityArray);
}
$container->initFactory();
Logger::stopLevel();
return $container;

View File

@ -170,6 +170,13 @@ class Factory
if (!$cfg->get('enable_events'))
Events::disable();
// Initialize all components
foreach ($this as $component)
{
if (method_exists($component, 'init'))
$component->init();
}
// Initialize all plugins
$this->plugins->loadHeadersFromPluginPaths();

View File

@ -533,23 +533,36 @@ class Logger {
public static function getType($type): string
{
switch ($type) {
case E_PARSE:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_USER_ERROR:
case E_STRICT:
case E_RECOVERABLE_ERROR:
case E_ERROR:
return 'ERROR';
case E_NOTICE:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_WARNING:
case E_USER_NOTICE:
case E_USER_DEPRECATED:
case E_DEPRECATED:
case E_WARNING:
return 'WARNING';
case E_PARSE:
return 'ERROR';
case E_NOTICE:
return 'WARNING';
case E_CORE_ERROR:
return 'ERROR';
case E_CORE_WARNING:
return 'WARNING';
case E_COMPILE_ERROR:
return 'ERROR';
case E_COMPILE_WARNING:
return 'WARNING';
case E_USER_ERROR:
return 'ERROR';
case E_USER_WARNING:
return 'WARNING';
case E_USER_NOTICE:
return 'WARNING';
case E_USER_DEPRECATED:
return 'WARNING';
case E_STRICT:
return 'ERROR';
case E_RECOVERABLE_ERROR:
return 'ERROR';
case E_DEPRECATED:
return 'WARNING';
}
return $type = 'Unknown error: ' . $type;