public function bootCore()
{
$config = $this->services->config;
if ($this->isTestingApplication()) {
throw new \RuntimeException('Unit tests should not call ' . __METHOD__);
}
if ($config->getVolatile('boot_complete')) {
return;
}
$this->loadSettings();
$config->set('boot_complete', false);
// This will be overridden by the DB value but may be needed before the upgrade script can be run.
$config->set('default_limit', 10);
// in case not loaded already
$this->loadCore();
$events = $this->services->events;
// Connect to database, load language files, load configuration, init session
// Plugins can't use this event because they haven't been loaded yet.
$events->trigger('boot', 'system');
// Load the plugins that are active
$this->services->plugins->load();
$root = Directory\Local::root();
if ($root->getPath() != self::elggDir()->getPath()) {
// Elgg is installed as a composer dep, so try to treat the root directory
// as a custom plugin that is always loaded last and can't be disabled...
if (!elgg_get_config('system_cache_loaded')) {
// configure view locations for the custom plugin (not Elgg core)
$viewsFile = $root->getFile('views.php');
if ($viewsFile->exists()) {
$viewsSpec = $viewsFile->includeFile();
if (is_array($viewsSpec)) {
_elgg_services()->views->mergeViewsSpec($viewsSpec);
}
}
// find views for the custom plugin (not Elgg core)
_elgg_services()->views->registerPluginViews($root->getPath());
}
if (!elgg_get_config('i18n_loaded_from_cache')) {
_elgg_services()->translator->registerPluginTranslations($root->getPath());
}
// This is root directory start.php
$root_start = $root->getPath("start.php");
if (is_file($root_start)) {
require $root_start;
}
}
// @todo move loading plugins into a single boot function that replaces 'boot', 'system' event
// and then move this code in there.
// This validates the view type - first opportunity to do it is after plugins load.
$viewtype = elgg_get_viewtype();
if (!elgg_is_registered_viewtype($viewtype)) {
elgg_set_viewtype('default');
}
$this->allowPathRewrite();
// Allows registering handlers strictly before all init, system handlers
$events->trigger('plugins_boot', 'system');
// Complete the boot process for both engine and plugins
$events->trigger('init', 'system');
$config->set('boot_complete', true);
// System loaded and ready
$events->trigger('ready', 'system');
}