From 3d9b1d9fe1aa89d49e159c439a8d0d8a07c94faa Mon Sep 17 00:00:00 2001
Date: Tue, 21 Jun 2011 14:31:40 +0200
Subject: [PATCH] Patch advanced_help: store $cache array in cache table to improve performance.
---
 advanced_help/advanced_help.module |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/advanced_help/advanced_help.module b/advanced_help/advanced_help.module
index 1d343f9..d245c6e 100644
--- a/advanced_help/advanced_help.module
+++ b/advanced_help/advanced_help.module
@@ -655,6 +655,17 @@ function advanced_help_get_settings() {
 function _advanced_help_parse_ini() {
   static $cache = NULL;

+  // NEW: Try to find $cache array in cache table.
+  if (!isset($cache)) {
+    $cache = cache_get('advanced_help_parse_ini');
+    if (!empty($cache->data)) {
+      $cache = $cache->data;
+    }
+    else {
+      unset($cache);
+    }
+  }
+  // END NEW: Go on with old (expensive) file detection if no cached value could be found.
   if (!isset($cache)) {
     $cache = array('topics' => array(), 'settings' => array());

@@ -722,6 +733,8 @@ function _advanced_help_parse_ini() {
       }
     }
     drupal_alter('advanced_help_topic_info', $cache);
+    // NEW: Store $cache array in cache table.
+    cache_set('advanced_help_parse_ini', $cache);
   }
   return $cache;
 }
--
1.6.5.1.1367.gcd48
