From 6b7ba3bc470b9d785dafc3c6871fccba83bb32e4 Mon Sep 17 00:00:00 2001 From: ArthurErlich Date: Mon, 2 Nov 2026 23:29:05 +0100 Subject: [PATCH 1/2] fix(dump): pass --column-statistics=0 for MySQL 8 mysqldump on MariaDB, release as 0.0.7 Backport for the Shopware 6.6 line. When the server is MariaDB but only MySQL 8's mysqldump is installed (e.g. dockware/web), the dump aborted with "Unknown table 'COLUMN_STATISTICS' in information_schema (1109)". Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 ++++++ composer.json | 2 +- src/Service/DumpBinaryLocator.php | 14 ++++++++++++++ src/Service/DumpService.php | 1 + src/Service/MySqlVariant.php | 14 ++++++++++++++ tests/Service/MySqlVariantTest.php | 16 ++++++++++++++++ 6 files changed, 52 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbe3c51..e36bf68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.0.7] - 2026-11-02 + +### Fixed + +- Creating a dump failed on MariaDB when only MySQL 8's `mysqldump` was installed (`Unknown table 'COLUMN_STATISTICS'`); it now passes `--column-statistics=0` in that case. + ## [0.0.6] - 2026-10-04 ### Changed diff --git a/composer.json b/composer.json index 01f6008..0be72f6 100755 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Export database dumps for Shopware 6 environments.", "type": "shopware-platform-plugin", "license": "MIT", - "version": "0.0.6", + "version": "0.0.7", "keywords": [ "shopware", "shopware6", diff --git a/src/Service/DumpBinaryLocator.php b/src/Service/DumpBinaryLocator.php index 7083d31..ff5b442 100644 --- a/src/Service/DumpBinaryLocator.php +++ b/src/Service/DumpBinaryLocator.php @@ -6,6 +6,7 @@ use AeonDumpManager\Service\Exception\DumpBinaryNotFoundException; use Doctrine\DBAL\Connection; use Shopware\Core\System\SystemConfig\SystemConfigService; use Symfony\Component\Process\ExecutableFinder; +use Symfony\Component\Process\Process; /** * Picks mariadb-dump/mysqldump depending on what the configured DB connection @@ -38,6 +39,19 @@ class DumpBinaryLocator throw DumpBinaryNotFoundException::create($binaryNames); } + /** + * @return list client-specific flags for the located binary + */ + public function extraArguments(string $binary): array + { + $version = new Process([$binary, '--version']); + $version->run(); + + return MySqlVariant::needsColumnStatisticsOff($version->getOutput(), $this->isMariaDb()) + ? ['--column-statistics=0'] + : []; + } + private function isMariaDb(): bool { // Connection::getServerVersion() is private in the DBAL version this diff --git a/src/Service/DumpService.php b/src/Service/DumpService.php index d0cb382..8e8b958 100644 --- a/src/Service/DumpService.php +++ b/src/Service/DumpService.php @@ -173,6 +173,7 @@ class DumpService $binary, '--single-transaction', '--quick', + ...$this->dumpBinaryLocator->extraArguments($binary), '-h', (string) ($params['host'] ?? '127.0.0.1'), '-P', (string) ($params['port'] ?? 3306), '-u', (string) ($params['user'] ?? 'root'), diff --git a/src/Service/MySqlVariant.php b/src/Service/MySqlVariant.php index 1f609da..b247833 100644 --- a/src/Service/MySqlVariant.php +++ b/src/Service/MySqlVariant.php @@ -14,4 +14,18 @@ class MySqlVariant { return stripos($serverVersion, 'mariadb') !== false; } + + /** + * MySQL 8+ mysqldump queries information_schema.COLUMN_STATISTICS, which + * MariaDB lacks (error 1109); --column-statistics=0 skips it. MariaDB's own + * client (version string contains "MariaDB") and MySQL < 8 don't know the flag. + */ + public static function needsColumnStatisticsOff(string $clientVersion, bool $serverIsMariaDb): bool + { + return $serverIsMariaDb + && !self::isMariaDb($clientVersion) + // MySQL < 8 prints "Ver 10.13 Distrib 5.7.x": the Distrib number is the real version. + && (preg_match('/Distrib (\d+)\./', $clientVersion, $m) === 1 || preg_match('/\bVer (\d+)\./', $clientVersion, $m) === 1) + && (int) $m[1] >= 8; + } } diff --git a/tests/Service/MySqlVariantTest.php b/tests/Service/MySqlVariantTest.php index 8947726..68804b7 100644 --- a/tests/Service/MySqlVariantTest.php +++ b/tests/Service/MySqlVariantTest.php @@ -21,4 +21,20 @@ class MySqlVariantTest extends TestCase yield 'mariadb without legacy prefix' => ['10.11.2-MariaDB', true]; yield 'mariadb lowercase' => ['10.11.2-mariadb', true]; } + + #[DataProvider('columnStatisticsProvider')] + public function testNeedsColumnStatisticsOff(string $clientVersion, bool $serverIsMariaDb, bool $expected): void + { + self::assertSame($expected, MySqlVariant::needsColumnStatisticsOff($clientVersion, $serverIsMariaDb)); + } + + public static function columnStatisticsProvider(): iterable + { + $mysql8 = 'mysqldump Ver 8.0.46-0ubuntu0.24.04.4 for Linux on x86_64 ((Ubuntu))'; + yield 'mysql 8 client, mariadb server' => [$mysql8, true, true]; + yield 'mysql 8 client, mysql server' => [$mysql8, false, false]; + yield 'mysql 5.7 client, mariadb server' => ['mysqldump Ver 10.13 Distrib 5.7.44, for Linux (x86_64)', true, false]; + yield 'mariadb client, mariadb server' => ['mariadb-dump from 11.4.2-MariaDB, client 10.19 for debian-linux-gnu (x86_64)', true, false]; + yield 'mariadb legacy mysqldump name' => ['mysqldump Ver 10.19 Distrib 10.11.6-MariaDB, for debian-linux-gnu (x86_64)', true, false]; + } } -- 2.54.0 From fa50fa3343312555267598678cff3309a2a07e69 Mon Sep 17 00:00:00 2001 From: ArthurErlich Date: Mon, 2 Nov 2026 23:33:58 +0100 Subject: [PATCH 2/2] ci(phpunit): install core patches that have no shopware/production tag The newest shopware/core in ~6.6.0 is 6.6.10.31, but shopware/production is only tagged up to 6.6.10.30, so create-project failed. Install the newest template inside the constraint and require the resolved core version on top. Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/plugin-checks.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/plugin-checks.yml b/.gitea/workflows/plugin-checks.yml index 71c3f8b..c8b761b 100644 --- a/.gitea/workflows/plugin-checks.yml +++ b/.gitea/workflows/plugin-checks.yml @@ -110,6 +110,7 @@ jobs: test -n "$VERSION" || { echo "::error::could not resolve a Shopware version for ${CONSTRAINT}"; exit 1; } echo "Shopware ${VERSION} (constraint ${CONSTRAINT})" echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "constraint=${CONSTRAINT}" >> "$GITHUB_OUTPUT" # Project (vendor/, phpunit, config) and the installed database as a SQL dump. Neither depends on the plugin. - name: Restore Shopware project and database id: shopware @@ -125,8 +126,13 @@ jobs: if: steps.shopware.outputs.cache-hit != 'true' run: | set -e - composer create-project "shopware/production:${{ steps.sw.outputs.version }}" shopware --no-interaction --no-scripts - composer require --dev phpunit/phpunit:^10 --no-interaction --no-scripts -d shopware + # shopware/production pins one exact core version and is not tagged for every core patch + # (e.g. core 6.6.10.31, template only up to 6.6.10.30): take the newest template inside the + # constraint, then require the resolved core version on top of it. + composer create-project "shopware/production:${{ steps.sw.outputs.constraint }}" shopware --no-interaction --no-scripts --no-install + composer require "shopware/core:${{ steps.sw.outputs.version }}" --no-update -d shopware + composer require --dev phpunit/phpunit:^10 --no-update -d shopware + composer update -W --no-interaction --no-scripts -d shopware - name: Ensure the MariaDB client run: | command -v mariadb-dump >/dev/null || command -v mysqldump >/dev/null && exit 0 -- 2.54.0