summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-29 20:12:51 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-29 20:12:51 +0000
commita4627fe187cdf5c5a04365927122ab7e0ea0b9e8 (patch)
tree50e232692857b0d6c9c1f7b06efbeb3ce1641956
parentab3ab562997af96cfa4eda00e6fb4a0e18ef2494 (diff)
downloadbrdo-a4627fe187cdf5c5a04365927122ab7e0ea0b9e8.tar.gz
brdo-a4627fe187cdf5c5a04365927122ab7e0ea0b9e8.tar.bz2
Rolling back #852470. Needs more discussion.
-rw-r--r--modules/filter/filter.module40
1 files changed, 12 insertions, 28 deletions
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 26e1fb86f..f31a5d32c 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -368,25 +368,17 @@ function filter_modules_disabled($modules) {
* @see filter_formats_reset()
*/
function filter_formats($account = NULL) {
- global $language;
$formats = &drupal_static(__FUNCTION__, array());
- // All available formats are cached for performance.
+ // Statically cache all existing formats upfront.
if (!isset($formats['all'])) {
- if ($cache = cache_get("filter_formats:{$language->language}")) {
- $formats['all'] = $cache->data;
- }
- else {
- $formats['all'] = db_select('filter_format', 'ff')
- ->addTag('translatable')
- ->fields('ff')
- ->condition('status', 1)
- ->orderBy('weight')
- ->execute()
- ->fetchAllAssoc('format');
-
- cache_set("filter_formats:{$language->language}", $formats['all']);
- }
+ $formats['all'] = db_select('filter_format', 'ff')
+ ->addTag('translatable')
+ ->fields('ff')
+ ->condition('status', 1)
+ ->orderBy('weight')
+ ->execute()
+ ->fetchAllAssoc('format');
}
// Build a list of user-specific formats.
@@ -403,13 +395,11 @@ function filter_formats($account = NULL) {
}
/**
- * Resets text format caches.
+ * Resets the static cache of all text formats.
*
* @see filter_formats()
*/
function filter_formats_reset() {
- cache_clear_all('filter_formats', 'cache', TRUE);
- cache_clear_all('filter_list_format', 'cache', TRUE);
drupal_static_reset('filter_list_format');
drupal_static_reset('filter_formats');
}
@@ -635,15 +625,9 @@ function filter_list_format($format_id) {
$filter_info = filter_get_filters();
if (!isset($filters['all'])) {
- if ($cache = cache_get('filter_list_format')) {
- $filters['all'] = $cache->data;
- }
- else {
- $result = db_query('SELECT * FROM {filter} ORDER BY weight, module, name');
- foreach ($result as $record) {
- $filters['all'][$record->format][$record->name] = $record;
- }
- cache_set('filter_list_format', $filters['all']);
+ $result = db_query('SELECT * FROM {filter} ORDER BY weight, module, name');
+ foreach ($result as $record) {
+ $filters['all'][$record->format][$record->name] = $record;
}
}