Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.463
diff -u -r1.463 bootstrap.inc
--- includes/bootstrap.inc	5 Jan 2011 06:23:07 -0000	1.463
+++ includes/bootstrap.inc	5 Jan 2011 17:25:48 -0000
@@ -767,12 +767,14 @@
  * variable names.
  *
  * @param $name
- *   The name of the variable to return.
+ *   The name of the variable to return, or an array where the key represents
+ *   the variable name, and the value represents the desired value.
  * @param $default
  *   The default value to use if this variable has never been set.
  *
  * @return
- *   The value of the variable.
+ *   The value of the variable, or if passing an array, it will return an
+ *   array of variable name => value pairs.
  *
  * @see variable_del()
  * @see variable_set()
@@ -780,7 +782,16 @@
 function variable_get($name, $default = NULL) {
   global $conf;
 
-  return isset($conf[$name]) ? $conf[$name] : $default;
+  // Single values are retrieved immediately.
+  if (!is_array($name)) {
+    return isset($conf[$name]) ? $conf[$name] : $default;
+  }
+
+  $values = array();
+  foreach ($name as $variable => $value) {
+    $values[$variable] = isset($conf[$variable]) ? $conf[$variable] : $value;
+  }
+  return $values;
 }
 
 /**
@@ -791,22 +802,29 @@
  * variable names.
  *
  * @param $name
- *   The name of the variable to set.
+ *   The name of the variable to set (string), or an array where the key
+ *   represents the variable name, and the value is the desired value for the
+ *   variable.
  * @param $value
  *   The value to set. This can be any PHP data type; these functions take care
- *   of serialization as necessary.
+ *   of serialization as necessary. If $name is an array, this parameter is not
+ *   required.
  *
  * @see variable_del()
  * @see variable_get()
  */
-function variable_set($name, $value) {
+function variable_set($name, $value = NULL) {
   global $conf;
 
-  db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute();
+  // Single values are switched to arrays to simplify the method.
+  $variables = !is_array($name) ? array($name => $value) : $name;
 
-  cache_clear_all('variables', 'cache_bootstrap');
+  foreach ($variables as $key => $value) {
+    db_merge('variable')->key(array('name' => $key))->fields(array('value' => serialize($value)))->execute();
+    $conf[$key] = $value;
+  }
 
-  $conf[$name] = $value;
+  cache_clear_all('variables', 'cache_bootstrap');
 }
 
 /**
@@ -817,7 +835,8 @@
  * variable names.
  *
  * @param $name
- *   The name of the variable to undefine.
+ *   The name of the variable to undefine (string), or an array of variable
+ *   names desired for deletion.
  *
  * @see variable_get()
  * @see variable_set()
@@ -825,12 +844,18 @@
 function variable_del($name) {
   global $conf;
 
-  db_delete('variable')
-    ->condition('name', $name)
-    ->execute();
-  cache_clear_all('variables', 'cache_bootstrap');
+  // Single values are switched to arrays to simplify the method.
+  $variables = !is_array($name) ? array($name) : $name;
 
-  unset($conf[$name]);
+  // Remove the variable from both the database and the global configuration.
+  $or = db_or();
+  foreach ($variables as $variable) {
+    $or->condition('name', $variable);
+    unset($conf[$name]);
+  }
+  // Use one database query to remove all variables via the or condition.
+  db_delete('variable')->condition($or)->execute();
+  cache_clear_all('variables', 'cache_bootstrap');
 }
 
 /**
Index: modules/simpletest/tests/bootstrap.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/bootstrap.test,v
retrieving revision 1.35
diff -u -r1.35 bootstrap.test
--- modules/simpletest/tests/bootstrap.test	23 Nov 2010 03:08:34 -0000	1.35
+++ modules/simpletest/tests/bootstrap.test	5 Jan 2011 17:25:48 -0000
@@ -255,6 +255,32 @@
     variable_del('simpletest_bootstrap_variable_test');
     $variable = variable_get('simpletest_bootstrap_variable_test', $default_value);
     $this->assertIdentical($variable, $default_value, t('Deleting variables'));
+    
+    //Setting and retrieving values (array format).
+    $variables = array(
+      'simpletest_bootstrap_variable_test_1' => $this->randomName(),
+      'simpletest_bootstrap_variable_test_2' => $this->randomName(),
+    );
+    variable_set($variables);
+    $variable_get = variable_get(array(
+      'simpletest_bootstrap_variable_test1' => NULL,
+      'simpletest_bootstrap_variable_test2' => NULL,
+    ));
+    $this->assertIdentical($variables, $variable_get, t('Setting and retrieving values as array'));
+
+    // Make sure the variables persists across multiple requests.
+    $this->drupalGet('system-test/variable-get-array');
+    $this->assertText(print_r($variables, TRUE), t('Variables set as arrays persist across multiple requests'));
+
+    // Deleting variables.
+    $variables = array(
+      'simpletest_bootstrap_variable_test_1' => $this->randomName(),
+      'simpletest_bootstrap_variable_test_2' => $this->randomName(),
+    );
+    variable_del(array('simpletest_bootstrap_variable_test_1', 'simpletest_bootstrap_variable_test_2'));
+    $variable_get = variable_get($variables);
+    $this->assertIdentical($variables, $variable_get, t('Deleting variables as array'));
+    
   }
 
   /**
Index: modules/simpletest/tests/system_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/system_test.module,v
retrieving revision 1.33
diff -u -r1.33 system_test.module
--- modules/simpletest/tests/system_test.module	1 Dec 2010 00:23:36 -0000	1.33
+++ modules/simpletest/tests/system_test.module	5 Jan 2011 17:25:48 -0000
@@ -57,6 +57,20 @@
     'access arguments' => array('access content'),
     'type' => MENU_CALLBACK,
   );
+  
+  $items['system-test/variable-get-array'] = array(
+    'title' => 'Variable Get',
+    'page callback' => 'system_test_variable_get_array',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
+  
+  $items['system-test/variable-get-array'] = array(
+    'title' => 'Variable Get',
+    'page callback' => 'system_test_variable_get_array',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
 
   $items['system-test/lock-acquire'] = array(
     'title' => 'Lock acquire',
@@ -318,6 +332,17 @@
 }
 
 /**
+ * Menu callback; Retrieves a set of variables using an array.
+ */
+function system_test_variable_get_array() {
+  $variables = array(
+    'simpletest_bootstrap_variable_test_1' => NULL,
+    'simpletest_bootstrap_variable_test_2' => NULL,
+  );
+  return print_r(variable_get($variables), TRUE);
+}
+
+/**
  * Implements hook_filetransfer_info().
  */
 function system_test_filetransfer_info() {
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.1003
diff -u -r1.1003 system.module
--- modules/system/system.module	4 Jan 2011 00:56:23 -0000	1.1003
+++ modules/system/system.module	5 Jan 2011 17:25:49 -0000
@@ -2746,12 +2746,15 @@
   // Exclude unnecessary elements.
   form_state_values_clean($form_state);
 
+  $values = array();
   foreach ($form_state['values'] as $key => $value) {
     if (is_array($value) && isset($form_state['values']['array_filter'])) {
       $value = array_keys(array_filter($value));
     }
-    variable_set($key, $value);
+    $values[$key] = $value;
   }
+  // Set all the variables at once.
+  variable_set($values);
 
   drupal_set_message(t('The configuration options have been saved.'));
 }
