domain_conf_variable_save

Versions
domain
domain_conf_variable_save($domain_id, $variable, $value = NULL)

Store a single variable in {domain_conf}.

@link http://drupal.org/node/367963

See also

domain_conf_variable_set()

Parameters

$domain_id The unique domain ID that is being edited.

$variable The name of the variable you wish to set.

$value The value of the variable to set. You may leave this value blank in order to unset the custom variable.

▾ 2 functions call domain_conf_variable_save()

domain_conf_variable_set in domain_conf/domain_conf.module
Change the variable setting for a domain. This function is called by external modules that wish to alter Domain Conf settings.
domain_settings_form_submit in domain_settings/domain_settings.module
Submit handler for domain-specific settings.

Code

domain_conf/domain_conf.module, line 747

<?php
function domain_conf_variable_save($domain_id, $variable, $value = NULL) {
  // Get the current settings for this domain, if any.
  $settings = domain_unserialize(db_result(db_query("SELECT settings FROM {domain_conf} WHERE domain_id = %d", $domain_id)));
  // Settings found, update them.
  if (!empty($settings)) {
    $settings[$variable] = $value;
    db_query("UPDATE {domain_conf} SET settings = %b WHERE domain_id = %d", serialize($settings), $domain_id);
  }
  else if (domain_lookup($domain_id) != -1) {
    $settings = array($variable => $value);
    db_query("INSERT INTO {domain_conf} (domain_id, settings) VALUES (%d, %b)", $domain_id, serialize($settings));
  }
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List