? .cvsignore ? 145164_hook_variables_113.patch ? 145164_hook_variables_114.patch ? 145164_hook_variables_115.patch ? 145164_hook_variables_116.patch ? nbproject ? user_load_multiple_14.patch ? user_load_multiple_15.patch ? sites/d7p ? sites/all/modules ? sites/default/files ? sites/default/settings.php Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.160 diff -u -p -r1.160 install.php --- install.php 17 Mar 2009 15:26:29 -0000 1.160 +++ install.php 20 Mar 2009 11:53:47 -0000 @@ -695,15 +695,17 @@ function install_tasks($profile, $task) } if ($task == 'configure') { - if (variable_get('site_name', FALSE) || variable_get('site_mail', FALSE)) { + // We need to check if a variable has been saved, because variable_get + // returns a different default value than FALSE (Drupal) we need here. + global $conf; + if (isset($conf['site_name']) || isset($conf['site_email'])) { // Site already configured: This should never happen, means re-running // the installer, possibly by an attacker after the 'install_task' variable // got accidentally blown somewhere. Stop it now. install_already_done_error(); } $form = drupal_get_form('install_configure_form', $url); - - if (!variable_get('site_name', FALSE) && !variable_get('site_mail', FALSE)) { + if (!isset($conf['site_name']) && !isset($conf['site_email'])) { // Not submitted yet: Prepare to display the form. $output = $form; drupal_set_title(st('Configure site')); Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.272 diff -u -p -r1.272 bootstrap.inc --- includes/bootstrap.inc 18 Mar 2009 09:21:21 -0000 1.272 +++ includes/bootstrap.inc 20 Mar 2009 11:53:47 -0000 @@ -627,14 +627,16 @@ function variable_init($conf = array()) * @param $name * The name of the variable to return. * @param $default - * The default value to use if this variable has never been set. + * The default value for dynamic variables. Static variables defaults should + * be declared in hook_variables(). * @return * The value of the variable. */ function variable_get($name, $default = NULL) { global $conf; - return isset($conf[$name]) ? $conf[$name] : $default; + $value = isset($conf[$name]) ? $conf[$name] : variable_default($name); + return !is_null($value) ? $value : $default; } /** @@ -645,15 +647,76 @@ function variable_get($name, $default = * @param $value * The value to set. This can be any PHP data type; these functions take care * of serialization as necessary. + * @return + * The value of the variable. */ function variable_set($name, $value) { global $conf; - db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); - + // Do not store default values in the database. + if ($value == variable_default($name)) { + variable_del($name); + } + else { + db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); + } + // Clear the cache and reset the variable. cache_clear_all('variables', 'cache'); - $conf[$name] = $value; + return $conf[$name] = $value; +} + +/** + * Gets the default value for a given variable. + * + * @param $name + * The name of the variable in question. + * @param $refresh + * If TRUE, refreshes the internal static cache. Defaults to FALSE. + * @return + * The default value for that variable, to be used in case no value is set. + */ +function variable_default($name, $refresh = FALSE) { + static $defaults; + static $invoked = FALSE; + if ($refresh) { + $defaults = array(); + $invoked = FALSE; + } + if (empty($defaults)) { + // These variables need to be initialized here because they are required to + // exist before the database is set up and the variable system initialized. + $defaults['cache_inc'] = './includes/cache.inc'; + $defaults['page_cache_fastpath'] = FALSE; + $defaults['blocked_ips'] = NULL; + $defaults['session_inc'] = './includes/session.inc'; + $defaults['dev_query'] = 0; + $defaults['reverse_proxy'] = 0; + $defaults['reverse_proxy_addresses'] = array(); + $defaults['cache'] = CACHE_DISABLED; + $defaults['cache_flush'] = 0; + $defaults['language_count'] = 1; + $defaults['session_write_interval'] = 180; + $defaults['site_frontpage'] = 'node'; + $defaults['install_profile_modules'] = array(); + $defaults['install_locale_batch_components'] = array(); + $defaults['password_inc'] = './includes/password.inc'; + $defaults['field_storage_module'] = 'field_sql_storage'; + $defaults['language_default'] = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''); + } + // We use function_exists() here, because the registry may not be available early on in the page process. + if (!$invoked && !isset($defaults[$name]) && !array_key_exists($name, $defaults) && function_exists('module_invoke_all') && function_exists('drupal_alter') && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')) { + $invoked = TRUE; + $defaults += module_invoke_all('variables'); + drupal_alter('variable_defaults', $defaults); + } + if (empty($name)) { + return NULL; + } + if (isset($defaults[$name]) || array_key_exists($name, $defaults)) { + return $defaults[$name]; + } + return NULL; } /** Index: includes/password.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/password.inc,v retrieving revision 1.6 diff -u -p -r1.6 password.inc --- includes/password.inc 26 Feb 2009 07:30:26 -0000 1.6 +++ includes/password.inc 20 Mar 2009 11:53:47 -0000 @@ -15,23 +15,6 @@ */ /** - * The standard log2 number of iterations for password stretching. This should - * increase by 1 at least every other Drupal version in order to counteract - * increases in the speed and power of computers available to crack the hashes. - */ -define('DRUPAL_HASH_COUNT', 14); - -/** - * The minimum allowed log2 number of iterations for password stretching. - */ -define('DRUPAL_MIN_HASH_COUNT', 7); - -/** - * The maximum allowed log2 number of iterations for password stretching. - */ -define('DRUPAL_MAX_HASH_COUNT', 30); - -/** * Returns a string for mapping an int to the corresponding base 64 character. */ function _password_itoa64() { Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.470 diff -u -p -r1.470 theme.inc --- includes/theme.inc 22 Feb 2009 17:55:29 -0000 1.470 +++ includes/theme.inc 20 Mar 2009 11:53:47 -0000 @@ -923,8 +923,8 @@ function theme_get_settings($key = NULL) $settings = array_merge($defaults, variable_get('theme_settings', array())); if ($key) { - $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_' . $key . '_settings'), array())); - } + $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_' . $key . '_settings'), array())); + } // Only offer search box if search.module is enabled. if (!defined('MAINTENANCE_MODE') && module_exists('search') && user_access('search content')) { Index: modules/aggregator/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.405 diff -u -p -r1.405 aggregator.module --- modules/aggregator/aggregator.module 1 Mar 2009 07:21:02 -0000 1.405 +++ modules/aggregator/aggregator.module 20 Mar 2009 11:53:48 -0000 @@ -30,6 +30,20 @@ function aggregator_help($path, $arg) { } /** + * Implementation of hook_variables(). + */ +function aggregator_variables() { + return array( + 'aggregator_allowed_html_tags' => '