Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling database:updateschema with short name (like d:u) does not work #684

Closed
mbrodala opened this issue Mar 9, 2018 · 10 comments
Closed

Comments

@mbrodala
Copy link
Contributor

mbrodala commented Mar 9, 2018

Q A
Bug report? yes
Feature request? no
TYPO3 version 8.7.10
TYPO3 Console version 5.1.1
TYPO3 Composer mode? yes

If the DB tables cf_cache_hash does not exist, the whole CLI is broken, not even database:updateschema can be executed which could create this table. Having that table created (e.g. by a dump import) leads to the next error with cf_extbase_object, after that with cf_extbase_object_tags. After adding these three tables database:updateschema works as expected.

Output without cf_cache_hash
$ bin/typo3cms d:u
                                                                                                                                                                
  [ Doctrine\DBAL\Exception\TableNotFoundException ]                                                                                                            
  An exception occurred while executing 'SELECT `content` FROM `cf_cache_hash` WHERE (`identifier` = ?) AND (`expires` >= ?)' with params ["<identifier>", 1520612052]:                                                                                                                                 
                                                                                                                                                                
  Table '<db>.cf_cache_hash' doesn't exist                                                                                                                     
                                                                                                                                                                

Exception trace:
#0 ()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:53
#1 Doctrine\DBAL\Driver\AbstractMySQLDriver::convertException()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:128
#2 Doctrine\DBAL\DBALException::driverExceptionDuringQuery()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:855
#3 Doctrine\DBAL\Connection::executeQuery()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:206
#4 Doctrine\DBAL\Query\QueryBuilder::execute()
   typo3/sysext/core/Classes/Database/Query/QueryBuilder.php:173
#5 TYPO3\CMS\Core\Database\Query\QueryBuilder::execute()
   typo3conf/ext/searchable/Classes/Database/Query/QueryBuilder.php:29
#6 PAGEmachine\Searchable\Database\Query\QueryBuilder::execute()
   typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php:151
#7 TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::get()
   typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php:83
#8 TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::get()
   typo3/sysext/backend/Classes/Utility/BackendUtility.php:1214
#9 TYPO3\CMS\Backend\Utility\BackendUtility::getHash()
   typo3/sysext/backend/Classes/Configuration/TsConfigParser.php:56
#10 TYPO3\CMS\Backend\Configuration\TsConfigParser::parseTSconfig()
   typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php:1330
#11 TYPO3\CMS\Core\Authentication\BackendUserAuthentication::fetchGroupData()
   typo3/sysext/core/Classes/Authentication/CommandLineUserAuthentication.php:75
#12 TYPO3\CMS\Core\Authentication\CommandLineUserAuthentication::authenticate()
   vendor/helhum/typo3-console/Classes/Core/Booting/Scripts.php:203
#13 Helhum\Typo3Console\Core\Booting\Scripts::loadCommandLineBackendUser()
   vendor/helhum/typo3-console/Classes/Core/Booting/Scripts.php:186
#14 Helhum\Typo3Console\Core\Booting\Scripts::initializeAuthenticatedOperations()
   vendor/helhum/typo3-console/Classes/Core/Booting/Step.php:53
#15 Helhum\Typo3Console\Core\Booting\Step::__invoke()
   vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:109
#16 Helhum\Typo3Console\Core\Booting\Sequence::invokeStep()
   vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:112
#17 Helhum\Typo3Console\Core\Booting\Sequence::invokeStep()
   vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:93
#18 Helhum\Typo3Console\Core\Booting\Sequence::invoke()
   vendor/helhum/typo3-console/Classes/Core/Booting/RunLevel.php:90
#19 Helhum\Typo3Console\Core\Booting\RunLevel::runSequenceForCommand()
   vendor/helhum/typo3-console/Classes/Core/Kernel.php:178
#20 Helhum\Typo3Console\Core\Kernel::handle()
   vendor/helhum/typo3-console/Scripts/typo3-console.php:24
#21 {closure}()
   vendor/helhum/typo3-console/Scripts/typo3-console.php:26
#22 require()
   vendor/helhum/typo3-console/typo3cms:18

Caused by:
                                                   
  [ Doctrine\DBAL\Driver\Mysqli\MysqliException ]  
  Table '<db>.cf_cache_hash' doesn't exist        
                                                   

Exception trace:
#0 ()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php:101
#1 Doctrine\DBAL\Driver\Mysqli\MysqliStatement::__construct()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php:120
#2 Doctrine\DBAL\Driver\Mysqli\MysqliConnection::prepare()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:844
#3 Doctrine\DBAL\Connection::executeQuery()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:206
#4 Doctrine\DBAL\Query\QueryBuilder::execute()
   typo3/sysext/core/Classes/Database/Query/QueryBuilder.php:173
#5 TYPO3\CMS\Core\Database\Query\QueryBuilder::execute()
   typo3conf/ext/searchable/Classes/Database/Query/QueryBuilder.php:29
#6 PAGEmachine\Searchable\Database\Query\QueryBuilder::execute()
   typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php:151
#7 TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::get()
   typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php:83
#8 TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::get()
   typo3/sysext/backend/Classes/Utility/BackendUtility.php:1214
#9 TYPO3\CMS\Backend\Utility\BackendUtility::getHash()
   typo3/sysext/backend/Classes/Configuration/TsConfigParser.php:56
#10 TYPO3\CMS\Backend\Configuration\TsConfigParser::parseTSconfig()
   typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php:1330
#11 TYPO3\CMS\Core\Authentication\BackendUserAuthentication::fetchGroupData()
   typo3/sysext/core/Classes/Authentication/CommandLineUserAuthentication.php:75
#12 TYPO3\CMS\Core\Authentication\CommandLineUserAuthentication::authenticate()
   vendor/helhum/typo3-console/Classes/Core/Booting/Scripts.php:203
#13 Helhum\Typo3Console\Core\Booting\Scripts::loadCommandLineBackendUser()
   vendor/helhum/typo3-console/Classes/Core/Booting/Scripts.php:186
#14 Helhum\Typo3Console\Core\Booting\Scripts::initializeAuthenticatedOperations()
   vendor/helhum/typo3-console/Classes/Core/Booting/Step.php:53
#15 Helhum\Typo3Console\Core\Booting\Step::__invoke()
   vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:109
#16 Helhum\Typo3Console\Core\Booting\Sequence::invokeStep()
   vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:112
#17 Helhum\Typo3Console\Core\Booting\Sequence::invokeStep()
   vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:93
#18 Helhum\Typo3Console\Core\Booting\Sequence::invoke()
   vendor/helhum/typo3-console/Classes/Core/Booting/RunLevel.php:90
#19 Helhum\Typo3Console\Core\Booting\RunLevel::runSequenceForCommand()
   vendor/helhum/typo3-console/Classes/Core/Kernel.php:178
#20 Helhum\Typo3Console\Core\Kernel::handle()
   vendor/helhum/typo3-console/Scripts/typo3-console.php:24
#21 {closure}()
   vendor/helhum/typo3-console/Scripts/typo3-console.php:26
#22 require()
   vendor/helhum/typo3-console/typo3cms:18
Output without cf_extbase_object
$ bin/typo3cms d:u
                                                                                                                                 
  [ Doctrine\DBAL\Exception\TableNotFoundException ]                                                                             
  An exception occurred while executing 'SELECT `content` FROM `cf_extbase_object` WHERE (`identifier` = ?) AND (`expires` >= ?  
  )' with params ["<identifier>", 1520612389]:                                                               
                                                                                                                                 
  Table '<db>.cf_extbase_object' doesn't exist                                                                                 
                                                                                                                                 

Exception trace:
#0 ()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:53
#1 Doctrine\DBAL\Driver\AbstractMySQLDriver::convertException()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:128
#2 Doctrine\DBAL\DBALException::driverExceptionDuringQuery()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:855
#3 Doctrine\DBAL\Connection::executeQuery()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:206
#4 Doctrine\DBAL\Query\QueryBuilder::execute()
   typo3/sysext/core/Classes/Database/Query/QueryBuilder.php:173
#5 TYPO3\CMS\Core\Database\Query\QueryBuilder::execute()
   typo3conf/ext/searchable/Classes/Database/Query/QueryBuilder.php:29
#6 PAGEmachine\Searchable\Database\Query\QueryBuilder::execute()
   typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php:151
#7 TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::get()
   typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php:83
#8 TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::get()
   typo3/sysext/extbase/Classes/Object/Container/ClassInfoCache.php:60
#9 TYPO3\CMS\Extbase\Object\Container\ClassInfoCache::get()
   typo3/sysext/extbase/Classes/Object/Container/Container.php:345
#10 TYPO3\CMS\Extbase\Object\Container\Container::getClassInfo()
   typo3/sysext/extbase/Classes/Object/Container/Container.php:173
#11 TYPO3\CMS\Extbase\Object\Container\Container::getInstanceInternal()
   typo3/sysext/extbase/Classes/Object/Container/Container.php:126
#12 TYPO3\CMS\Extbase\Object\Container\Container::getInstance()
   typo3/sysext/extbase/Classes/Object/ObjectManager.php:98
#13 TYPO3\CMS\Extbase\Object\ObjectManager::get()
   vendor/helhum/typo3-console/Classes/Core/Kernel.php:179
#14 Helhum\Typo3Console\Core\Kernel::handle()
   vendor/helhum/typo3-console/Scripts/typo3-console.php:24
#15 {closure}()
   vendor/helhum/typo3-console/Scripts/typo3-console.php:26
#16 require()
   vendor/helhum/typo3-console/typo3cms:18

Caused by:
                                                   
  [ Doctrine\DBAL\Driver\Mysqli\MysqliException ]  
  Table '<db>.cf_extbase_object' doesn't exist   
                                                   

Exception trace:
#0 ()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php:101
#1 Doctrine\DBAL\Driver\Mysqli\MysqliStatement::__construct()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php:120
#2 Doctrine\DBAL\Driver\Mysqli\MysqliConnection::prepare()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:844
#3 Doctrine\DBAL\Connection::executeQuery()
   vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:206
#4 Doctrine\DBAL\Query\QueryBuilder::execute()
   typo3/sysext/core/Classes/Database/Query/QueryBuilder.php:173
#5 TYPO3\CMS\Core\Database\Query\QueryBuilder::execute()
   typo3conf/ext/searchable/Classes/Database/Query/QueryBuilder.php:29
#6 PAGEmachine\Searchable\Database\Query\QueryBuilder::execute()
   typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php:151
#7 TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::get()
   typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php:83
#8 TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::get()
   typo3/sysext/extbase/Classes/Object/Container/ClassInfoCache.php:60
#9 TYPO3\CMS\Extbase\Object\Container\ClassInfoCache::get()
   typo3/sysext/extbase/Classes/Object/Container/Container.php:345
#10 TYPO3\CMS\Extbase\Object\Container\Container::getClassInfo()
   typo3/sysext/extbase/Classes/Object/Container/Container.php:173
#11 TYPO3\CMS\Extbase\Object\Container\Container::getInstanceInternal()
   typo3/sysext/extbase/Classes/Object/Container/Container.php:126
#12 TYPO3\CMS\Extbase\Object\Container\Container::getInstance()
   typo3/sysext/extbase/Classes/Object/ObjectManager.php:98
#13 TYPO3\CMS\Extbase\Object\ObjectManager::get()
   vendor/helhum/typo3-console/Classes/Core/Kernel.php:179
#14 Helhum\Typo3Console\Core\Kernel::handle()
   vendor/helhum/typo3-console/Scripts/typo3-console.php:24
#15 {closure}()
   vendor/helhum/typo3-console/Scripts/typo3-console.php:26
#16 require()
   vendor/helhum/typo3-console/typo3cms:18
Output without cf_extbase_object_tags
$ bin/typo3cms d:u
                                                                                                                                 
  [ Doctrine\DBAL\Exception\TableNotFoundException ]                                                                             
  An exception occurred while executing 'DELETE FROM `cf_extbase_object_tags` WHERE `identifier` = ?' with params ["<identifier>"]:                                                                                                       
                                                                                                                                 
  Table '<db>.cf_extbase_object_tags' doesn't exist                                                                            
                                                                                                                                 

Caused by:
                                                       
  [ Doctrine\DBAL\Driver\Mysqli\MysqliException ]      
  Table '<db>.cf_extbase_object_tags' doesn't exist  
                                                       

database:updateschema [--dry-run] [--] <schemaUpdateTypes>


@helhum
Copy link
Member

helhum commented Mar 9, 2018

The functional tests cover that database:updateschema works with a completely empty database.

Please provide a full backtrace with the error message you are seeing.
I suspect some extension accessing cache_hash cache in ext_localconf.php (or any similar file)

@mbrodala
Copy link
Contributor Author

mbrodala commented Mar 9, 2018

I have already provided the full backtraces. I'll check without any 3rd party extensions.

@helhum
Copy link
Member

helhum commented Mar 9, 2018

ah, didn't see the backtraces, as they are folded in (didn't know this before)

@helhum
Copy link
Member

helhum commented Mar 9, 2018

hm, what is the exact console version you are using? "user" does not seem to be a valid version number ;)

@mbrodala
Copy link
Contributor Author

mbrodala commented Mar 9, 2018

Whoops, damn clipboards, I've added the version (5.1.1).

@helhum
Copy link
Member

helhum commented Mar 9, 2018

ah, got it

@helhum
Copy link
Member

helhum commented Mar 9, 2018

I guess bin/typo3cms d:u does not work, but bin/typo3cms database:updateschema works, right?

That is pretty hard to fix though…

@helhum helhum changed the title CLI broken without some caching framework DB tables Calling database:updateschema with short name (like d:u) does not work Mar 10, 2018
helhum added a commit to helhum/TYPO3-Console that referenced this issue Mar 10, 2018
I order to be able get rid of Configuration/Console/Commands.php
in the future, we now unify command registration.

All commands can now be registered with

"command:name" => [
	// Command configuration
]

This includes also commands from command controllers.

Run level, booting steps, replaces, aliases and vendor name
are now part of this configuration. All these are optional
with proper defaults in case they are missing.

Defaults are:

runLevel: full
booting steps: none
replaces: none
aliases: none
vendor name: package name (or extension key for TYPO3 extensions)

This allows to specify arbitrary aliases also for
command controller commands. Even different command names would be possible.

Old registration and command controllers registered in
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers']
still work, as their registration is migrated to the new format.

Because this migrated configuration is merged with existing new configuration,
it is possible to just supply some command controller commands with aliases,
while not having to register every single command.

However all commands within TYPO3 Console are converted to the
new format. This will make the transition to native Symfony commands
much easier, because now every single command is registered.

Fixes: TYPO3-Console#684
helhum added a commit to helhum/TYPO3-Console that referenced this issue Mar 10, 2018
I order to be able get rid of Configuration/Console/Commands.php
in the future, we now unify command registration.

All commands can now be registered with

"command:name" => [
	// Command configuration
]

This includes also commands from command controllers.

Run level, booting steps, replaces, aliases and vendor name
are now part of this configuration. All these are optional
with proper defaults in case they are missing.

Defaults are:

runLevel: full
booting steps: none
replaces: none
aliases: none
vendor name: package name (or extension key for TYPO3 extensions)

This allows to specify arbitrary aliases also for
command controller commands. Even different command names would be possible.

Old registration and command controllers registered in
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers']
still work, as their registration is migrated to the new format.

Because this migrated configuration is merged with existing new configuration,
it is possible to just supply some command controller commands with aliases,
while not having to register every single command.

However all commands within TYPO3 Console are converted to the
new format. This will make the transition to native Symfony commands
much easier, because now every single command is registered.

Fixes: TYPO3-Console#684
helhum added a commit to helhum/TYPO3-Console that referenced this issue Mar 10, 2018
I order to be able get rid of Configuration/Console/Commands.php
in the future, we now unify command registration.

All commands can now be registered with

"command:name" => [
	// Command configuration
]

This includes also commands from command controllers.

Run level, booting steps, replaces, aliases and vendor name
are now part of this configuration. All these are optional
with proper defaults in case they are missing.

Defaults are:

runLevel: full
booting steps: none
replaces: none
aliases: none
vendor name: package name (or extension key for TYPO3 extensions)

This allows to specify arbitrary aliases also for
command controller commands. Even different command names would be possible.

Old registration and command controllers registered in
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers']
still work, as their registration is migrated to the new format.

Because this migrated configuration is merged with existing new configuration,
it is possible to just supply some command controller commands with aliases,
while not having to register every single command.

However all commands within TYPO3 Console are converted to the
new format. This will make the transition to native Symfony commands
much easier, because now every single command is registered.

All this also streamlines and hardens the way run levels are defined
and allows selecting the correct run level even when the command
is called with an alias or in short form.

Fixes: TYPO3-Console#684
helhum added a commit to helhum/TYPO3-Console that referenced this issue Mar 10, 2018
I order to be able get rid of Configuration/Console/Commands.php
in the future, we now unify command registration.

All commands can now be registered with

"command:name" => [
	// Command configuration
]

This includes also commands from command controllers.

Run level, booting steps, replaces, aliases and vendor name
are now part of this configuration. All these are optional
with proper defaults in case they are missing.

Defaults are:

runLevel: full
booting steps: none
replaces: none
aliases: none
vendor name: package name (or extension key for TYPO3 extensions)

This allows to specify arbitrary aliases also for
command controller commands. Even different command names would be possible.

Old registration and command controllers registered in
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers']
still work, as their registration is migrated to the new format.

Because this migrated configuration is merged with existing new configuration,
it is possible to just supply some command controller commands with aliases,
while not having to register every single command.

However all commands within TYPO3 Console are converted to the
new format. This will make the transition to native Symfony commands
much easier, because now every single command is registered.

All this also streamlines and hardens the way run levels are defined
and allows selecting the correct run level even when the command
is called with an alias or in short form.

Fixes: TYPO3-Console#684
@mbrodala
Copy link
Contributor Author

I saw that you added a test for this which works fine now. Thanks for fixing!

@helhum
Copy link
Member

helhum commented Mar 12, 2018

yupp, fixed, tested, released with 5.2.0 :)

@mbrodala
Copy link
Contributor Author

Better late than never: I also just confirmed that the issue was fixed, thanks. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants