Elgg  Version 1.12
start.php
Go to the documentation of this file.
1 <?php
25 $START_MICROTIME = microtime(true);
26 
27 // we need to register for shutdown before Symfony registers the session_write_close() function
28 // https://github.com/Elgg/Elgg/issues/9243
29 register_shutdown_function(function () {
30  // There are cases where we may exit before this function is defined.
31  // TODO move this to Application::create in 2.0
32  if (function_exists('_elgg_shutdown_hook')) {
34  }
35 });
36 
51 if (!isset($CONFIG)) {
52  $CONFIG = new \stdClass;
53 }
54 $CONFIG->boot_complete = false;
55 
56 $engine_dir = dirname(__FILE__);
57 
58 // No settings means a fresh install
59 if (!is_file("$engine_dir/settings.php")) {
60  header("Location: install.php");
61  exit;
62 }
63 
64 if (!is_readable("$engine_dir/settings.php")) {
65  echo "The Elgg settings file exists but the web server doesn't have read permission to it.";
66  exit;
67 }
68 
69 require_once "$engine_dir/settings.php";
70 
71 // This will be overridden by the DB value but may be needed before the upgrade script can be run.
72 $CONFIG->default_limit = 10;
73 
74 require_once "$engine_dir/load.php";
75 
76 // Connect to database, load language files, load configuration, init session
77 // Plugins can't use this event because they haven't been loaded yet.
78 elgg_trigger_event('boot', 'system');
79 
80 // Load the plugins that are active
82 
83 // @todo move loading plugins into a single boot function that replaces 'boot', 'system' event
84 // and then move this code in there.
85 // This validates the view type - first opportunity to do it is after plugins load.
88  elgg_set_viewtype('default');
89 }
90 
91 // @todo deprecate as plugins can use 'init', 'system' event
92 elgg_trigger_event('plugins_boot', 'system');
93 
94 // Complete the boot process for both engine and plugins
95 elgg_trigger_event('init', 'system');
96 
97 $CONFIG->boot_complete = true;
98 
99 // System loaded and ready
100 elgg_trigger_event('ready', 'system');
elgg_is_registered_viewtype($viewtype)
Checks if $viewtype is registered.
Definition: views.php:138
$engine_dir
Definition: start.php:56
exit
Definition: reorder.php:12
_elgg_load_plugins()
Loads all active plugins in the order specified in the tool admin panel.
Definition: plugins.php:150
_elgg_shutdown_hook()
Emits a shutdown:system event upon PHP shutdown, but before database connections are dropped...
Definition: elgglib.php:1441
elgg_set_viewtype($viewtype="")
Manually set the viewtype.
Definition: views.php:70
elgg_get_viewtype()
Return the current view type.
Definition: views.php:91
elgg echo
Translates a string.
Definition: languages.js:48
global $START_MICROTIME
The time with microseconds when the Elgg engine was started.
Definition: start.php:24
elgg global
Pointer to the global context.
Definition: elgglib.js:12
global $CONFIG
Configuration values.
Definition: start.php:50
clearfix elgg elgg elgg elgg page header
Definition: admin.php:127
elgg_trigger_event($event, $object_type, $object=null)
Definition: elgglib.php:584
$viewtype
Definition: start.php:86