From c1fcbf3aa417dfb1e7fb48d8c97ead40cff9c71c Mon Sep 17 00:00:00 2001 From: Konrad Michalik Date: Tue, 24 Feb 2026 08:58:44 +0100 Subject: [PATCH 1/3] feat: add AVIF, WebP and brotli support checks to requirements --- autoload.php | 1 + deployer/requirements/config/set.php | 1 + .../requirements/task/check_media_support.php | 123 ++++++++++++++++++ deployer/requirements/task/requirements.php | 1 + 4 files changed, 126 insertions(+) create mode 100644 deployer/requirements/task/check_media_support.php diff --git a/autoload.php b/autoload.php index 7a60a1c..daf1072 100644 --- a/autoload.php +++ b/autoload.php @@ -44,6 +44,7 @@ require_once(__DIR__ . '/deployer/requirements/task/check_locales.php'); require_once(__DIR__ . '/deployer/requirements/task/check_packages.php'); require_once(__DIR__ . '/deployer/requirements/task/check_image_processing.php'); +require_once(__DIR__ . '/deployer/requirements/task/check_media_support.php'); require_once(__DIR__ . '/deployer/requirements/task/check_php_extensions.php'); require_once(__DIR__ . '/deployer/requirements/task/check_php_settings.php'); require_once(__DIR__ . '/deployer/requirements/task/check_database.php'); diff --git a/deployer/requirements/config/set.php b/deployer/requirements/config/set.php index 56da57d..93a1191 100644 --- a/deployer/requirements/config/set.php +++ b/deployer/requirements/config/set.php @@ -11,6 +11,7 @@ set('requirements_check_locales_enabled', true); set('requirements_check_packages_enabled', true); set('requirements_check_image_processing_enabled', true); +set('requirements_check_media_support_enabled', true); set('requirements_check_php_extensions_enabled', true); set('requirements_check_php_settings_enabled', true); set('requirements_check_database_enabled', true); diff --git a/deployer/requirements/task/check_media_support.php b/deployer/requirements/task/check_media_support.php new file mode 100644 index 0000000..2e7d72e --- /dev/null +++ b/deployer/requirements/task/check_media_support.php @@ -0,0 +1,123 @@ +hidden(); + +function checkGdFormatSupport(): void +{ + $formats = ['AVIF' => 'AVIF Support', 'WebP' => 'WebP Support']; + + try { + $gdJson = run('php -r "echo function_exists(\'gd_info\') ? json_encode(gd_info()) : \'null\';" 2>/dev/null'); + } catch (RunException) { + foreach ($formats as $label => $key) { + addRequirementRow("GD: $label Support", REQUIREMENT_SKIP, 'Could not query GD'); + } + + return; + } + + $gdInfo = json_decode($gdJson, true); + + if (!is_array($gdInfo)) { + foreach ($formats as $label => $key) { + addRequirementRow("GD: $label Support", REQUIREMENT_SKIP, 'GD not available'); + } + + return; + } + + foreach ($formats as $label => $key) { + $supported = !empty($gdInfo[$key]); + addRequirementRow( + "GD: $label Support", + $supported ? REQUIREMENT_OK : REQUIREMENT_WARN, + $supported ? 'Supported' : 'Not compiled into GD' + ); + } +} + +function checkImageToolFormatSupport(): void +{ + $formats = ['AVIF' => 'AVIF', 'WEBP' => 'WebP']; + $formatList = null; + $toolLabel = null; + + // Try GraphicsMagick first + try { + $output = run('gm convert -list format 2>/dev/null'); + + if ('' !== trim($output)) { + $formatList = $output; + $toolLabel = 'GraphicsMagick'; + } + } catch (RunException) { + // not available + } + + // Fallback to ImageMagick + if (null === $formatList) { + foreach (['magick', 'convert'] as $imCommand) { + try { + $output = run("$imCommand -list format 2>/dev/null"); + + if ('' !== trim($output)) { + $formatList = $output; + $toolLabel = 'ImageMagick'; + + break; + } + } catch (RunException) { + continue; + } + } + } + + if (null === $formatList || null === $toolLabel) { + foreach ($formats as $label) { + addRequirementRow("IM/GM: $label", REQUIREMENT_SKIP, 'No image processing tool found'); + } + + return; + } + + foreach ($formats as $formatKey => $label) { + $supported = (bool) preg_match('/^\s*' . $formatKey . '\b/mi', $formatList); + addRequirementRow( + "$toolLabel: $label", + $supported ? REQUIREMENT_OK : REQUIREMENT_WARN, + $supported ? 'Supported' : 'Format not supported' + ); + } +} + +function checkBrotliExtension(): void +{ + try { + $modules = strtolower(run('php -m 2>/dev/null')); + } catch (RunException) { + addRequirementRow('PHP ext: brotli', REQUIREMENT_SKIP, 'Could not retrieve PHP modules'); + + return; + } + + $loaded = in_array('brotli', array_map('trim', explode("\n", $modules)), true); + addRequirementRow( + 'PHP ext: brotli', + $loaded ? REQUIREMENT_OK : REQUIREMENT_WARN, + $loaded ? 'Loaded' : 'Not loaded' + ); +} diff --git a/deployer/requirements/task/requirements.php b/deployer/requirements/task/requirements.php index 20cba39..34bc9aa 100644 --- a/deployer/requirements/task/requirements.php +++ b/deployer/requirements/task/requirements.php @@ -8,6 +8,7 @@ 'requirements:check:locales', 'requirements:check:packages', 'requirements:check:image_processing', + 'requirements:check:media_support', 'requirements:check:php_extensions', 'requirements:check:php_settings', 'requirements:check:database', From a5478beae96fa1f5280146ab0134d80d074db005 Mon Sep 17 00:00:00 2001 From: Konrad Michalik Date: Tue, 24 Feb 2026 08:59:13 +0100 Subject: [PATCH 2/3] docs: add media support check section to requirements documentation --- docs/REQUIREMENTS.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/REQUIREMENTS.md b/docs/REQUIREMENTS.md index 3b40e49..3005e5f 100644 --- a/docs/REQUIREMENTS.md +++ b/docs/REQUIREMENTS.md @@ -21,7 +21,6 @@ $ dep requirements:list [host] ## Checks ### Locales - Verifies that required system locales are available (default: `de_DE.utf8`, `en_US.utf8`). ### System packages @@ -32,6 +31,20 @@ Checks for required CLI tools: rsync, curl, ghostscript, git, gzip, mariadb-clie Checks for GraphicsMagick (>= 1.3, recommended) or ImageMagick (>= 6.0) with version validation. Either one is sufficient. +### Media support + +Checks for modern media format support across the PHP GD library and the installed image processing tool (GraphicsMagick or ImageMagick): + +| Check | Method | OK | WARN | SKIP | +|-------|--------|----|------|------| +| GD: AVIF Support | `gd_info()` key `AVIF Support` | Compiled into GD | Not compiled into GD | GD not available | +| GD: WebP Support | `gd_info()` key `WebP Support` | Compiled into GD | Not compiled into GD | GD not available | +| IM/GM: AVIF | Format list (`-list format`) | Format supported | Format not supported | No tool found | +| IM/GM: WebP | Format list (`-list format`) | Format supported | Format not supported | No tool found | +| PHP ext: brotli | `php -m` | Loaded | Not loaded | — | + +All checks use WARN (not FAIL) since these features are recommended but not strictly required. + ### PHP version Validates the PHP version against the configured minimum (TYPO3: >= 8.2.0, default: >= 8.1.0). @@ -158,6 +171,9 @@ set('requirements_packages', [ set('requirements_mariadb_min_version', '10.6.0'); set('requirements_mysql_min_version', '8.0.30'); +// Disable media support checks (AVIF, WebP, brotli) +set('requirements_check_media_support_enabled', false); + // Override image processing minimum versions set('requirements_graphicsmagick_min_version', '1.3.30'); set('requirements_imagemagick_min_version', '7.0'); From dc6c143fbcba8e4e840ff6fa6edd6534ac47a74d Mon Sep 17 00:00:00 2001 From: Konrad Michalik Date: Tue, 24 Feb 2026 09:25:20 +0100 Subject: [PATCH 3/3] style: stabilize IM/GM row names and align docs with actual output --- deployer/requirements/task/check_media_support.php | 4 ++-- docs/REQUIREMENTS.md | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/deployer/requirements/task/check_media_support.php b/deployer/requirements/task/check_media_support.php index 2e7d72e..7f4028d 100644 --- a/deployer/requirements/task/check_media_support.php +++ b/deployer/requirements/task/check_media_support.php @@ -97,9 +97,9 @@ function checkImageToolFormatSupport(): void foreach ($formats as $formatKey => $label) { $supported = (bool) preg_match('/^\s*' . $formatKey . '\b/mi', $formatList); addRequirementRow( - "$toolLabel: $label", + "IM/GM: $label", $supported ? REQUIREMENT_OK : REQUIREMENT_WARN, - $supported ? 'Supported' : 'Format not supported' + $supported ? "Supported ($toolLabel)" : "Format not supported ($toolLabel)" ); } } diff --git a/docs/REQUIREMENTS.md b/docs/REQUIREMENTS.md index 3005e5f..63b8cf1 100644 --- a/docs/REQUIREMENTS.md +++ b/docs/REQUIREMENTS.md @@ -37,11 +37,11 @@ Checks for modern media format support across the PHP GD library and the install | Check | Method | OK | WARN | SKIP | |-------|--------|----|------|------| -| GD: AVIF Support | `gd_info()` key `AVIF Support` | Compiled into GD | Not compiled into GD | GD not available | -| GD: WebP Support | `gd_info()` key `WebP Support` | Compiled into GD | Not compiled into GD | GD not available | -| IM/GM: AVIF | Format list (`-list format`) | Format supported | Format not supported | No tool found | -| IM/GM: WebP | Format list (`-list format`) | Format supported | Format not supported | No tool found | -| PHP ext: brotli | `php -m` | Loaded | Not loaded | — | +| GD: AVIF Support | `gd_info()` key `AVIF Support` | Supported | Not compiled into GD | GD not available | +| GD: WebP Support | `gd_info()` key `WebP Support` | Supported | Not compiled into GD | GD not available | +| IM/GM: AVIF | Format list (`-list format`) | Supported (tool name) | Format not supported (tool name) | No image processing tool found | +| IM/GM: WebP | Format list (`-list format`) | Supported (tool name) | Format not supported (tool name) | No image processing tool found | +| PHP ext: brotli | `php -m` | Loaded | Not loaded | Could not retrieve PHP modules | All checks use WARN (not FAIL) since these features are recommended but not strictly required.