Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
457 changes: 457 additions & 0 deletions .ddev/.setup/scripts/utils.sh

Large diffs are not rendered by default.

102 changes: 102 additions & 0 deletions .ddev/.setup/templates/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php
$extensionKey = getenv('EXTENSION_NAME');
$typo3AdminUser = getenv('TYPO3_SETUP_ADMIN_USERNAME');
$typo3AdminPassword = getenv('TYPO3_SETUP_ADMIN_PASSWORD');
$supportedVersions = explode(' ', getenv('TYPO3_VERSIONS'));

// Check if composer.json exists
$composerJsonPath = __DIR__ . '/../composer.json';
if (file_exists($composerJsonPath)) {
$composerJsonContent = file_get_contents($composerJsonPath);
$composerData = json_decode($composerJsonContent, true);
$description = $composerData['description'];
} else {
$description = 'composer.json file not found. =(';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?php echo $extensionKey; ?></title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
>
<style>
.flex {
display: flex;
gap: 10px;
}
</style>
</head>
<body>
<header class="container">
<h1>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="-0.5 -0.5 24 24" id="Typo3-Icon--Streamline-Svg-Logos.svg" height="40" width="40"><path fill="#F49700" d="M9.895582291666667 0.5915863541666667c-0.4094479166666667 0.35015104166666666 -0.7003020833333333 0.7595869791666667 -0.7003020833333333 1.9823292708333333 0 3.32738125 4.19994375 13.322414583333334 7.060448958333334 13.322414583333334 0.32128125 0.004360416666666667 0.6412927083333333 -0.04125625 0.9485583333333334 -0.13522083333333335l-0.0060375 0.0016770833333333334 -0.07309687499999999 0.11725208333333334C14.656414583333333 19.815003125000004 11.685221875 22.70162291666667 9.887244791666667 22.759530208333334L9.832571875000001 22.760416666666668C5.927195833333333 22.760416666666668 0.38405927083333335 10.970137500000002 0.38405927083333335 5.7827270833333335c0 -0.8170270833333334 0.185265 -1.45805625 0.46686645833333335 -1.8563635416666668C2.194099375 2.2849110416666667 6.394071875000001 0.9991703125 9.895582291666667 0.5915863541666667ZM15.379429166666668 0.23958333333333334c3.616366666666667 0 7.236446875 0.5835842708333334 7.236446875 2.6252104166666665 0 4.142515625000001 -2.627055208333333 9.1632 -3.9683864583333337 9.1632 -2.391760416666667 0 -5.372680208333334 -6.652869791666666 -5.372680208333334 -9.980222291666667C13.274809375 0.5304494791666666 13.856541666666667 0.23958333333333334 15.373870833333335 0.23958333333333334h0.0055583333333333335Z" stroke-width="1"></path></svg>
<?php echo $extensionKey; ?></h1>
</header>
<main class="container">
<blockquote><?php echo $description; ?></blockquote>
<hr/>
<p>Run <code>ddev install all</code> to install all TYPO3 instances below:</p>
<?php
foreach ($supportedVersions as $version) {
$directoryPath = '/var/www/html/.Build/' . $version;
if (is_dir($directoryPath)) {
echo "<article class='flex'><kbd>{$version}</kbd><div><strong>Frontend</strong><br/><strong>Backend</strong></div><div><a target='_blank' href='https://{$version}.{$extensionKey}.ddev.site'>https://{$version}.{$extensionKey}.ddev.site</a><br/><a target='_blank' href='https://{$version}.{$extensionKey}.ddev.site/typo3/?u={$typo3AdminUser}&p={$typo3AdminPassword}'>https://{$version}.{$extensionKey}.ddev.site/typo3</a></div></article>";
} else {
echo "<article>Version {$version} is not installed. Run <code>ddev install {$version}</code> to install.</article>";
}
}
?>
<h2>Additional information</h2>
<h4>DDEV commands</h4>
<?php
// Directories to scan for DDEV commands
$directories = [
'/var/www/html/.ddev/commands/web',
'/var/www/html/.ddev/commands/host',
];

foreach ($directories as $directory) {
foreach (new DirectoryIterator($directory) as $fileInfo) {
$filePath = $fileInfo->getPathname();
$fileName = $fileInfo->getFilename();

if ($fileName[0] === '.' || $fileInfo->isDir()) {
continue;
}

$fileContent = file($filePath);
if (str_starts_with($fileContent[0], '#!/bin/bash')) {
$description = '';
$usage = '';
$example = '';

foreach ($fileContent as $line) {
if (str_starts_with($line, '## Description:')) {
$description = trim(str_replace('## Description:', '', $line));
} elseif (str_starts_with($line, '## Usage:')) {
$usage = trim(str_replace('## Usage:', '', $line));
} elseif (str_starts_with($line, '## Example:')) {
$example = trim(str_replace('## Example:', '', $line));
}
}

echo "<article><code>ddev $usage</code><br/>$description<br/> <em>Example: $example</em></article>";
}
}
}
?>
<details open>
<summary><h4>TYPO3 Backend Credentials</h4></summary>
<ul>
<li>Username: <code><?php echo $typo3AdminUser; ?></code></li>
<li>Password: <code><?php echo $typo3AdminPassword; ?></code></li>
</ul>
</details>
</main>

</body>
</html>
26 changes: 26 additions & 0 deletions .ddev/addon-metadata/typo3-multi-version-extension/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: typo3-multi-version-extension
repository: konradmichalik/ddev-typo3-multi-version-extension
version: 0.3.0
install_date: "2026-04-20T14:42:24+02:00"
project_files:
- .setup/scripts/utils.sh
- .setup/templates/index.php
- .setup/Tests/Acceptance/Fixtures/
- apache/10.conf
- apache/20.conf
- commands/host/launch
- commands/web/.install-11
- commands/web/.install-12
- commands/web/.install-13
- commands/web/.install-14
- commands/web/11
- commands/web/12
- commands/web/13
- commands/web/14
- commands/web/all
- commands/web/install
- docker-compose.typo3-setup.yaml
global_files: []
removal_actions:
- rm ${DDEV_APPROOT}/.ddev/config.typo3-setup.yaml
- rm -f ${DDEV_APPROOT}/.ddev/.setup/
43 changes: 43 additions & 0 deletions .ddev/apache/10.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ddev-generated
# If you want to take over this file and customize it, remove the line above
# and ddev will respect it and won't overwrite the file.
# See https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#custom-apache-configuration
<VirtualHost *:80>
ServerName repeatable-form-elements.ddev.site
DocumentRoot /var/www/html/.Build
<Directory "/var/www/html/.Build">
AllowOverride All
Allow from All
</Directory>

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ https://%{HTTP_HOST}$1/ [redirect,last]
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
ErrorLog /dev/stdout
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias "/phpstatus" "/var/www/phpstatus.php"
</VirtualHost>

<VirtualHost *:443>
ServerName repeatable-form-elements.ddev.site
DocumentRoot /var/www/html/.Build
<Directory "/var/www/html/.Build">
AllowOverride All
Allow from All
</Directory>

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ https://%{HTTP_HOST}$1/ [redirect,last]
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
ErrorLog /dev/stdout
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias "/phpstatus" "/var/www/phpstatus.php"

SSLEngine on
SSLCertificateFile /etc/ssl/certs/master.crt
SSLCertificateKeyFile /etc/ssl/certs/master.key
</VirtualHost>
51 changes: 51 additions & 0 deletions .ddev/apache/20.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ddev-generated
# If you want to take over this file and customize it, remove the line above
# and ddev will respect it and won't overwrite the file.
# See https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#custom-apache-configuration
<VirtualHost *:80>
ServerName sub.repeatable-form-elements.ddev.site
ServerAlias *.repeatable-form-elements.ddev.site
DocumentRoot /var/www/html/.Build
<Directory "/var/www/html/.Build">
AllowOverride All
Allow from All
</Directory>

RewriteEngine On
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+)\.repeatable-form-elements\.ddev\.site$
RewriteRule ^(.*)$ /var/www/html/.Build/%1/public/$1 [L]

RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ https://%{HTTP_HOST}$1/ [redirect,last]
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
ErrorLog /dev/stdout
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias "/phpstatus" "/var/www/phpstatus.php"
</VirtualHost>

<VirtualHost *:443>
ServerName sub.repeatable-form-elements.ddev.site
ServerAlias *.repeatable-form-elements.ddev.site
DocumentRoot /var/www/html/.Build
<Directory "/var/www/html/.Build">
AllowOverride All
Allow from All
</Directory>

RewriteEngine On
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+)\.repeatable-form-elements\.ddev\.site$
RewriteRule ^(.*)$ /var/www/html/.Build/%1/public/$1 [L]

RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ https://%{HTTP_HOST}$1/ [redirect,last]
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
ErrorLog /dev/stdout
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias "/phpstatus" "/var/www/phpstatus.php"

SSLEngine on
SSLCertificateFile /etc/ssl/certs/master.crt
SSLCertificateKeyFile /etc/ssl/certs/master.key
</VirtualHost>
19 changes: 19 additions & 0 deletions .ddev/commands/web/.install-11
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

## #ddev-generated
. .ddev/.setup/scripts/utils.sh

# Pre-setup function for TYPO3 version 11.
# This function is part of the installation script and is responsible for performing
# initial setup tasks before the main installation process begins.
pre_setup 11

#_progress " ├─ Install additional composer packages"
# composer req x/y:'^1.0' \
# --no-progress -n -d $BASE_PATH
#_done

# Function to perform post-setup tasks.
# This function is called after the main installation process to finalize the setup.
# It typically includes tasks such as configuring settings, modifying files, and other necessary adjustments.
post_setup
18 changes: 18 additions & 0 deletions .ddev/commands/web/.install-12
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

. .ddev/.setup/scripts/utils.sh

# Pre-setup function for TYPO3 version 12.
# This function is part of the installation script and is responsible for performing
# initial setup tasks before the main installation process begins.
pre_setup 12

#_progress " ├─ Install additional composer packages"
# composer req x/y:'^1.0' \
# --no-progress -n -d $BASE_PATH
#_done

# Function to perform post-setup tasks.
# This function is called after the main installation process to finalize the setup.
# It typically includes tasks such as configuring settings, modifying files, and other necessary adjustments.
post_setup
44 changes: 44 additions & 0 deletions .ddev/commands/web/.install-13
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

. .ddev/.setup/scripts/utils.sh

# Pre-setup function for TYPO3 version 13.
pre_setup 13

# Copy form definitions to fileadmin (before post_setup so they exist when TYPO3 boots)
_progress " ├─ Copy form definitions"
FORM_DIR="$BASE_PATH/public/fileadmin/form_definitions"
mkdir -p "$FORM_DIR"
cp /var/www/html/Tests/Acceptance/Fixtures/form_definitions/*.form.yaml "$FORM_DIR/" 2>/dev/null || true
_done

post_setup

# v13 needs sys_template with explicit TypoScript imports + PAGE definition
_progress " ├─ Configure sys_template"
cd $BASE_PATH
php -r '
$pdo = new PDO("mysql:host=db;dbname='$DATABASE'", "root", "root");
$config = "@import \"EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript\"\n@import \"EXT:form/Configuration/TypoScript/setup.typoscript\"\n@import \"EXT:repeatable_form_elements/Configuration/TypoScript/setup.typoscript\"\n\npage = PAGE\npage.typeNum = 0\npage.includeCSSLibs.bootstrap = https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\npage.includeCSSLibs.bootstrap.external = 1\npage.10 = FLUIDTEMPLATE\npage.10.templateName = Default\npage.10.templateRootPaths.10 = EXT:sitepackage/Resources/Private/Templates/Page/\npage.10.layoutRootPaths.10 = EXT:sitepackage/Resources/Private/Layouts/\n";
$pdo->prepare("UPDATE sys_template SET config = ? WHERE pid = 1")->execute([$config]);
echo "sys_template updated\n";
'
_done

# Add site set dependency AFTER post_setup (site config is created during post_setup)
_progress " ├─ Configure site set"
SITE_CONFIG="$BASE_PATH/config/sites/main/config.yaml"
if [ -f "$SITE_CONFIG" ]; then
cd $BASE_PATH
php -r '
$f = "config/sites/main/config.yaml";
$c = file_get_contents($f);
$c = preg_replace("/^dependencies:\n( - .*\n)*/m", "dependencies:\n - test/sitepackage\n", $c);
file_put_contents($f, $c);
'
fi
_done

_progress " ├─ Flush cache"
$TYPO3_BIN cache:flush
_done
51 changes: 51 additions & 0 deletions .ddev/commands/web/.install-14
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

. .ddev/.setup/scripts/utils.sh

# Pre-setup function for TYPO3 version 14.
pre_setup 14

# Copy form definitions to fileadmin (before post_setup so they exist when TYPO3 boots)
_progress " ├─ Copy form definitions"
FORM_DIR="$BASE_PATH/public/fileadmin/form_definitions"
mkdir -p "$FORM_DIR"
cp /var/www/html/Tests/Acceptance/Fixtures/form_definitions/*.form.yaml "$FORM_DIR/" 2>/dev/null || true
_done

post_setup

# v14: Remove sys_template to avoid double rendering (site sets provide all TypoScript)
_progress " ├─ Remove sys_template"
cd $BASE_PATH
php -r '
$pdo = new PDO("mysql:host=db;dbname='$DATABASE'", "root", "root");
$pdo->exec("DELETE FROM sys_template");
echo "sys_template removed\n";
'
_done

# v14: Disable contentRenderingTemplates to prevent double content rendering
_progress " ├─ Disable contentRenderingTemplates"
echo '<?php $GLOBALS["TYPO3_CONF_VARS"]["FE"]["contentRenderingTemplates"] = [];' > $BASE_PATH/config/system/additional.php
_done

# Add test/sitepackage to existing site dependencies
_progress " ├─ Configure site set"
SITE_CONFIG="$BASE_PATH/config/sites/main/config.yaml"
if [ -f "$SITE_CONFIG" ]; then
cd $BASE_PATH
php -r '
$f = "config/sites/main/config.yaml";
$c = file_get_contents($f);
if (strpos($c, "test/sitepackage") === false) {
$c = preg_replace("/^(dependencies:\n(?: - .*\n)*)/m", "$1 - test/sitepackage\n", $c);
file_put_contents($f, $c);
}
'
fi
_done

_progress " ├─ Flush cache"
rm -rf $BASE_PATH/var/cache/*
$TYPO3_BIN cache:flush
_done
24 changes: 24 additions & 0 deletions .ddev/commands/web/11
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

## #ddev-generated
## Description: Exec command for TYPO3 instance 11.
## Usage: 11
## Example: "ddev 11 composer du -o" or "ddev 11 typo3 cache:flush"

. .ddev/.setup/scripts/utils.sh

command=$@
version=11

if [[ $command == typo3* ]]; then
command="/usr/bin/php vendor/bin/typo3cms${command:5}"
fi

TYPO3_PATH=".Build/${version}"
if [ -d "$TYPO3_PATH" ]; then
message magenta "[TYPO3 v${version}] ${command}"
cd $TYPO3_PATH
$command
else
message red "TYPO3 binary not found for version ${version}"
fi
Loading