function _acquia_purge_get_domains in Acquia Purge 6
Same name and namespace in other branches
- 7 acquia_purge.deprecated.inc \_acquia_purge_get_domains()
Get a list of defined domains that we can purge for.
@returns Array with string values mapping to all defined DNS domains for this site.
6 calls to _acquia_purge_get_domains()
- acquia_purge_expire_cache in ./
acquia_purge.module - Implements hook_expire_cache().
- acquia_purge_manualpurge_form in ./
acquia_purge.admin.inc - Menu callback to drupal_get_form; let users manually purge pages.
- drush_acquia_purge_ap_domains in ./
acquia_purge.drush.inc - List all detected domain names that Acquia Purge will purge.
- _acquia_purge_get_diagnosis_domains in ./
acquia_purge.diagnostics.inc - Test whether the amount of domain names is healthy.
- _acquia_purge_queue_pop in ./
acquia_purge.module - Queue manager: pop X amount of items from the queue.
File
- ./
acquia_purge.module, line 446 - Acquia Purge, Top-notch Varnish purging on Acquia Cloud!
Code
function _acquia_purge_get_domains() {
static $domains;
// Statically cache the domains as fetching them once per request is enough.
if (is_null($domains)) {
$domains = array();
// If the configuration key 'acquia_purge_domains' is set we skip automatic
// detection fully and add that list of domains to be purged.
if ($acquia_purge_domains = variable_get('acquia_purge_domains', FALSE)) {
if (is_array($acquia_purge_domains) && count($acquia_purge_domains)) {
foreach ($acquia_purge_domains as $domain) {
_acquia_purge_get_domains_add($domain, $domains);
}
// Set and return the set of hardcoded domains.
return $domains;
}
}
// Add the current HTTP_HOST that we're connected to.
_acquia_purge_get_domains_add($_SERVER['HTTP_HOST'], $domains);
// Strip an empty absolute URL (which respects $base_url) and make sure
// that domain is also in the list of domains to be purged.
$base_domain = url('', array(
'absolute' => TRUE,
));
$base_domain = str_replace('https://', '', $base_domain);
$base_domain = str_replace('http://', '', $base_domain);
$base_domain = str_replace(base_path(), '', $base_domain);
_acquia_purge_get_domains_add($base_domain, $domains);
// To better support multi-sites we only load in the configured Acquia Cloud
// domain names when we are on the 'default' site as that would else flood
// another site which we don't want to happen, on <front> for example.
if (conf_path() == 'sites/default') {
// Add the domain names the customer defined on Acquia Cloud. When this
// process would fail we have at least the current + $base_url domain.
if (_acquia_purge_are_we_on_acquiacloud()) {
_acquia_purge_get_domains_add_acloud($domains);
}
}
}
return $domains;
}