domain_cron

Definition

domain_cron()
domain.module, line 345

Description

Implements hook_cron()

This function invokes hook_domaincron() and allows Domain Access modules to run functions for all active affiliates.

Code

function domain_cron() {
  global $_domain;
  // Check to see if this function is needed at all.
  $modules = module_implements('domaincron');
  if (!empty($modules)) {
    // Store the current $_domain global.
    $_temp = $_domain;
    // Get the domain list.
    $domains = domain_domains();
    // Run the hook for each active domain.
    foreach ($domains as $domain) {
      // Set the domain-specific variables
      if (function_exists('_domain_conf_load')) {
        _domain_conf_load($domain);       
              }
      // Set the global table prefix
      if (function_exists('_domain_prefix_load')) {
        _domain_prefix_load($domain);       
              }
      // Set the global to the current $domain.
      $_domain = $domain;
      foreach ($modules as $module) {
        module_invoke($module, 'domaincron', $domain);
      }
    }
    // Set the $_domain global back.
    $_domain = $_temp;
  }
}