-
Notifications
You must be signed in to change notification settings - Fork 0
build(ddev): update multi-version add-on to 0.3.3 and add test fixtures #49
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
Changes from all commits
21f5434
9c50f79
6ab0f36
becd87d
d8c9ba3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,104 @@ | ||||||||||||||||||||||||||||||||||||||
| <?php | ||||||||||||||||||||||||||||||||||||||
| declare(strict_types=1); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| $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>"; | ||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Don’t put the backend password in the URL. Line 49 sends Proposed fix- 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>";
+ 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/'>https://{$version}.{$extensionKey}.ddev.site/typo3</a></div></article>";📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
| } 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) { | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+59
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Skip missing command directories before iterating.
Proposed fix foreach ($directories as $directory) {
+ if (!is_dir($directory)) {
+ continue;
+ }
+
foreach (new DirectoryIterator($directory) as $fileInfo) {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
| $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> | ||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,26 @@ | ||
| name: typo3-multi-version-extension | ||
| repository: konradmichalik/ddev-typo3-multi-version-extension | ||
| version: 0.1.0 | ||
| install_date: "2025-07-31T12:02:23+02:00" | ||
| version: 0.3.3 | ||
| install_date: "2026-06-25T15:55:59+02:00" | ||
| project_files: | ||
| - .typo3-setup/scripts/utils.sh | ||
| - .typo3-setup/templates/index.php | ||
| - .typo3-setup/Tests/.typo3-setup/ | ||
| - .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/.typo3-setup/ | ||
| - rm -rf ${DDEV_APPROOT}/Tests/.typo3-setup/ | ||
| - rm -f ${DDEV_APPROOT}/.ddev/config.typo3-setup.yaml | ||
| - rm -rf ${DDEV_APPROOT}/.ddev/.setup/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/bash | ||
| set -eo pipefail | ||
|
|
||
| . .ddev/.setup/scripts/utils.sh | ||
|
|
||
| # Pre-setup function for TYPO3 version 14 | ||
| # This function is part of the installation script and is responsible for performing | ||
| # initial setup tasks before the main installation process begins. | ||
| pre_setup 14 | ||
|
|
||
| #_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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: Exec command for TYPO3 instance 14. | ||
| ## Usage: 14 | ||
| ## Example: "ddev 14 composer du -o" or "ddev 14 typo3 cache:flush" | ||
|
|
||
| . .ddev/.setup/scripts/utils.sh | ||
|
|
||
| command=$@ | ||
| version=14 | ||
|
|
||
| if [[ $command == typo3* ]]; then | ||
| command="/usr/bin/php vendor/bin/${command}" | ||
| 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 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,13 +1,20 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## #ddev-generated | ||||||||||||||||||||||||||||||||||||||||||||||||
| ## Description: Install TYPO3 instances. | ||||||||||||||||||||||||||||||||||||||||||||||||
| ## Usage: install | ||||||||||||||||||||||||||||||||||||||||||||||||
| ## Example: "ddev install" or "ddev install 12" or "ddev install all" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ## Description: Install TYPO3 instances. Pass -v/--verbose to stream all command output. | ||||||||||||||||||||||||||||||||||||||||||||||||
| ## Usage: install [version|all] [-v|--verbose] | ||||||||||||||||||||||||||||||||||||||||||||||||
| ## Example: "ddev install" or "ddev install 12" or "ddev install all" or "ddev install 14 -v" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ## MutagenSync: true | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| TYPO3=${1} | ||||||||||||||||||||||||||||||||||||||||||||||||
| TYPO3="" | ||||||||||||||||||||||||||||||||||||||||||||||||
| for arg in "$@"; do | ||||||||||||||||||||||||||||||||||||||||||||||||
| case "$arg" in | ||||||||||||||||||||||||||||||||||||||||||||||||
| -v|--verbose) export VERBOSE=1 ;; | ||||||||||||||||||||||||||||||||||||||||||||||||
| *) [ -z "$TYPO3" ] && TYPO3="$arg" ;; | ||||||||||||||||||||||||||||||||||||||||||||||||
| esac | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Reject unknown flags and extra positional args. This loop keeps only the first non-verbose token. Suggested guard TYPO3=""
for arg in "$@"; do
case "$arg" in
-v|--verbose) export VERBOSE=1 ;;
- *) [ -z "$TYPO3" ] && TYPO3="$arg" ;;
+ -*)
+ message red "Unknown option: $arg"
+ exit 1
+ ;;
+ *)
+ if [ -z "$TYPO3" ]; then
+ TYPO3="$arg"
+ else
+ message red "Unexpected extra argument: $arg"
+ exit 1
+ fi
+ ;;
esac
done📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| . .ddev/.typo3-setup/scripts/utils.sh | ||||||||||||||||||||||||||||||||||||||||||||||||
| . .ddev/.setup/scripts/utils.sh | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$TYPO3" == "all" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||
| mapfile -t versions < <(get_supported_typo3_versions) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| type: php | ||
| docroot: .Build | ||
| webserver_type: apache-fpm | ||
| additional_hostnames: | ||
| - 11.xima-typo3-internal-news | ||
| - 12.xima-typo3-internal-news | ||
| - 13.xima-typo3-internal-news | ||
| - 14.xima-typo3-internal-news | ||
| hooks: | ||
| post-start: | ||
| - exec: mkdir -p /var/www/html/.Build/ && cp /var/www/html/.ddev/.typo3-setup/templates/* /var/www/html/.Build/ | ||
| - exec: mkdir -p /var/www/html/.Build/ && cp /var/www/html/.ddev/.setup/templates/* /var/www/html/.Build/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| mod { | ||
| web_layout { | ||
| backendLayouts { | ||
| default { | ||
| jsFile = EXT:xima_typo3_internal_news/Resources/Public/JavaScript/backend.js | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+1
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify how TYPO3 13/14 parses page.tsconfig backendLayouts key casing
# and whether the generated backend layout is registered.
# Check for custom BackendLayoutDataProvider or jsFile usage
rg -n "jsFile" --type-add 'typo3:*.{php,tsconfig}' -t typo3
# Check for extension code that might read this PageTSConfig path
rg -n "BackendLayouts|backendLayouts" --type-add 'typo3:*.{php,tsconfig}' -t typo3
# Check if there's a custom data provider
rg -n "PageTsBackendLayoutDataProvider|BackendLayoutDataProvider" --type-add 'typo3:*.php' -t typo3Repository: xima-media/xima-typo3-internal-news Length of output: 173 Fix missing backend layout grid definition and correct TSconfig key casing The current Update the file to match the standard structure:
Corrected structure example🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Escape dynamic values before rendering HTML.
Environment values, Composer metadata, versions, and command descriptions are rendered raw. A quote or markup character can break the page or inject HTML into the DDEV landing page.
Proposed pattern
$supportedVersions = explode(' ', getenv('TYPO3_VERSIONS')); + +function h(mixed $value): string +{ + return htmlspecialchars((string)$value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); +}Apply the same
h()wrapper to$description,$version,$usage,$example,$typo3AdminUser, and$typo3AdminPassword; userawurlencode()for URL path/query components.Also applies to: 42-42, 49-51, 89-89, 97-98
🤖 Prompt for AI Agents