|
| 1 | +<?php |
| 2 | +declare(strict_types=1); |
| 3 | + |
| 4 | +$extensionKey = getenv('EXTENSION_NAME'); |
| 5 | +$typo3AdminUser = getenv('TYPO3_SETUP_ADMIN_USERNAME'); |
| 6 | +$typo3AdminPassword = getenv('TYPO3_SETUP_ADMIN_PASSWORD'); |
| 7 | +$supportedVersions = explode(' ', getenv('TYPO3_VERSIONS')); |
| 8 | + |
| 9 | +// Check if composer.json exists |
| 10 | +$composerJsonPath = __DIR__.'/../composer.json'; |
| 11 | +if (file_exists($composerJsonPath)) { |
| 12 | + $composerJsonContent = file_get_contents($composerJsonPath); |
| 13 | + $composerData = json_decode($composerJsonContent, true); |
| 14 | + $description = $composerData['description']; |
| 15 | +} else { |
| 16 | + $description = 'composer.json file not found. =('; |
| 17 | +} |
| 18 | +?> |
| 19 | +<!DOCTYPE html> |
| 20 | +<html lang="en"> |
| 21 | +<head> |
| 22 | + <meta charset="UTF-8"> |
| 23 | + <title><?php echo $extensionKey; ?></title> |
| 24 | + <link |
| 25 | + rel="stylesheet" |
| 26 | + href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css" |
| 27 | + > |
| 28 | + <style> |
| 29 | + .flex { |
| 30 | + display: flex; |
| 31 | + gap: 10px; |
| 32 | + } |
| 33 | + </style> |
| 34 | +</head> |
| 35 | +<body> |
| 36 | +<header class="container"> |
| 37 | + <h1> |
| 38 | + <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> |
| 39 | + <?php echo $extensionKey; ?></h1> |
| 40 | +</header> |
| 41 | +<main class="container"> |
| 42 | + <blockquote><?php echo $description; ?></blockquote> |
| 43 | + <hr/> |
| 44 | + <p>Run <code>ddev install all</code> to install all TYPO3 instances below:</p> |
| 45 | + <?php |
| 46 | + foreach ($supportedVersions as $version) { |
| 47 | + $directoryPath = '/var/www/html/.Build/'.$version; |
| 48 | + if (is_dir($directoryPath)) { |
| 49 | + 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>"; |
| 50 | + } else { |
| 51 | + echo "<article>Version {$version} is not installed. Run <code>ddev install {$version}</code> to install.</article>"; |
| 52 | + } |
| 53 | + } |
| 54 | +?> |
| 55 | + <h2>Additional information</h2> |
| 56 | + <h4>DDEV commands</h4> |
| 57 | + <?php |
| 58 | +// Directories to scan for DDEV commands |
| 59 | +$directories = [ |
| 60 | + '/var/www/html/.ddev/commands/web', |
| 61 | + '/var/www/html/.ddev/commands/host', |
| 62 | +]; |
| 63 | + |
| 64 | +foreach ($directories as $directory) { |
| 65 | + foreach (new DirectoryIterator($directory) as $fileInfo) { |
| 66 | + $filePath = $fileInfo->getPathname(); |
| 67 | + $fileName = $fileInfo->getFilename(); |
| 68 | + |
| 69 | + if ('.' === $fileName[0] || $fileInfo->isDir()) { |
| 70 | + continue; |
| 71 | + } |
| 72 | + |
| 73 | + $fileContent = file($filePath); |
| 74 | + if (str_starts_with($fileContent[0], '#!/bin/bash')) { |
| 75 | + $description = ''; |
| 76 | + $usage = ''; |
| 77 | + $example = ''; |
| 78 | + |
| 79 | + foreach ($fileContent as $line) { |
| 80 | + if (str_starts_with($line, '## Description:')) { |
| 81 | + $description = trim(str_replace('## Description:', '', $line)); |
| 82 | + } elseif (str_starts_with($line, '## Usage:')) { |
| 83 | + $usage = trim(str_replace('## Usage:', '', $line)); |
| 84 | + } elseif (str_starts_with($line, '## Example:')) { |
| 85 | + $example = trim(str_replace('## Example:', '', $line)); |
| 86 | + } |
| 87 | + } |
| 88 | + |
| 89 | + echo "<article><code>ddev $usage</code><br/>$description<br/> <em>Example: $example</em></article>"; |
| 90 | + } |
| 91 | + } |
| 92 | +} |
| 93 | +?> |
| 94 | + <details open> |
| 95 | + <summary><h4>TYPO3 Backend Credentials</h4></summary> |
| 96 | + <ul> |
| 97 | + <li>Username: <code><?php echo $typo3AdminUser; ?></code></li> |
| 98 | + <li>Password: <code><?php echo $typo3AdminPassword; ?></code></li> |
| 99 | + </ul> |
| 100 | + </details> |
| 101 | +</main> |
| 102 | + |
| 103 | +</body> |
| 104 | +</html> |
0 commit comments