Project

General

Profile

Bug #25106 » 17673.diff

Administrator Admin, 2011-02-19 17:47

View differences:

t3lib/config_default.php (working copy)
)
)
),
'useCachingFramework' => FALSE, // Boolean: Enable this if you want to use the caching framework by default for the core caches cache_pages, cache_pagesection and cache_hash.
'displayErrors' => -1, // <p>Integer (-1, 0, 1, 2). Configures whether PHP errors should be displayed.</p><dl><dt>0</dt><dd>Do not display any PHP error messages. Overrides the value of "exceptionalErrors" and sets it to 0 (= no errors are turned into exceptions), the configured "productionExceptionHandler" is used as exception handler</dd><dt>1</dt><dd>Display error messages with the registered errorhandler. The configured "debugExceptionHandler" is used as exception handler</dd><dt>2</dt><dd>Display errors only if client matches <a href="#SYS-devIPmask">[SYS][devIPmask]</a>. If devIPmask matches the users IP address the configured "debugExceptionHandler" is used for exceptions, if not "productionExceptionHandler" will be used</dd><dt>-1</dt><dd>Default setting. With this option, you can override the PHP setting "display_errors". If devIPmask matches the users IP address the configured "debugExceptionHandler" is used for exceptions, if not "productionExceptionHandler" will be used.</dd></dl>
'productionExceptionHandler' => 't3lib_error_ProductionExceptionHandler', // String: Classname to handle exceptions that might happen in the TYPO3-code. Leave empty to disable exception handling. Default: "t3lib_error_ProductionExceptionHandler". This exception handler displays a nice error message when something went wrong. The error message is logged to the configured logs. Note: The configured "productionExceptionHandler" is used if displayErrors is set to "0" or to "-1" and devIPmask doesn't match the users IP.
'debugExceptionHandler' => 't3lib_error_DebugExceptionHandler', // String: Classname to handle exceptions that might happen in the TYPO3-code. Leave empty to disable exception handling. Default: "t3lib_error_DebugExceptionHandler". This exception handler displays the complete stack trace of any encountered exception. The error message and the stack trace is logged to the configured logs. Note: The configured "debugExceptionHandler" is used if displayErrors is set to "1" and if displayErrors is "-1" or "2" and the devIPmask matches the users IP.
......
require_once(t3lib_extMgm::extPath('lang') . 'lang.php');
// Define disposal of caching framewor for core caches:
define('TYPO3_UseCachingFramework', (bool)$GLOBALS['TYPO3_CONF_VARS']['SYS']['useCachingFramework']);
// Define disposal of caching framework for core caches:
// @deprecated, constant can be removed in 4.8
define('TYPO3_UseCachingFramework', TRUE);
if (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['useCachingFramework'])) {
// Deprecation log since 4.6, can be removed in 4.8
t3lib_div::deprecationLog('Setting $GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'useCachingFramework\'] is deprecated since TYPO3 4.6 and should be removed.');
}
if (isset($GLOBALS['TYPO3_CONF_VARS']['FE']['pageCacheToExternalFiles'])) {
// Deprecation log since 4.6, can be removed in 4.8
t3lib_div::deprecationLog('Setting $GLOBALS[\'TYPO3_CONF_VARS\'][\'FE\'][\'pageCacheToExternalFiles\'] is deprecated since TYPO3 4.6 and should be removed.');
}
// Define "TYPO3_DLOG" constant
define('TYPO3_DLOG', $GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']);
t3lib/stddb/tables.sql (working copy)
KEY username (username)
);
#
# Table structure for table 'cache_hash'
#
CREATE TABLE cache_hash (
id int(11) unsigned NOT NULL auto_increment,
hash varchar(32) DEFAULT '' NOT NULL,
content mediumblob,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
ident varchar(32) DEFAULT '' NOT NULL,
PRIMARY KEY (id),
KEY hash (hash)
) ENGINE=InnoDB;
#
# Table structure for table 'cachingframework_cache_hash'
#
t3lib/class.t3lib_tstemplate.php (working copy)
* is regenerated - at least the this->start function must be called,
* because this will make a new portion of data in currentPageData string.
*
* @return array Returns the unmatched array $currentPageData if found cached in "cache_pagesection". Otherwise false is returned which means that the array must be generated and stored in the cache-table
* @return array Returns the unmatched array $currentPageData if found cached in "cache_pagesection". Otherwise false is returned which means that the array must be generated and stored in the cache
* @see start(), tslib_fe::getFromCache()
*/
function getCurrentPageData() {
$currentPageData = FALSE;
if (TYPO3_UseCachingFramework) {
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
/* @var $pageSectionCache t3lib_cache_AbstractCache */
$currentPageData = $pageSectionCache->get(
intval($GLOBALS['TSFE']->id) . '_' . t3lib_div::md5int($GLOBALS['TSFE']->MP)
);
} else {
$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']);
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
return $currentPageData;
public function getCurrentPageData() {
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
return $pageSectionCache->get(intval($GLOBALS['TSFE']->id) . '_' . t3lib_div::md5int($GLOBALS['TSFE']->MP));
}
/**
......
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 (TYPO3_UseCachingFramework) {
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
/* @var $pageSectionCache t3lib_cache_AbstractCache */
$pageSectionCache->set(
intval($GLOBALS['TSFE']->id) . '_' . $mpvarHash,
$cc,
array(
'pageId_' . intval($GLOBALS['TSFE']->id),
'mpvarHash_' . $mpvarHash
)
);
} else {
$dbFields = array(
'content' => serialize($cc),
'tstamp' => $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);
}
}
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
/* @var $pageSectionCache t3lib_cache_AbstractCache */
$pageSectionCache->set(
intval($GLOBALS['TSFE']->id) . '_' . $mpvarHash,
$cc,
array(
'pageId_' . intval($GLOBALS['TSFE']->id),
'mpvarHash_' . $mpvarHash
)
);
}
// If everything OK.
if ($this->rootId && $this->rootLine && $this->setup) {
t3lib/class.t3lib_befunc.php (working copy)
* @return void
*/
public static function storeHash($hash, $data, $ident) {
if (TYPO3_UseCachingFramework) {
$GLOBALS['typo3CacheManager']->getCache('cache_hash')->set(
$hash,
$data,
array('ident_' . $ident),
0 // unlimited lifetime
);
} else {
$insertFields = array(
'hash' => $hash,
'content' => $data,
'ident' => $ident,
'tstamp' => $GLOBALS['EXEC_TIME']
);
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash'));
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_hash', $insertFields);
}
$GLOBALS['typo3CacheManager']->getCache('cache_hash')->set(
$hash,
$data,
array('ident_' . $ident),
0 // unlimited lifetime
);
}
/**
......
*/
public static function getHash($hash, $expTime = 0) {
$hashContent = NULL;
if (TYPO3_UseCachingFramework) {
$contentHashCache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
$cacheEntry = $contentHashCache->get($hash);
if ($cacheEntry) {
$hashContent = $cacheEntry;
}
} else {
$expTime = intval($expTime);
if ($expTime) {
$whereAdd = ' AND tstamp > ' . (time() - $expTime);
}
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash') . $whereAdd);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
$hashContent = (is_array($row) ? $row['content'] : NULL);
$cacheEntry = $GLOBALS['typo3CacheManager']->getCache('cache_hash')->get($hash);
if ($cacheEntry) {
$hashContent = $cacheEntry;
}
return $hashContent;
}
t3lib/class.t3lib_cache.php (working copy)
* This method can be called by extensions in their ext_localconf.php. Calling it later would not work,
* since rendering is already started using the defined caches.
*
* @deprecated since 4.6, will be removed in 4.8: The caching framework is always enabled
* @return void
*/
public function enableCachingFramework() {
if (!defined('TYPO3_UseCachingFramework')) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['useCachingFramework'] = 1;
} elseif (!TYPO3_UseCachingFramework) {
throw new RuntimeException(
'The caching framework was already defined to be disabled and cannot be changed. ' .
'Please put your call to t3lib_cache::enableCachingFramework() into ext_localconf.php.',
1253273131
);
}
t3lib_div::logDeprecatedFunction();
}
}
t3lib/class.t3lib_page.php (working copy)
public static function getHash($hash, $expTime = 0) {
$hashContent = null;
if (TYPO3_UseCachingFramework) {
if (is_object($GLOBALS['typo3CacheManager'])) {
$contentHashCache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
$cacheEntry = $contentHashCache->get($hash);
if ($cacheEntry) {
$hashContent = $cacheEntry;
}
if (is_object($GLOBALS['typo3CacheManager'])) {
$contentEntry = $GLOBALS['typo3CacheManager']->getCache('cache_hash')->get($hash);
if ($cacheEntry) {
$hashContent = $cacheEntry;
}
} else {
$expTime = intval($expTime);
if ($expTime) {
$whereAdd = ' AND tstamp > ' . ($GLOBALS['ACCESS_TIME'] - $expTime);
}
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'hash=' . $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'];
}
}
return $hashContent;
}
......
* @see tslib_TStemplate::start(), getHash()
*/
public static function storeHash($hash, $data, $ident, $lifetime = 0) {
if (TYPO3_UseCachingFramework) {
if (is_object($GLOBALS['typo3CacheManager'])) {
$GLOBALS['typo3CacheManager']->getCache('cache_hash')->set(
$hash,
$data,
array('ident_' . $ident),
intval($lifetime)
);
}
} else {
$insertFields = array(
'hash' => $hash,
'content' => $data,
'ident' => $ident,
'tstamp' => $GLOBALS['EXEC_TIME']
if (is_object($GLOBALS['typo3CacheManager'])) {
$GLOBALS['typo3CacheManager']->getCache('cache_hash')->set(
$hash,
$data,
array('ident_' . $ident),
intval($lifetime)
);
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash'));
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_hash', $insertFields);
}
}
t3lib/class.t3lib_tsfebeuserauth.php (working copy)
* Returns the number of cached pages for a page id.
*
* @param integer The page id.
* @return integer The number of pages for this page in the table "cache_pages"
* @return integer The number of pages for this page in cache
*/
public function extGetNumberOfCachedPages($pageId) {
if (TYPO3_UseCachingFramework) {
$pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
$pageCacheEntries = $pageCache->getByTag('pageId_' . (int) $pageId);
$count = count($pageCacheEntries);
} else {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'cache_pages', 'page_id=' . intval($pageId));
list($count) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
}
return $count;
$pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
$pageCacheEntries = $pageCache->getByTag('pageId_' . (int) $pageId);
return count($pageCacheEntries);
}
t3lib/class.t3lib_tcemain.php (working copy)
// Delete cache for selected pages:
if (is_array($list_cache)) {
if (TYPO3_UseCachingFramework) {
$pageCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pages'
);
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pagesection'
);
$pageCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pages'
);
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pagesection'
);
$pageIds = $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache);
foreach ($pageIds as $pageId) {
$pageCache->flushByTag('pageId_' . $pageId);
$pageSectionCache->flushByTag('pageId_' . $pageId);
}
} else {
$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)) . ')');
$pageIds = $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache);
foreach ($pageIds as $pageId) {
$pageCache->flushByTag('pageId_' . $pageId);
$pageSectionCache->flushByTag('pageId_' . $pageId);
}
}
}
......
$GLOBALS['typo3CacheManager']->flushCaches();
}
if (TYPO3_UseCachingFramework) {
if (t3lib_extMgm::isLoaded('cms')) {
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
}
} else {
if (t3lib_extMgm::isLoaded('cms')) {
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_pagesection');
}
$this->internal_clearPageCache();
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_hash');
if (t3lib_extMgm::isLoaded('cms')) {
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
}
// Clearing additional cache tables:
......
// Delete cache for selected pages:
if (is_array($list_cache)) {
$pageCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pages'
);
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pagesection'
);
if (TYPO3_UseCachingFramework) {
$pageCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pages'
);
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pagesection'
);
foreach ($list_cache as $pageId) {
$pageCache->flushByTag('pageId_' . (int) $pageId);
$pageSectionCache->flushByTag('pageId_' . (int) $pageId);
}
} else {
$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!
foreach ($list_cache as $pageId) {
$pageCache->flushByTag('pageId_' . (int) $pageId);
$pageSectionCache->flushByTag('pageId_' . (int) $pageId);
}
}
}
......
* @return void
*/
function internal_clearPageCache() {
if (TYPO3_UseCachingFramework) {
if (t3lib_extMgm::isLoaded('cms')) {
$GLOBALS['typo3CacheManager']->getCache('cache_pages')->flush();
}
} else {
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_TRUNCATEquery('cache_pages');
}
if (t3lib_extMgm::isLoaded('cms')) {
$GLOBALS['typo3CacheManager']->getCache('cache_pages')->flush();
}
}
typo3/init.php (working copy)
// ***********************************
// Initializing the Caching System
// ***********************************
$typo3CacheManager = t3lib_div::makeInstance('t3lib_cache_Manager');
$typo3CacheFactory = t3lib_div::makeInstance('t3lib_cache_Factory');
$typo3CacheFactory->setCacheManager($typo3CacheManager);
if (TYPO3_UseCachingFramework) {
$typo3CacheManager = t3lib_div::makeInstance('t3lib_cache_Manager');
$typo3CacheFactory = t3lib_div::makeInstance('t3lib_cache_Factory');
$typo3CacheFactory->setCacheManager($typo3CacheManager);
t3lib_cache::initPageCache();
t3lib_cache::initPageSectionCache();
t3lib_cache::initContentHashCache();
t3lib_cache::initPageCache();
t3lib_cache::initPageSectionCache();
t3lib_cache::initContentHashCache();
}
// *************************
// CLI dispatch processing
// *************************
typo3/sysext/cms/ext_tables.sql (working copy)
#
# Table structure for table 'cache_pages'
#
CREATE TABLE cache_pages (
id int(11) unsigned NOT NULL auto_increment,
hash varchar(32) DEFAULT '' NOT NULL,
page_id int(11) unsigned DEFAULT '0' NOT NULL,
reg1 int(11) unsigned DEFAULT '0' NOT NULL,
HTML mediumblob,
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 (hash,page_id),
PRIMARY KEY (id)
) ENGINE=InnoDB;
#
# Table structure for table 'cache_pagesection'
#
CREATE TABLE cache_pagesection (
page_id int(11) unsigned DEFAULT '0' NOT NULL,
mpvar_hash int(11) unsigned DEFAULT '0' NOT NULL,
content blob,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (page_id,mpvar_hash)
) ENGINE=InnoDB;
#
# Table structure for table 'cachingframework_cache_pages'
#
CREATE TABLE cachingframework_cache_pages (
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy)
}
}
if (TYPO3_UseCachingFramework) {
$this->initCaches();
}
$this->initCaches();
}
/**
......
* @return void
*/
protected function initCaches() {
if (TYPO3_UseCachingFramework) {
$GLOBALS['TT']->push('Initializing the Caching System','');
$GLOBALS['TT']->push('Initializing the Caching System','');
$GLOBALS['typo3CacheManager'] = t3lib_div::makeInstance('t3lib_cache_Manager');
$GLOBALS['typo3CacheFactory'] = t3lib_div::makeInstance('t3lib_cache_Factory');
$GLOBALS['typo3CacheFactory']->setCacheManager($GLOBALS['typo3CacheManager']);
$GLOBALS['typo3CacheManager'] = t3lib_div::makeInstance('t3lib_cache_Manager');
$GLOBALS['typo3CacheFactory'] = t3lib_div::makeInstance('t3lib_cache_Factory');
$GLOBALS['typo3CacheFactory']->setCacheManager($GLOBALS['typo3CacheManager']);
try {
$this->pageCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pages'
);
} catch(t3lib_cache_exception_NoSuchCache $e) {
t3lib_cache::initPageCache();
try {
$this->pageCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pages'
);
} catch(t3lib_cache_exception_NoSuchCache $e) {
t3lib_cache::initPageCache();
$this->pageCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pages'
);
}
$this->pageCache = $GLOBALS['typo3CacheManager']->getCache(
'cache_pages'
);
}
t3lib_cache::initPageSectionCache();
t3lib_cache::initContentHashCache();
t3lib_cache::initPageSectionCache();
t3lib_cache::initContentHashCache();
$GLOBALS['TT']->pull();
}
$GLOBALS['TT']->pull();
}
/**
......
}
$this->config = (array)unserialize($row['cache_data']); // Fetches the lowlevel config stored with the cached data
$this->content = (TYPO3_UseCachingFramework ? $row['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 (TYPO3_UseCachingFramework) {
$GLOBALS['TT']->push('Cache Query', '');
$row = $this->pageCache->get($this->newHash);
$GLOBALS['TT']->pull();
} else {
$GLOBALS['TT']->push('Cache Query','');
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'S.*',
'cache_pages S,pages P',
'S.hash='.$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();
$GLOBALS['TT']->push('Cache Query', '');
$row = $this->pageCache->get($this->newHash);
$GLOBALS['TT']->pull();
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$this->pageCachePostProcess($row,'get');
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
return $row;
}
......
* @see realPageCacheContent(), tempPageCacheContent()
*/
function setPageCacheContent($content, $data, $expirationTstamp) {
$cacheData = array(
'identifier' => $this->newHash,
'page_id' => $this->id,
'content' => $content,
'temp_content' => $this->tempContent,
'cache_data' => serialize($data),
'expires' => $expirationTstamp,
'tstamp' => $GLOBALS['EXEC_TIME']
);
if (TYPO3_UseCachingFramework) {
$cacheData = 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;
$this->cacheExpires = $expirationTstamp;
$this->pageCacheTags[] = 'pageId_' . $cacheData['page_id'];
$this->pageCacheTags[] = 'pageId_' . $cacheData['page_id'];
if ($this->page_cache_reg1) {
$reg1 = intval($this->page_cache_reg1);
if ($this->page_cache_reg1) {
$reg1 = intval($this->page_cache_reg1);
$cacheData['reg1'] = $reg1;
$this->pageCacheTags[] = 'reg1_' . $reg1;
}
$this->pageCache->set(
$this->newHash,
$cacheData,
$this->pageCacheTags,
$expirationTstamp - $GLOBALS['EXEC_TIME']
);
} else {
$this->clearPageCacheContent();
$insertFields = array(
'hash' => $this->newHash,
'page_id' => $this->id,
'HTML' => $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);
$cacheData['reg1'] = $reg1;
$this->pageCacheTags[] = 'reg1_' . $reg1;
}
$this->pageCache->set(
$this->newHash,
$cacheData,
$this->pageCacheTags,
$expirationTstamp - $GLOBALS['EXEC_TIME']
);
}
/**
......
* @return void
*/
function clearPageCacheContent() {
if (TYPO3_UseCachingFramework) {
$this->pageCache->remove($this->newHash);
} else {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->newHash, 'cache_pages'));
}
$this->pageCache->remove($this->newHash);
}
/**
......
* @param array Input "cache_pages" row, passed by reference!
* @param string Type of operation, either "get" or "set"
* @return void
* @deprecated since 4.6, will be removed in 4.8
*/
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['HTML'] = @is_file($cacheFileName) ? t3lib_div::getUrl($cacheFileName) : '<!-- CACHING ERROR, sorry -->';
break;
case 'set':
t3lib_div::writeFileToTypo3tempDir($cacheFileName, $row['HTML']);
$row['HTML'] = '';
break;
}
}
t3lib_div::logDeprecatedFunction();
}
/**
......
* @return void
*/
function clearPageCacheContent_pidList($pidList) {
if (TYPO3_UseCachingFramework) {
$pageIds = t3lib_div::trimExplode(',', $pidList);
foreach ($pageIds as $pageId) {
$this->pageCache->flushByTag('pageId_' . (int) $pageId);
}
} else {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($pidList).')');
$pageIds = t3lib_div::trimExplode(',', $pidList);
foreach ($pageIds as $pageId) {
$this->pageCache->flushByTag('pageId_' . (int) $pageId);
}
}
typo3/sysext/cms/tslib/class.tslib_fetce.php (working copy)
$cacheCmd = intval($cacheCmd);
if ($cacheCmd) {
if (TYPO3_UseCachingFramework) {
$pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
$pageCache->flushByTag('pageId_' . $cacheCmd);
} else {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id = ' . $cacheCmd);
}
$pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flushByTag('pageId_' . $cacheCmd);
if ($cacheCmd == intval($GLOBALS['TSFE']->id)) {
// Setting no_cache true if the cleared-cache page is the current page!
typo3/sysext/indexed_search/modfunc1/class.tx_indexedsearch_modfunc1.php (working copy)
$idList[] = (int)$row['page_id'];
}
if (TYPO3_UseCachingFramework) {
$pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
foreach ($idList as $pageId) {
$pageCache->flushByTag('pageId_' . $pageId);
}
} else {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id IN (' . implode(',', $idList) . ')');
$pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
foreach ($idList as $pageId) {
$pageCache->flushByTag('pageId_' . $pageId);
}
}
}
(1-1/4)