Example #1
0
/**
 * Boots the engine
 *
 * 1. sets error handlers
 * 2. connects to database
 * 3. verifies the installation suceeded
 * 4. loads application configuration
 * 5. loads site configuration
 *
 * @access private
 */
function _elgg_engine_boot()
{
    // Register the error handlers
    set_error_handler('_elgg_php_error_handler');
    set_exception_handler('_elgg_php_exception_handler');
    register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/");
    setup_db_connections();
    verify_installation();
    _elgg_load_application_config();
    _elgg_load_site_config();
    _elgg_load_cache();
}
Example #2
0
/**
 * Returns (if required, also creates) a database link resource.
 *
 * Database link resources are stored in the {@link $dblink} global.  These
 * resources are created by {@link setup_db_connections()}, which is called if
 * no links exist.
 *
 * @param string $dblinktype The type of link we want: "read", "write" or "readwrite".
 *
 * @return object Database link
 * @access private
 */
function get_db_link($dblinktype)
{
    global $dblink;
    if (isset($dblink[$dblinktype])) {
        return $dblink[$dblinktype];
    } else {
        if (isset($dblink['readwrite'])) {
            return $dblink['readwrite'];
        } else {
            setup_db_connections();
            return get_db_link($dblinktype);
        }
    }
}
Example #3
0
/**
 * Boots the engine
 *
 * 1. sets error handlers
 * 2. connects to database
 * 3. verifies the installation succeeded
 * 4. loads application configuration
 * 5. loads i18n data
 * 6. loads cached autoloader state
 * 7. loads site configuration
 *
 * @access private
 */
function _elgg_engine_boot()
{
    // Register the error handlers
    set_error_handler('_elgg_php_error_handler');
    set_exception_handler('_elgg_php_exception_handler');
    setup_db_connections();
    verify_installation();
    _elgg_load_application_config();
    _elgg_load_autoload_cache();
    _elgg_load_site_config();
    _elgg_session_boot();
    _elgg_load_cache();
    _elgg_load_translations();
}
Example #4
0
 /**
  * Bootstrap database connection before entire engine is available
  *
  * @return bool
  */
 protected function connectToDatabase()
 {
     global $CONFIG;
     if (!(include_once "{$CONFIG->path}engine/settings.php")) {
         register_error(elgg_echo('InstallationException:CannotLoadSettings'));
         return FALSE;
     }
     if (!(include_once "{$CONFIG->path}engine/lib/database.php")) {
         $msg = elgg_echo('InstallationException:MissingLibrary', array('database.php'));
         register_error($msg);
         return FALSE;
     }
     try {
         setup_db_connections();
     } catch (Exception $e) {
         register_error($e->getMessage());
         return FALSE;
     }
     return TRUE;
 }
Example #5
0
File: start.php Project: r00ts/Elgg
if (!(include_once dirname(__FILE__) . "/settings.php")) {
    $msg = elgg_echo('InstallationException:CannotLoadSettings');
    throw new InstallationException($msg);
}
// load the rest of the library files from engine/lib/
$lib_files = array('database.php', 'actions.php', 'admin.php', 'annotations.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', 'deprecated-1.7.php', 'deprecated-1.8.php', 'deprecated-1.9.php');
foreach ($lib_files as $file) {
    $file = $lib_dir . $file;
    elgg_log("Loading {$file}...");
    if (!(include_once $file)) {
        $msg = sprintf(elgg_echo('InstallationException:MissingLibrary'), $file);
        throw new InstallationException($msg);
    }
}
// connect to db
setup_db_connections();
// confirm that the installation completed successfully
verify_installation();
// Autodetect some default configuration settings
set_default_config();
// needs to be set for links in html head
$viewtype = get_input('view', 'default');
$lastcached = datalist_get("simplecache_lastcached_{$viewtype}");
$CONFIG->lastcache = $lastcached;
// Trigger boot events for core. Plugins can't hook
// into this because they haven't been loaded yet.
elgg_trigger_event('boot', 'system');
// Load the plugins that are active
elgg_load_plugins();
elgg_trigger_event('plugins_boot', 'system');
// Trigger system init event for plugins