summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/bootstrap.inc4
-rw-r--r--includes/file.inc2
-rw-r--r--modules/color/color.module4
-rw-r--r--modules/locale/locale.install2
-rw-r--r--modules/simpletest/tests/bootstrap.test13
-rw-r--r--modules/system/system.api.php2
-rw-r--r--modules/system/system.install10
-rw-r--r--modules/user/user.test2
8 files changed, 25 insertions, 14 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index ba27a5f7c..a84257341 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -631,7 +631,7 @@ function variable_init($conf = array()) {
* @return
* The value of the variable.
*/
-function variable_get($name, $default) {
+function variable_get($name, $default = NULL) {
global $conf;
return isset($conf[$name]) ? $conf[$name] : $default;
@@ -1046,7 +1046,7 @@ function drupal_is_denied($ip) {
// Because this function is called on every page request, we first check
// for an array of IP addresses in settings.php before querying the
// database.
- $blocked_ips = variable_get('blocked_ips', NULL);
+ $blocked_ips = variable_get('blocked_ips');
if (isset($blocked_ips) && is_array($blocked_ips)) {
return in_array($ip, $blocked_ips);
}
diff --git a/includes/file.inc b/includes/file.inc
index 38c4999ff..05318add6 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -1407,7 +1407,7 @@ function file_scan_directory($dir, $mask, $nomask = '/(\.\.?|CVS)$/', $callback
* A string containing a temp directory.
*/
function file_directory_temp() {
- $temporary_directory = variable_get('file_directory_temp', NULL);
+ $temporary_directory = variable_get('file_directory_temp');
if (is_null($temporary_directory)) {
$directories = array();
diff --git a/modules/color/color.module b/modules/color/color.module
index fa53f45f7..d64a64b64 100644
--- a/modules/color/color.module
+++ b/modules/color/color.module
@@ -72,7 +72,7 @@ function _color_theme_select_form_alter(&$form, &$form_state) {
// Use the generated screenshot in the theme list.
$themes = list_themes();
foreach (element_children($form) as $theme) {
- if ($screenshot = variable_get('color_' . $theme . '_screenshot', NULL)) {
+ if ($screenshot = variable_get('color_' . $theme . '_screenshot')) {
if (isset($form[$theme]['screenshot'])) {
$form[$theme]['screenshot']['#markup'] = theme('image', $screenshot, '', '', array('class' => 'screenshot'), FALSE);
}
@@ -127,7 +127,7 @@ function _color_page_alter(&$vars) {
}
// Override logo.
- $logo = variable_get('color_' . $theme_key . '_logo', NULL);
+ $logo = variable_get('color_' . $theme_key . '_logo');
if ($logo && $vars['logo'] && preg_match('!' . $theme_key . '/logo.png$!', $vars['logo'])) {
$vars['logo'] = base_path() . $logo;
}
diff --git a/modules/locale/locale.install b/modules/locale/locale.install
index de8f6fe98..044ab62d3 100644
--- a/modules/locale/locale.install
+++ b/modules/locale/locale.install
@@ -172,7 +172,7 @@ function locale_update_6004() {
function locale_update_6005() {
foreach (node_get_types() as $type => $content_type) {
// Default to NULL, so we can skip dealing with non-existent settings.
- $setting = variable_get('language_' . $type, NULL);
+ $setting = variable_get('language_' . $type);
if ($type == 'default' && is_numeric($setting)) {
// language_default was overwritten with the content type setting,
// so reset the default language and save the content type setting.
diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test
index 149c5ef49..3cacf1175 100644
--- a/modules/simpletest/tests/bootstrap.test
+++ b/modules/simpletest/tests/bootstrap.test
@@ -151,7 +151,7 @@ class BootstrapVariableTestCase extends DrupalWebTestCase {
// Setting and retrieving values.
$variable = $this->randomName();
variable_set('simpletest_bootstrap_variable_test', $variable);
- $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test', NULL), t('Setting and retrieving values'));
+ $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test'), t('Setting and retrieving values'));
// Make sure the variable persists across multiple requests.
$this->drupalGet('system-test/variable-get');
@@ -164,6 +164,17 @@ class BootstrapVariableTestCase extends DrupalWebTestCase {
$this->assertIdentical($variable, $default_value, t('Deleting variables'));
}
+ /**
+ * Makes sure that the default variable parameter is passed through okay.
+ */
+ function testVariableDefaults() {
+ // Tests passing nothing through to the default.
+ $this->assertIdentical(NULL, variable_get('simpletest_bootstrap_variable_test'), t('Variables are correctly defaulting to NULL.'));
+
+ // Tests passing 5 to the default parameter.
+ $this->assertIdentical(5, variable_get('simpletest_bootstrap_variable_test', 5), t('The default variable parameter is passed through correctly.'));
+ }
+
}
/**
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 9fc2457fb..7e5e2e7e7 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -1322,7 +1322,7 @@ function hook_requirements($phase) {
// Report cron status
if ($phase == 'runtime') {
- $cron_last = variable_get('cron_last', NULL);
+ $cron_last = variable_get('cron_last');
if (is_numeric($cron_last)) {
$requirements['cron']['value'] = $t('Last run !time ago', array('!time' => format_interval(REQUEST_TIME - $cron_last)));
diff --git a/modules/system/system.install b/modules/system/system.install
index 1849f88ad..7b8f1e144 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -134,7 +134,7 @@ function system_requirements($phase) {
$help = $t('For more information, see the online handbook entry for <a href="@cron-handbook">configuring cron jobs</a>.', array('@cron-handbook' => 'http://drupal.org/cron'));
// Determine when cron last ran.
- $cron_last = variable_get('cron_last', NULL);
+ $cron_last = variable_get('cron_last');
if (!is_numeric($cron_last)) {
$cron_last = variable_get('install_time', 0);
}
@@ -2491,7 +2491,7 @@ function system_update_6041() {
*/
function system_update_6042() {
foreach (list_themes() as $theme) {
- $stylesheet = variable_get('color_' . $theme->name . '_stylesheet', NULL);
+ $stylesheet = variable_get('color_' . $theme->name . '_stylesheet');
if (!empty($stylesheet)) {
variable_set('color_' . $theme->name . '_stylesheets', array($stylesheet));
variable_del('color_' . $theme->name . '_stylesheet');
@@ -2853,12 +2853,12 @@ function system_update_7004(&$sandbox) {
}
}
// Rename forum module's block variables.
- $forum_block_num_0 = variable_get('forum_block_num_0', NULL);
+ $forum_block_num_0 = variable_get('forum_block_num_0');
if (isset($forum_block_num_0)) {
variable_set('forum_block_num_active', $forum_block_num_0);
variable_del('forum_block_num_0');
}
- $forum_block_num_1 = variable_get('forum_block_num_1', NULL);
+ $forum_block_num_1 = variable_get('forum_block_num_1');
if (isset($forum_block_num_1)) {
variable_set('forum_block_num_new', $forum_block_num_1);
variable_del('forum_block_num_1');
@@ -3090,7 +3090,7 @@ function system_update_7013() {
$timezones = system_time_zones();
// If the contributed Date module set a default time zone name, use this
// setting as the default time zone.
- if (($timezone_name = variable_get('date_default_timezone_name', NULL)) && isset($timezones[$timezone_name])) {
+ if (($timezone_name = variable_get('date_default_timezone_name')) && isset($timezones[$timezone_name])) {
$timezone = $timezone_name;
}
// If the contributed Event module has set a default site time zone, look up
diff --git a/modules/user/user.test b/modules/user/user.test
index 22dea39b1..327068f5b 100644
--- a/modules/user/user.test
+++ b/modules/user/user.test
@@ -42,7 +42,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$this->assertEqual($user->signature, '', t('Correct signature field.'));
$this->assertTrue(($user->created > REQUEST_TIME - 20 ), t('Correct creation time.'));
$this->assertEqual($user->status, variable_get('user_register', 1) == 1 ? 1 : 0, t('Correct status field.'));
- $this->assertEqual($user->timezone, variable_get('date_default_timezone', NULL), t('Correct time zone field.'));
+ $this->assertEqual($user->timezone, variable_get('date_default_timezone'), t('Correct time zone field.'));
$this->assertEqual($user->language, '', t('Correct language field.'));
$this->assertEqual($user->picture, '', t('Correct picture field.'));
$this->assertEqual($user->init, $mail, t('Correct init field.'));