aboutsummaryrefslogtreecommitdiff
path: root/engine/start.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-20 01:05:52 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-20 01:05:52 +0000
commitb17b5ed4b62eb75e96f4bf9dca2d309d73009c3d (patch)
treecd2e90531efa3a2ef0d220aef66c7e4cfb1f37b5 /engine/start.php
parent83f950638c0abc77a3674ac476ce9f201df0a672 (diff)
downloadelgg-b17b5ed4b62eb75e96f4bf9dca2d309d73009c3d.tar.gz
elgg-b17b5ed4b62eb75e96f4bf9dca2d309d73009c3d.tar.bz2
Removed ui_page_setup() to fix installation. Gave engine/start.php a bit of love.
git-svn-id: http://code.elgg.org/elgg/trunk@5453 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/start.php')
-rw-r--r--engine/start.php120
1 files changed, 27 insertions, 93 deletions
diff --git a/engine/start.php b/engine/start.php
index ff14b378b..770d2869a 100644
--- a/engine/start.php
+++ b/engine/start.php
@@ -23,62 +23,23 @@ if (!isset($CONFIG)) {
$CONFIG = new stdClass;
}
-/**
- * Load important prerequisites
- */
-
-if (!include_once(dirname(__FILE__) . "/lib/exceptions.php")) { // Exceptions
- echo "Error in installation: could not load the Exceptions library.";
- exit;
-}
-
-if (!include_once(dirname(__FILE__) . "/lib/elgglib.php")) { // Main Elgg library
- echo "Elgg could not load its main library.";
- exit;
-}
-
-if (!include_once(dirname(__FILE__) . "/lib/access.php")) { // Access library
- echo "Error in installation: could not load the Access library.";
- exit;
-}
-
-if (!include_once(dirname(__FILE__) . "/lib/system_log.php")) { // Logging library
- echo "Error in installation: could not load the System Log library.";
- exit;
-}
-
-if (!include_once(dirname(__FILE__) . "/lib/export.php")) { // Export library
- echo "Error in installation: could not load the Export library.";
- exit;
-}
-
-if (!include_once(dirname(__FILE__) . "/lib/sessions.php")) {
- echo ("Error in installation: Elgg could not load the Sessions library");
- exit;
-}
-
-if (!include_once(dirname(__FILE__) . "/lib/languages.php")) { // Languages library
- echo "Error in installation: could not load the languages library.";
- exit;
-}
-
-if (!include_once(dirname(__FILE__) . "/lib/input.php")) { // Input library
- echo "Error in installation: could not load the input library.";
- exit;
-}
-
-if (!include_once(dirname(__FILE__) . "/lib/install.php")) { // Installation library
- echo "Error in installation: could not load the installation library.";
- exit;
-}
-
-if (!include_once(dirname(__FILE__) . "/lib/cache.php")) { // Installation library
- echo "Error in installation: could not load the cache library.";
- exit;
+$lib_dir = dirname(__FILE__) . '/lib/';
+
+// bootstrapping with required files in a required order
+$required_files = array(
+ 'exceptions.php', 'elgglib.php', 'access.php', 'system_log.php', 'export.php',
+ 'sessions.php', 'languages.php', 'input.php', 'install.php', 'cache.php',
+);
+
+foreach ($required_files as $file) {
+ $path = $lib_dir . $file;
+ if (!include($path)) {
+ echo "Could not load file '$path'. "
+ . 'Please check your Elgg installation for all required files.';
+ exit;
+ }
}
-
-
// Use fallback view until sanitised
$oldview = get_input('view');
set_input('view', 'failsafe');
@@ -88,46 +49,18 @@ set_input('view', 'failsafe');
*/
$lightmode = false;
-/**
- * Establish handlers
- */
-
// Register the error handler
set_error_handler('__elgg_php_error_handler');
set_exception_handler('__elgg_php_exception_handler');
-/**
- * If there are basic issues with the way the installation is formed, don't bother trying
- * to load any more files
- */
-// Begin portion for sanitised installs only
+// attempt to save settings.php and .htaccess if in installation.
if ($sanitised = sanitised()) {
- /**
- * Load the system settings
- */
- if (!include_once(dirname(__FILE__) . "/settings.php")) {
- throw new InstallationException("Elgg could not load the settings file.");
- }
- /**
- * Load and initialise the database
- */
- if (!include_once(dirname(__FILE__) . "/lib/database.php")) {
- throw new InstallationException("Elgg could not load the main Elgg database library.");
- }
-
- if (!include_once(dirname(__FILE__) . "/lib/actions.php")) {
- throw new InstallationException("Elgg could not load the Actions library");
- }
-
- // Get config
- global $CONFIG;
-
- // load the rest of the library files from engine/lib/
+ // load library files
$lib_files = array(
- 'activity.php', 'admin.php', 'annotations.php', 'api.php',
+ 'actions.php', 'activity.php', 'admin.php', 'annotations.php', 'api.php',
'cache.php', 'calendar.php', 'configuration.php', 'cron.php',
- 'entities.php', 'export.php', 'extender.php', 'filestore.php',
+ 'entities.php', 'export.php', 'extender.php', 'database.php', 'filestore.php',
'group.php', 'input.php', 'install.php', 'location.php', 'mb_wrapper.php',
'memcache.php', 'metadata.php', 'metastrings.php', 'notification.php',
'objects.php', 'opendd.php', 'pagehandler.php', 'pageowner.php', 'pam.php',
@@ -137,9 +70,6 @@ if ($sanitised = sanitised()) {
'xml-rpc.php'
);
- $lib_dir = dirname(__FILE__) . '/lib/';
-
- // Include them
foreach($lib_files as $file) {
$file = $lib_dir . $file;
elgg_log("Loading $file...");
@@ -147,7 +77,12 @@ if ($sanitised = sanitised()) {
throw new InstallationException("Could not load {$file}");
}
}
-} else { // End portion for sanitised installs only
+
+ // Load system settings
+ if (!include_once(dirname(__FILE__) . "/settings.php")) {
+ throw new InstallationException("Elgg could not load the settings file.");
+ }
+} else {
throw new InstallationException(elgg_echo('installation:error:configuration'));
}
@@ -177,8 +112,8 @@ if (($installed) && ($db_installed) && ($sanitised) && (!$lightmode)) {
// Forward if we haven't been installed
if ((!$installed || !$db_installed)
&& !substr_count($_SERVER["PHP_SELF"], "install.php")
- && !substr_count($_SERVER["PHP_SELF"],"css.php")
- && !substr_count($_SERVER["PHP_SELF"],"action_handler.php")) {
+ && !substr_count($_SERVER["PHP_SELF"], "css.php")
+ && !substr_count($_SERVER["PHP_SELF"], "action_handler.php")) {
header("Location: install.php");
exit;
@@ -190,7 +125,6 @@ if (!substr_count($_SERVER["PHP_SELF"],"install.php") &&
!$lightmode
&& !(defined('upgrading') && upgrading == 'upgrading')) {
-
trigger_elgg_event('init', 'system');
}