variable_set

5.x db.inc variable_set($name, $value)
4.x db.inc variable_set($name, $value)

Set a variable value, so we can retrieve it later on.

This will write to our variables database table, as well as store in a cache array for quick look-up later.

Parameters

unknown_type $name:

unknown_type $value:

7 calls to variable_set()
admin_apply_draft_changes_form_submit in modules/admin/admin.module
Handles the actual moving of draft courses into production.
cron.php in ./cron.php
The cron.php file for FlightPath, which should be run periodically.
fp_token in includes/misc.inc
Returns back the site's "token", which is a simply md5 of some randomness. It is used primarily with forms, to ensure against cross-site forgeries. The site's token gets saved to the variables table, for later use. The idea is…
system_handle_form_submit in modules/system/system.module
Intercepts form submissions from System Settings Forms.
system_perform_run_cron in modules/system/system.module
Called from menu, will run hook_cron() for all modules.

... See full list

File

includes/db.inc, line 360
This file contains mostly db shortcuts.

Code

function variable_set($name, $value) {

  // Save back to our "cache" GLOBALS array:
  $GLOBALS["fp_system_settings"][$name] = $value;


  // Boolean FALSE presents unusual problems when we try to tell if it got unserialized correctly.
  // We will convert it to a placeholder so we can positively store it.   
  if ($value === FALSE) {
    $value = "BOOLEAN_FALSE_PLACEHOLDER";
  }

  db_query("REPLACE INTO variables (name, value)
              VALUES ('?', '?') ", $name, serialize($value));


}