Skip to content

Commit

Permalink
[TASK] Add list_type to CType Upgrade Wizards (#298)
Browse files Browse the repository at this point in the history
In order to implement the upgrade wizard we
need to require typo3/cms-install.

As that package is currently not compatible with composer we need to install composer indepenetly in its own folder.

references TYPO3-Documentation/Changelog-To-Doc#1071

Releases: main
  • Loading branch information
linawolf authored Oct 13, 2024
1 parent 36331f9 commit cbbc04b
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
*GENERATED*
.ddev
/.php-cs-fixer.cache
/Build/rector/composer.json.testing
/Build/rector/composer.lock
18 changes: 16 additions & 2 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Options:
- composer: "composer" with all remaining arguments dispatched.
- composerNormalize: "composer normalize"
- composerUpdate: "composer update", handy if host has no PHP
- composerUpdateRector: "composer update", for rector subdirectory
- composerValidate: "composer validate"
- lint: PHP linting
- phpstan: PHPStan static analysis
Expand Down Expand Up @@ -276,6 +277,19 @@ case ${TEST_SUITE} in
cp ${ROOT_DIR}/composer.json ${ROOT_DIR}/composer.json.testing
mv ${ROOT_DIR}/composer.json.orig ${ROOT_DIR}/composer.json
;;

composerUpdateRector)
rm -rf Build/rector/.Build/bin/ Build/rector/.Build/vendor Build/rector/composer.lock
cp ${ROOT_DIR}/Build/rector/composer.json ${ROOT_DIR}/Build/rector/composer.json.orig
if [ -f "${ROOT_DIR}/Build/rector/composer.json.testing" ]; then
cp ${ROOT_DIR}/Build/rector/composer.json ${ROOT_DIR}/Build/rector/composer.json.orig
fi
COMMAND=(composer require --working-dir=${ROOT_DIR}/Build/rector --no-ansi --no-interaction --no-progress)
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-install-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} "${COMMAND[@]}"
SUITE_EXIT_CODE=$?
cp ${ROOT_DIR}/Build/rector/composer.json ${ROOT_DIR}/Build/rector/composer.json.testing
mv ${ROOT_DIR}/Build/rector/composer.json.orig ${ROOT_DIR}/Build/rector/composer.json
;;
composerValidate)
COMMAND=(composer validate "$@")
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-command-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} "${COMMAND[@]}"
Expand All @@ -298,9 +312,9 @@ case ${TEST_SUITE} in
;;
rector)
if [ "${CGLCHECK_DRY_RUN}" -eq 1 ]; then
COMMAND=(php -dxdebug.mode=off .Build/bin/rector -n --config=Build/rector/rector.php --clear-cache "$@")
COMMAND=(php -dxdebug.mode=off Build/rector/.Build/bin/rector -n --config=Build/rector/rector.php --clear-cache "$@")
else
COMMAND=(php -dxdebug.mode=off .Build/bin/rector --config=Build/rector/rector.php --clear-cache "$@")
COMMAND=(php -dxdebug.mode=off Build/rector/.Build/bin/rector --config=Build/rector/rector.php --clear-cache "$@")
fi
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name rector-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} "${COMMAND[@]}"
SUITE_EXIT_CODE=$?
Expand Down
20 changes: 20 additions & 0 deletions Build/rector/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "t3docs/blog-example-rector",
"description": "Rector in its own package to avoid compability issues.",
"license": "GPL-2.0-or-later",
"type": "typo3-cms-extension",
"authors": [
{
"name": "TYPO3 Documentation Team and contributors",
"role": "Developer"
}
],
"require": {
"ssch/typo3-rector": "^2.3"
},
"config": {
"bin-dir": ".Build/bin",
"sort-packages": true,
"vendor-dir": ".Build/vendor"
}
}
44 changes: 44 additions & 0 deletions Classes/Upgrades/ExtbasePluginListTypeToCTypeUpdate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

declare(strict_types=1);

/*
* This file is part of the TYPO3 CMS 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 the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

namespace T3docs\Examples\Upgrades;

use TYPO3\CMS\Install\Attribute\UpgradeWizard;
use TYPO3\CMS\Install\Updates\AbstractListTypeToCTypeUpdate;

#[UpgradeWizard('example_extbasePluginListTypeToCTypeUpdate')]
final class ExtbasePluginListTypeToCTypeUpdate extends AbstractListTypeToCTypeUpdate
{
protected function getListTypeToCTypeMapping(): array
{
return [
'examples_error' => 'examples_error',
'examples_htmlparser' => 'examples_htmlparser',
'examples_falexamples' => 'examples_falexamples',
];
}

public function getTitle(): string
{
return 'Migrate Example Extbase plugins';
}

public function getDescription(): string
{
return 'Migrate Example Extbase plugins from deprecated registration via "list-type" to "CType"';
}
}
43 changes: 43 additions & 0 deletions Classes/Upgrades/HaikuPluginListTypeToCTypeUpdate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

declare(strict_types=1);

/*
* This file is part of the TYPO3 CMS 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 the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

namespace T3docs\Examples\Upgrades;

use TYPO3\CMS\Install\Attribute\UpgradeWizard;
use TYPO3\CMS\Install\Updates\AbstractListTypeToCTypeUpdate;

#[UpgradeWizard('example_haikuPluginListTypeToCTypeUpdate')]
final class HaikuPluginListTypeToCTypeUpdate extends AbstractListTypeToCTypeUpdate
{
protected function getListTypeToCTypeMapping(): array
{
return [
'examples_haiku_list' => 'examples_haiku_list',
'examples_haiku_detail' => 'examples_haiku_detail',
];
}

public function getTitle(): string
{
return 'Migrate Example Haiku plugins';
}

public function getDescription(): string
{
return 'Migrate Example Haiku plugins from deprecated registration via "list-type" to "CType"';
}
}
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ phpstan: ## Run phpstan tests
phpstan-baseline: ## Update the phpstan baseline
Build/Scripts/runTests.sh -s phpstanBaseline

.PHONY: install
install: composerUpdate ## Update composer dependencies

.PHONY: composerUpdate
composerUpdate: ## Update composer dependencies
Build/Scripts/runTests.sh -s composerUpdate
Build/Scripts/runTests.sh -s composerUpdateRector
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
],
"require": {
"php": "^8.2",
"typo3/cms-backend": "^13.2 || dev-main",
"typo3/cms-core": "^13.2 || dev-main",
"typo3/cms-extbase": "^13.2 || dev-main",
"typo3/cms-fluid": "^13.2 || dev-main",
"typo3/cms-fluid-styled-content": "^13.2 || dev-main",
"typo3/cms-impexp": "^13.2 || dev-main",
"typo3/cms-linkvalidator": "^13.2 || dev-main",
"typo3/cms-reactions": "^13.2 || dev-main"
"typo3/cms-backend": "dev-main",
"typo3/cms-core": "dev-main",
"typo3/cms-extbase": "dev-main",
"typo3/cms-fluid": "dev-main",
"typo3/cms-fluid-styled-content": "dev-main",
"typo3/cms-impexp": "dev-main",
"typo3/cms-install": "dev-main",
"typo3/cms-linkvalidator": "dev-main",
"typo3/cms-reactions": "dev-main"
},
"require-dev": {
"ergebnis/composer-normalize": "~2.42.0",
"friendsofphp/php-cs-fixer": "^3.52",
"phpstan/phpstan": "^1.10",
"ssch/typo3-rector": "^2.3"
"phpstan/phpstan": "^1.10"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down

0 comments on commit cbbc04b

Please sign in to comment.