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

Deprecate TYPO3_CONSOLE_FEATURE_GENERATE_PACKAGE_STATES #550

Merged
merged 2 commits into from
Sep 3, 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
11 changes: 5 additions & 6 deletions Classes/Composer/InstallerScript/GeneratePackageStates.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
*/

use Composer\Script\Event as ScriptEvent;
use Composer\Util\Filesystem;
use Helhum\Typo3Console\Mvc\Cli\CommandDispatcher;
use Helhum\Typo3ConsolePlugin\Config as PluginConfig;
use TYPO3\CMS\Composer\Plugin\Config as Typo3Config;
use TYPO3\CMS\Composer\Plugin\Core\InstallerScript;

/**
* @deprecated will be removed with 5.0
*/
class GeneratePackageStates implements InstallerScript
{
/**
Expand All @@ -44,12 +46,9 @@ private function shouldRun(ScriptEvent $event): bool
return false;
}

if (!getenv('TYPO3_CONSOLE_TEST_SETUP') && $composer->getPackage()->getName() === 'helhum/typo3-console') {
return false;
}
$io->writeError('<warning>Using TYPO3_CONSOLE_FEATURE_GENERATE_PACKAGE_STATES env var has been deprecated.</warning>');
$io->writeError('<warning>Please abstain from using it and consider using "typo3-console/auto-setup" composer package instead.</warning>');

// Ensure we have at least the typo3conf folder present
(new Filesystem())->ensureDirectoryExists($typo3PluginConfig->get('root-dir') . '/typo3conf');
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/Composer/InstallerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public static function register(Event $event, ScriptDispatcher $scriptDispatcher
$scriptDispatcher->addInstallerScript(new AutoloadConnector());
$scriptDispatcher->addInstallerScript(new CopyTypo3Directory());
}
$scriptDispatcher->addInstallerScript(new GeneratePackageStates(), 40);
$scriptDispatcher->addInstallerScript(new InstallDummyExtension(), 40);
$scriptDispatcher->addInstallerScript(new GeneratePackageStates(), 65);
$scriptDispatcher->addInstallerScript(new InstallDummyExtension(), 65);
}

/**
Expand Down
9 changes: 2 additions & 7 deletions Classes/Composer/LegacyInstallerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,8 @@ private static function generatePackageStates(ScriptEvent $event)
return;
}

if (!getenv('TYPO3_CONSOLE_TEST_SETUP') && $composer->getPackage()->getName() === 'helhum/typo3-console') {
return;
}

// Ensure we have at least the typo3conf folder present
(new Filesystem())->ensureDirectoryExists($typo3PluginConfig->get('web-dir') . '/typo3conf');
$io = $event->getIO();
$io->writeError('<warning>Using TYPO3_CONSOLE_FEATURE_GENERATE_PACKAGE_STATES env var has been deprecated.</warning>');
$io->writeError('<warning>Please abstain from using it and consider using "typo3-console/auto-setup" composer package instead.</warning>');

$commandDispatcher = CommandDispatcher::createFromComposerRun($event);
$commandOptions = [
Expand Down
31 changes: 0 additions & 31 deletions Tests/Functional/Command/Install/InstallCommandControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,35 +112,4 @@ public function packageStatesFileIsCreatedWithDefaultPackages()
$this->assertSame('active', $packageConfig['packages']['reports']['state']);
}
}

/**
* @test
*/
public function packageStatesFileIsCreatedFromComposerRun()
{
$packageStatesFile = getenv('TYPO3_PATH_ROOT') . '/typo3conf/PackageStates.php';
copy($packageStatesFile, $packageStatesFile . '_');
@unlink($packageStatesFile);

$this->executeComposerCommand(
[
'dump-autoload',
'-vv',
],
[
'TYPO3_CONSOLE_FEATURE_GENERATE_PACKAGE_STATES' => 'yes',
'TYPO3_CONSOLE_TEST_SETUP' => 'yes',
'TYPO3_ACTIVATE_DEFAULT_FRAMEWORK_EXTENSIONS' => 'yes',
]
);

$this->assertTrue(file_exists($packageStatesFile));
$packageConfig = require $packageStatesFile;
copy($packageStatesFile . '_', $packageStatesFile);
if ($packageConfig['version'] === 5) {
$this->assertArrayHasKey('reports', $packageConfig['packages']);
} else {
$this->assertSame('active', $packageConfig['packages']['reports']['state']);
}
}
}