Skip to content
This repository has been archived by the owner on Dec 24, 2021. It is now read-only.

Commit

Permalink
Fixed permission error for migrations running in separate processes
Browse files Browse the repository at this point in the history
  • Loading branch information
cleggypdc committed Jun 29, 2017
1 parent ad620de commit 5f60d88
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/PimcoreMigrations/Migration/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -152,7 +152,7 @@ public function migrate()
} else {
$this->output->writeln(' - <error>Migration Failed :-(</error>');
$this->output->writeln('<comment>' . implode('\n', $result[1]) . '</comment>');
throw new \Exception('Migration Failure, exit code ' . $result);
throw new \Exception('Migration Failure, exit code ' . $result[0]);
}

}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5f60d88

Please sign in to comment.