summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/filter/filter.module21
-rw-r--r--modules/locale/locale.module11
-rw-r--r--modules/node/content_types.inc3
-rw-r--r--modules/system/system.install120
-rw-r--r--modules/user/user.module4
5 files changed, 144 insertions, 15 deletions
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index ba0628a06..e32ff4149 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -149,6 +149,15 @@ function filter_perm() {
}
/**
+ * Implementation of hook_cron().
+ *
+ * Expire outdated filter cache entries
+ */
+function filter_cron() {
+ cache_clear_all(NULL, 'cache_filter');
+}
+
+/**
* Implementation of hook_filter_tips().
*/
function filter_filter_tips($delta, $format, $long = FALSE) {
@@ -388,7 +397,7 @@ function filter_admin_delete_submit($form_id, $form_values) {
db_query("UPDATE {comments} SET format = %d WHERE format = %d", $default, $form_values['format']);
db_query("UPDATE {boxes} SET format = %d WHERE format = %d", $default, $form_values['format']);
- cache_clear_all('filter:'. $form_values['format'], TRUE);
+ cache_clear_all($form_values['format'] .':', 'cache_filter', TRUE);
drupal_set_message(t('Deleted input format %format.', array('%format' => $form_values['name'])));
return 'admin/settings/filters';
@@ -524,7 +533,7 @@ function filter_admin_format_form_submit($form_id, $form_values) {
db_query("UPDATE {filter_formats} SET cache = %d, name='%s', roles = '%s' WHERE format = %d", $cache, $name, $roles, $format);
- cache_clear_all('filter:'. $format, TRUE);
+ cache_clear_all($format .':', 'cache_filter', TRUE);
// If a new filter was added, return to the main list of filters. Otherwise, stay on edit filter page to show new changes.
if ($new) {
@@ -582,7 +591,7 @@ function filter_admin_order_submit($form_id, $form_values) {
}
drupal_set_message(t('The filter ordering has been saved.'));
- cache_clear_all('filter:'. $form_values['format'], TRUE);
+ cache_clear_all($form_values['format'] .':', 'cache_filter', TRUE);
}
/**
@@ -747,8 +756,8 @@ function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $check = TRUE) {
$format = filter_resolve_format($format);
// Check for a cached version of this piece of text.
- $id = 'filter:'. $format .':'. md5($text);
- if ($cached = cache_get($id)) {
+ $id = $format .':'. md5($text);
+ if ($cached = cache_get($id, 'cache_filter')) {
return $cached->data;
}
@@ -774,7 +783,7 @@ function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $check = TRUE) {
// Store in cache with a minimum expiration time of 1 day.
if ($cache) {
- cache_set($id, $text, time() + (60 * 60 * 24));
+ cache_set($id, 'cache_filter', $text, time() + (60 * 60 * 24));
}
}
else {
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 555e4cafc..abe3db056 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -181,11 +181,11 @@ function locale($string) {
// Store database cached translations in a static var.
if (!isset($locale_t)) {
- $cache = cache_get("locale:$locale");
+ $cache = cache_get("locale:$locale", 'cache');
if (!$cache) {
locale_refresh_cache();
- $cache = cache_get("locale:$locale");
+ $cache = cache_get("locale:$locale", 'cache');
}
$locale_t = unserialize($cache->data);
}
@@ -225,7 +225,7 @@ function locale($string) {
}
}
// Clear locale cache in DB
- cache_clear_all("locale:$locale");
+ cache_clear_all("locale:$locale", 'cache');
}
}
@@ -246,7 +246,7 @@ function locale_refresh_cache() {
while ($data = db_fetch_object($result)) {
$t[$data->source] = (empty($data->translation) ? TRUE : $data->translation);
}
- cache_set("locale:$locale", serialize($t));
+ cache_set("locale:$locale", 'cache', serialize($t));
}
}
@@ -357,7 +357,8 @@ function locale_admin_manage_delete_form_submit($form_id, $form_values) {
}
// Changing the locale settings impacts the interface:
- cache_clear_all();
+ cache_clear_all('*', 'cache_menu', TRUE);
+ cache_clear_all('*', 'cache_page', TRUE);
return 'admin/settings/locale/language/overview';
}
diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc
index 6e0fb0d7f..307346e12 100644
--- a/modules/node/content_types.inc
+++ b/modules/node/content_types.inc
@@ -281,7 +281,6 @@ function node_type_form_submit($form_id, $form_values) {
if ($update_count) {
drupal_set_message(t('Changed the content type of %update_count %posts from %old_type to %type.', array('%update_count' => $update_count, '%posts' => format_plural($update_count, 'post', 'posts'), '%old_type' => $type->old_type, '%type' => $type->type)));
- cache_clear_all('filter:', TRUE);
}
}
}
@@ -318,8 +317,8 @@ function node_type_form_submit($form_id, $form_values) {
}
node_types_rebuild();
+ // menu_rebuild clears the cache, too
menu_rebuild();
- cache_clear_all();
$t_args = array('%name' => $type->name);
if ($op == t('Reset to defaults')) {
diff --git a/modules/system/system.install b/modules/system/system.install
index ac8aebaa0..b0ebbe7ca 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -54,6 +54,33 @@ function system_install() {
PRIMARY KEY (cid),
INDEX expire (expire)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+ db_query("CREATE TABLE {cache_filter} (
+ cid varchar(255) NOT NULL default '',
+ data longblob,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid),
+ INDEX expire (expire)
+ ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+ db_query("CREATE TABLE {cache_menu} (
+ cid varchar(255) NOT NULL default '',
+ data longblob,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid),
+ INDEX expire (expire)
+ ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+ db_query("CREATE TABLE {cache_page} (
+ cid varchar(255) NOT NULL default '',
+ data longblob,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid),
+ INDEX expire (expire)
+ ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {comments} (
cid int NOT NULL auto_increment,
@@ -455,7 +482,34 @@ function system_install() {
headers text,
PRIMARY KEY (cid)
)");
+ db_query("CREATE TABLE {cache_filter} (
+ cid varchar(255) NOT NULL default '',
+ data bytea,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid)
+ )");
+ db_query("CREATE TABLE {cache_menu} (
+ cid varchar(255) NOT NULL default '',
+ data bytea,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid)
+ )");
+ db_query("CREATE TABLE {cache_page} (
+ cid varchar(255) NOT NULL default '',
+ data bytea,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid)
+ )");
db_query("CREATE INDEX {cache}_expire_idx ON {cache} (expire)");
+ db_query("CREATE INDEX {cache}_expire_idx ON {cache_filter} (expire)");
+ db_query("CREATE INDEX {cache}_expire_idx ON {cache_menu} (expire)");
+ db_query("CREATE INDEX {cache}_expire_idx ON {cache_page} (expire)");
db_query("CREATE TABLE {comments} (
cid serial,
@@ -3107,6 +3161,72 @@ function system_update_1008() {
return $ret;
}
+function system_update_1009() {
+ $ret = array();
+ switch ($GLOBALS['db_type']) {
+ case 'mysql':
+ case 'mysqli':
+ $ret[] = update_sql("CREATE TABLE {cache_filter} (
+ cid varchar(255) NOT NULL default '',
+ data longblob,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid),
+ INDEX expire (expire)
+ ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+ $ret[] = update_sql("CREATE TABLE {cache_menu} (
+ cid varchar(255) NOT NULL default '',
+ data longblob,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid),
+ INDEX expire (expire)
+ ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+ $ret[] = update_sql("CREATE TABLE {cache_page} (
+ cid varchar(255) NOT NULL default '',
+ data longblob,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid),
+ INDEX expire (expire)
+ ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+ break;
+ case 'pgsql':
+ $ret[] = update_sql("CREATE TABLE {cache_filter} (
+ cid varchar(255) NOT NULL default '',
+ data bytea,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid)
+ )");
+ $ret[] = update_sql("CREATE TABLE {cache_menu} (
+ cid varchar(255) NOT NULL default '',
+ data bytea,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid)
+ )");
+ $ret[] = update_sql("CREATE TABLE {cache_page} (
+ cid varchar(255) NOT NULL default '',
+ data bytea,
+ expire int NOT NULL default '0',
+ created int NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid)
+ )");
+ $ret[] = update_sql("CREATE INDEX {cache}_expire_idx ON {cache_filter} (expire)");
+ $ret[] = update_sql("CREATE INDEX {cache}_expire_idx ON {cache_menu} (expire)");
+ $ret[] = update_sql("CREATE INDEX {cache}_expire_idx ON {cache_page} (expire)");
+ break;
+ }
+ return $ret;
+}
+
/**
* @} End of "defgroup updates-4.7-to-x.x"
* The next series of updates should start at 2000.
diff --git a/modules/user/user.module b/modules/user/user.module
index 54f279d60..32eb5c0ba 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -1461,7 +1461,7 @@ function user_edit_submit($form_id, $form_values) {
user_module_invoke('submit', $form_values, $account, $category);
user_save($account, $form_values, $category);
// Delete that user's menu cache.
- cache_clear_all('menu:'. $account->uid, TRUE);
+ cache_clear_all($account->uid .':', 'cache_menu', TRUE);
drupal_set_message(t('The changes have been saved.'));
return 'user/'. $account->uid;
}
@@ -2065,7 +2065,7 @@ function user_admin_account_submit($form_id, $edit) {
}
call_user_func_array($function, $args);
- cache_clear_all();
+ cache_clear_all('*', 'cache_menu', TRUE);
drupal_set_message(t('The update has been performed.'));
}
}