/** * @note Before 2.5, toArray was used to generate the content, as of 2.5 * only parameters that influence the result of an query is included. * * @since 2.1 * * @return string */ public function getHash() { // FIXME 3.0 Leave the hash unchanged to avoid unnecessary BC issues in // case the cache is not used. if ($GLOBALS['smwgQueryResultCacheType'] === false || $GLOBALS['smwgQueryResultCacheType'] === CACHE_NONE || $GLOBALS['smwgQueryResultCacheType'] === 'hash') { return HashBuilder::createFromArray($this->toArray()); } // For an optimal (less fragmentation) use of the cache, only use // elements that directly influence the result list $serialized = array(); $serialized['conditions'] = $this->getQueryString(); $serialized['parameters'] = array('limit' => $this->limit, 'offset' => $this->offset, 'sortkeys' => $this->sortkeys, 'querymode' => $this->querymode); if ($this->querySource !== null && $this->querySource !== '') { $serialized['parameters']['source'] = $this->querySource; } // printouts are avoided as part of the hash as they not influence the // match process and are only resolved after the query result has been // retrieved return HashBuilder::createFromArray($serialized); }