summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Miles2010-08-13 23:13:14 (GMT)
committer Earl Miles2010-08-13 23:13:14 (GMT)
commit9f1018b706d410fa2f14dd4ee8e92e5f68dc157a (patch)
treef71492e851cf924c993aebb36f463996ee697fa9
parent7dff50c29907036040baf5bfb843c20e89fb94e6 (diff)
#402944 by drewish: Cache views block list to reduce overhead when listing blocks.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--views.module9
2 files changed, 10 insertions, 0 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 3b391d9..6ac79ba 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -327,6 +327,7 @@ Views 3.x-7.x-dev
o #743682 by nicedawg: Prevent exposed filter in a block from showing up twice on validation error.
o #768972 by dereine, cyberwolf and nicedawg: Add an option to disable an error message if terms do not exist on taxonomy term filter.
o #812608 by drunken monkey: Views outputs unquoted version in exports.
+ o #402944 by drewish: Cache views block list to reduce overhead when listing blocks.
Views 6.x-3.x-dev
o #396380 by merlinofchaos, dereine and dagmar: Initial support for GROUP BY queries!!!!!!!!!!!!
diff --git a/views.module b/views.module
index 75143c8..fdfb38a 100644
--- a/views.module
+++ b/views.module
@@ -318,6 +318,13 @@ function views_page() {
* Implement hook_block_info().
*/
function views_block_info() {
+ // Try to avoid instantiating all the views just to get the blocks info.
+ views_include('cache');
+ $cache = views_cache_get('views_block_items', TRUE);
+ if ($cache && is_array($cache->data)) {
+ return $cache->data;
+ }
+
$items = array();
$views = views_get_all_views();
foreach ($views as $view) {
@@ -372,6 +379,8 @@ function views_block_info() {
$view->destroy();
}
+ views_cache_set('views_block_items', $items, TRUE);
+
return $items;
}