You are here

private function ExpireDomain::getBaseUrls in Cache Expiration 7.2

Get all base url's where this node can appear.

Parameters

$node: Node object.

Return value

array List of base urls that should be expired.

File

includes/expire.domain.inc, line 50
Provides class that expires domain base urls.

Class

ExpireDomain
@file Provides class that expires domain base urls.

Code

private function getBaseUrls($node) {

  // Get list of URL's if using domain access
  $base_urls = array();
  $domains = array();

  // Get domains from node/user object
  foreach ($node->domains as $key => $domain_id) {
    if ($key != $domain_id) {
      continue;
    }
    $domains[$domain_id] = $domain_id;
  }

  // Get domains from database
  foreach (expire_get_domains($node) as $domain_id) {
    $domains[$domain_id] = $domain_id;
  }

  // Get aliases and set base url
  foreach ($domains as $domain_id) {
    $domain = domain_lookup($domain_id);
    if ($domain['valid'] == 1) {
      if (isset($domain['path'])) {
        $base_urls[$domain_id][] = $domain['path'];
      }
      if (is_array($domain['aliases'])) {
        foreach ($domain['aliases'] as $alias) {
          if ($alias['redirect'] != 1) {
            $temp_domain = array(
              'scheme' => $domain['scheme'],
              'subdomain' => $alias['pattern'],
            );
            $base_urls[$domain_id][] = domain_get_path($temp_domain);
          }
        }
      }
    }
  }
  return $base_urls;
}