From 44e7648e06176e12ff25595efaa53334da2aa00f Mon Sep 17 00:00:00 2001 From: Haylan Date: Mon, 14 Sep 2026 22:00:26 +0200 Subject: [PATCH] feat(dump): locate mysqldump/mariadb-dump binary --- src/Resources/config/config.xml | 5 +++ src/Service/DumpBinaryLocator.php | 45 +++++++++++++++++++ .../Exception/DumpBinaryNotFoundException.php | 16 +++++++ 3 files changed, 66 insertions(+) mode change 100644 => 100755 src/Resources/config/config.xml create mode 100644 src/Service/DumpBinaryLocator.php create mode 100644 src/Service/Exception/DumpBinaryNotFoundException.php diff --git a/src/Resources/config/config.xml b/src/Resources/config/config.xml old mode 100644 new mode 100755 index 46a0c16..42334d0 --- a/src/Resources/config/config.xml +++ b/src/Resources/config/config.xml @@ -16,6 +16,11 @@ 0 + + dumpBinaryName + + "" + diff --git a/src/Service/DumpBinaryLocator.php b/src/Service/DumpBinaryLocator.php new file mode 100644 index 0000000..0027f63 --- /dev/null +++ b/src/Service/DumpBinaryLocator.php @@ -0,0 +1,45 @@ +systemConfigService->getString('AeonDumpManager.config.dumpBinaryName'); + $binaryNames = $configuredName !== '' + ? [$configuredName] + : ($this->isMariaDb() ? ['mariadb-dump', 'mysqldump'] : ['mysqldump']); + + foreach ($binaryNames as $binaryName) { + $path = $this->executableFinder->find($binaryName); + if ($path !== null) { + return $path; + } + } + + throw DumpBinaryNotFoundException::create($binaryNames); + } + + private function isMariaDb(): bool + { + return MySqlVariant::isMariaDb($this->connection->getServerVersion()); + } +} diff --git a/src/Service/Exception/DumpBinaryNotFoundException.php b/src/Service/Exception/DumpBinaryNotFoundException.php new file mode 100644 index 0000000..f086bb5 --- /dev/null +++ b/src/Service/Exception/DumpBinaryNotFoundException.php @@ -0,0 +1,16 @@ +