Writing DBAL configuration (needs http://forge.typo3.org/attachments/2868/hooks.diff...
authorXavier Perseguers <typo3@perseguers.ch>
Sun, 25 Apr 2010 22:00:37 +0000 (22:00 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Sun, 25 Apr 2010 22:00:37 +0000 (22:00 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/dbal/trunk@32569 735d13b6-9817-0410-8766-e36946ffe9aa

typo3/sysext/dbal/class.user_tx_install_hook.php
typo3/sysext/dbal/ext_localconf.php

index 11eda16..b27c6db 100644 (file)
@@ -47,14 +47,48 @@ class user_tx_install_hook {
         * @param tx_install $instObj
         * @return void
         */
-       public function execute(array &$markers, $step, tx_install $instObj) {
+       public function executeStepOutput(array &$markers, $step, tx_install $instObj) {
                switch ($step) {
                        case 2:
                                $this->createConnectionForm(t3lib_div::_GET('driver'), $markers, $instObj);
                                break;
+               }
+       }
+
+       /**
+        * Hooks into Installer to modify lines to be written to localconf.php.
+        * 
+        * @param array $lines
+        * @param integer $step
+        * @param tx_install $instObj
+        * @return void
+        */
+       public function executeLocalconf(array &$lines, $step, tx_install $instObj) {
+               switch ($step) {
                        case 3:
-                               t3lib_div::debug(t3lib_div::_POST, 'POST');
-                               die();
+                               $driver = $instObj->INSTALL['localconf.php']['typo_db_driver'];
+                               $driverConfig = '';
+                               switch ($driver) {
+                                       case 'oci8':
+                                               $driverConfig = '\'driverOptions\' => array(' .
+                                                       '\'connectSID\' => ' . ($instObj->INSTALL['localconf.php']['typo_db_type'] === 'sid' ? 'TRUE' : 'FALSE') .
+                                               ')' ;
+                                               break;
+                                       case 'mssql':
+                                       case 'odbc_mssql':
+                                               $driverConfig = '\'useNameQuote\' => TRUE';
+                                               break;
+                               }
+                               $config = 'array(' .
+                                       '\'_DEFAULT\' => array(' .
+                                               '\'type\' => \'adodb\',' .
+                                               '\'config\' => array(' .
+                                                       '\'driver\' => \'' . $driver . '\',' .
+                                                       $driverConfig .
+                                               ')' .
+                                       ')' .
+                               ');';
+                               $lines[] = '$TYPO3_CONF_VARS[\'EXTCONF\'][\'dbal\'][\'handlerCfg\'] = ' . $config;
                                break;
                }
        }
index f253dd5..2c0af34 100644 (file)
@@ -9,4 +9,5 @@ $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc'] = t3lib_
 
 // Register a hook for the installer
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['stepOutput'][] = 'EXT:dbal/class.user_tx_install_hook.php:user_tx_install_hook';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['localconf'][] = 'EXT:dbal/class.user_tx_install_hook.php:user_tx_install_hook';
 ?>