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 @@ +