[BUGFIX] Install tool throws database errors in upgrade wizard
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 24 Oct 2011 21:30:54 +0000 (23:30 +0200)
committerTolleiv Nietsch <info@tolleiv.de>
Mon, 24 Oct 2011 22:32:03 +0000 (00:32 +0200)
Some upgrade wizards like addflexformstoacl need working cache tables.
Those might not exist already. The patch forces creation of those tables
if calling the upgrade wizard.

Change-Id: I5d831bb819389cd2bf90854bb300408b4e6ed823
Resolves: #30862
Reviewed-on: http://review.typo3.org/6262
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Oliver Hader
Reviewed-by: Wouter Wolters
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
typo3/sysext/install/mod/class.tx_install.php

index 3784a32..16b6f27 100644 (file)
@@ -5569,7 +5569,7 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndp
                                        if ($tblFileContent) {
                                                $fileContent = implode(
                                                        LF,
-                                                       $this->getStatementArray($tblFileContent,1,'^CREATE TABLE ')
+                                                       $this->sqlHandler->getStatementArray($tblFileContent,1,'^CREATE TABLE ')
                                                );
                                                $FDfile = $this->sqlHandler->getFieldDefinitions_fileContent($fileContent);
                                                if (!count($FDfile)) {
@@ -6345,6 +6345,22 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndp
                        // clear cache files
                t3lib_extMgm::removeCacheFiles(t3lib_extMgm::getCacheFilePrefix());
 
+                       // Forces creation / update of caching framework tables that are needed by some update wizards
+               $cacheTablesConfiguration = implode(LF, $this->sqlHandler->getStatementArray(t3lib_cache::getDatabaseTableDefinitions(), 1, '^CREATE TABLE '));
+               $neededTableDefinition = $this->sqlHandler->getFieldDefinitions_fileContent($cacheTablesConfiguration);
+               $currentTableDefinition = $this->sqlHandler->getFieldDefinitions_database();
+               $updateTableDefenition = $this->sqlHandler->getDatabaseExtra($neededTableDefinition, $currentTableDefinition);
+               $updateStatements = $this->sqlHandler->getUpdateSuggestions($updateTableDefenition);
+               if (isset($updateStatements['create_table']) && count($updateStatements['create_table']) > 0) {
+                       $this->sqlHandler->performUpdateQueries($updateStatements['create_table'], $updateStatements['create_table']);
+               }
+               if (isset($updateStatements['add']) && count($updateStatements['add']) > 0) {
+                       $this->sqlHandler->performUpdateQueries($updateStatements['add'], $updateStatements['add']);
+               }
+               if (isset($updateStatements['change']) && count($updateStatements['change']) > 0) {
+                       $this->sqlHandler->performUpdateQueries($updateStatements['change'], $updateStatements['change']);
+               }
+
                        // call wizard
                $action = ($this->INSTALL['database_type'] ? $this->INSTALL['database_type'] : 'checkForUpdate');
                $this->updateWizard_parts($action);
@@ -8368,4 +8384,4 @@ $out="
 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/install/mod/class.tx_install.php'])) {
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/install/mod/class.tx_install.php']);
 }
-?>
+?>
\ No newline at end of file