Example #1
0
/**
 * Loads values into $CONFIG.
 *
 * If Elgg is installed, this function pulls all rows from dbprefix_config
 * and cherry picks some values from dbprefix_datalists.  This also extracts
 * some commonly used values from the default site object.
 *
 * @elgg_event boot system
 * @return true|null
 */
function configuration_boot()
{
    global $CONFIG;
    $path = datalist_get('path');
    if (!empty($path)) {
        $CONFIG->path = $path;
    }
    $dataroot = datalist_get('dataroot');
    if (!empty($dataroot)) {
        $CONFIG->dataroot = $dataroot;
    }
    $simplecache_enabled = datalist_get('simplecache_enabled');
    if ($simplecache_enabled !== false) {
        $CONFIG->simplecache_enabled = $simplecache_enabled;
    } else {
        $CONFIG->simplecache_enabled = 1;
    }
    $viewpath_cache_enabled = datalist_get('viewpath_cache_enabled');
    if ($viewpath_cache_enabled !== false) {
        $CONFIG->viewpath_cache_enabled = $viewpath_cache_enabled;
    } else {
        $CONFIG->viewpath_cache_enabled = 1;
    }
    if (isset($CONFIG->site) && $CONFIG->site instanceof ElggSite) {
        $CONFIG->wwwroot = $CONFIG->site->url;
        $CONFIG->sitename = $CONFIG->site->name;
        $CONFIG->sitedescription = $CONFIG->site->description;
        $CONFIG->siteemail = $CONFIG->site->email;
    }
    $CONFIG->url = $CONFIG->wwwroot;
    // Load default settings from database
    get_all_config();
}
Example #2
0
/**
 * Loads configuration related to this site
 *
 * This loads from the config database table and the site entity
 * @access private
 */
function _elgg_load_site_config()
{
    global $CONFIG;
    $CONFIG->site_guid = (int) datalist_get('default_site');
    $CONFIG->site_id = $CONFIG->site_guid;
    $CONFIG->site = get_entity($CONFIG->site_guid);
    if (!$CONFIG->site) {
        throw new InstallationException(elgg_echo('InstallationException:SiteNotInstalled'));
    }
    $CONFIG->wwwroot = $CONFIG->site->url;
    $CONFIG->sitename = $CONFIG->site->name;
    $CONFIG->sitedescription = $CONFIG->site->description;
    $CONFIG->siteemail = $CONFIG->site->email;
    $CONFIG->url = $CONFIG->wwwroot;
    get_all_config();
    // gives hint to elgg_get_config function how to approach missing values
    $CONFIG->site_config_loaded = true;
}
Example #3
0
/**
 * Loads configuration related to this site
 *
 * This loads from the config database table and the site entity
 * @access private
 */
function _elgg_load_site_config()
{
    global $CONFIG;
    $site_guid = elgg_trigger_plugin_hook("siteid", "system");
    if ($site_guid === null || $site_guid === false) {
        $site_guid = (int) datalist_get('default_site');
    }
    $CONFIG->site_guid = $site_guid;
    $CONFIG->site_id = $CONFIG->site_guid;
    $CONFIG->site = get_entity($CONFIG->site_guid);
    if (!$CONFIG->site) {
        throw new InstallationException(elgg_echo('InstallationException:SiteNotInstalled'));
    }
    $CONFIG->wwwroot = $CONFIG->site->url;
    $CONFIG->sitename = $CONFIG->site->name;
    $CONFIG->sitedescription = $CONFIG->site->description;
    $CONFIG->siteemail = $CONFIG->site->email;
    $CONFIG->url = $CONFIG->wwwroot;
    get_all_config();
    // gives hint to elgg_get_config function how to approach missing values
    $CONFIG->site_config_loaded = true;
    // needs to be set before system, init for links in html head
    $viewtype = get_input('view', 'default');
    $lastcached = datalist_get("sc_lastcached_" . $viewtype . "_" . $CONFIG->site->getGUID());
    $CONFIG->lastcache = $lastcached;
}