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

[BUGFIX] Allow to update DB schema without ext_tables.php #534

Merged
merged 1 commit into from
Aug 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions Classes/Core/Booting/RunLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ protected function buildExtendedRuntimeSequence()
{
$sequence = $this->buildBasicRuntimeSequence(self::LEVEL_FULL);

// @deprecated can be removed if TYPO3 8 support is removed
$this->addStep($sequence, 'helhum.typo3console:database');
// Fix core caches that were disabled beforehand
$this->addStep($sequence, 'helhum.typo3console:enablecorecaches');
$this->addStep($sequence, 'helhum.typo3console:persistence');
$this->addStep($sequence, 'helhum.typo3console:authentication');

return $sequence;
Expand Down Expand Up @@ -214,12 +214,10 @@ protected function addStep($sequence, $stepIdentifier)
case 'helhum.typo3console:enablecorecaches':
$sequence->addStep(new Step('helhum.typo3console:enablecorecaches', [\Helhum\Typo3Console\Core\Booting\Scripts::class, 'reEnableOriginalCoreCaches']), 'helhum.typo3console:database');
break;
// @deprecated can be removed if TYPO3 8 support is removed
case 'helhum.typo3console:database':
$sequence->addStep(new Step('helhum.typo3console:database', [\Helhum\Typo3Console\Core\Booting\Scripts::class, 'initializeDatabaseConnection']), 'helhum.typo3console:errorhandling');
break;
case 'helhum.typo3console:persistence':
$sequence->addStep(new Step('helhum.typo3console:persistence', [\Helhum\Typo3Console\Core\Booting\Scripts::class, 'initializePersistence']), 'helhum.typo3console:extensionconfiguration');
break;
case 'helhum.typo3console:authentication':
$sequence->addStep(new Step('helhum.typo3console:authentication', [\Helhum\Typo3Console\Core\Booting\Scripts::class, 'initializeAuthenticatedOperations']), 'helhum.typo3console:extensionconfiguration');
break;
Expand Down
13 changes: 3 additions & 10 deletions Classes/Core/Booting/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,20 @@ public static function initializeExtensionConfiguration(ConsoleBootstrap $bootst
{
ExtensionManagementUtility::loadExtLocalconf();
$bootstrap->applyAdditionalConfigurationSettings();
$bootstrap->loadTcaOnly();
}

/**
* @param ConsoleBootstrap $bootstrap
*/
public static function initializePersistence(ConsoleBootstrap $bootstrap)
public static function initializeAuthenticatedOperations(ConsoleBootstrap $bootstrap)
{
if (is_callable([$bootstrap, 'loadExtTables'])) {
$bootstrap->loadBaseTca();
$bootstrap->loadExtTables();
} else {
// @deprecated can be removed once TYPO3 7.6 support is removed
$bootstrap->loadExtensionTables();
$bootstrap->loadExtTablesOnly();
}
}

/**
* @param ConsoleBootstrap $bootstrap
*/
public static function initializeAuthenticatedOperations(ConsoleBootstrap $bootstrap)
{
$bootstrap->initializeBackendUser(CommandLineUserAuthentication::class);
self::loadCommandLineBackendUser();
// Global language object on CLI? rly? but seems to be needed by some scheduler tasks :(
Expand Down
23 changes: 21 additions & 2 deletions Classes/Core/ConsoleBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,32 @@ public function initializeConfigurationManagement()
$this->defineUserAgentConstant();
}

/**
* @deprecated can be removed if TYPO3 7 support is removed (directly use $bootstrap->loadBaseTca())
*/
public function loadTcaOnly()
{
Utility\ExtensionManagementUtility::loadBaseTca();
}

/**
* @deprecated can be removed if TYPO3 7 support is removed (directly use $bootstrap->loadExtTables())
*/
public function loadExtTablesOnly()
{
Utility\ExtensionManagementUtility::loadExtTables();
$this->executeExtTablesAdditionalFile();
$this->runExtTablesPostProcessingHooks();
}

/**
* @deprecated can be removed if TYPO3 7 support is removed
*/
public function initializeDatabaseConnection()
{
// @deprecated can be removed if TYPO3 7 support is removed
if (is_callable([$this, 'defineDatabaseConstants'])) {
$this->defineDatabaseConstants();
}
// @deprecated can be removed if TYPO3 7 support is removed
if (is_callable([$this, 'initializeTypo3DbGlobal'])) {
$this->initializeTypo3DbGlobal();
}
Expand Down
1 change: 1 addition & 0 deletions Classes/Install/CliSetupRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public function setup($interactiveSetup, array $givenRequestArguments)
}
// Flush caches, as the extension list has changed
$this->commandDispatcher->executeCommand('cache:flush', ['--files-only' => true]);
$this->commandDispatcher->executeCommand('database:updateschema');
$this->commandDispatcher->executeCommand('extension:setupactive');
$this->output->outputLine('<success>OK</success>');
}
Expand Down
1 change: 0 additions & 1 deletion Configuration/Console/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
'typo3_console:cache:flush' => ['helhum.typo3console:database'],
'typo3_console:database:updateschema' => [
'helhum.typo3console:database',
'helhum.typo3console:persistence',
],
],
];
2 changes: 1 addition & 1 deletion Tests/Functional/Command/AbstractCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected function executeComposerCommand(array $arguments = [], array $environm
$process = $processBuilder->setTimeout(null)->getProcess();
$process->run();
if (!$process->isSuccessful()) {
$this->fail(sprintf('Composer command failed with message: "%s", output: "%s"', $process->getErrorOutput(), $process->getOutput()));
$this->fail(sprintf('Composer command "%s" failed with message: "%s", output: "%s"', $process->getCommandLine(), $process->getErrorOutput(), $process->getOutput()));
}
return $process->getOutput() . $process->getErrorOutput();
}
Expand Down