[TYPO3-core] RFC #16177: Add DB structure update pre-processing hook in EM

Xavier Perseguers typo3 at perseguers.ch
Sat Oct 30 08:51:00 CEST 2010


Hi,

This is an SVN patch request.

Type: feature

Bug tracker reference:
http://bugs.typo3.org/view.php?id=16177

Branches: trunk

Problem:
Extension Manager lacks a way to perform actions prior to modify the 
database structure (create new tables or add additional fields in 
existing ones) when installing an extension.

Use case:
This would be very handy (e.g., for DBAL) to let user update mapping 
definition from within TYPO3 without the need to first manually edit 
typo3conf/localconf.php.

Example:
(localconf.php of your extension):

$TYPO3_CONF_VARS['SC_OPTIONS']['typo3/mod/tools/em/index.php']['checkDBupdates'][] 
= t3lib_extMgm::extPath($_EXTKEY) . 'test.php:user_test';

(typo3conf/ext/your-ext/test.php)

<?php

class user_test implements em_index_checkDBupdatesHook {

     public function preprocessDBupdates($extKey, array $extInfo, array 
$updateStatements, SC_mod_tools_em_index $parent) {
         $output = '';

         $options = t3lib_div::_GP('user_test');
         if (is_array($options) && $options['foo'] == 1) {
             // Perform some action
         } else {
             //t3lib_div::debug($updateStatements, 'statements');
             // Show actions that should be performed
             $output .= '<input type="checkbox" name="user_test[foo]" 
value="1" /> Pre-processing action';
         }

         return $output;
     }
}

?>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 16177.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20101030/ffc2ce7c/attachment-0001.txt>


More information about the TYPO3-team-core mailing list