Project

General

Profile

Bug #21979 » 13273_01.diff

Administrator Admin, 2010-01-17 19:45

View differences:

t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php (working copy)
* @return void
*/
public function flushByTag($tag) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->cacheTable,
'identifier IN (' .
$GLOBALS['TYPO3_DB']->SELECTsubquery(
'identifier',
$this->tagsTable,
$this->getQueryForTag($tag)
) .
')'
);
$tagsTableWhereClause = $this->getQueryForTag($tag);
$this->deleteCacheTableRowsByTagsTableWhereClause($tagsTableWhereClause);
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->tagsTable,
$this->getQueryForTag($tag)
$this->getQueryForTag($tagsTableWhereClause)
);
}
......
$listQueryConditions[$tag] = $this->getQueryForTag($tag);
}
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->cacheTable,
'identifier IN (' .
$GLOBALS['TYPO3_DB']->SELECTsubquery(
'identifier',
$this->tagsTable,
implode(' OR ', $listQueryConditions)
) .
')'
);
$tagsTableWhereClause = implode(' OR ', $listQueryConditions);
$this->deleteCacheTableRowsByTagsTableWhereClause($tagsTableWhereClause);
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->tagsTable,
implode(' OR ', $listQueryConditions)
$tagsTableWhereClause
);
}
}
......
* @author Ingo Renner <ingo@typo3.org>
*/
public function collectGarbage() {
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->tagsTable,
'identifier IN (' .
$GLOBALS['TYPO3_DB']->SELECTsubquery(
'identifier',
$this->cacheTable,
'crdate + lifetime < ' . $GLOBALS['EXEC_TIME'] . ' AND lifetime > 0'
) .
')'
$tagsEntryIdentifierRowsRessource = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'identifier',
$this->cacheTable,
'crdate + lifetime < ' . $GLOBALS['EXEC_TIME'] . ' AND lifetime > 0'
);
$tagsEntryIdentifiers = array();
while ($tagsEntryIdentifierRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($tagsEntryIdentifierRowsRessource)) {
$tagsEntryIdentifiers[] = $tagsEntryIdentifierRow['identifier'];
}
$GLOBALS['TYPO3_DB']->sql_free_result($cacheEntryIdentifierRowsRessource);
if (count($tagsEntryIdentifiers)) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->tagsTable,
'identifier IN (\'' .implode('\', \'', $tagsEntryIdentifiers) . '\')'
);
}
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->cacheTable,
'crdate + lifetime < ' . $GLOBALS['EXEC_TIME'] . ' AND lifetime > 0'
......
return $query;
}
/**
* Deletes rows in cache table found by where clause on tags table
*
* @param string The where clause for the tags table
* @return void
*/
protected function deleteCacheTableRowsByTagsTableWhereClause($tagsTableWhereClause) {
$cacheEntryIdentifierRowsRessource = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'DISTINCT identifier',
$this->tagsTable,
$tagsTableWhereClause
);
$cacheEntryIdentifiers = array();
while ($cacheEntryIdentifierRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($cacheEntryIdentifierRowsRessource)) {
$cacheEntryIdentifiers[] = $cacheEntryIdentifierRow['identifier'];
}
$GLOBALS['TYPO3_DB']->sql_free_result($cacheEntryIdentifierRowsRessource);
if (count($cacheEntryIdentifiers)) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->cacheTable,
'identifier IN (\'' .implode('\', \'', $cacheEntryIdentifiers) . '\')'
);
}
}
}
(1-1/3)