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

Avoid deprecation messages with TYPO3 master #683

Merged
merged 1 commit into from
Mar 14, 2018
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ script:
jobs:
fast_finish: true
allow_failures:
- env: TYPO3_VERSION="dev-master as 9.1.0"
- env: TYPO3_VERSION="9.2.*@dev"
include:
- &lint
stage: test
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
env: TYPO3_VERSION="~9.1.0"
- stage: test
php: 7.2
env: TYPO3_VERSION="dev-master as 9.1.0"
env: TYPO3_VERSION="9.2.*@dev"

- stage: test
php: 7.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,26 @@
*/

use Doctrine\Common\Annotations\AnnotationReader;
use Helhum\Typo3Console\Package\UncachedPackageManager;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Package\DependencyResolver;
use TYPO3\CMS\Core\Service\DependencyOrderingService;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class CompatibilityScripts
{
/**
* @param Bootstrap $bootstrap
*/
public static function createPackageManager(): UncachedPackageManager
{
$packageManager = new UncachedPackageManager();
$dependencyResolver = GeneralUtility::makeInstance(DependencyResolver::class);
$dependencyResolver->injectDependencyOrderingService(
GeneralUtility::makeInstance(DependencyOrderingService::class)
);
$packageManager->injectDependencyResolver($dependencyResolver);

return $packageManager;
}

public static function initializeConfigurationManagement(Bootstrap $bootstrap)
{
self::initializeAnnotationReader();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
namespace Helhum\Typo3Console\TYPO3v91\Core\Booting;

/*
* This file is part of the TYPO3 Console project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read
* LICENSE file that was distributed with this source code.
*
*/

use Helhum\Typo3Console\Package\UncachedPackageManager;
use TYPO3\CMS\Core\Package\DependencyResolver;
use TYPO3\CMS\Core\Service\DependencyOrderingService;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class CompatibilityScripts
{
public static function createPackageManager(): UncachedPackageManager
{
$packageManager = new UncachedPackageManager();
$dependencyResolver = GeneralUtility::makeInstance(DependencyResolver::class);
$dependencyResolver->injectDependencyOrderingService(
GeneralUtility::makeInstance(DependencyOrderingService::class)
);
$packageManager->injectDependencyResolver($dependencyResolver);

return $packageManager;
}

public static function initializeConfigurationManagement()
{
// noop for TYPO3 9
}

/**
* @deprecated can be removed when TYPO3 8 support is removed
*/
public static function initializeDatabaseConnection()
{
// noop for TYPO3 9
}

public static function initializeExtensionConfiguration()
{
// noop for TYPO3 9
}
}
11 changes: 11 additions & 0 deletions Classes/Console/Core/Booting/CompatibilityScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,19 @@
*
*/

use Helhum\Typo3Console\Package\UncachedPackageManager;
use TYPO3\CMS\Core\Service\DependencyOrderingService;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class CompatibilityScripts
{
public static function createPackageManager(): UncachedPackageManager
{
$packageManager = new UncachedPackageManager(GeneralUtility::makeInstance(DependencyOrderingService::class));

return $packageManager;
}

public static function initializeConfigurationManagement()
{
// noop for TYPO3 9
Expand Down
10 changes: 2 additions & 8 deletions Classes/Console/Core/Booting/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Helhum\Typo3Console\Core\Cache\FakeDatabaseBackend;
use Helhum\Typo3Console\Error\ErrorHandler;
use Helhum\Typo3Console\Error\ExceptionHandler;
use Helhum\Typo3Console\Package\UncachedPackageManager;
use Symfony\Component\Console\Exception\RuntimeException;
use TYPO3\CMS\Core\Authentication\CommandLineUserAuthentication;
use TYPO3\CMS\Core\Cache\Backend\NullBackend;
Expand Down Expand Up @@ -76,16 +75,11 @@ public static function baseSetup(Bootstrap $bootstrap)
*/
private static function initializePackageManagement(Bootstrap $bootstrap)
{
$packageManager = new UncachedPackageManager();
$packageManager = CompatibilityScripts::createPackageManager();
$bootstrap->setEarlyInstance(PackageManager::class, $packageManager);
GeneralUtility::setSingletonInstance(PackageManager::class, $packageManager);
ExtensionManagementUtility::setPackageManager($packageManager);
$dependencyResolver = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Package\DependencyResolver::class);
$dependencyResolver->injectDependencyOrderingService(
GeneralUtility::makeInstance(\TYPO3\CMS\Core\Service\DependencyOrderingService::class)
);
$packageManager->injectDependencyResolver($dependencyResolver);
$packageManager->init();
GeneralUtility::setSingletonInstance(PackageManager::class, $packageManager);
}

public static function disableCachesForObjectManagement()
Expand Down
7 changes: 5 additions & 2 deletions Classes/Console/Core/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Input\InputInterface;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Package\PackageManager;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down Expand Up @@ -87,11 +88,13 @@ private function ensureRequiredEnvironment()
*/
private function initializeCompatibilityLayer()
{
$typo3Branch = '90';
$typo3Branch = '92';
if (method_exists($this->bootstrap, 'setCacheHashOptions')) {
$typo3Branch = '87';
} elseif (!class_exists(Environment::class)) {
$typo3Branch = '91';
}
if ($typo3Branch === '90') {
if ($typo3Branch === '92') {
return;
}
$compatibilityNamespace = 'Helhum\\Typo3Console\\TYPO3v' . $typo3Branch . '\\';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,19 @@ public function canPerformTypo3Upgrade()

private function setUpNewTypo3Instance()
{
$this->commandDispatcher = CommandDispatcher::createFromTestRun($this->upgradeInstancePath . '/vendor/helhum/typo3-console-test/' . Application::COMMAND_NAME);
$this->commandDispatcher = CommandDispatcher::createFromTestRun($this->upgradeInstancePath . '/vendor/helhum/typo3-console/' . Application::COMMAND_NAME);
if (!is_dir($this->upgradeInstancePath)) {
mkdir($this->upgradeInstancePath);
}

file_put_contents($this->upgradeInstancePath . '/composer.json', '{}');
$this->executeComposerCommand(['config', 'extra.typo3/cms.cms-package-dir', '{$vendor-dir}/typo3/cms']);
$this->executeComposerCommand(['config', 'extra.typo3/cms.web-dir', 'web']);
$this->executeComposerCommand(['config', 'extra.helhum/typo3-console.install-extension-dummy', '0']);
$this->executeComposerCommand(['config', 'extra.typo3/cms.web-dir', 'public']);
$this->copyDirectory($this->consoleRootPath, $this->upgradeInstancePath . '/typo3_console', ['.Build', '.git']);
$consoleComposerJson = file_get_contents($this->upgradeInstancePath . '/typo3_console/composer.json');
$consoleComposerJson = str_replace('"name": "helhum/typo3-console"', '"name": "helhum/typo3-console-test"', $consoleComposerJson);
$consoleComposerJson = preg_replace('#"typo3/cms-([^"]*)": "([^"]*)"#', '"typo3/cms-\1": "\2 || ' . getenv('TYPO3_VERSION') . '"', $consoleComposerJson);
file_put_contents($this->upgradeInstancePath . '/typo3_console/composer.json', $consoleComposerJson);
$this->executeComposerCommand(['config', 'repositories.console', '{"type": "path", "url": "typo3_console", "options": {"symlink": false}}']);
$output = $this->executeComposerCommand(['require', 'typo3/cms-core=^8.7.10', 'helhum/typo3-console-test=@dev']);
$output = $this->executeComposerCommand(['require', 'typo3/cms-core=^8.7.10', 'helhum/typo3-console=@dev']);
$this->assertContains('Mirroring from typo3_console', $output);

$this->executeMysqlQuery('DROP DATABASE IF EXISTS ' . $this->upgradeInstanceDatabase, false);
Expand All @@ -132,7 +130,7 @@ private function setUpNewTypo3Instance()
],
[
'TYPO3_PATH_COMPOSER_ROOT' => $this->upgradeInstancePath,
'TYPO3_PATH_ROOT' => $this->upgradeInstancePath . '/web',
'TYPO3_PATH_ROOT' => $this->upgradeInstancePath . '/public',
]
);
$this->assertContains('Successfully installed TYPO3 CMS!', $output);
Expand All @@ -151,12 +149,14 @@ private function upgradeCodeToTypo3Version($typo3Version)
'typo3/cms-extbase=' . $typo3Version,
'typo3/cms-extensionmanager=' . $typo3Version,
'typo3/cms-fluid=' . $typo3Version,
'typo3/cms-frontend=' . $typo3Version,
'typo3/cms-install=' . $typo3Version,
'typo3/cms-saltedpasswords=' . $typo3Version,
'typo3/cms-scheduler=' . $typo3Version,
'--no-update',
]
);
$output = $this->executeComposerCommand(['update', 'typo3/*', 'doctrine/dbal', '--with-all-dependencies']);
$output = $this->executeComposerCommand(['update', 'typo3/*', 'doctrine/dbal', 'helhum/typo3-composer-setup']);
if (DIRECTORY_SEPARATOR === '\\') {
$output = preg_replace('/[^\x09-\x0d\x1b\x20-\xff]/', '', $output);
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"typo3/cms-fluid": "^8.7.10 || ~9.1.0",
"typo3/cms-frontend": "^8.7.10 || ~9.1.0",
"typo3/cms-install": "^8.7.10 || ~9.1.0",
"typo3/cms-scheduler": "^8.7.10 || ~9.1.0",
"typo3/cms-saltedpasswords": "^8.7.10 || ~9.1.0",
"typo3/cms-scheduler": "^8.7.10 || ~9.1.0",

"doctrine/annotations": "^1.4",
"symfony/console": "^3.4.4 || ^4.0",
Expand Down