LSsearch: remove buggy _hash cache parameter and replace it by an hash accessible key

This commit is contained in:
Benjamin Renard 2020-08-24 16:54:43 +02:00
parent 7c8fb87c99
commit 11c2e3c9d4

View file

@ -70,9 +70,6 @@ class LSsearch extends LSlog_staticLoggerClass {
// The cache of search parameters // The cache of search parameters
private $_searchParams = NULL; private $_searchParams = NULL;
// The cache of the hash of the search parameters
private $_hash = NULL;
// The result of the search // The result of the search
private $result=NULL; private $result=NULL;
@ -744,9 +741,6 @@ class LSsearch extends LSlog_staticLoggerClass {
* @retval void * @retval void
**/ **/
private function generateSearchParams() { private function generateSearchParams() {
// Purge the cache of the hash
$this -> _hash = NULL;
// Base // Base
$retval = array( $retval = array(
'filter' => $this -> params['filter'], 'filter' => $this -> params['filter'],
@ -984,10 +978,9 @@ class LSsearch extends LSlog_staticLoggerClass {
public function getHash($searchParams=null) { public function getHash($searchParams=null) {
if(is_null($searchParams)) { if(is_null($searchParams)) {
$searchParams=$this -> _searchParams; $searchParams=$this -> _searchParams;
if ($this -> _hash) {
return $this -> _hash;
}
} }
if (!$searchParams)
return false;
if ($searchParams['filter'] instanceof Net_LDAP_Filter) { if ($searchParams['filter'] instanceof Net_LDAP_Filter) {
$searchParams['filter']=$searchParams['filter']->asString(); $searchParams['filter']=$searchParams['filter']->asString();
} }
@ -1195,6 +1188,9 @@ class LSsearch extends LSlog_staticLoggerClass {
return $ret; return $ret;
} }
} }
elseif ($key == 'hash') {
return $this -> getHash();
}
else { else {
throw new Exception('Incorrect property !'); throw new Exception('Incorrect property !');
} }