From 5f60d8890faaf6aaa2214453904187f65d2d187c Mon Sep 17 00:00:00 2001 From: Paul Clegg Date: Thu, 29 Jun 2017 19:33:20 +0100 Subject: [PATCH] Fixed permission error for migrations running in separate processes --- lib/PimcoreMigrations/Migration/Manager.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/PimcoreMigrations/Migration/Manager.php b/lib/PimcoreMigrations/Migration/Manager.php index 37edfd1..4bd81de 100644 --- a/lib/PimcoreMigrations/Migration/Manager.php +++ b/lib/PimcoreMigrations/Migration/Manager.php @@ -135,11 +135,11 @@ public function migrate() * @var $migration AbstractMigration */ - if($this->versionInRange($version)) { + if($this->versionInRange($version) && !$migration->hasBeenApplied()) { $this->output->write('Starting Migration ' . $migration->getVersion()); $result = $this->runInSeparateProcess($this->getConsoleCommandPath($migration->getFilename())); } else { - $this->output->writeln(sprintf('Migration version "%d" not in range', $migration->getVersion())); + $this->output->writeln(sprintf('Migration version "%d" skipped', $migration->getVersion())); continue; } @@ -152,7 +152,7 @@ public function migrate() } else { $this->output->writeln(' - Migration Failed :-('); $this->output->writeln('' . implode('\n', $result[1]) . ''); - throw new \Exception('Migration Failure, exit code ' . $result); + throw new \Exception('Migration Failure, exit code ' . $result[0]); } } @@ -229,10 +229,10 @@ protected function getConsoleCommandPath($migrationFile) $cmdPath = PIMCORE_PATH . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'console.php'; $env = \Pimcore\Config::getEnvironment(); if ($env) { - $cmdPath .= '--environment=' . $env; + $env = '--environment=' . $env; } - return $cmdPath . ' deployment:migrations:run "'.$migrationFile.'" ' . $this->getMode(); + return sprintf('php %s %s deployment:migrations:run %s %s', $cmdPath, $env, $migrationFile, $this->getMode()); } protected function runInSeparateProcess($command)