Bug #66671
Install Tool should show the ALTER TABLE instead of CREATE TABLE
Status: | Closed | Start date: | 2015-04-30 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 0% |
|
Category: | DBAL | Spent time: | - | |
Target version: | - | |||
TYPO3 Version: | 6.2 | Is Regression: | No | |
PHP Version: | Sprint Focus: | |||
Complexity: | hard |
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
History
#1 Updated by Xavier Perseguers 3 months 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.
#2 Updated by Xavier Perseguers 3 months 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
#3 Updated by Morton Jonuschat about 1 month ago
I think this has been solved in #67286
#4 Updated by Morton Jonuschat about 1 month ago
- Status changed from New to Needs Feedback
#5 Updated by Tizian Schmidlin about 1 month ago
I can confirm that this looks like the solution!
Thanks Morton!
#6 Updated by Alexander Opitz about 1 month ago
- Status changed from Needs Feedback to Closed
Thanks for your feedback.