Project

General

Profile

Feature #19283 » tslib_class.tslib_fe.php_patch.txt

Administrator Admin, 2008-09-03 22:34

 
Index: /daten/workspace/TYPO3_4_TRUNK/typo3/sysext/cms/tslib/class.tslib_fe.php
===================================================================
--- /daten/workspace/TYPO3_4_TRUNK/typo3/sysext/cms/tslib/class.tslib_fe.php (revision 4059)
+++ /daten/workspace/TYPO3_4_TRUNK/typo3/sysext/cms/tslib/class.tslib_fe.php (working copy)
@@ -2701,6 +2701,52 @@
*/
function setPageCacheContent($content,$data,$tstamp) {
$this->clearPageCacheContent();
+
+ // Call hook for $tstamp calulating
+ if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_cacheexpire_timestamp'])) {
+ foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_cacheexpire_timestamp'] as $_classRef) {
+ $_procObj = &t3lib_div::getUserObj($_classRef);
+ $tstamp = $_procObj->calculateExpireTimestamp(array('tstamp' => $tstamp, 'pid' => $this->id),$this);
+ }
+ }
+
+ $sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
+
+ // Workspace does not matter, because they are on an different page
+ // so whe can use $this-id to check for content elements on this page
+ // Versioning does not matter, because they got pid = -1
+ $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', '
+ tt_content.pid='.intval($this->id).'
+ AND (
+ (tt_content.starttime > '.$GLOBALS['EXEC_TIME'].' AND tt_content.starttime < '.$tstamp.')
+ OR
+ (tt_content.endtime > '.$GLOBALS['EXEC_TIME'].' AND tt_content.endtime < '.$tstamp.')
+ ) '.$sys_page->enableFields('tt_content',0,array('starttime' => true,'endtime' => true),FALSE));
+
+ while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+ // $tstamp is the orignial expire-date of that page
+ // usually it is calculated by cache-expiredate and
+ // $GLOBALS['EXEC_TIME']
+ // the page starttime/endtime is checked before
+ // it is requested from cache. So we do not have to care
+ // of starttime/endtime of the page itself
+
+ // we want to respect the starttime / endtime of the
+ // content elements
+ //
+ // we have to check for each content element only, if it has a starttime
+ // or an endtime which takes effect betwwen $GLOBALS['EXEC_TIME']
+ // and the default-expire date ($tstamp).
+ if ($row['starttime'] < $tstamp && $row['starttime'] > $GLOBALS['EXEC_TIME']) {
+ t3lib_div::devLog('Expires was: '.$tstamp.' new Timestamp via starttime is: '.$row['starttime'].' (ID='.$row['id'].')','cacheexpire',0,$row);
+ $tstamp = $row['starttime'];
+ }
+ if ($row['endtime'] < $tstamp && $row['endtime'] > $GLOBALS['EXEC_TIME']) {
+ t3lib_div::devLog('Expires was: '.$tstamp.' new Timestamp via endtime is: '.$row['endtime'].' (ID='.$row['id'].')','cacheexpire',0,$row);
+ $tstamp = $row['endtime'];
+ }
+ }
+
$insertFields = array(
'hash' => $this->newHash,
'page_id' => $this->id,
(1-1/8)