|
@@ -118,7 +118,7 @@ discard block |
|
|
block discarded – undo |
|
118
|
118
|
|
|
119
|
119
|
$processes = array(); |
|
120
|
120
|
/** @var MigrationDefinition $migrationDefinition */ |
|
121
|
|
- foreach($paths as $path => $count) { |
|
|
121
|
+ foreach ($paths as $path => $count) { |
|
122
|
122
|
$this->writeln("<info>Queueing processing of: $path ($count migrations)</info>", OutputInterface::VERBOSITY_VERBOSE); |
|
123
|
123
|
|
|
124
|
124
|
$process = $builder |
|
@@ -168,10 +168,10 @@ discard block |
|
|
block discarded – undo |
|
168
|
168
|
|
|
169
|
169
|
$time = microtime(true) - $start; |
|
170
|
170
|
|
|
171
|
|
- $this->writeln('<info>'.$this->migrationsDone[0].' migrations executed, '.$this->migrationsDone[1].' failed, '.$this->migrationsDone[2].' skipped</info>'); |
|
|
171
|
+ $this->writeln('<info>' . $this->migrationsDone[0] . ' migrations executed, ' . $this->migrationsDone[1] . ' failed, ' . $this->migrationsDone[2] . ' skipped</info>'); |
|
172
|
172
|
|
|
173
|
173
|
// since we use subprocesses, we can not measure max memory used |
|
174
|
|
- $this->writeln("Time taken: ".sprintf('%.2f', $time)." secs"); |
|
|
174
|
+ $this->writeln("Time taken: " . sprintf('%.2f', $time) . " secs"); |
|
175
|
175
|
|
|
176
|
176
|
return $failed; |
|
177
|
177
|
} |
|
@@ -208,7 +208,7 @@ discard block |
|
|
block discarded – undo |
|
208
|
208
|
foreach ($toExecute as $name => $migrationDefinition) { |
|
209
|
209
|
// let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway |
|
210
|
210
|
if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
|
211
|
|
- $this->writeln("<comment>Skipping migration (invalid definition?) Path: ".$migrationDefinition->path."</comment>", self::VERBOSITY_CHILD); |
|
|
211
|
+ $this->writeln("<comment>Skipping migration (invalid definition?) Path: " . $migrationDefinition->path . "</comment>", self::VERBOSITY_CHILD); |
|
212
|
212
|
$skipped++; |
|
213
|
213
|
continue; |
|
214
|
214
|
} |
|
@@ -239,7 +239,7 @@ discard block |
|
|
block discarded – undo |
|
239
|
239
|
$this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input); |
|
240
|
240
|
|
|
241
|
241
|
$executed++; |
|
242
|
|
- } catch(\Exception $e) { |
|
|
242
|
+ } catch (\Exception $e) { |
|
243
|
243
|
$failed++; |
|
244
|
244
|
if ($input->getOption('ignore-failures')) { |
|
245
|
245
|
$this->errOutput->writeln("<error>Migration failed! Path: " . $migrationDefinition->path . ", Reason: " . $e->getMessage() . "</error>", self::VERBOSITY_CHILD); |
|
@@ -264,7 +264,7 @@ discard block |
|
|
block discarded – undo |
|
264
|
264
|
//return $failed; |
|
265
|
265
|
} |
|
266
|
266
|
|
|
267
|
|
- public function onSubProcessOutput($type, $buffer, $process=null) |
|
|
267
|
+ public function onSubProcessOutput($type, $buffer, $process = null) |
|
268
|
268
|
{ |
|
269
|
269
|
$lines = explode("\n", trim($buffer)); |
|
270
|
270
|
|
|
@@ -282,7 +282,7 @@ discard block |
|
|
block discarded – undo |
|
282
|
282
|
|
|
283
|
283
|
// we tag the output from the different processes |
|
284
|
284
|
if (trim($line) !== '') { |
|
285
|
|
- echo '[' . ($process ? $process->getPid() : ''). '] ' . trim($line) . "\n"; |
|
|
285
|
+ echo '[' . ($process ? $process->getPid() : '') . '] ' . trim($line) . "\n"; |
|
286
|
286
|
} |
|
287
|
287
|
} |
|
288
|
288
|
} |
|
@@ -310,7 +310,7 @@ discard block |
|
|
block discarded – undo |
|
310
|
310
|
|
|
311
|
311
|
// filter away all migrations except 'to do' ones |
|
312
|
312
|
$toExecute = array(); |
|
313
|
|
- foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
|
313
|
+ foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
314
|
314
|
if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && in_array($migration->status, $allowedStatuses))) { |
|
315
|
315
|
$toExecute[$name] = $isChild ? $migrationService->parseMigrationDefinition($migrationDefinition) : $migrationDefinition; |
|
316
|
316
|
} |
|
@@ -352,7 +352,7 @@ discard block |
|
|
block discarded – undo |
|
352
|
352
|
{ |
|
353
|
353
|
$output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories'); |
|
354
|
354
|
$output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] . |
|
355
|
|
- ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
|
355
|
+ ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
356
|
356
|
if ($this->migrationsAlreadyDone[Migration::STATUS_STARTED]) { |
|
357
|
357
|
$output->writeln('<info>In the same directories, migrations currently executing: ' . $this->migrationsAlreadyDone[Migration::STATUS_STARTED] . '</info>'); |
|
358
|
358
|
} |
|
@@ -365,7 +365,7 @@ discard block |
|
|
block discarded – undo |
|
365
|
365
|
protected function groupMigrationsByPath($toExecute) |
|
366
|
366
|
{ |
|
367
|
367
|
$paths = array(); |
|
368
|
|
- foreach($toExecute as $name => $migrationDefinition) { |
|
|
368
|
+ foreach ($toExecute as $name => $migrationDefinition) { |
|
369
|
369
|
$path = dirname($migrationDefinition->path); |
|
370
|
370
|
if (!isset($paths[$path])) { |
|
371
|
371
|
$paths[$path] = 1; |