If I am not wrong, after disabling all Domain modules and clearing all browser private data, one can still access alfa.example.com and see alfa-specific settings (e.g. header, footer). Maybe it's harmless, I was just surprised.

Comments

agentrickard’s picture

Well that's just some misconceptions, I think.

Seeing alpha.example.com has nothing to do with this module -- that's a server-level configuration.

Browser-private data is not relevant. What is relevant is the data stored in the database. That said, the domain-specific configuration settings should no longer appear when the modules are turned off.

However, if you have page caching turned on, you would need to clear the cache, since the cache for that page might still exist. Perhaps clearing the page cache needs to go into the implementation of hook_uninstall().

agentrickard’s picture

I think I get it.

If you don't uninstall the module, then the domain_conf table still exists. If it does, you would need to remove the change to settings.php -- otherwise the conf load routine in _domain_conf_load() still runs.

I'll put a 'module_exists' check in that function.

agentrickard’s picture

module_exists will only work is caching is disabled. Try removing the lines from settings.php

skizzo’s picture

yes: I had nothing in cache, module was disabled, but table was still used... Indeed I don't want/need to remove the module. Maybe this issue should be mentioned in documentation, just in case somebody (with caching) disables the module believing that it is enough, while users are still accessing domains.

agentrickard’s picture

Category: support » bug
Status: Active » Reviewed & tested by the community

I added something to the documentation. I think that is a sufficient fix, though I could add a query.

This is a module for advanced users, after all.

But this works, so I'll add it, since it's only one query:

function _domain_conf_load() {
  $check = db_fetch_array(db_query("SELECT status FROM {system} WHERE name = 'domain_conf'"));
  if ($check['status'] == 1) {
    // Cribbed from bootstrap.inc -- removes port protocols from the host value.
    $_subdomain = implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.'))));
    // Lookup the active domain against our allowed hosts record.
    $domain = db_fetch_array(db_query("SELECT domain_id FROM {domain} WHERE subdomain = '%s'", $_subdomain));
    if ($domain['domain_id']) {
      $data = array();
      $data = db_fetch_array(db_query("SELECT settings FROM {domain_conf} WHERE domain_id = %d", $domain['domain_id']));
      if (!empty($data)) {
        global $conf;
        $settings = unserialize($data['settings']);
        // Overwrite the $conf variables.
        foreach ($settings as $key => $value) {
          $conf[$key] = $value;
        }
      }
    }
  }
}
agentrickard’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.