From 4504c603ae33d49ae4fd812b25f306d173549378 Mon Sep 17 00:00:00 2001
From: Sjoerd Arendsen <sjoerd@optixdesigns.com>
Date: Wed, 31 Aug 2011 10:03:14 +0200
Subject: [PATCH] #1229198 Fixed empty cache result on install

---
 config_perms.module | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/config_perms.module b/config_perms.module
index b9b98f9..a7a7603 100755
--- a/config_perms.module
+++ b/config_perms.module
@@ -20,11 +20,10 @@ function config_perms_perms($machine_name = NULL, $rebuild = FALSE) {
 
   // Rebuild if not there
   if (!$perms || $rebuild) {
-    config_perms_cache_rebuild();
-    $perms = cache_get('config_perms');
+    $perms = config_perms_cache_rebuild();
   }
 
-  return ($machine_name) ? $perms->data[$machine_name] : $perms->data;
+  return ($machine_name) ? $perms[$machine_name] : $perms;
 }
 
 /**
@@ -33,6 +32,8 @@ function config_perms_perms($machine_name = NULL, $rebuild = FALSE) {
 function config_perms_cache_rebuild() {
   $perms = config_perms_loadperms();
   cache_set('config_perms', $perms);
+  
+  return $perms;
 }
 
 /*******************************************************************************
@@ -101,18 +102,7 @@ function config_perms_menu() {
 /**
  * Implements hook_menu_alter().
  */
-function config_perms_menu_alter(&$items) {
-  /*
-  foreach (config_perms_perms() as $perm) {
-    foreach ($perm->path as $path) {
-      if (isset($items[$path]) && $perm->status) {
-        $items[$path]['access callback'] = 'config_perms_access_callback';
-        $items[$path]['access arguments'] = array($perm);
-      }
-    }
-  }
-  */
-  
+function config_perms_menu_alter(&$items) {  
   // Run through all menu items and leter them accordingly
   foreach($items as $key => $item) {
     foreach (config_perms_perms() as $perm) {
-- 
1.8.2.1

