Commit a1593ab1 authored by Dries's avatar Dries

- Patch #370454 by chx, Damien Tournoud: simplify page caching.

parent 46b9fe93
This diff is collapsed.
......@@ -261,16 +261,14 @@ class HookBootExitTestCase extends DrupalWebTestCase {
$this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot called with normal cache.'));
$this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit called with normal cache.'));
// Test with aggressive cache. Boot and exit should not fire since the
// page is cached.
variable_set('cache', CACHE_AGGRESSIVE);
// Boot and exit should not fire since the page is cached.
variable_set('page_cache_invoke_hooks', FALSE);
$this->assertTrue(cache_get(url('', array('absolute' => TRUE)), 'cache_page'), t('Page has been cached.'));
$this->drupalGet('');
$this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot not called with agressive cache and a cached page.'));
$this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit not called with agressive cache and a cached page.'));
// Test with aggressive cache and page cache cleared. Boot and exit should
// be called.
// Test with page cache cleared, boot and exit should be called.
$this->assertTrue(db_delete('cache_page')->execute(), t('Page cache cleared.'));
$this->drupalGet('');
$calls++;
......
......@@ -1363,21 +1363,6 @@ function system_performance_settings() {
);
$cache = variable_get('cache', CACHE_DISABLED);
$js_hide = $cache != CACHE_AGGRESSIVE ? 'js-hide' : '';
$problem_modules = array_unique(array_merge(module_implements('boot'), module_implements('exit')));
if (count($problem_modules) > 0) {
$module_names = array();
foreach ($problem_modules as $module) {
$info = drupal_parse_info_file(drupal_get_path('module', $module) . "/$module.info");
$module_names[] = $info['name'];
}
sort($module_names);
$message = format_plural(count($module_names), '%module may cause issues when using aggressive caching.', '%modules may cause issues when using aggressive caching.', array('%module' => $module_names[0], '%modules' => implode(', ', $module_names)));
$description = ' <strong id="cache-error" class="error ' . $js_hide . '">' . $message . '</strong>';
}
else {
$description = ' <strong class="' . $js_hide . '">' . t('Note: if you use aggressive page caching and enable new modules, you will need to check this setting again to ensure compatibility.') . '</strong>';
}
$form['caching']['cache'] = array(
'#type' => 'radios',
'#title' => t('Page cache for anonymous users'),
......
......@@ -2242,6 +2242,17 @@ function system_update_7032() {
return $ret;
}
/**
* Move CACHE_AGGRESSIVE to CACHE_NORMAL.
*/
function system_update_7033() {
if (variable_get('cache') == 2) {
variable_set('cache', CACHE_NORMAL);
$ret[] = array('success' => TRUE, 'query' => "Aggressive caching was disabled and replaced with normal caching, please read the page caching section in default.settings.php for more information on how to enable similar functionality.");
}
return array();
}
/**
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment