Project

General

Profile

Feature #16915 » 0004877.patch

Administrator Admin, 2007-01-29 12:21

View differences:

t3lib/class.t3lib_extmgm.php (Arbeitskopie)
}
if ($conf['ext_tables.php']) {
$cFiles['ext_tables'].=t3lib_extMgm::_makeIncludeHeader($key,$conf['ext_tables.php']);
$cFiles['ext_tables'].=t3lib_extMgm::watchTablesInclude($key, 'begin');
$cFiles['ext_tables'].=trim(t3lib_div::getUrl($conf['ext_tables.php']));
$cFiles['ext_tables'].=t3lib_extMgm::watchTablesInclude($key, 'end');
}
}
}
......
}
return $out;
}
/**
* Returns the watchTable code for the compiled cache-files.
*
* @param string $key: The extension key
* @param string $action: One of 'begin' or 'end'
* @return string PHP code like "<?php t3lib_extMgm::watchTables('my_extension','begin'); ?>"
*/
function watchTablesInclude($key, $action) {
return "<?php t3lib_extMgm::watchTables('".addslashes($key)."','$action'); ?>";
}
/**
* watchTable handler to determine which table belongs to which extension key (and vice versa).
* The $action 'begin' puts a new level on the TYPO3_WATCH_TABLES stack. If there was already an
* element on the stack, the state for the previous extension has to be stored temporarily and updated
* afterwards. This could happen if an extension includes anonther extension, what isn't a good style,
* but could happen!
* The $action 'end' searches the differences between the 'begin' call and the 'end' call and writes
* the information, if any, to TYPO3_CONF_VARS/EXT/extTables and ~/extKeys.
* extKeys: <key> -> array of tables
* extTables: <table> -> string of extension key
*
* @param string $key: The extension key
* @param string $action: One of 'begin' or 'end'
* @return void
*/
function watchTables($key, $action) {
// Initialize TYPO3_WATCH_TABLES and TYPO3_LOADED_TABLES as array:
if (!is_array($GLOBALS['TYPO3_WATCH_TABLES'])) {
$GLOBALS['TYPO3_WATCH_TABLES'] = array();
$GLOBALS['TYPO3_LOADED_TABLES'] = array();
}
// Get the current structure depth (normally this should be 0 or 1):
$structureDepth = count($GLOBALS['TYPO3_WATCH_TABLES']);
// Put a new level on the stack:
if ($action == 'begin') {
// If the previous extension included loads an extension (not good, but could happen):
if ($structureDepth > 0) {
$previousIndex = $structureDepth-1;
$GLOBALS['TYPO3_WATCH_TABLES'][$previousIndex]['tables'] = array_diff(
array_keys($GLOBALS['TCA']),
$GLOBALS['TYPO3_WATCH_TABLES'][$previousIndex]['tca']
);
}
// Put the current extension on the stack and store current tables in TCA:
$GLOBALS['TYPO3_WATCH_TABLES'][] = array(
'tca' => array_keys($GLOBALS['TCA']),
'tables' => array()
);
// Remove the last element from the stack and process differences (tables, that have been set):
} elseif ($action == 'end') {
// If the previous extension included loads an extension (not good, but could happen):
if ($structureDepth > 1) {
$previousIndex = $structureDepth-2;
$GLOBALS['TYPO3_WATCH_TABLES'][$previousIndex]['tca'] = array_keys($GLOBALS['TCA']);
}
// Remove the current extension from the stack:
$currentLevel = array_pop($GLOBALS['TYPO3_WATCH_TABLES']);
// Get differences between 'begin' and 'end' call of this extension:
$tables = array_diff(
array_keys($GLOBALS['TCA']),
$currentLevel['tca']
);
// If this extension included a different extension, there is addional information - merge it to $tables:
if (count($currentLevel['tables'])) {
$tables = array_merge($currentLevel['tables'], $tables);
}
// If this extension has set tables at all, store them to TYPO3_LOADED_TABLES and TYPO3_LOADED_EXT:
if (count($tables)) {
sort($tables);
$GLOBALS['TYPO3_LOADED_EXT'][$key]['tables'] = implode(',', $tables);
foreach ($tables as $tableName) {
$GLOBALS['TYPO3_LOADED_TABLES'][$tableName] = $key;
}
}
}
}
}
?>
typo3/sysext/lowlevel/config/index.php (Arbeitskopie)
1 => '$TCA (tables.php)',
3 => '$TYPO3_LOADED_EXT',
4 => '$TBE_STYLES',
5 => 'TYPO3_LOADED_TABLES',
),
'regexsearch' => '',
'fixedLgd' => ''
......
$theVar = $GLOBALS['TBE_STYLES'];
$arrayBrowser->varName = '$TBE_STYLES';
break;
case 5:
$theVar = $GLOBALS['TYPO3_LOADED_TABLES'];
$arrayBrowser->varName = '$TYPO3_LOADED_TABLES';
break;
default:
$theVar = array();
break;
(1-1/2)