|
@@ -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 ? ' or more' : '').' failed, '.$this->migrationsDone[2].' skipped</info>'); |
|
|
171
|
+ $this->writeln('<info>' . $this->migrationsDone[0] . ' migrations executed, ' . $this->migrationsDone[1] . ($failed ? ' or more' : '') . ' 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 + $this->migrationsDone[1]; |
|
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
|
} |
|
@@ -242,7 +242,7 @@ discard block |
|
|
block discarded – undo |
|
242
|
242
|
$this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input); |
|
243
|
243
|
|
|
244
|
244
|
$executed++; |
|
245
|
|
- } catch(\Exception $e) { |
|
|
245
|
+ } catch (\Exception $e) { |
|
246
|
246
|
$failed++; |
|
247
|
247
|
if ($input->getOption('ignore-failures')) { |
|
248
|
248
|
$this->writeErrorln("<error>Migration failed! Path: " . $migrationDefinition->path . ", Reason: " . $e->getMessage() . "</error>", self::VERBOSITY_CHILD); |
|
@@ -267,7 +267,7 @@ discard block |
|
|
block discarded – undo |
|
267
|
267
|
//return $failed; |
|
268
|
268
|
} |
|
269
|
269
|
|
|
270
|
|
- public function onSubProcessOutput($type, $buffer, $process=null) |
|
|
270
|
+ public function onSubProcessOutput($type, $buffer, $process = null) |
|
271
|
271
|
{ |
|
272
|
272
|
$lines = explode("\n", trim($buffer)); |
|
273
|
273
|
|
|
@@ -285,7 +285,7 @@ discard block |
|
|
block discarded – undo |
|
285
|
285
|
|
|
286
|
286
|
// we tag the output from the different processes |
|
287
|
287
|
if (trim($line) !== '') { |
|
288
|
|
- $msg = '[' . ($process ? $process->getPid() : ''). '] ' . trim($line); |
|
|
288
|
+ $msg = '[' . ($process ? $process->getPid() : '') . '] ' . trim($line); |
|
289
|
289
|
if ($type == 'err') { |
|
290
|
290
|
$this->errOutput->writeln($msg, OutputInterface::OUTPUT_RAW); |
|
291
|
291
|
} else { |
|
@@ -318,7 +318,7 @@ discard block |
|
|
block discarded – undo |
|
318
|
318
|
|
|
319
|
319
|
// filter away all migrations except 'to do' ones |
|
320
|
320
|
$toExecute = array(); |
|
321
|
|
- foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
|
321
|
+ foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
322
|
322
|
if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && in_array($migration->status, $allowedStatuses))) { |
|
323
|
323
|
$toExecute[$name] = $isChild ? $migrationService->parseMigrationDefinition($migrationDefinition) : $migrationDefinition; |
|
324
|
324
|
} |
|
@@ -360,7 +360,7 @@ discard block |
|
|
block discarded – undo |
|
360
|
360
|
{ |
|
361
|
361
|
$output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories'); |
|
362
|
362
|
$output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] . |
|
363
|
|
- ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
|
363
|
+ ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
364
|
364
|
if ($this->migrationsAlreadyDone[Migration::STATUS_STARTED]) { |
|
365
|
365
|
$output->writeln('<info>In the same directories, migrations currently executing: ' . $this->migrationsAlreadyDone[Migration::STATUS_STARTED] . '</info>'); |
|
366
|
366
|
} |
|
@@ -373,7 +373,7 @@ discard block |
|
|
block discarded – undo |
|
373
|
373
|
protected function groupMigrationsByPath($toExecute) |
|
374
|
374
|
{ |
|
375
|
375
|
$paths = array(); |
|
376
|
|
- foreach($toExecute as $name => $migrationDefinition) { |
|
|
376
|
+ foreach ($toExecute as $name => $migrationDefinition) { |
|
377
|
377
|
$path = dirname($migrationDefinition->path); |
|
378
|
378
|
if (!isset($paths[$path])) { |
|
379
|
379
|
$paths[$path] = 1; |