[icinga-checkins] icinga.org: icinga-web/master: * Fixed principal caching error that prevented some principals to work

git at icinga.org git at icinga.org
Mon Aug 29 09:11:59 CEST 2011


Module: icinga-web
Branch: master
Commit: f7b70e7f32bb7796357649ef1c2f9772cfde4d2e
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=f7b70e7f32bb7796357649ef1c2f9772cfde4d2e

Author: Jannis Moßhammer <jannis.mosshammer at netways.de>
Date:   Fri Aug 26 19:02:28 2011 +0200

* Fixed principal caching error that prevented some principals to work
* correctly

---

 app/modules/AppKit/lib/database/models/NsmRole.php |   22 +------------------
 app/modules/AppKit/lib/database/models/NsmUser.php |   21 +-----------------
 2 files changed, 4 insertions(+), 39 deletions(-)

diff --git a/app/modules/AppKit/lib/database/models/NsmRole.php b/app/modules/AppKit/lib/database/models/NsmRole.php
index 9b146e1..dad0264 100644
--- a/app/modules/AppKit/lib/database/models/NsmRole.php
+++ b/app/modules/AppKit/lib/database/models/NsmRole.php
@@ -189,21 +189,10 @@ class NsmRole extends BaseNsmRole {
      * @return Doctrine_Collection
      */
     public function getTargetValues($target_name) {
-        if($this->getStorage()->read("target_".$target_name."_role")) {
-            $targets = unserialize($this->getStorage()->read("target_".$target_name."_role"));
-            if($targets)
-                return $targets;
-        }
-        $this->getStorage()->write("target_".$target_name."_role",serialize($result));
         return $this->getTargetValuesQuery($target_name)->execute();
     }
 
     public function getTargetValue($target_name, $value_name) {
-        if($this->getStorage()->read("target_".$target_name."_".$value_name."_role")) {
-            $targets = unserialize($this->getStorage()->read("target_".$target_name."_".$value_name."_role"));
-            if($targets)
-                return $targets;
-        }
         $q = $this->getTargetValuesQuery($target_name);
         $q->select('tv.tv_val');
         $q->andWhere('tv.tv_key=?', array($value_name));
@@ -214,18 +203,11 @@ class NsmRole extends BaseNsmRole {
             $out[] = $r->tv_val;
         }
         
-        $this->getStorage()->write("target_".$target_name."_".$value_name."_role",serialize($out));
+
         return $out;
     }
 
     public function getTargetValuesArray() {
-        if($this->getStorage()->read("targetValuesArray_role")) {
-            $targets = unserialize($this->getStorage()->read("targetValuesArray_role"));
-            if($targets)
-                return $targets;
-        }
-
-
         $tc = Doctrine_Query::create()
               ->select('t.target_name, t.target_id')
               ->from('NsmTarget t')
@@ -255,7 +237,7 @@ class NsmRole extends BaseNsmRole {
             }
         }
         
-        $this->getStorage()->write("targetValuesArray_role",serialize($out));
+
         return $out;
     }
 }
diff --git a/app/modules/AppKit/lib/database/models/NsmUser.php b/app/modules/AppKit/lib/database/models/NsmUser.php
index bd40d4c..3b9c3da 100644
--- a/app/modules/AppKit/lib/database/models/NsmUser.php
+++ b/app/modules/AppKit/lib/database/models/NsmUser.php
@@ -434,23 +434,12 @@ class NsmUser extends BaseNsmUser {
      * @return Doctrine_Collection
      */
     public function getTargetValues($target_name) {
-        if($this->getStorage()->read("target_".$target_name."_user")) {
-            $targets = unserialize($this->getStorage()->read("target_".$target_name."_user"));
-            if($targets)
-                return $targets;
-        }
         $result =  $this->getTargetValuesQuery($target_name)->execute(); 
-        $this->getStorage()->write("target_".$target_name."_user",serialize($result));
         
         return $result;
     }
 
     public function getTargetValue($target_name, $value_name) {
-        if($this->getStorage()->read("target_".$target_name."_".$value_name."_user")) {
-            $targets = unserialize($this->getStorage()->read("target_".$target_name."_".$value_name."_user"));
-            if($targets)
-                return $targets;
-        }
         $q = $this->getTargetValuesQuery($target_name);
         $q->select('tv.tv_val');
         $q->andWhere('tv.tv_key=?', array($value_name));
@@ -460,17 +449,11 @@ class NsmUser extends BaseNsmUser {
         foreach($res as $r) {
             $out[] = $r->tv_val;
         }
-        $this->getStorage()->write("target_".$target_name."_".$value_name."_user",serialize($out));
+
         return $targets;
     }
 
     public function getTargetValuesArray() {
-        if($this->getStorage()->read("targetValuesArray_user")) {
-            $targets = unserialize($this->getStorage()->read("targetValuesArray_user"));
-            if($targets)
-                return $targets;
-        }
-
         $tc = Doctrine_Query::create()
               ->select('t.target_name, t.target_id')
               ->from('NsmTarget t')
@@ -500,7 +483,7 @@ class NsmUser extends BaseNsmUser {
             }
         }
     
-        $this->getStorage()->write("targetValuesArray_user",serialize($out));
+
         return $out;
     }
 }





More information about the icinga-checkins mailing list