You are here

function boost_domainupdate in Boost 6

Implementation of hook_domainupdate() - keeps domain whitelist variable current

File

./boost.module, line 572
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function boost_domainupdate($op, $domain, $form_state = array()) {
  switch ($op) {
    case 'create':
      if (variable_get('boost_domain_whitelist_use_domain', FALSE)) {
        $whitelist = variable_get('boost_domain_whitelist', array());
        $whitelist[$domain['subdomain']] = $domain['subdomain'];
        asort($whitelist);
        variable_set('boost_domain_whitelist', $whitelist);
      }
      break;
    case 'update':
      if (variable_get('boost_domain_whitelist_use_domain', FALSE)) {
        $whitelist = variable_get('boost_domain_whitelist', array());
        unset($whitelist[$domain['subdomain']]);
        $new_name = $form_state['values']['subdomain'];
        $whitelist[$new_name] = $new_name;
        asort($whitelist);
        variable_set('boost_domain_whitelist', $whitelist);
      }
      break;
    case 'delete':
      if (variable_get('boost_domain_whitelist_use_domain', FALSE)) {
        $whitelist = variable_get('boost_domain_whitelist', array());
        unset($whitelist[$domain['subdomain']]);
        variable_set('boost_domain_whitelist', $whitelist);
      }
      break;
  }
}