From c4ce4cc39b97198dff7bc00ef912f22cc4511095 Mon Sep 17 00:00:00 2001 From: Tom Robertshaw Date: Fri, 18 Dec 2015 11:49:19 +0000 Subject: [PATCH] Fixes #24: Remove magerun db:dump command usage. --- src/Meanbee/Magedbm/Command/PutCommand.php | 38 ++-------------------- 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/src/Meanbee/Magedbm/Command/PutCommand.php b/src/Meanbee/Magedbm/Command/PutCommand.php index e5f697e..c4eecf6 100644 --- a/src/Meanbee/Magedbm/Command/PutCommand.php +++ b/src/Meanbee/Magedbm/Command/PutCommand.php @@ -198,49 +198,15 @@ protected function cleanUp() } /** - * Create database backup in tmp directory. - * Use magerun db:dump if available. Otherwise use php alternative if exec not available. + * Database export without using exec. * * @param InputInterface $input * @param OutputInterface $output - * * @throws \Exception */ private function createBackup(InputInterface $input, OutputInterface $output) { - $magerun = $this->getMagerun(); - $filePath = $this->getFilePath($input); - - try { - /** @var \N98\Magento\Command\Database\DumpCommand $dumpCommand */ - $dumpCommand = $magerun->find("db:dump"); - - $stripOptions = $input->getOption('strip') ? : '@development'; - $dumpInput = new ArrayInput(array( - 'filename' => $filePath, - '--strip' => $stripOptions, - '--compression' => 'gzip', - )); - - if ($dumpCommand->run($dumpInput, $output)) { - throw new \Exception("magerun db:dump failed to create backup.."); - } - } catch (\InvalidArgumentException $e) { - $this->createBackupWithoutExec($input, $output); - - $output->writeln('Finished'); - } - } - - /** - * PHP alternative to dump database without exec - * - * @param InputInterface $input - * @param OutputInterface $output - * @throws \Exception - */ - private function createBackupWithoutExec(InputInterface $input, OutputInterface $output) - { + // Use Magerun for getting DB details $magerun = $this->getMagerun(); $filePath = $this->getFilePath($input);