Added feature #14260: Allow DBAL to be configured [Install Tool]
authorXavier Perseguers <typo3@perseguers.ch>
Fri, 30 Apr 2010 18:56:27 +0000 (18:56 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Fri, 30 Apr 2010 18:56:27 +0000 (18:56 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7473 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_install.php
typo3/sysext/install/mod/class.tx_install.php

index 7aae823..aaa311a 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
 
 2010-04-30  Xavier Perseguers  <typo3@perseguers.ch>
 
+       * Added feature #14260: Allow DBAL to be configured [Install Tool]
        * Fixed bug #14055: Install Tool wants to remove static_template table (thanks to Gregor Hermens)
        * Fixed bug #14254: Fresh install does not redirect to Install Tool when mysql is not available
 
index fd094cf..4140cd0 100644 (file)
@@ -126,10 +126,11 @@ class t3lib_install {
         * @param       array           $line_array     the localconf.php file exploded into an array by linebreaks. (see writeToLocalconf_control())
         * @param       string          $variable       The variable name to find and substitute. This string must match the first part of a trimmed line in the line-array. Matching is done backwards so the last appearing line will be substituted.
         * @param       string          $value          Is the value to be insert for the variable
+        * @param       boolean         $quoteValue     Whether the given value should be quoted before being written 
         * @return      void
         * @see writeToLocalconf_control()
         */
-       function setValueInLocalconfFile(&$line_array, $variable, $value)       {
+       public function setValueInLocalconfFile(&$line_array, $variable, $value, $quoteValue = TRUE) {
                if (!$this->checkForBadString($value))  return 0;
 
                        // Initialize:
@@ -154,7 +155,10 @@ class t3lib_install {
                                        $mainparts = explode($variable,$v,2);
                                        if (count($mainparts)==2)       {       // should ALWAYS be....
                                                $subparts = explode('//',$mainparts[1],2);
-                                               $line_array[$k] = $mainparts[0].$variable." = '".$this->slashValueForSingleDashes($value)."';   ".('//'.$comment.str_replace($comment,'',$subparts[1]));
+                                               if ($quoteValue) {
+                                                       $value = '\'' . $this->slashValueForSingleDashes($value) . '\'';
+                                               }
+                                               $line_array[$k] = $mainparts[0] . $variable . " = " . $value . ";       " . ('//' . $comment . str_replace($comment, '', $subparts[1]));
                                                $this->touchedLine = count($line_array)-$k-1;
                                                $found = 1;
                                                break;
@@ -168,7 +172,10 @@ class t3lib_install {
                                        $mainparts = explode($varDoubleQuotes, $v, 2);
                                        if (count($mainparts) == 2) { // should ALWAYS be....
                                                $subparts = explode('//', $mainparts[1], 2);
-                                               $line_array[$k] = $mainparts[0] . $variable . " = '" . $this->slashValueForSingleDashes($value) . "';   " . ('//' . $comment . str_replace($comment, '', $subparts[1]));
+                                               if ($quoteValue) {
+                                                       $value = '\'' . $this->slashValueForSingleDashes($value) . '\'';
+                                               }
+                                               $line_array[$k] = $mainparts[0] . $variable . " = " . $value . ";       " . ('//' . $comment . str_replace($comment, '', $subparts[1]));
                                                $this->touchedLine = count($line_array) - $k - 1;
                                                $found = 1;
                                                break;
@@ -182,13 +189,16 @@ class t3lib_install {
                                $line_array[] = $commentKey.$this->localconf_editPointToken;
                                $line_array[] = '';
                        }
-                       $line_array[] = $variable." = '".$this->slashValueForSingleDashes($value)."';   // ".$comment;
+                       if ($quoteValue) {
+                               $value = '\'' . $this->slashValueForSingleDashes($value) . '\'';
+                       }
+                       $line_array[] = $variable . " = " . $value . "; // " . $comment;
                        $this->touchedLine = -1;
                }
                if ($variable == '$typo_db_password') {
                        $this->messages[] = 'Updated ' . $variable;
                } else {
-                       $this->messages[] = $variable . " = '" . htmlspecialchars($value) . "'";
+                       $this->messages[] = $variable . " = " . htmlspecialchars($value);
                }
                $this->setLocalconf = 1;
        }
index 1de7bee..2cc83d2 100755 (executable)
@@ -353,6 +353,12 @@ BTW: This Install Tool will only work if cookies are accepted by your web browse
                                @touch($enableInstallToolFile);
                        }
 
+                               // Let DBAL decide whether to load itself
+                       $dbalLoaderFile = $this->backPath . 'sysext/dbal/class.tx_dbal_autoloader.php'; 
+                       if (@is_file($dbalLoaderFile)) {
+                               include($dbalLoaderFile);
+                       }
+
                        if($this->redirect_url) {
                                t3lib_utility_Http::redirect($this->redirect_url);
                        }
@@ -4024,7 +4030,7 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndp
         *
         * @return array List of available databases
         */
-       function getDatabaseList() {
+       public function getDatabaseList() {
                $dbArr = array();
                if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
                        $dbArr = $GLOBALS['TYPO3_DB']->admin_get_dbs();
@@ -8328,7 +8334,7 @@ $out="
         * @param integer $keyLength Desired key length
         * @return string The encryption key
         */
-       protected function createEncryptionKey($keyLength = 96) {
+       public function createEncryptionKey($keyLength = 96) {
                $bytes = t3lib_div::generateRandomBytes($keyLength);
                return substr(bin2hex($bytes), -96);
        }