Project

General

Profile

Bug #20737 » 11505_re-implement_db_caching_ignore_spaces.diff

Administrator Admin, 2009-07-08 12:44

View differences:

t3lib/config_default.php (Arbeitskopie)
'reverseProxyPrefix' => '', // String: optional prefix to be added to the internal URL (SCRIPT_NAME and REQUEST_URI).
'reverseProxySSL' => '', // String: '*' or list of IP addresses of proxies that use SSL (https) for the connection to the client, but an unencrypted connection (http) to the server. If '*' all proxies defined in SYS[reverseProxyIP] use SSL.
'reverseProxyPrefixSSL' => '', // String: prefix to be added to the internal URL (SCRIPT_NAME and REQUEST_URI) when accessing the server via an SSL proxy. This setting overrides SYS[reverseProxyPrefix].
'caching' => array(
'defaultFrontend' => 't3lib_cache_frontend_VariableFrontend',
'defaultBackend' => 't3lib_cache_backend_FileBackend',
'cacheFrontends' => array(
't3lib_cache_frontend_VariableFrontend' => 't3lib/cache/frontend/class.t3lib_cache_frontend_variablefrontend.php:t3lib_cache_frontend_VariableFrontend',
't3lib_cache_frontend_StringFrontend' => 't3lib/cache/frontend/class.t3lib_cache_frontend_stringfrontend.php:t3lib_cache_frontend_StringFrontend'
'useCachingFramework' => 0, // Boolean: Enable this if you want to use the caching framework
),
'cacheBackends' => array(
't3lib_cache_backend_DbBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php:t3lib_cache_backend_DbBackend',
't3lib_cache_backend_FileBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_filebackend.php:t3lib_cache_backend_FileBackend',
't3lib_cache_backend_GlobalsBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_globalsbackend.php:t3lib_cache_backend_GlobalsBackend',
't3lib_cache_backend_MemcachedBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_memcachedbackend.php:t3lib_cache_backend_MemcachedBackend',
't3lib_cache_backend_ApcBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_apcbackend.php:t3lib_cache_backend_ApcBackend',
't3lib_cache_backend_NullBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_nullbackend.php:t3lib_cache_backend_NullBackend'
),
'cacheConfigurations' => array(
'cache_hash' => array(
'backend' => 't3lib_cache_backend_DbBackend',
'options' => array(
'cacheTable' => 'cache_hash'
)
),
'cache_pages' => array(
'backend' => 't3lib_cache_backend_DbBackend',
'options' => array(
'cacheTable' => 'cache_pages'
)
),
'cache_pagesection' => array(
'backend' => 't3lib_cache_backend_DbBackend',
'options' => array(
'cacheTable' => 'cache_pagesection'
)
)
/*
For memcached, use:
=============
'cache_pages' => array(
'backend' => 't3lib_cache_backend_MemcachedBackend',
'options' => array(
'servers' => array('localhost:11211', 'otherhost:11211', 'thirdhost:11211'), // port is mandatory!
)
),
=============
You need to have memcached installed as a daemon and also as a PHP extension!
*/
)
)
),
'EXT' => Array ( // Options related to the Extension Management
'noEdit' => 1, // Boolean: If set, the Extension Manager does NOT allow extension files to be edited! (Otherwise both local and global extensions can be edited.)
'allowGlobalInstall' => 0, // Boolean: If set, global extensions in typo3/ext/ are allowed to be installed, updated and deleted etc.
......
if (!@is_file(PATH_typo3conf.'localconf.php')) die('localconf.php is not found!');
require(PATH_typo3conf.'localconf.php');
$GLOBALS['USE_CACHING_FRAMEWORK'] = FALSE;
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['useCachingFramework']==1) {
$GLOBALS['USE_CACHING_FRAMEWORK'] = TRUE;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching'] = array(
'defaultFrontend' => 't3lib_cache_frontend_VariableFrontend',
'defaultBackend' => 't3lib_cache_backend_FileBackend',
'cacheFrontends' => array(
't3lib_cache_frontend_VariableFrontend' => 't3lib/cache/frontend/class.t3lib_cache_frontend_variablefrontend.php:t3lib_cache_frontend_VariableFrontend',
't3lib_cache_frontend_StringFrontend' => 't3lib/cache/frontend/class.t3lib_cache_frontend_stringfrontend.php:t3lib_cache_frontend_StringFrontend'
),
'cacheBackends' => array(
't3lib_cache_backend_DbBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php:t3lib_cache_backend_DbBackend',
't3lib_cache_backend_FileBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_filebackend.php:t3lib_cache_backend_FileBackend',
't3lib_cache_backend_GlobalsBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_globalsbackend.php:t3lib_cache_backend_GlobalsBackend',
't3lib_cache_backend_MemcachedBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_memcachedbackend.php:t3lib_cache_backend_MemcachedBackend',
't3lib_cache_backend_ApcBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_apcbackend.php:t3lib_cache_backend_ApcBackend',
't3lib_cache_backend_NullBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_nullbackend.php:t3lib_cache_backend_NullBackend'
),
'cacheConfigurations' => array(
'cache_hash' => array(
'backend' => 't3lib_cache_backend_DbBackend',
'options' => array(
'cacheTable' => 'cache_hash'
)
),
'cache_pages' => array(
'backend' => 't3lib_cache_backend_DbBackend',
'options' => array(
'cacheTable' => 'cache_pages'
)
),
'cache_pagesection' => array(
'backend' => 't3lib_cache_backend_DbBackend',
'options' => array(
'cacheTable' => 'cache_pagesection'
)
)
/*
For memcached, use:
=============
'cache_pages' => array(
'backend' => 't3lib_cache_backend_MemcachedBackend',
'options' => array(
'servers' => array('localhost:11211', 'otherhost:11211', 'thirdhost:11211'), // port is mandatory!
)
),
=============
You need to have memcached installed as a daemon and also as a PHP extension!
*/
)
);
}
// Defining the database setup as constants
define('TYPO3_db', $typo_db);
define('TYPO3_db_username', $typo_db_username);
t3lib/stddb/tables.sql (Arbeitskopie)
identifier varchar(250) DEFAULT '' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
content mediumtext,
ident varchar(20) DEFAULT '' NOT NULL,
tags mediumtext,
lifetime int(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
t3lib/class.t3lib_tstemplate.php (Arbeitskopie)
*/
function getCurrentPageData() {
$currentPageData = false;
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'content', 'cache_pagesection', 'page_id='.intval($GLOBALS['TSFE']->id).' AND mpvar_hash='.t3lib_div::md5int($GLOBALS['TSFE']->MP));
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$currentPageData = unserialize($row['content']);
}
} else {
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
/* @var $pageSectionCache t3lib_cache_AbstractCache */
......
if ($cacheEntry) {
$currentPageData = unserialize($cacheEntry);
}
}
return $currentPageData; // 2008-02-03 / Stucki: Notice that $this->currentPageData is not used anymore!
}
......
unset($cc['match']);
if (!$isCached && !$this->simulationHiddenOrTime && !$GLOBALS['TSFE']->no_cache) { // Only save the data if we're not simulating by hidden/starttime/endtime
$mpvarHash = t3lib_div::md5int($GLOBALS['TSFE']->MP);
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$dbFields = array(
'content' => serialize($cc),
'crdate' => $GLOBALS['EXEC_TIME']
);
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('cache_pagesection', 'page_id=' . intval($GLOBALS['TSFE']->id) . ' AND mpvar_hash=' . $mpvarHash, $dbFields);
if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 0) {
$dbFields['page_id'] = intval($GLOBALS['TSFE']->id);
$dbFields['mpvar_hash'] = $mpvarHash;
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pagesection', $dbFields);
}
} else {
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
/* @var $pageSectionCache t3lib_cache_AbstractCache */
$mpvarHash = t3lib_div::md5int($GLOBALS['TSFE']->MP);
$pageSectionCache->set(
intval($GLOBALS['TSFE']->id) . '_' . $mpvarHash,
serialize($cc),
......
);
}
}
// If everything OK.
if ($this->rootId && $this->rootLine && $this->setup) {
$this->loaded = 1;
t3lib/class.t3lib_befunc.php (Arbeitskopie)
* @return void
*/
public static function storeHash($hash, $data, $ident) {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$insertFields = array(
'identifier' => $hash,
'content' => $data,
'ident' => $ident,
'crdate' => $GLOBALS['EXEC_TIME']
);
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'identifier='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash'));
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_hash', $insertFields);
} else {
$GLOBALS['typo3CacheManager']->getCache('cache_hash')->set(
$hash,
$data,
......
0 // unlimited lifetime
);
}
}
/**
* Returns string value stored for the hash string in the cache "cache_hash"
......
* @param string The hash-string which was used to store the data value
* @return string
*/
public static function getHash($hash) {
public static function getHash($hash, $expTime = 0) {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$expTime = intval($expTime);
if ($expTime) {
$whereAdd = ' AND crdate > '.(time()-$expTime);
}
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'identifier='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash').$whereAdd);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
return (is_array($row) ? $row['content'] : null);
} else {
$hashContent = null;
$contentHashCache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
......
return $hashContent;
}
}
/*******************************************
*
* TypoScript related
t3lib/class.t3lib_page.php (Arbeitskopie)
* @return string The "content" field of the "cache_hash" cache entry.
* @see tslib_TStemplate::start(), storeHash()
*/
public static function getHash($hash) {
public static function getHash($hash, $expTime = 0) {
$hashContent = null;
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$expTime = intval($expTime);
if ($expTime) {
$whereAdd = ' AND crdate > '.($GLOBALS['ACCESS_TIME']-$expTime);
}
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'identifier='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash').$whereAdd);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
if ($row) {
$hashContent= $row['content'];
}
} else {
$contentHashCache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
$cacheEntry = $contentHashCache->get($hash);
......
$hashContent = $cacheEntry;
}
}
return $hashContent;
}
......
* @see tslib_TStemplate::start(), getHash()
*/
public static function storeHash($hash, $data, $ident, $lifetime = 0) {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$insertFields = array(
'identifier' => $hash,
'content' => $data,
'ident' => $ident,
'crdate' => $GLOBALS['EXEC_TIME']
);
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'identifier='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash'));
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_hash', $insertFields);
} else {
$GLOBALS['typo3CacheManager']->getCache('cache_hash')->set(
$hash,
$data,
......
);
}
}
/**
* Returns the "AND NOT deleted" clause for the tablename given IF $TCA configuration points to such a field.
*
t3lib/class.t3lib_div.php (Arbeitskopie)
$array = $firstLevelCache[$identifier];
} else {
// look up in second level cache
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$cacheContent = t3lib_pageSelect::getHash($identifier, 0);
$array = unserialize($cacheContent);
} else {
$array = $GLOBALS['typo3CacheManager']->getCache('cache_hash')->get($identifier);
}
if ($array === false) {
$array = self::xml2arrayProcess($string, $NSprefix, $reportDocTag);
// store content in second level cache
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
t3lib_pageSelect::storeHash($identifier, serialize($array), 'ident_xml2array');
} else {
$GLOBALS['typo3CacheManager']->getCache('cache_hash')->set($identifier, $array, array('ident_xml2array'), 0);
}
}
// store content in first level cache
$firstLevelCache[$identifier] = $array;
}
t3lib/class.t3lib_tsfebeuserauth.php (Arbeitskopie)
*/
public function initializeAdminPanel() {
$this->extAdminConfig = $this->getTSConfigProp('admPanel');
if (isset($this->extAdminConfig['enable.'])) {
foreach($this->extAdminConfig['enable.'] as $key => $value) {
if ($value) {
......
* @return integer The number of pages for this page in the table "cache_pages"
*/
public function extGetNumberOfCachedPages($pageId) {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'cache_pages', 'page_id='.intval($pageId));
list($num) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
return $num;
} else {
$pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
$pageCacheEntries = $pageCache->getByTag('pageId_' . (int) $pageId);
return count($pageCacheEntries);
}
}
t3lib/class.t3lib_userauthgroup.php (Arbeitskopie)
$this->userTS_text = implode(chr(10).'[GLOBAL]'.chr(10),$this->TSdataArray); // Imploding with "[global]" will make sure that non-ended confinements with braces are ignored.
$hash = md5('userTS:'.$this->userTS_text);
$cachedContent = t3lib_BEfunc::getHash($hash);
if (isset($cachedContent) && !$this->userTS_dontGetCached) {
$this->userTS = unserialize($cachedContent);
} else {
t3lib/class.t3lib_tcemain.php (Arbeitskopie)
// Delete cache for selected pages:
if (is_array($list_cache)) {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages','page_id IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)).')');
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pagesection', 'page_id IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)).')');
} else {
$pageCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pages'
);
......
}
}
}
}
// Clear cache for pages entered in TSconfig:
if ($TSConfig['clearCacheCmd']) {
......
case 'all':
if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.all')) {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
if (t3lib_extMgm::isLoaded('cms')) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_treelist', '');
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pagesection','');
}
$this->internal_clearPageCache();
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash','');
} else {
// clear all caches that use the t3lib_cache framework
$GLOBALS['typo3CacheManager']->flushCaches();
if (t3lib_extMgm::isLoaded('cms')) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_treelist', '');
}
}
// Clearing additional cache tables:
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables'])) {
......
// Delete cache for selected pages:
if (is_array($list_cache)) {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages','page_id IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)).')');
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pagesection', 'page_id IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)).')'); // Originally, cache_pagesection was not cleared with cache_pages!
} else {
$pageCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pages'
);
......
}
}
}
}
// Call post processing function for clear-cache:
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'])) {
......
* @return void
*/
function internal_clearPageCache() {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
if (t3lib_extMgm::isLoaded('cms')) {
if ($GLOBALS['TYPO3_CONF_VARS']['FE']['pageCacheToExternalFiles']) {
$cacheDir = PATH_site.'typo3temp/cache_pages';
$retVal = t3lib_div::rmdir($cacheDir,true);
if (!$retVal) {
t3lib_div::sysLog('Could not remove page cache files in "'.$cacheDir.'"','Core/t3lib_tcemain',2);
}
}
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages','');
}
} else {
if (t3lib_extMgm::isLoaded('cms')) {
$GLOBALS['typo3CacheManager']->getCache('cache_pages')->flush();
}
}
}
/**
* Finds page UIDs for the element from table <code>$table</code> with UIDs from <code>$idList</code>
typo3/init.php (Arbeitskopie)
// Initializing the Caching System
// ***********************************
if ($GLOBALS['USE_CACHING_FRAMEWORK']) {
$typo3CacheManager = t3lib_div::makeInstance('t3lib_cache_Manager');
$typo3CacheFactory = t3lib_div::makeInstance('t3lib_cache_Factory');
$typo3CacheFactory->setCacheManager($typo3CacheManager);
......
t3lib_cache::initPageSectionCache();
t3lib_cache::initContentHashCache();
unset($cacheFactoryClass);
}
// *************************
// CLI dispatch processing
// *************************
typo3/sysext/cms/ext_tables.sql (Arbeitskopie)
id int(11) unsigned NOT NULL auto_increment,
identifier varchar(250) DEFAULT '' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
page_id int(11) unsigned DEFAULT '0' NOT NULL,
reg1 int(11) unsigned DEFAULT '0' NOT NULL,
content mediumtext,
tags mediumtext,
lifetime int(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
KEY cache_id (identifier)
temp_content int(1) DEFAULT '0' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
expires int(10) unsigned DEFAULT '0' NOT NULL,
cache_data mediumblob,
KEY page_id (page_id),
KEY sel (identifier,page_id),
PRIMARY KEY (id)
) ENGINE=InnoDB;
......
content mediumtext,
tags mediumtext,
lifetime int(11) unsigned DEFAULT '0' NOT NULL,
page_id int(11) unsigned DEFAULT '0' NOT NULL,
mpvar_hash int(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
KEY cache_id (identifier)
KEY cache_id (identifier),
KEY sel (page_id,mpvar_hash)
) ENGINE=InnoDB;
typo3/sysext/cms/tslib/class.tslib_fe.php (Arbeitskopie)
}
}
if ($GLOBALS['USE_CACHING_FRAMEWORK']) {
$this->initCaches();
}
}
/**
* Connect to MySQL database
......
$this->releasePageGenerationLock($this->pages_lockObj);
$this->config = (array)unserialize($row['cache_data']); // Fetches the lowlevel config stored with the cached data
$this->content = $row['HTML']; // Getting the content
$this->content = $row['content']; // Getting the content
$this->tempContent = $row['temp_content']; // Flag for temp content
$this->cacheContentFlag = 1; // Setting flag, so we know, that some cached content has been loaded
$this->cacheExpires = $row['expires'];
......
* @return array Cached row, if any. Otherwise void.
*/
function getFromCache_queryRow() {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$GLOBALS['TT']->push('Cache Query', '');
$cachedPage = $this->pageCache->get($this->newHash);
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'S.*',
'cache_pages S,pages P',
'S.identifier='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->newHash, 'cache_pages').'
AND S.page_id=P.uid
AND S.expires > '.intval($GLOBALS['ACCESS_TIME']).'
AND P.deleted=0
AND P.hidden=0
AND P.starttime<='.intval($GLOBALS['ACCESS_TIME']).'
AND (P.endtime=0 OR P.endtime>'.intval($GLOBALS['ACCESS_TIME']).')'
);
$GLOBALS['TT']->pull();
return $cachedPage;
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$this->pageCachePostProcess($row,'get');
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
} else {
$GLOBALS['TT']->push('Cache Query', '');
$row = $this->pageCache->get($this->newHash);
$GLOBALS['TT']->pull();
}
return $row;
}
/**
* Detecting if shift-reload has been clicked
......
* @see realPageCacheContent(), tempPageCacheContent()
*/
function setPageCacheContent($content, $data, $expirationTstamp) {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$this->clearPageCacheContent();
$insertFields = array(
'identifier' => $this->newHash,
'page_id' => $this->id,
'content' => $content,
'temp_content' => $this->tempContent,
'cache_data' => serialize($data),
'expires' => $expirationTstamp,
'tstamp' => $GLOBALS['EXEC_TIME']
);
$this->cacheExpires = $expirationTstamp;
if ($this->page_cache_reg1) {
$insertFields['reg1'] = intval($this->page_cache_reg1);
}
$this->pageCachePostProcess($insertFields,'set');
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pages', $insertFields);
} else {
$cacheData = array(
'hash' => $this->newHash,
'identifier' => $this->newHash,
'page_id' => $this->id,
'HTML' => $content,
'content' => $content,
'temp_content' => $this->tempContent,
'cache_data' => serialize($data),
'expires' => $expirationTstamp,
......
}
$this->pageCache->set(
$cacheData['hash'],
$this->newHash,
$cacheData,
$this->pageCacheTags,
$cacheData['expires'] - $GLOBALS['EXEC_TIME']
$expirationTstamp - $GLOBALS['EXEC_TIME']
);
}
}
/**
* Clears cache content (for $this->newHash)
......
* @return void
*/
function clearPageCacheContent() {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'identifier='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->newHash, 'cache_pages'));
} else {
$this->pageCache->remove($this->newHash);
}
}
/**
* Post processing page cache rows for both get and set.
*
* @param array Input "cache_pages" row, passed by reference!
* @param string Type of operation, either "get" or "set"
* @return void
*/
function pageCachePostProcess(&$row,$type) {
if ($this->TYPO3_CONF_VARS['FE']['pageCacheToExternalFiles']) {
$cacheFileName = PATH_site.'typo3temp/cache_pages/'.$row['hash']{0}.$row['hash']{1}.'/'.$row['hash'].'.html';
switch((string)$type) {
case 'get':
$row['content'] = @is_file($cacheFileName) ? t3lib_div::getUrl($cacheFileName) : '<!-- CACHING ERROR, sorry -->';
break;
case 'set':
t3lib_div::writeFileToTypo3tempDir($cacheFileName,$row['content']);
$row['content'] = '';
break;
}
}
}
/**
* Clears cache content for a list of page ids
*
* @param string A list of INTEGER numbers which points to page uids for which to clear entries in the cache_pages cache (page content cache)
* @return void
*/
function clearPageCacheContent_pidList($pidList) {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($pidList).')');
} else {
$pageIds = t3lib_div::trimExplode(',', $pidList);
foreach ($pageIds as $pageId) {
$this->pageCache->flushByTag('pageId_' . (int) $pageId);
}
}
}
/**
* Sets sys last changed
typo3/sysext/cms/tslib/class.tslib_content.php (Arbeitskopie)
$this->substMarkerCache[$storeKey] = $storeArr;
// Storing the cached data:
$GLOBALS['TSFE']->sys_page->storeHash($storeKey, serialize($storeArr), 'substMarkArrayCached');
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
$storeArrDat = serialize($storeArr);
}
$GLOBALS['TSFE']->sys_page->storeHash($storeKey, $storeArrDat, 'substMarkArrayCached');
$GLOBALS['TT']->setTSlogMessage('Parsing',0);
} else {
if (!$GLOBALS['USE_CACHING_FRAMEWORK']) {
// Unserializing
$storeArr = unserialize($storeArrDat);
} else {
$storeArr = $storeArrDat;
}
// Setting cache:
$this->substMarkerCache[$storeKey] = $storeArr;
$GLOBALS['TT']->setTSlogMessage('Cached from DB',0);
}
}
// Substitution/Merging:
// Merging content types together, resetting
$valueArr = array_merge($markContentArray,$subpartContentArray,$wrappedSubpartContentArray);
(2-2/4)