Fixed naming flaw with the Install Tool hook class
authorXavier Perseguers <typo3@perseguers.ch>
Thu, 29 Apr 2010 17:32:01 +0000 (17:32 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Thu, 29 Apr 2010 17:32:01 +0000 (17:32 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/dbal/trunk@32758 735d13b6-9817-0410-8766-e36946ffe9aa

typo3/sysext/dbal/class.tx_dbal_installtool.php [new file with mode: 0644]
typo3/sysext/dbal/class.user_tx_install_hook.php [deleted file]
typo3/sysext/dbal/ext_localconf.php
typo3/sysext/dbal/res/Templates/install.html

diff --git a/typo3/sysext/dbal/class.tx_dbal_installtool.php b/typo3/sysext/dbal/class.tx_dbal_installtool.php
new file mode 100644 (file)
index 0000000..0c8434f
--- /dev/null
@@ -0,0 +1,447 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Xavier Perseguers <typo3@perseguers.ch>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Hooks for TYPO3 Install Tool.
+ *
+ * $Id$
+ *
+ * @author Xavier Perseguers <typo3@perseguers.ch>
+ *
+ * @package TYPO3
+ * @subpackage dbal
+ */
+class tx_dbal_installtool {
+
+       protected $templateFilePath = 'res/Templates/';
+
+       /**
+        * Hooks into Installer to let a non-MySQL database to be configured.
+        * 
+        * @param array $markers
+        * @param integer $step
+        * @param tx_install $instObj
+        * @return void
+        */
+       public function executeStepOutput(array &$markers, $step, tx_install $instObj) {
+               switch ($step) {
+                       case 2:
+                               $this->createConnectionForm(t3lib_div::_GET('driver'), $markers, $instObj);
+                               break;
+                       case 3:
+                               $this->createDatabaseForm($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:
+                               $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;
+               }
+       }
+
+       /**
+        * Creates a specialized form to configure the DBMS connection.
+        * 
+        * @param string $driver
+        * @param array $markers
+        * @param tx_install $instObj
+        * @return void
+        */
+       protected function createConnectionForm($driver, array &$markers, tx_install $instObj) {
+                       // Get the template file
+               $templateFile = @file_get_contents(
+                       t3lib_extMgm::extPath('dbal') . $this->templateFilePath . 'install.html'
+               );
+                       // Get the template part from the file
+               $template = t3lib_parsehtml::getSubpart(
+                       $templateFile, '###TEMPLATE###'
+               );
+
+                       // Get the subpart for the connection form
+               $formSubPart = t3lib_parsehtml::getSubpart(
+                       $template, '###CONNECTION_FORM###'
+               );
+               $driverTemplate = t3lib_parsehtml::getSubpart(
+                       $formSubPart, '###DATABASE_DRIVER###'
+               );
+               $driverSubPart = $this->prepareDatabaseDrivers($driverTemplate);
+               $formSubPart = t3lib_parsehtml::substituteSubpart(
+                       $formSubPart,
+                       '###DATABASE_DRIVER###',
+                       $driverSubPart
+               );
+
+                       // Get the subpart related to selected database driver
+               if ($driver === '' || $driver === 'mysql' || $driver === 'mysqli') {
+                       $driverOptionsSubPart = t3lib_parsehtml::getSubpart(
+                               $template, '###DRIVER_MYSQL###'
+                       );
+               } else {
+                       $driverOptionsSubPart = t3lib_parsehtml::getSubpart(
+                               $template, '###DRIVER_' . t3lib_div::strtoupper($driver) . '###'
+                       );
+                       if ($driverOptionsSubPart === '') {
+                               $driverOptionsSubPart = t3lib_parsehtml::getSubpart(
+                                       $template, '###DRIVER_DEFAULT###'
+                               );
+                       }
+               }
+
+                       // Define driver-specific markers
+               $driverMarkers = array();
+               switch ($driver) {
+                       case 'mssql':
+                               $driverMarkers = array(
+                                       'labelUsername' => 'Username',
+                                       'username' => TYPO3_db_username,
+                                       'labelPassword' => 'Password',
+                                       'password' => TYPO3_db_password,
+                                       'labelHost' => 'Host',
+                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'windows',
+                               );
+                               $nextStep = $instObj->step + 1;
+                               break;
+                       case 'odbc_mssql':
+                               $driverMarkers = array(
+                                       'labelUsername' => 'Username',
+                                       'username' => TYPO3_db_username,
+                                       'labelPassword' => 'Password',
+                                       'password' => TYPO3_db_password,
+                                       'labelHost' => 'Host',
+                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'windows',
+                                       'database' => 'dummy_string',
+                               );
+                               $nextStep = $instObj->step + 2;
+                               break;
+                       case 'oci8':
+                               $driverMarkers = array(
+                                       'labelUsername' => 'Username',
+                                       'username' => TYPO3_db_username,
+                                       'labelPassword' => 'Password',
+                                       'password' => TYPO3_db_password,
+                                       'labelHost' => 'Host',
+                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'localhost',
+                                       'labelType' => 'Type',
+                                       'labelSID' => 'SID',
+                                       'labelServiceName' => 'Service Name',
+                                       'labelDatabase' => 'Name',
+                                       'database' => TYPO3_db,
+                               );
+                               $nextStep = $instObj->step + 2;
+                               break;
+                       default:
+                               $driverMarkers = array(
+                                       'labelUsername' => 'Username',
+                                       'username' => TYPO3_db_username,
+                                       'labelPassword' => 'Password',
+                                       'password' => TYPO3_db_password,
+                                       'labelHost' => 'Host',
+                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'localhost',
+                                       'labelDatabase' => 'Database',
+                                       'database' => TYPO3_db,
+                               );
+                               $nextStep = $instObj->step + 1;
+                               break;
+               }
+
+                       // Add header marker for main template
+               $markers['header'] = 'Connect to your database host';
+                       // Define the markers content for the subpart
+               $subPartMarkers = array(
+                       'step' => $nextStep,
+                       'action' => htmlspecialchars($instObj->action),
+                       'encryptionKey' => $instObj->createEncryptionKey(),
+                       'branch' => TYPO3_branch,
+                       'driver_options' => $driverOptionsSubPart,
+                       'continue' => 'Continue'
+               );
+               $subPartMarkers = array_merge($subPartMarkers, $driverMarkers);
+
+                       // Add step marker for main template
+               $markers['step'] = t3lib_parsehtml::substituteMarkerArray(
+                       $formSubPart,
+                       $subPartMarkers,
+                       '###|###',
+                       1,
+                       1
+               );
+       }
+
+       /**
+        * Prepares the list of database drivers for step 2.
+        *
+        * @param string $template
+        * @return string
+        */
+       protected function prepareDatabaseDrivers($template) {
+               $subParts = array(
+                       'abstractionLayer' => t3lib_parsehtml::getSubpart($template, '###ABSTRACTION_LAYER###'),
+                       'vendor' => t3lib_parsehtml::getSubpart($template, '###VENDOR###'),
+               );
+               $supportedDrivers = array(
+                       'Native' => array(
+                               'mysqli' => array(
+                                       'label'      => 'MySQLi (recommended)',
+                                       'extensions' => array('mysqli'),
+                               ),
+                               'mysql' => array(
+                                       'label'      => 'MySQL',
+                                       'extensions' => array('mysql'),
+                               ),
+                               'mssql' => array(
+                                       'label'      => 'Microsoft SQL Server',
+                                       'extensions' => array('mssql'),
+                               ),
+                               'oci8' => array(
+                                       'label'      => 'Oracle OCI8',
+                                       'extensions' => array('oci8'),
+                               ),
+                               'postgres' => array(
+                                       'label'      => 'PostgreSQL',
+                                       'extensions' => array('pgsql'),
+                               )
+                       ),
+                       'ODBC' => array(
+                               'odbc_mssql' => array(
+                                       'label'      => 'Microsoft SQL Server',
+                                       'extensions' => array('odbc', 'mssql'),
+                               ),
+                       ),
+               );
+
+                       // Search for installed drivers
+               $installedDrivers = array();
+               foreach ($supportedDrivers as $abstractionLayer => $drivers) {
+                       foreach ($drivers as $driver => $info) {
+                               $isAvailable = TRUE;
+                               foreach ($info['extensions'] as $extension) {
+                                       $isAvailable &= extension_loaded($extension);
+                               }
+                               if ($isAvailable) {
+                                       if (!isset($installedDrivers[$abstractionLayer])) {
+                                               $installedDrivers[$abstractionLayer] = array();
+                                       }
+                                       $installedDrivers[$abstractionLayer][$driver] = $info['label'];
+                               }
+                       }
+               }
+
+                       // Create the drop-down list of drivers
+               $dropdown = '';
+               $activeDriver = t3lib_div::_GET('driver');
+               foreach ($installedDrivers as $abstractionLayer => $drivers) {
+                       $options = array();
+                       foreach ($drivers as $driver => $label) {
+                               $markers = array(
+                                       'driver'      => $driver,
+                                       'labelvendor' => $label,
+                                       'onclick'     => 'document.location=\'index.php?TYPO3_INSTALL[type]=config&mode=123&step=2&driver=' . $driver . '\';',
+                                       'selected'    => '',
+                               );
+                               if ($driver === $activeDriver) {
+                                       $markers['selected'] .= ' selected="selected"';
+                               }
+                               $options[] = t3lib_parsehtml::substituteMarkerArray(
+                                       $subParts['vendor'],
+                                       $markers,
+                                       '###|###',
+                                       1
+                               );
+                       }
+                       $subPart = t3lib_parsehtml::substituteSubpart(
+                               $subParts['abstractionLayer'],
+                               '###VENDOR###',
+                               implode("\n", $options)
+                       );
+                       $dropdown .= t3lib_parsehtml::substituteMarker(
+                               $subPart,
+                               '###LABELABSTRACTIONLAYER###',
+                               $abstractionLayer
+                       );
+               }
+               $form = t3lib_parsehtml::substituteSubpart(
+                       $template,
+                       '###ABSTRACTION_LAYER###',
+                       $dropdown
+               );
+               $form = t3lib_parsehtml::substituteMarker(
+                       $form,
+                       '###LABELDRIVER###',
+                       'Driver'
+               );
+               return $form;
+       }
+
+       /**
+        * Creates a specialized form to configure the database.
+        * 
+        * @param array $markers
+        * @param tx_install $instObj
+        */
+       protected function createDatabaseForm(array &$markers, tx_install $instObj) {
+               $error_missingConnect = '
+                       <p class="typo3-message message-error">
+                               <strong>
+                                       There is no connection to the database!
+                               </strong>
+                               <br />
+                               (Username: <em>' . TYPO3_db_username . '</em>,
+                               Host: <em>' . TYPO3_db_host . '</em>,
+                               Using Password: YES)
+                               <br />
+                               Go to Step 1 and enter a proper username/password!
+                       </p>
+               ';
+
+                       // Add header marker for main template
+               $markers['header'] = 'Select database';
+                       // There should be a database host connection at this point
+               if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(
+                       TYPO3_db_host, TYPO3_db_username, TYPO3_db_password
+               )) {
+                               // Get the template file
+                       $templateFile = @file_get_contents(
+                               t3lib_extMgm::extPath('dbal') . $this->templateFilePath . 'install.html'
+                       );
+                               // Get the template part from the file
+                       $template = t3lib_parsehtml::getSubpart(
+                               $templateFile, '###TEMPLATE###'
+                       );
+                               // Get the subpart for the database choice step
+                       $formSubPart = t3lib_parsehtml::getSubpart(
+                               $template, '###DATABASE_FORM###'
+                       );
+                               // Get the subpart for the database options
+                       $step3DatabaseOptionsSubPart = t3lib_parsehtml::getSubpart(
+                               $formSubPart, '###DATABASEOPTIONS###'
+                       );
+
+                       $dbArr = $instObj->getDatabaseList();
+                       $dbIncluded = FALSE;
+                       foreach ($dbArr as $dbname) {
+                                       // Define the markers content for database options
+                               $step3DatabaseOptionMarkers = array(
+                                       'databaseValue' => htmlspecialchars($dbname),
+                                       'databaseSelected' => ($dbname === TYPO3_db) ? 'selected="selected"' : '',
+                                       'databaseName' => htmlspecialchars($dbname)
+                               );
+                                       // Add the option HTML to an array
+                               $step3DatabaseOptions[] = t3lib_parsehtml::substituteMarkerArray(
+                                       $step3DatabaseOptionsSubPart,
+                                       $step3DatabaseOptionMarkers,
+                                       '###|###',
+                                       1,
+                                       1
+                               );
+                               if ($dbname === TYPO3_db) {
+                                       $dbIncluded = TRUE;
+                               }
+                       }
+                       if (!$dbIncluded && TYPO3_db) {
+                                       // // Define the markers content when no access
+                               $step3DatabaseOptionMarkers = array(
+                                       'databaseValue' => htmlspecialchars(TYPO3_db),
+                                       'databaseSelected' => 'selected="selected"',
+                                       'databaseName' => htmlspecialchars(TYPO3_db) . ' (NO ACCESS!)'
+                               );
+                                       // Add the option HTML to an array
+                               $step3DatabaseOptions[] = t3lib_parsehtml::substituteMarkerArray(
+                                       $step3DatabaseOptionsSubPart,
+                                       $step3DatabaseOptionMarkers,
+                                       '###|###',
+                                       1,
+                                       1
+                               );
+                       }
+                               // Substitute the subpart for the database options
+                       $content = t3lib_parsehtml::substituteSubpart(
+                               $formSubPart,
+                               '###DATABASEOPTIONS###',
+                               implode(chr(10), $step3DatabaseOptions)
+                       );
+                               // Define the markers content
+                       $step3SubPartMarkers = array(
+                               'step' => $instObj->step + 1,
+                               'action' => htmlspecialchars($instObj->action),
+                               'llOption2' => 'Select an EMPTY existing database:',
+                               'llRemark2' => 'All tables used by TYPO3 will be overwritten in step 3.',
+                               'continue' => 'Continue'
+                       );
+                               // Add step marker for main template
+                       $markers['step'] = t3lib_parsehtml::substituteMarkerArray(
+                               $content,
+                               $step3SubPartMarkers,
+                               '###|###',
+                               1,
+                               1
+                       );
+               } else {
+                               // Add step marker for main template when no connection
+                       $markers['step'] = $error_missingConnect;
+               }
+       }
+
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dbal/class.tx_dbal_installtool.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dbal/class.tx_dbal_installtool.php']);
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/dbal/class.user_tx_install_hook.php b/typo3/sysext/dbal/class.user_tx_install_hook.php
deleted file mode 100644 (file)
index 06a8ac5..0000000
+++ /dev/null
@@ -1,342 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2010 Xavier Perseguers <typo3@perseguers.ch>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Hook for TYPO3 installer.
- *
- * $Id$
- *
- * @author Xavier Perseguers <typo3@perseguers.ch>
- *
- * @package TYPO3
- * @subpackage dbal
- */
-class user_tx_install_hook {
-
-       protected $templateFilePath = 'res/Templates/';
-
-       /**
-        * Hooks into Installer to let a non-MySQL database to be configured.
-        * 
-        * @param array $markers
-        * @param integer $step
-        * @param tx_install $instObj
-        * @return void
-        */
-       public function executeStepOutput(array &$markers, $step, tx_install $instObj) {
-               switch ($step) {
-                       case 2:
-                               $this->createConnectionForm(t3lib_div::_GET('driver'), $markers, $instObj);
-                               break;
-                       case 3:
-                               $this->createDatabaseForm($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:
-                       case 4:
-                               $driver = $instObj->INSTALL['localconf.php']['typo_db_driver'];
-                               if (!$driver) {
-                                       break;
-                               }
-                               $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;
-               }
-       }
-
-       /**
-        * Creates a specialized form to configure the DBMS connection.
-        * 
-        * @param string $driver
-        * @param array $markers
-        * @param tx_install $instObj
-        * @return void
-        */
-       protected function createConnectionForm($driver, array &$markers, tx_install $instObj) {
-                       // Get the template file
-               $templateFile = @file_get_contents(
-                       t3lib_extMgm::extPath('dbal') . $this->templateFilePath . 'install.html'
-               );
-                       // Get the template part from the file
-               $template = t3lib_parsehtml::getSubpart(
-                       $templateFile, '###TEMPLATE###'
-               );
-
-                       // Get the subpart for the connection form
-               $formSubPart = t3lib_parsehtml::getSubpart(
-                       $template, '###CONNECTION_FORM###'
-               );
-               $driverTemplate = t3lib_parsehtml::getSubpart(
-                       $formSubPart, '###DATABASE_DRIVER###'
-               );
-               $driverSubPart = $instObj->prepareDatabaseDrivers($driverTemplate);
-               $formSubPart = t3lib_parsehtml::substituteSubpart(
-                       $formSubPart,
-                       '###DATABASE_DRIVER###',
-                       $driverSubPart
-               );
-
-                       // Get the subpart related to selected database driver
-               if ($driver === '' || $driver === 'mysql' || $driver === 'mysqli') {
-                       $driverOptionsSubPart = t3lib_parsehtml::getSubpart(
-                               $template, '###DRIVER_MYSQL###'
-                       );
-               } else {
-                       $driverOptionsSubPart = t3lib_parsehtml::getSubpart(
-                               $template, '###DRIVER_' . t3lib_div::strtoupper($driver) . '###'
-                       );
-                       if ($driverOptionsSubPart === '') {
-                               $driverOptionsSubPart = t3lib_parsehtml::getSubpart(
-                                       $template, '###DRIVER_DEFAULT###'
-                               );
-                       }
-               }
-
-                       // Define driver-specific markers
-               $driverMarkers = array();
-               switch ($driver) {
-                       case 'mssql':
-                               $driverMarkers = array(
-                                       'labelUsername' => 'Username',
-                                       'username' => TYPO3_db_username,
-                                       'labelPassword' => 'Password',
-                                       'password' => TYPO3_db_password,
-                                       'labelHost' => 'Host',
-                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'windows',
-                               );
-                               $nextStep = $instObj->step + 1;
-                               break;
-                       case 'odbc_mssql':
-                               $driverMarkers = array(
-                                       'labelUsername' => 'Username',
-                                       'username' => TYPO3_db_username,
-                                       'labelPassword' => 'Password',
-                                       'password' => TYPO3_db_password,
-                                       'labelHost' => 'Host',
-                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'windows',
-                                       'database' => 'dummy_string',
-                               );
-                               $nextStep = $instObj->step + 2;
-                               break;
-                       case 'oci8':
-                               $driverMarkers = array(
-                                       'labelUsername' => 'Username',
-                                       'username' => TYPO3_db_username,
-                                       'labelPassword' => 'Password',
-                                       'password' => TYPO3_db_password,
-                                       'labelHost' => 'Host',
-                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'localhost',
-                                       'labelType' => 'Type',
-                                       'labelSID' => 'SID',
-                                       'labelServiceName' => 'Service Name',
-                                       'labelDatabase' => 'Name',
-                                       'database' => TYPO3_db,
-                               );
-                               $nextStep = $instObj->step + 2;
-                               break;
-                       default:
-                               $driverMarkers = array(
-                                       'labelUsername' => 'Username',
-                                       'username' => TYPO3_db_username,
-                                       'labelPassword' => 'Password',
-                                       'password' => TYPO3_db_password,
-                                       'labelHost' => 'Host',
-                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'localhost',
-                                       'labelDatabase' => 'Database',
-                                       'database' => TYPO3_db,
-                               );
-                               $nextStep = $instObj->step + 1;
-                               break;
-               }
-
-                       // Add header marker for main template
-               $markers['header'] = 'Connect to your database host';
-                       // Define the markers content for the subpart
-               $subPartMarkers = array(
-                       'step' => $nextStep,
-                       'action' => htmlspecialchars($instObj->action),
-                       'encryptionKey' => $instObj->createEncryptionKey(),
-                       'branch' => TYPO3_branch,
-                       'driver_options' => $driverOptionsSubPart,
-                       'continue' => 'Continue'
-               );
-               $subPartMarkers = array_merge($subPartMarkers, $driverMarkers);
-
-                       // Add step marker for main template
-               $markers['step'] = t3lib_parsehtml::substituteMarkerArray(
-                       $formSubPart,
-                       $subPartMarkers,
-                       '###|###',
-                       1,
-                       1
-               );
-       }
-
-       /**
-        * Creates a specialized form to configure the database.
-        * 
-        * @param array $markers
-        * @param tx_install $instObj
-        */
-       protected function createDatabaseForm(array &$markers, tx_install $instObj) {
-               $error_missingConnect = '
-                       <p class="typo3-message message-error">
-                               <strong>
-                                       There is no connection to the database!
-                               </strong>
-                               <br />
-                               (Username: <em>' . TYPO3_db_username . '</em>,
-                               Host: <em>' . TYPO3_db_host . '</em>,
-                               Using Password: YES)
-                               <br />
-                               Go to Step 1 and enter a proper username/password!
-                       </p>
-               ';
-
-                       // Add header marker for main template
-               $markers['header'] = 'Select database';
-                       // There should be a database host connection at this point
-               if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(
-                       TYPO3_db_host, TYPO3_db_username, TYPO3_db_password
-               )) {
-                               // Get the template file
-                       $templateFile = @file_get_contents(
-                               t3lib_extMgm::extPath('dbal') . $this->templateFilePath . 'install.html'
-                       );
-                               // Get the template part from the file
-                       $template = t3lib_parsehtml::getSubpart(
-                               $templateFile, '###TEMPLATE###'
-                       );
-                               // Get the subpart for the database choice step
-                       $formSubPart = t3lib_parsehtml::getSubpart(
-                               $template, '###DATABASE_FORM###'
-                       );
-                               // Get the subpart for the database options
-                       $step3DatabaseOptionsSubPart = t3lib_parsehtml::getSubpart(
-                               $formSubPart, '###DATABASEOPTIONS###'
-                       );
-
-                       $dbArr = $instObj->getDatabaseList();
-                       $dbIncluded = FALSE;
-                       foreach ($dbArr as $dbname) {
-                                       // Define the markers content for database options
-                               $step3DatabaseOptionMarkers = array(
-                                       'databaseValue' => htmlspecialchars($dbname),
-                                       'databaseSelected' => ($dbname === TYPO3_db) ? 'selected="selected"' : '',
-                                       'databaseName' => htmlspecialchars($dbname)
-                               );
-                                       // Add the option HTML to an array
-                               $step3DatabaseOptions[] = t3lib_parsehtml::substituteMarkerArray(
-                                       $step3DatabaseOptionsSubPart,
-                                       $step3DatabaseOptionMarkers,
-                                       '###|###',
-                                       1,
-                                       1
-                               );
-                               if ($dbname === TYPO3_db) {
-                                       $dbIncluded = TRUE;
-                               }
-                       }
-                       if (!$dbIncluded && TYPO3_db) {
-                                       // // Define the markers content when no access
-                               $step3DatabaseOptionMarkers = array(
-                                       'databaseValue' => htmlspecialchars(TYPO3_db),
-                                       'databaseSelected' => 'selected="selected"',
-                                       'databaseName' => htmlspecialchars(TYPO3_db) . ' (NO ACCESS!)'
-                               );
-                                       // Add the option HTML to an array
-                               $step3DatabaseOptions[] = t3lib_parsehtml::substituteMarkerArray(
-                                       $step3DatabaseOptionsSubPart,
-                                       $step3DatabaseOptionMarkers,
-                                       '###|###',
-                                       1,
-                                       1
-                               );
-                       }
-                               // Substitute the subpart for the database options
-                       $content = t3lib_parsehtml::substituteSubpart(
-                               $formSubPart,
-                               '###DATABASEOPTIONS###',
-                               implode(chr(10), $step3DatabaseOptions)
-                       );
-                               // Define the markers content
-                       $step3SubPartMarkers = array(
-                               'step' => $instObj->step + 1,
-                               'action' => htmlspecialchars($instObj->action),
-                               'llOption2' => 'Select an EMPTY existing database:',
-                               'llRemark2' => 'All tables used by TYPO3 will be overwritten in step 3.',
-                               'continue' => 'Continue'
-                       );
-                               // Add step marker for main template
-                       $markers['step'] = t3lib_parsehtml::substituteMarkerArray(
-                               $content,
-                               $step3SubPartMarkers,
-                               '###|###',
-                               1,
-                               1
-                       );
-               } else {
-                               // Add step marker for main template when no connection
-                       $markers['step'] = $error_missingConnect;
-               }
-       }
-
-}
-
-?>
\ No newline at end of file
index 2c0af34..5742860 100644 (file)
@@ -8,6 +8,6 @@ $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_sqlparser.php'] = t3li
 $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc'] = t3lib_extMgm::extPath('dbal') . 'class.ux_db_list_extra.php';
 
 // 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';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['stepOutput'][] = 'EXT:dbal/class.tx_dbal_installtool.php:tx_dbal_installtool';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['localconf'][] = 'EXT:dbal/class.tx_dbal_installtool.php:tx_dbal_installtool';
 ?>
index 6c2d782..f828577 100644 (file)
@@ -29,7 +29,7 @@
                                        <!-- ###ABSTRACTION_LAYER### begin -->
                                        <optgroup label="###LABELABSTRACTIONLAYER###">
                                                <!-- ###VENDOR### begin -->
-                                               <option value="###DRIVER###"###ATTRIBUTES###>###LABELVENDOR###</option>
+                                               <option value="###DRIVER###"###SELECTED### onclick="###ONCLICK###">###LABELVENDOR###</option>
                                                <!-- ###VENDOR### end -->
                                        </optgroup>
                                        <!-- ###ABSTRACTION_LAYER### end -->