Project

General

Profile

Actions

Bug #66671

closed

Install Tool should show the ALTER TABLE instead of CREATE TABLE

Added by Xavier Perseguers about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2015-04-30
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
hard
Is Regression:
No
Sprint Focus:

Description

In TYPO3 4.5 many tables where not fully "conform" with the ext_tables.sql definition (various minor mixup due to other field types) but having the ALTER TABLE statements helped to know whether one had to worry about it or not.

In TYPO3 6.2 only the CREATE TABLE statement is shown and it is

  • hard to know what is missing (full table, only a few fields, only mixup in field types)

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #66691: Cannot clear all cache in Install ToolClosed2015-04-30

Actions
Related to TYPO3 Core - Bug #67286: InstallTool Database Compare shows all tables missingClosed2015-06-03

Actions
Actions #1

Updated by Xavier Perseguers about 9 years ago

Hint: when checking a single CREATE TABLE statement in Install Tool which then succeeds, the result screen properly shows a list of additional ALTER TABLE statements that should be executed.

Actions #2

Updated by Xavier Perseguers almost 9 years ago

  • Complexity set to hard

OK, analyze:

We miss a call to ->sql_pconnect() or ->connectDB() in Install Tool somehow because this call will properly instantiate the ->handlerInstance and thus lead to have the _DEFAULT instance uninitialized.

This missing call is originating from

  • \TYPO3\CMS\Core\Core\Bootstrap::initializeTypo3DbGlobal() which is called from
  • \TYPO3\CMS\Install\Controller\Action\AbstractAction::loadExtLocalconfDatabaseAndExtTables()

Now, within DBAL's method sql_select_db(), we miss the check of ->isConnected() at the beginning, something that we have when using Core's overridden method.

If we add the call:

if (!$this->isConnected()) {
    $this->connectDB();
}

we have a recursion to ->sql_select_db() because \TYPO3\CMS\Dbal\Database\DatabaseConnection::isConnected() returns FALSE since $this->lastHandlerKey is still to its default (empty) value (see class definition).

BUT, if we set the default value to "_DEFAULT", this fixes the bug, if we are already in the main windows of the Install Tool (initial steps have passed) but it crashes the Install Tool with:

TYPO3 Fatal Error: No database selected!

when opening the Install Tool for the first time, e.g., by clicking the corresponding module in TYPO3 Backend.

This is caused by \TYPO3\CMS\Dbal\Database\DatabaseConnection::handler_init() not fully initializing $this->handlerCfg[$handlerKey] (beginning of the method). More specifically the 'type' is still set to "native", which only works if DBAL is configured with a 'mysqli' backend, so not in a real use of DBAL (e.g., with MSSQL).

This in turn, happens because prior to the change, DBAL's sql_select_db() did not call ->connectDB(). But not having this call causes another bug in Install Tool, namely that opening http://mywebsite/typo3/install always blocks on the database selection (call to getDatabaseList() which calls ->admin_get_dbs(), again as "native" driver has not been replaced. Only (current) way is to manually trick the URL to go to the Tool controller.

Dirty hack

Merge "type" and "driverOptions" when initializing ->handlerCfg['__DEFAULT'] from $this->conf when $this->databaseName is not empty:

$this->handlerCfg[$handlerKey]['type'] = $this->conf['handlerCfg'][$handlerKey]['type'];
// same for driverOptions
Actions #3

Updated by Morton Jonuschat almost 9 years ago

I think this has been solved in #67286

Actions #4

Updated by Morton Jonuschat almost 9 years ago

  • Status changed from New to Needs Feedback
Actions #5

Updated by Tizian Schmidlin almost 9 years ago

I can confirm that this looks like the solution!

Thanks Morton!

Actions #6

Updated by Alexander Opitz almost 9 years ago

  • Status changed from Needs Feedback to Closed

Thanks for your feedback.

Actions

Also available in: Atom PDF