[TYPO3-core] RFC #16177: Add DB structure update pre-processing hook in EM
Franz Holzinger
franz at ttproducts.de
Tue Nov 2 08:27:20 CET 2010
Hello Xavier,
> Please find enclosed v3 which takes care of hiding any "import static
> data" that should not be shown while the hook provides another form.
>
> I now have a working patch for DBAL [1] which detects invalid
> table/field names, have a method to suggest a better naming (should
> still be enhanced), shows the form to the user and updates localconf.php
> with the mapping. Once the hook detects that all seems good (no more
> problem with table/field names), it lets EM works as usual, that is show
> tables to be created.
>
I still would like to have some modification.
The hook has a break in the for loop. This means that the hook will be
executed only for the first extension and not for the others.
foreach
($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/tools/em/index.php']['checkDBupdates']
as $classData) {
$hookObject = t3lib_div::getUserObj($classData);
if (!($hookObject instanceof em_index_checkDBupdatesHook)) {
throw new UnexpectedValueException('$hookObject must implement
interface em_index_checkDBupdatesHook', 1288418476);
}
/* @var $hookObject em_index_checkDBupdatesHook */
$preprocessContent = $hookObject->preprocessDBupdates($extKey,
$extInfo, $diff, $this);
if ($preprocessContent) {
$content .= $preprocessContent;
$showUpdateStatements = FALSE;
break;
}
}
======================================
I propose to have a behaviour like this.
/* @var $hookObject em_index_checkDBupdatesHook */
$preprocessContent = $hookObject->preprocessDBupdates($extKey, $extInfo,
$diff, $instObj, $this, $update_statements, $showUpdateStatements);
$content .= $preprocessContent;
The output of the hook functions is always added. Also other extensions
could add their hooks and output here.
$update_statements, $showUpdateStatements are output parameters and can
be modified. The parameter $instObj should be passed as well.
And another proposal: Add the extension key to the hook. In most cases
you will write a hook only for one or very few extensions. The hook
shall not be called for other extensions.
foreach
($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/tools/em/index.php']['checkDBupdates'][$extKey])
as $classData) {
- Franz
More information about the TYPO3-team-core
mailing list