Exemplo n.º 1
0
if (drupal_is_cli() && function_exists('drush_get_option') && ($http_host = drush_get_option('acsf-install-uri', FALSE))) {
    $host = $_SERVER['HTTP_HOST'] = $http_host;
    // Match the expected drupal sites.php key. @see conf_path().
    $dir = implode('.', array_reverse(explode(':', $host)));
} else {
    $host = rtrim($_SERVER['HTTP_HOST'], '.');
    // Match the expected drupal sites.php key. @see conf_path().
    $dir = implode('.', array_reverse(explode(':', $host)));
}
if (!GARDENS_SITE_DATA_USE_APC) {
    // gardens_site_data_refresh_one() will do a full parse if the domain is in
    // the file at all and a single line parse fails.
    $data = gardens_site_data_refresh_one($host);
} elseif (($data = gardens_site_data_cache_get($host)) !== 0) {
    if (empty($data)) {
        // Note - when set to use APC, we never parse the whole file on a web
        // request, but we do attempt to parse out the one requested.
        $data = gardens_site_data_refresh_one($host);
    }
}
// A value of zero either from the cache or when attempting to refresh indicates
// that the host is known to not exist and was cached as such - we don't need to
// refresh, just fail.
if ($data === 0) {
    return;
}
$GLOBALS['gardens_site_settings'] = $data['gardens_site_settings'];
$sites[$dir] = $data['dir'];
// Include custom sites.php code from factory-hooks/post-sites-php.
acsf_hooks_include('post-sites-php');
Exemplo n.º 2
0
        $conf['cache_default_class'] = 'MemCacheDrupal';
        $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
        // The oembed cache in many cases should not evict data (given that data
        // is obtained from costly API calls and is not expected to change when
        // refreshed), so is more suited to the database than to memcache.
        $conf['cache_class_cache_oembed'] = 'DrupalDatabaseCache';
    }
    // Until the site installation finishes, noone should be able to visit the
    // site, unless the site is being installed via install.php and the user has
    // the correct token to access it.
    if (!drupal_is_cli() && !empty($site_settings['flags']['access_restricted']['enabled'])) {
        $token_match = !empty($site_settings['flags']['access_restricted']['token']) && !empty($_GET['site_install_token']) && $_GET['site_install_token'] == $site_settings['flags']['access_restricted']['token'];
        $path_match = $_SERVER['SCRIPT_NAME'] == $GLOBALS['base_path'] . 'install.php';
        if (!$token_match || !$path_match) {
            header($_SERVER['SERVER_PROTOCOL'] . ' 503 Service unavailable');
            if (!empty($site_settings['flags']['access_restricted']['reason'])) {
                print $site_settings['flags']['access_restricted']['reason'];
            }
            exit;
        }
    }
    if (!empty($site_settings['conf'])) {
        foreach ((array) $site_settings['conf'] as $key => $value) {
            $conf[$key] = $value;
        }
    }
}
// Include custom sites.php code from factory-hooks/post-sites-php.
if (function_exists('acsf_hooks_include')) {
    acsf_hooks_include('post-settings-php');
}