]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
single for loop for loading libraries
authorCash Costello <cash.costello@gmail.com>
Sat, 21 Jan 2012 14:05:20 +0000 (09:05 -0500)
committerCash Costello <cash.costello@gmail.com>
Sat, 21 Jan 2012 14:05:20 +0000 (09:05 -0500)
engine/lib/languages.php
engine/start.php

index 0400843af351aad16e9bbdbc87c48803c7d481d7..207fe4c99aa00033cea1202f3fc73856cb299110 100644 (file)
@@ -301,6 +301,14 @@ function get_missing_language_keys($language) {
        return false;
 }
 
+/**
+ * Load translations
+ * @access private
+ */
+function elgg_language_boot() {
+       register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/");
+}
+
 /**
  * Initialize the language library
  * @access private
@@ -310,6 +318,5 @@ function elgg_languages_init() {
        elgg_register_simplecache_view("cache/js/languages/$lang");
 }
 
+elgg_register_event_handler('boot', 'system', 'elgg_language_boot', 1);
 elgg_register_event_handler('init', 'system', 'elgg_languages_init');
-
-register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/");
index ee878126fc80d7ab6319ed69de73fafbb83b7d0a..b4f9d6fdaa444f4dc06a3ba00279deb441f6020c 100644 (file)
@@ -52,56 +52,35 @@ if (!isset($CONFIG)) {
 
 $lib_dir = dirname(__FILE__) . '/lib/';
 
-/**
- * The minimum required libs to bootstrap an Elgg installation.
- *
- * @var array
- */
-$required_files = array(
-       'elgglib.php', 'views.php', 'access.php', 'system_log.php', 'export.php',
-       'sessions.php', 'languages.php', 'pageowner.php', 'input.php', 'cache.php',
-       'output.php'
-);
-
-// include bootstraping libs
-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;
-       }
+// Load the bootstrapping library
+$path = $lib_dir . 'elgglib.php';
+if (!include_once($path)) {
+       echo "Could not load file '$path'. Please check your Elgg installation for all required files.";
+       exit;
 }
 
-// Register the error handler
-set_error_handler('_elgg_php_error_handler');
-set_exception_handler('_elgg_php_exception_handler');
-
-/**
- * Load the system settings
- */
+// Load the system settings
 if (!include_once(dirname(__FILE__) . "/settings.php")) {
-       $msg = elgg_echo('InstallationException:CannotLoadSettings');
+       $msg = 'Elgg could not load the settings file. It does not exist or there is a file permissions issue.';
        throw new InstallationException($msg);
 }
 
 
 // load the rest of the library files from engine/lib/
 $lib_files = array(
-       // these need to be loaded first.
-       'database.php', 'actions.php',
-
-       'admin.php', 'annotations.php', 'calendar.php',
-       'configuration.php', 'cron.php', 'entities.php', 'export.php',
-       'extender.php', 'filestore.php', 'group.php', 
-       'location.php', 'mb_wrapper.php', 'memcache.php', 'metadata.php',
-       'metastrings.php', 'navigation.php', 'notification.php', 'objects.php',
-       'opendd.php', 'pagehandler.php', 'pam.php', 'plugins.php',
-       'private_settings.php', 'relationships.php', 'river.php', 'sites.php',
-       'statistics.php', 'tags.php', 'user_settings.php', 'users.php',
-       'upgrade.php', 'web_services.php', 'widgets.php', 'xml.php', 'xml-rpc.php',
+       'access.php', 'actions.php', 'admin.php', 'annotations.php', 'cache.php',
+       'calendar.php', 'configuration.php', 'cron.php', 'database.php',
+       'entities.php', 'export.php', 'extender.php', 'filestore.php', 'group.php',
+       'input.php', 'languages.php', 'location.php', 'mb_wrapper.php',
+       'memcache.php', 'metadata.php', 'metastrings.php', 'navigation.php',
+       'notification.php', 'objects.php', 'opendd.php', 'output.php',
+       'pagehandler.php', 'pageowner.php', 'pam.php', 'plugins.php',
+       'private_settings.php', 'relationships.php', 'river.php', 'sessions.php',
+       'sites.php', 'statistics.php', 'system_log.php', 'tags.php',
+       'user_settings.php', 'users.php', 'upgrade.php', 'views.php',
+       'web_services.php', 'widgets.php', 'xml.php', 'xml-rpc.php',
        
-       //backwards compatibility
+       // backward compatibility
        'deprecated-1.7.php', 'deprecated-1.8.php',
 );
 
@@ -109,11 +88,15 @@ foreach ($lib_files as $file) {
        $file = $lib_dir . $file;
        elgg_log("Loading $file...");
        if (!include_once($file)) {
-               $msg = sprintf(elgg_echo('InstallationException:MissingLibrary'), $file);
+               $msg = "Could not load $file";
                throw new InstallationException($msg);
        }
 }
 
+// Register the error handler
+set_error_handler('_elgg_php_error_handler');
+set_exception_handler('_elgg_php_exception_handler');
+
 // connect to db
 setup_db_connections();