Project

General

Profile

Bug #18534 ยป class.user_hookT3lib_tcemain_clearPageCacheEval.php

Administrator Admin, 2008-04-22 12:26

 
<?php

class user_hookT3lib_tcemain_clearPageCacheEval
{

function hookT3lib_tcemain_clearPageCacheEval ($_params, $pObj)
{

global $BE_USER;


$GLOBALS['TYPO3_DB']->debugOutput = 1;

if (strcmp($_params['table'], 'pages')) {

// check the Pid of this current record
// Normally, $list_cache is filled with the value of pid if the table is not 'pages'
// see t3lib_TCEmain::clear_cache

if (count($_params['pageIdArray']) == 1) {
$pid = $_params['pageIdArray'][0];
} else {
$pid = intval($pObj->getPID($_params['table'],$_params['uid']));
}
if (!strcmp($_params['table'], 'tt_content')) {
// array filled with pages id to clear the cache
$array_pidsToClear = array();
$array_pagesRef = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'pid,tx_srincludepages_pages,tx_ehessttcontentauthor_beUserUid',
'tt_content',
'CType=\'sr_include_pages_pi1\'' . t3lib_BEFunc::deleteClause('tt_content') . t3lib_BEFunc::BEenableFields('tt_content')
);
// we don't clear cache of pages which contain hidden 'include pages' content. However, the cache of these pages will be cleared
// when content will be unhide


foreach ($array_pagesRef as $r) {
if (t3lib_div::inList($r['tx_srincludepages_pages'], $pid)) {
$array_pidsToClear[] = $r['pid'];
}
}
$array_pagesRef = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'uid,content_from_pid',
'pages',
'content_from_pid IS NOT NULL' . t3lib_BEFunc::deleteClause('pages') . t3lib_BEFunc::BEenableFields('pages')
);
// we don't clear the cache of pages which are hidden. However, the cache of these pages will be cleared
// when it will be unhide


foreach ($array_pagesRef as $r) {
if (t3lib_div::inList($r['content_from_pid'], $pid)) {
$array_pidsToClear[] = $r['uid'];
}
}

$list_pidsToClear = !empty($array_pidsToClear) ? t3lib_div::uniqueList(implode(',', $array_pidsToClear)) : NULL;

$array_pidsToClear = !is_null($list_pidsToClear) ? t3lib_div::trimExplode(',', $list_pidsToClear, 1) : array();
$_params['pageIdArray'] = array_merge($_params['pageIdArray'], $array_pidsToClear);

// modify timestamp field to time() value for sr_include_pages_pi1 content type
$res_check = $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
'tt_content',
'(pid IN (\'' . implode(',', $array_pidsToClear) . '\') AND CType=\'sr_include_pages_pi1\') OR pid=\'' . $pid . '\'',
array('tstamp' => time())
);

}
}

}

}
?>
    (1-1/1)