Skip to content

Commit

Permalink
[TASK] Merge release/4.0.0 to main (#118)
Browse files Browse the repository at this point in the history
Add TYPO3 13 support
  • Loading branch information
kszymukowicz authored Oct 19, 2024
1 parent e4e6456 commit f7343f4
Show file tree
Hide file tree
Showing 26 changed files with 377 additions and 132 deletions.
32 changes: 23 additions & 9 deletions .ddev/commands/host/ci
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ set -e
source .ddev/test/utils.sh
export_ddev_env_vars

trap 'restoreComposerFiles' SIGINT SIGTERM

ci_single() {
TYPO3=$1
PHP=$2
Expand All @@ -31,27 +33,39 @@ ci_single() {
fi

if [[ "$COMPOSER" != "lowest" && "$COMPOSER" != "highest" ]]; then
echo_red "Invalid third argument. COMPOSER value can only be 'lowest' or 'highest'."
message red "Invalid third argument. COMPOSER value can only be 'lowest' or 'highest'."
exit 1
fi

echo_magenta "-------------------------------------------------"
echo_magenta "| TYPO3 \t| PHP\t\t| Composer\t|"
echo_magenta "-------------------------------------------------"
echo_magenta "| $TYPO3\t\t| $PHP\t\t| $COMPOSER\t|"
echo_magenta "-------------------------------------------------"
echo_magenta ""
message magenta "-------------------------------------------------"
message magenta "| TYPO3 \t| PHP\t\t| Composer\t|"
message magenta "-------------------------------------------------"
message magenta "| $TYPO3\t\t| $PHP\t\t| $COMPOSER\t|"
message magenta "-------------------------------------------------"
message magenta ""

ddev config --php-version="$PHP"
ddev restart

if [ -n "$GH_TOKEN" ] && ! ddev composer config --global --list | grep -q "github-oauth.github.com"; then
message magenta "Add GH_TOKEN to composer github-oauth.github.com after 'ddev ci' internal ddev restart"
ddev composer config --global github-oauth.github.com "${GH_TOKEN}"
fi

stashComposerFiles
ddev composer require --no-ansi --no-interaction --no-progress --no-update typo3/cms-core:^${TYPO3} || exit 1
if [ "$COMPOSER" == "lowest" ]; then
ddev exec composer update --prefer-lowest --prefer-stable
ddev exec composer update --prefer-lowest --prefer-stable --with-dependencies --no-progress --no-interaction || exit 1
else
ddev exec composer update
ddev exec composer update --with-dependencies --no-progress --no-interaction || exit 1
fi
message magenta "ddev composer normalize"
ddev composer normalize
message magenta "ddev install $TYPO3"
ddev install "$TYPO3"
message magenta "composer ci"
ddev composer ci
restoreComposerFiles
}

if [ $# -eq 0 ]; then
Expand Down
73 changes: 14 additions & 59 deletions .ddev/commands/web/.install-12
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,17 @@
set +x
set -e

VERSION=12
BASE_PATH=.test/$VERSION
TYPO3_BIN=$BASE_PATH/vendor/bin/typo3
DATABASE=database_$VERSION

rm -rf $BASE_PATH

exclusions=(".*" "Documentation" "Documentation-GENERATED-temp" "var")
mkdir -p "$BASE_PATH/src/$EXTENSION_KEY"
for item in ./*; do
base_name=$(basename "$item")
for exclusion in "${exclusions[@]}"; do
if [[ $base_name == "$exclusion" ]]; then
continue 2
fi
done
ln -sr "$item" "$BASE_PATH/src/$EXTENSION_KEY/$base_name"
done

mysql -uroot -proot -e "DROP DATABASE IF EXISTS $DATABASE"

ln -sr ".ddev/test/files/src/site/" $BASE_PATH/src/site
ln -sr ".ddev/test/files/src/t3apinews/" $BASE_PATH/src/t3apinews

composer init --name="sourcebroker/typo3-$VERSION" --description="TYPO3 $VERSION" --no-interaction --working-dir $BASE_PATH
composer config extra.typo3/cms.web-dir public --working-dir $BASE_PATH
composer config repositories.src path 'src/*' --working-dir $BASE_PATH
composer config --no-interaction allow-plugins.typo3/cms-composer-installers true --working-dir $BASE_PATH
composer config --no-interaction allow-plugins.typo3/class-alias-loader true --working-dir $BASE_PATH
composer config --no-plugins allow-plugins.cweagans/composer-patches true --working-dir $BASE_PATH
jq '.extra.patches += {"typo3/cms-impexp": {"Disable error on new sys_file warning.": "typo3-cms-impexp-disable-error-on-sys-file-warning.patch"}}' $BASE_PATH/composer.json > $BASE_PATH/composer.json.tmp && mv $BASE_PATH/composer.json.tmp $BASE_PATH/composer.json
cp ".ddev/test/files/typo3-cms-impexp-disable-error-on-sys-file-warning.patch" $BASE_PATH

composer req typo3/minimal:'^12.4' typo3/cms-recycler:'^12.4' typo3/cms-tstemplate:'^12.4' typo3/cms-info:'^12.4' \
typo3/cms-lowlevel:'^12.4' typo3/cms-rte-ckeditor:'^12.4' typo3/cms-impexp:'^12.4' \
helhum/typo3-console:'^8.1' georgringer/news:'^11.3.0' \
v/site:'^1.0.0' sourcebroker/t3apinews:'^1.0.0' cweagans/composer-patches \
sourcebroker/t3api:'@dev' \
--no-progress --no-interaction --working-dir $BASE_PATH


$TYPO3_BIN install:setup -n --database-name $DATABASE
$TYPO3_BIN configuration:set 'BE/debug' 1
$TYPO3_BIN configuration:set 'BE/lockSSL' true
$TYPO3_BIN configuration:set 'FE/debug' 1
$TYPO3_BIN configuration:set 'SYS/devIPmask' '*'
$TYPO3_BIN configuration:set 'SYS/displayErrors' 1
$TYPO3_BIN configuration:set 'SYS/trustedHostsPattern' '.*.*'
$TYPO3_BIN configuration:set 'MAIL/transport' 'smtp'
$TYPO3_BIN configuration:set 'MAIL/transport_smtp_server' 'localhost:1025'
$TYPO3_BIN configuration:set 'GFX/processor' 'ImageMagick'
$TYPO3_BIN configuration:set 'GFX/processor_path' '/usr/bin/'

ln -srf ".ddev/test/files/config/sites/main/config.yaml" $BASE_PATH/config/sites/main/config.yaml

.ddev/commands/web/data import "$VERSION"

$TYPO3_BIN database:updateschema
$TYPO3_BIN cache:flush
source .ddev/test/utils-install.sh
install_start "12"

composer req typo3/cms-backend:'^12.4' typo3/cms-core:'^12.4' typo3/cms-extbase:'^12.4' typo3/cms-filelist:'^12.4' \
typo3/cms-fluid:'^12.4' typo3/cms-frontend:'^12.4' typo3/cms-recycler:'^12.4' typo3/cms-tstemplate:'^12.4' \
typo3/cms-info:'^12.4' typo3/cms-lowlevel:'^12.4' typo3/cms-rte-ckeditor:'^12.4' typo3/cms-impexp:'^12.4' \
typo3/cms-install:'^12.4' \
helhum/typo3-console:'^8.1' \
cweagans/composer-patches:'^1.7.3' georgringer/news:'dev-12-13' \
sourcebroker/t3apinews:'^1.0.0' v/site:'^1.0.0' \
sourcebroker/t3api:'@dev' \
--no-progress --no-interaction --working-dir "$BASE_PATH"

install_end
26 changes: 26 additions & 0 deletions .ddev/commands/web/.install-13
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

## Description: [ExtDev] Install TYPO3 13 integration instance.
## Usage: install
## Example: "ddev install 13"

set +x
set -e

source .ddev/test/utils-install.sh
install_start "13"

# remove next two lines later after stable version of helhum/typo3-console START
composer config repositories.helhum/typo3-console vcs https://github.com/bmack/TYPO3-Console --working-dir $BASE_PATH
cp ".ddev/test/files/patches/typo3-cms-core-review-85198.patch" $BASE_PATH/patches/
composer req typo3/cms-backend:'^13.3' typo3/cms-core:'^13.3' typo3/cms-extbase:'^13.3' typo3/cms-filelist:'^13.3' \
typo3/cms-fluid:'^13.3' typo3/cms-frontend:'^13.3' typo3/cms-recycler:'^13.3' typo3/cms-tstemplate:'^13.3' \
typo3/cms-info:'^13.3' typo3/cms-lowlevel:'^13.3' typo3/cms-rte-ckeditor:'^13.3' typo3/cms-impexp:'^13.3' \
typo3/cms-install:'^13.3' \
helhum/typo3-console:'dev-issue/1169' \
cweagans/composer-patches:'^1.7.3' georgringer/news:'dev-12-13' \
sourcebroker/t3apinews:'^1.0.0' v/site:'^1.0.0' \
sourcebroker/t3api:'@dev' \
--no-progress --no-interaction --working-dir "$BASE_PATH"

install_end
4 changes: 2 additions & 2 deletions .ddev/commands/web/cache-flush
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ mapfile -t versions < <(get_supported_typo3_versions)
for version in "${versions[@]}"; do
TYPO3_PATH=".test/${version}/vendor/bin/typo3"
if [ -f "$TYPO3_PATH" ]; then
echo_green "Cache flush TYPO3 v${version}..."
message green "Cache flush TYPO3 v${version}..."
/usr/bin/php $TYPO3_PATH cache:flush
else
echo_red "TYPO3 binary not found for version ${version}"
message red "TYPO3 binary not found for version ${version}"
fi
done
2 changes: 1 addition & 1 deletion .ddev/commands/web/data
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ exportData() {
mv "${EXPORT_PATH}" "${TEST_SRC_IMPEXP_DIR}"
mv "${EXPORT_PATH}.files/" "${TEST_SRC_IMPEXP_DIR}"

echo_green "Dump finished and saved at ${TEST_SRC_IMPEXP_DIR}/${EXPORT_FILE}"
message green "Dump finished and saved at ${TEST_SRC_IMPEXP_DIR}/${EXPORT_FILE}"
}


Expand Down
2 changes: 1 addition & 1 deletion .ddev/commands/web/install
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TYPO3=${1}
if [ "$TYPO3" == "all" ]; then
mapfile -t versions < <(get_supported_typo3_versions)
for version in "${versions[@]}"; do
echo_green "Installing TYPO3 v${version}..."
message green "Installing TYPO3 v${version}..."
.ddev/commands/web/.install-$version
done
else
Expand Down
2 changes: 1 addition & 1 deletion .ddev/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: t3api
type: php
docroot: .test
php_version: "8.1"
php_version: "8.3"
webserver_type: apache-fpm
router_http_port: "80"
router_https_port: "443"
Expand Down
2 changes: 1 addition & 1 deletion .ddev/docker-compose.web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
- EXTENSION_KEY=t3api
- PACKAGE_NAME=sourcebroker/t3api

- TYPO3_VERSIONS=12
- TYPO3_VERSIONS=12 13
- TYPO3_VERSIONS_12_PHP=8.1 8.2 8.3
- TYPO3_VERSIONS_13_PHP=8.2 8.3

Expand Down
48 changes: 48 additions & 0 deletions .ddev/test/files/patches/typo3-cms-core-review-85198.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From c7b62d663c886c7448f91fe7e263b63f97a3aa9b Mon Sep 17 00:00:00 2001
From: Garvin Hicking <[email protected]>
Date: Wed, 10 Jul 2024 09:56:38 +0200
Subject: [PATCH] [BUGFIX] Fix composer PackageArtifact packagePath resolve for root pkgs

With #103898 the handling of `handleRootPackage()` was streamlined.

This lead to root packages' paths not being set to the base dir
of the composer installation any more.

The missing code is now added again.

Resolves: #104345
Related: #103898
Releases: main, 12.4
Change-Id: I8c66d88ffcacddc2c825964d393d7446db551e68
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85198
Tested-by: Nikita Hovratov <[email protected]>
Tested-by: core-ci <[email protected]>
Reviewed-by: Nikita Hovratov <[email protected]>
Tested-by: Helmut Hummel <[email protected]>
Reviewed-by: Helmut Hummel <[email protected]>
---

diff --git a/Classes/Composer/PackageArtifactBuilder.php b/Classes/Composer/PackageArtifactBuilder.php
index 1a4848a..7aab94d 100644
--- a/Classes/Composer/PackageArtifactBuilder.php
+++ b/Classes/Composer/PackageArtifactBuilder.php
@@ -181,7 +181,7 @@
$usedExtensionKeys = [];

return array_map(
- function (array $packageAndPath) use (&$usedExtensionKeys): array {
+ function (array $packageAndPath) use ($rootPackage, &$usedExtensionKeys): array {
[$composerPackage, $packagePath] = $packageAndPath;
$packageName = $composerPackage->getName();
$packagePath = GeneralUtility::fixWindowsFilePath($packagePath);
@@ -210,6 +210,10 @@
$usedExtensionKeys[$extensionKey] = $packageName;
unset($this->availableComposerPackageKeys[$packageName]);
$this->composerNameToPackageKeyMap[$packageName] = $extensionKey;
+ if ($composerPackage === $rootPackage) {
+ // The root package's path is the Composer base dir
+ $packagePath = $this->config->get('base-dir');
+ }
// Add extension key to the package map for later reference
return [$composerPackage, $packagePath, $extensionKey];
},
4 changes: 2 additions & 2 deletions .ddev/test/files/src/t3apinews/Classes/Domain/Model/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class News extends \GeorgRinger\News\Domain\Model\News
* "api_put_item_t3apinews_news",
* })
*/
protected $categories;
protected \TYPO3\CMS\Extbase\Persistence\ObjectStorage $categories;

/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SourceBroker\T3apinews\Domain\Model\News>
Expand Down Expand Up @@ -278,7 +278,7 @@ class News extends \GeorgRinger\News\Domain\Model\News
* "api_get_item_t3apinews_news",
* })
*/
protected $tags;
protected \TYPO3\CMS\Extbase\Persistence\ObjectStorage $tags;

/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SourceBroker\T3apinews\Domain\Model\FileReference>
Expand Down
91 changes: 91 additions & 0 deletions .ddev/test/utils-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash

set -e

function install_start() {
check_ddev_environment
setup_environment "$1"
create_symlinks_main_extension
create_symlinks_additional_extensions
setup_composer
}

function install_end() {
setup_typo3
import_data
update_typo3
}

function check_ddev_environment() {
if [ -z "$DDEV_PROJECT" ]; then
echo "This script must be run inside a DDEV web container."
exit 1
fi
}

function setup_environment() {
local version=$1
BASE_PATH=".test/$version"
rm -rf "$BASE_PATH"
mkdir -p "$BASE_PATH/src/$EXTENSION_KEY"
export DATABASE="database_$version"
export BASE_PATH
export VERSION="$version"
export TYPO3_BIN="$BASE_PATH/vendor/bin/typo3"
mysql -uroot -proot -e "DROP DATABASE IF EXISTS $DATABASE"
}

function create_symlinks_main_extension() {
local exclusions=(".*" "Documentation" "Documentation-GENERATED-temp" "var")
for item in ./*; do
local base_name=$(basename "$item")
for exclusion in "${exclusions[@]}"; do
if [[ $base_name == "$exclusion" ]]; then
continue 2
fi
done
ln -sr "$item" "$BASE_PATH/src/$EXTENSION_KEY/$base_name"
done
}

function create_symlinks_additional_extensions() {
for dir in .ddev/test/files/src/*/; do
ln -sr "$dir" "$BASE_PATH/src/$(basename "$dir")"
done
}

function setup_composer() {
composer init --name="sourcebroker/typo3-$VERSION" --description="TYPO3 $VERSION" --no-interaction --working-dir "$BASE_PATH"
composer config extra.typo3/cms.web-dir public --working-dir "$BASE_PATH"
composer config repositories.src path 'src/*' --working-dir "$BASE_PATH"
composer config --no-interaction allow-plugins.typo3/cms-composer-installers true --working-dir "$BASE_PATH"
composer config --no-interaction allow-plugins.typo3/class-alias-loader true --working-dir "$BASE_PATH"
composer config --no-plugins allow-plugins.cweagans/composer-patches true --working-dir "$BASE_PATH"
mkdir -p "$BASE_PATH/patches"
jq '.extra.patches += {"typo3/cms-impexp": {"Disable error on new sys_file warning.": "patches/typo3-cms-impexp-disable-error-on-sys-file-warning.patch"}}' "$BASE_PATH/composer.json" > "$BASE_PATH/composer.json.tmp" && mv "$BASE_PATH/composer.json.tmp" "$BASE_PATH/composer.json"
cp ".ddev/test/files/patches/typo3-cms-impexp-disable-error-on-sys-file-warning.patch" "$BASE_PATH/patches/"
}

function setup_typo3() {
$TYPO3_BIN install:setup -n --database-name "$DATABASE"
$TYPO3_BIN configuration:set 'BE/debug' 1
$TYPO3_BIN configuration:set 'BE/lockSSL' true
$TYPO3_BIN configuration:set 'FE/debug' 1
$TYPO3_BIN configuration:set 'SYS/devIPmask' '*'
$TYPO3_BIN configuration:set 'SYS/displayErrors' 1
$TYPO3_BIN configuration:set 'SYS/trustedHostsPattern' '.*.*'
$TYPO3_BIN configuration:set 'MAIL/transport' 'smtp'
$TYPO3_BIN configuration:set 'MAIL/transport_smtp_server' 'localhost:1025'
$TYPO3_BIN configuration:set 'GFX/processor' 'ImageMagick'
$TYPO3_BIN configuration:set 'GFX/processor_path' '/usr/bin/'
ln -srf ".ddev/test/files/config/sites/main/config.yaml" "$BASE_PATH/config/sites/main/config.yaml"
}

function import_data() {
.ddev/commands/web/data import "$VERSION"
}

function update_typo3() {
$TYPO3_BIN database:updateschema
$TYPO3_BIN cache:flush
}
Loading

0 comments on commit f7343f4

Please sign in to comment.