Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.462
diff -u -p -b -r1.462 bootstrap.inc
--- includes/bootstrap.inc	5 Jan 2011 06:17:58 -0000	1.462
+++ includes/bootstrap.inc	23 Jan 2011 08:28:03 -0000
@@ -806,7 +806,11 @@ function variable_set($name, $value) {
 
   cache_clear_all('variables', 'cache_bootstrap');
 
+  $old_value = isset($conf[$name]) ? $conf[$name] : NULL;
+
   $conf[$name] = $value;
+
+  module_invoke_all('variable_set', $name, $value, $old_value);
 }
 
 /**
@@ -831,6 +835,8 @@ function variable_del($name) {
   cache_clear_all('variables', 'cache_bootstrap');
 
   unset($conf[$name]);
+
+  module_invoke_all('variable_del', $name);
 }
 
 /**
@@ -1197,7 +1203,7 @@ function drupal_serve_page_from_cache(st
  * Define the critical hooks that force modules to always be loaded.
  */
 function bootstrap_hooks() {
-  return array('boot', 'exit', 'watchdog', 'language_init');
+  return array('boot', 'exit', 'watchdog', 'language_init', 'variable_del', 'variable_set');
 }
 
 /**
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.225
diff -u -p -b -r1.225 system.api.php
--- modules/system/system.api.php	4 Jan 2011 00:58:30 -0000	1.225
+++ modules/system/system.api.php	23 Jan 2011 08:28:05 -0000
@@ -1880,6 +1880,34 @@ function hook_system_info_alter(&$info, 
 }
 
 /**
+ * Allow modules to react to changes in a variable.
+ *
+ * @param mixed $name
+ *   The name of the variable.
+ * @param mixed $value
+ *   The value the variable is being set to.
+ * @param mixed $old_value
+ *   The old value of the variable.
+ */
+function hook_variable_set($name, $value, $old_value = NULL) {
+  if ($name == 'mymodule_foo') {
+    mymodule_notify_variable_change($name, $value, $old_value);
+  }
+}
+
+/**
+ * Allow modules to react to a variable deletion.
+ *
+ * @param mixed $name
+ *   The name of the variable.
+ */
+function hook_variable_del($name) {
+  if ($name == 'mymodule_foo') {
+    mymodule_notify_variable_del($name);
+  }
+}
+
+/**
  * Define user permissions.
  *
  * This hook can supply permissions that the module defines, so that they
