From: Oliver Hader Date: Wed, 1 Oct 2008 17:56:24 +0000 (+0000) Subject: Fixed bug #9408: Selecting by tag using wildcards does not work with database disposa... X-Git-Tag: TYPO3_4-3-0alpha1~139 X-Git-Url: https://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/7ec24f2eb5c743730c23034f2ef6fbec873c2555 Fixed bug #9408: Selecting by tag using wildcards does not work with database disposal of t3lib_cache git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4267 709f56b5-9817-0410-a4d7-c38de5d9e867 --- diff --git a/ChangeLog b/ChangeLog index 7a89d19..17f9b15 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2008-10-01 Oliver Hader * Fixed bug #9442: SQL LIKE wildcards are not escaped correctly for list queries + * Fixed bug #9408: Selecting by tag using wildcards does not work with database disposal of t3lib_cache 2008-10-01 Ernesto Baschny diff --git a/t3lib/cache/backend/class.t3lib_cache_backend_db.php b/t3lib/cache/backend/class.t3lib_cache_backend_db.php index 9d0a5f6..155f80c 100644 --- a/t3lib/cache/backend/class.t3lib_cache_backend_db.php +++ b/t3lib/cache/backend/class.t3lib_cache_backend_db.php @@ -150,7 +150,7 @@ class t3lib_cache_backend_Db extends t3lib_cache_AbstractBackend { $cacheEntryRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 'identifier', $this->cacheTable, - $GLOBALS['TYPO3_DB']->listQuery('tags', $tag, $this->cacheTable) + $this->getListQueryForTag($tag); ); foreach ($cacheEntryRows as $cacheEntryRow) { @@ -174,7 +174,7 @@ class t3lib_cache_backend_Db extends t3lib_cache_AbstractBackend { $whereClause = array(); foreach ($tags as $tag) { - $whereClause[] = $GLOBALS['TYPO3_DB']->listQuery('tags', $tag, $this->cacheTable); + $whereClause[] = $this->getListQueryForTag($tag); } $cacheEntryRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( @@ -216,6 +216,18 @@ class t3lib_cache_backend_Db extends t3lib_cache_AbstractBackend { protected function setCacheTable($cacheTable) { $this->cacheTable = $cacheTable; } + + /** + * Gets the query to be used for selecting entries by a tag. The asterisk ("*") + * is allowed as a wildcard at the beginning and the end of a tag. + * + * @param string The tag to search for, the "*" wildcard is supported + * @return string the query to be used for selecting entries + * @author Oliver Hader + */ + protected function getListQueryForTag($tag) { + return str_replace('*', '%', $GLOBALS['TYPO3_DB']->listQuery('tags', $tag, $this->cacheTable)); + } }