Project

General

Profile

Bug #15122 ยป tslib_fe-cTCA.diff

Administrator Admin, 2007-03-13 16:12

View differences:

class.tslib_fe.php 2007-03-13 16:06:45.000000000 +0100
global $TCA;
$GLOBALS['TT']->push('Get Compressed TC array');
if (!$this->TCAloaded) {
// Create hash string for storage / retrieval of cached content:
$tempHash = md5('tables.php:'.
filemtime(TYPO3_extTableDef_script ? PATH_typo3conf.TYPO3_extTableDef_script : PATH_t3lib.'stddb/tables.php').
(TYPO3_extTableDef_script?filemtime(PATH_typo3conf.TYPO3_extTableDef_script):'').
($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] ? filemtime(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php') : '')
);
// Try to fetch if:
list($TCA,$this->TCAcachedExtras) = unserialize($this->sys_page->getHash($tempHash, 0));
// If no result, create it:
if (!is_array($TCA)) {
$this->includeTCA(0);
$newTc = Array();
$this->TCAcachedExtras = array(); // Collects other information
foreach($TCA as $key => $val) {
$newTc[$key]['ctrl'] = $val['ctrl'];
$newTc[$key]['feInterface'] = $val['feInterface'];
// Collect information about localization exclusion of fields:
t3lib_div::loadTCA($key);
if (is_array($TCA[$key]['columns'])) {
$this->TCAcachedExtras[$key]['l10n_mode'] = array();
foreach($TCA[$key]['columns'] as $fN => $fV) {
if ($fV['l10n_mode']) {
$this->TCAcachedExtras[$key]['l10n_mode'][$fN] = $fV['l10n_mode'];
}
if (!is_array($this->TCAcachedExtras) || count($this->TCAcachedExtras)==0) {
if (!$this->TCAloaded) {
// Create hash string for storage / retrieval of cached content:
$tempHash = md5('tables.php:'.
filemtime(TYPO3_extTableDef_script ? PATH_typo3conf.TYPO3_extTableDef_script : PATH_t3lib.'stddb/tables.php').
(TYPO3_extTableDef_script?filemtime(PATH_typo3conf.TYPO3_extTableDef_script):'').
($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] ? filemtime(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php') : '')
);
// Try to fetch it:
list($TCA,$this->TCAcachedExtras) = unserialize($this->sys_page->getHash($tempHash, 0));
// If no result, create it:
if (!is_array($TCA)) {
$this->includeTCA(0);
}
}
$newTCA = Array();
$this->TCAcachedExtras = array(); // Collects other information
foreach($TCA as $key => $val) {
$newTCA[$key]['ctrl'] = $val['ctrl'];
$newTCA[$key]['feInterface'] = $val['feInterface'];
// Collect information about localization exclusion of fields:
t3lib_div::loadTCA($key);
if (is_array($TCA[$key]['columns'])) {
$this->TCAcachedExtras[$key]['l10n_mode'] = array();
foreach($TCA[$key]['columns'] as $fN => $fV) {
if ($fV['l10n_mode']) {
$this->TCAcachedExtras[$key]['l10n_mode'][$fN] = $fV['l10n_mode'];
}
}
}
}
// Store it in cache:
$TCA = $newTc;
$this->sys_page->storeHash($tempHash, serialize(array($newTc,$this->TCAcachedExtras)), 'SHORT TC');
// Store it in cache:
if (!$this->beUserLogin) { // we don't want to lose the real TCA for BE sessions! (and don't need to cache it)
$TCA = $newTCA;
$this->sys_page->storeHash($tempHash, serialize(array($newTCA,$this->TCAcachedExtras)), 'SHORT TC');
}
}
$GLOBALS['TT']->pull();
    (1-1/1)