From 262db3cf1179a8efec68730ad1e7545fe13aeaf1 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Wed, 5 Jan 2011 16:57:38 +0100 Subject: [PATCH] Don't use query cache, query building is not that expensive. If really necessary this should be implemented as an instance cache, not a static cache. Fixes failing pgsql unit test. --- framework/Share/lib/Horde/Share/Sql/Hierarchical.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/framework/Share/lib/Horde/Share/Sql/Hierarchical.php b/framework/Share/lib/Horde/Share/Sql/Hierarchical.php index 849f0db1e..9ba3678c4 100644 --- a/framework/Share/lib/Horde/Share/Sql/Hierarchical.php +++ b/framework/Share/lib/Horde/Share/Sql/Hierarchical.php @@ -166,17 +166,11 @@ class Horde_Share_Sql_Hierarchical extends Horde_Share_Sql $attributes = null, $parent = null, $allLevels = true) { - static $criteria = array(); - if (is_object($parent)) { $parent_id = $parent->getId(); } else { $parent_id = $parent; } - $key = hash('sha1', serialize(array($userid, $perm, $parent_id, $allLevels, $attributes))); - if (isset($criteria[$key])) { - return $criteria[$key]; - } $query = ' FROM ' . $this->_table . ' s '; $where = ''; @@ -264,17 +258,15 @@ class Horde_Share_Sql_Hierarchical extends Horde_Share_Sql $where_parent = "(s.share_parents = '' OR s.share_parents IS NULL)"; } - if (empty($where_parent)) { - $criteria[$key] = $query . (!empty($where) ? ' WHERE ' . $where : ''); - } else { - if (!empty($where)) { - $criteria[$key] = $query . ' WHERE (' . $where . ') AND ' . $where_parent; + if (!empty($where_parent)) { + if (empty($where)) { + $where = $where_parent; } else { - $criteria[$key] = $query . ' WHERE ' . $where_parent; + $where = '(' . $where . ') AND ' . $where_parent; } } - return $criteria[$key]; + return $query . ' WHERE ' . $where; } /** -- 2.11.0