Elgg  Version 1.9
start.php
Go to the documentation of this file.
1 <?php
25 $START_MICROTIME = microtime(true);
26 
41 if (!isset($CONFIG)) {
42  $CONFIG = new stdClass;
43 }
44 $CONFIG->boot_complete = false;
45 
46 $engine_dir = dirname(__FILE__);
47 
48 // No settings means a fresh install
49 if (!is_file("$engine_dir/settings.php")) {
50  header("Location: install.php");
51  exit;
52 }
53 
54 if (!is_readable("$engine_dir/settings.php")) {
55  echo "The Elgg settings file exists but the web server doesn't have read permission to it.";
56  exit;
57 }
58 
59 include_once("$engine_dir/settings.php");
60 
61 $lib_dir = "$engine_dir/lib";
62 
63 require_once("$lib_dir/autoloader.php");
64 require_once("$lib_dir/elgglib.php");
65 
66 // load the rest of the library files from engine/lib/
67 // All on separate lines to make diffs easy to read + make it apparent how much
68 // we're actually loading on every page (Hint: it's too much).
69 $lib_files = array(
70  'access.php',
71  'actions.php',
72  'admin.php',
73  'annotations.php',
74  'cache.php',
75  'comments.php',
76  'configuration.php',
77  'cron.php',
78  'database.php',
79  'entities.php',
80  'extender.php',
81  'filestore.php',
82  'friends.php',
83  'group.php',
84  'input.php',
85  'languages.php',
86  'mb_wrapper.php',
87  'memcache.php',
88  'metadata.php',
89  'metastrings.php',
90  'navigation.php',
91  'notification.php',
92  'objects.php',
93  'output.php',
94  'pagehandler.php',
95  'pageowner.php',
96  'pam.php',
97  'plugins.php',
98  'private_settings.php',
99  'relationships.php',
100  'river.php',
101  'sessions.php',
102  'sites.php',
103  'statistics.php',
104  'system_log.php',
105  'tags.php',
106  'user_settings.php',
107  'users.php',
108  'upgrade.php',
109  'views.php',
110  'widgets.php',
111 
112  // backward compatibility
113  'deprecated-1.7.php',
114  'deprecated-1.8.php',
115  'deprecated-1.9.php',
116 );
117 
118 foreach ($lib_files as $file) {
119  require_once("$lib_dir/$file");
120 }
121 
122 // Connect to database, load language files, load configuration, init session
123 // Plugins can't use this event because they haven't been loaded yet.
124 elgg_trigger_event('boot', 'system');
125 
126 // Load the plugins that are active
128 
129 // @todo move loading plugins into a single boot function that replaces 'boot', 'system' event
130 // and then move this code in there.
131 // This validates the view type - first opportunity to do it is after plugins load.
134  elgg_set_viewtype('default');
135 }
136 
137 // @todo deprecate as plugins can use 'init', 'system' event
138 elgg_trigger_event('plugins_boot', 'system');
139 
140 // Complete the boot process for both engine and plugins
141 elgg_trigger_event('init', 'system');
142 
143 $CONFIG->boot_complete = true;
144 
145 // System loaded and ready
146 elgg_trigger_event('ready', 'system');
elgg_is_registered_viewtype($viewtype)
Checks if $viewtype is registered.
Definition: views.php:138
$engine_dir
Definition: start.php:46
exit
Definition: reorder.php:12
_elgg_load_plugins()
Loads all active plugins in the order specified in the tool admin panel.
Definition: plugins.php:316
elgg_set_viewtype($viewtype="")
Manually set the viewtype.
Definition: views.php:70
elgg_get_viewtype()
Return the current view type.
Definition: views.php:91
$lib_dir
Definition: start.php:61
elgg echo
Translates a string.
Definition: languages.js:43
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:40
$lib_files
Definition: start.php:69
clearfix elgg elgg elgg elgg page header
Definition: admin.php:127
elgg_trigger_event($event, $object_type, $object=null)
Trigger an Elgg Event and attempt to run all handler callbacks registered to that event...
Definition: elgglib.php:720
$viewtype
Definition: start.php:132