|
@@ -132,7 +132,7 @@ discard block |
|
|
block discarded – undo |
|
132
|
132
|
|
|
133
|
133
|
$processes = array(); |
|
134
|
134
|
/** @var MigrationDefinition $migrationDefinition */ |
|
135
|
|
- foreach($paths as $path => $count) { |
|
|
135
|
+ foreach ($paths as $path => $count) { |
|
136
|
136
|
$this->writeln("<info>Queueing processing of: $path ($count migrations)</info>", OutputInterface::VERBOSITY_VERBOSE); |
|
137
|
137
|
|
|
138
|
138
|
$process = $builder |
|
@@ -179,14 +179,14 @@ discard block |
|
|
block discarded – undo |
|
179
|
179
|
} |
|
180
|
180
|
|
|
181
|
181
|
$missed = $total - $this->migrationsDone[Migration::STATUS_DONE] - $this->migrationsDone[Migration::STATUS_FAILED] - $this->migrationsDone[Migration::STATUS_SKIPPED]; |
|
182
|
|
- $this->writeln("\nExecuted ".$this->migrationsDone[Migration::STATUS_DONE].' migrations'. |
|
183
|
|
- ', failed '.$this->migrationsDone[Migration::STATUS_FAILED]. |
|
184
|
|
- ', skipped '.$this->migrationsDone[Migration::STATUS_SKIPPED]. |
|
|
182
|
+ $this->writeln("\nExecuted " . $this->migrationsDone[Migration::STATUS_DONE] . ' migrations' . |
|
|
183
|
+ ', failed ' . $this->migrationsDone[Migration::STATUS_FAILED] . |
|
|
184
|
+ ', skipped ' . $this->migrationsDone[Migration::STATUS_SKIPPED] . |
|
185
|
185
|
($missed ? ", missed $missed" : '')); |
|
186
|
186
|
|
|
187
|
187
|
$time = microtime(true) - $start; |
|
188
|
188
|
// since we use subprocesses, we can not measure max memory used |
|
189
|
|
- $this->writeln("<info>Time taken: ".sprintf('%.3f', $time)." secs</info>"); |
|
|
189
|
+ $this->writeln("<info>Time taken: " . sprintf('%.3f', $time) . " secs</info>"); |
|
190
|
190
|
|
|
191
|
191
|
return $subprocessesFailed + $this->migrationsDone[Migration::STATUS_FAILED] + $missed; |
|
192
|
192
|
} |
|
@@ -211,7 +211,7 @@ discard block |
|
|
block discarded – undo |
|
211
|
211
|
$prefix = array($php); |
|
212
|
212
|
|
|
213
|
213
|
if ($input->getOption('child-process-php-ini-config')) { |
|
214
|
|
- foreach($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
|
214
|
+ foreach ($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
215
|
215
|
$ini = explode(':', $iniSpec, 2); |
|
216
|
216
|
if (count($ini) < 2 || $ini[0] === '') { |
|
217
|
217
|
throw new \Exception("Invalid php ini specification: '$iniSpec'"); |
|
@@ -240,7 +240,7 @@ discard block |
|
|
block discarded – undo |
|
240
|
240
|
foreach ($toExecute as $name => $migrationDefinition) { |
|
241
|
241
|
// let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway |
|
242
|
242
|
if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
|
243
|
|
- $this->writeln("<comment>Skipping migration (invalid definition?) Path: ".$migrationDefinition->path."</comment>", self::$VERBOSITY_CHILD); |
|
|
243
|
+ $this->writeln("<comment>Skipping migration (invalid definition?) Path: " . $migrationDefinition->path . "</comment>", self::$VERBOSITY_CHILD); |
|
244
|
244
|
$skipped++; |
|
245
|
245
|
continue; |
|
246
|
246
|
} |
|
@@ -280,7 +280,7 @@ discard block |
|
|
block discarded – undo |
|
280
|
280
|
$this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input); |
|
281
|
281
|
|
|
282
|
282
|
$executed++; |
|
283
|
|
- } catch(\Exception $e) { |
|
|
283
|
+ } catch (\Exception $e) { |
|
284
|
284
|
$failed++; |
|
285
|
285
|
|
|
286
|
286
|
$errorMessage = $e->getMessage(); |
|
@@ -313,7 +313,7 @@ discard block |
|
|
block discarded – undo |
|
313
|
313
|
* @param string $buffer |
|
314
|
314
|
* @param null|\Symfony\Component\Process\Process $process |
|
315
|
315
|
*/ |
|
316
|
|
- public function onChildProcessOutput($type, $buffer, $process=null) |
|
|
316
|
+ public function onChildProcessOutput($type, $buffer, $process = null) |
|
317
|
317
|
{ |
|
318
|
318
|
$lines = explode("\n", trim($buffer)); |
|
319
|
319
|
|
|
@@ -331,7 +331,7 @@ discard block |
|
|
block discarded – undo |
|
331
|
331
|
|
|
332
|
332
|
// we tag the output with the id of the child process |
|
333
|
333
|
if (trim($line) !== '') { |
|
334
|
|
- $msg = '[' . ($process ? $process->getPid() : ''). '] ' . trim($line); |
|
|
334
|
+ $msg = '[' . ($process ? $process->getPid() : '') . '] ' . trim($line); |
|
335
|
335
|
if ($type == 'err') { |
|
336
|
336
|
$this->writeErrorln($msg, OutputInterface::VERBOSITY_QUIET, OutputInterface::OUTPUT_RAW); |
|
337
|
337
|
} else { |
|
@@ -365,7 +365,7 @@ discard block |
|
|
block discarded – undo |
|
365
|
365
|
|
|
366
|
366
|
// filter away all migrations except 'to do' ones |
|
367
|
367
|
$toExecute = array(); |
|
368
|
|
- foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
|
368
|
+ foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
369
|
369
|
if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && in_array($migration->status, $allowedStatuses))) { |
|
370
|
370
|
$toExecute[$name] = $isChild ? $migrationService->parseMigrationDefinition($migrationDefinition) : $migrationDefinition; |
|
371
|
371
|
} |
|
@@ -407,7 +407,7 @@ discard block |
|
|
block discarded – undo |
|
407
|
407
|
{ |
|
408
|
408
|
$output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories'); |
|
409
|
409
|
$output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] . |
|
410
|
|
- ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
|
410
|
+ ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
411
|
411
|
if ($this->migrationsAlreadyDone[Migration::STATUS_STARTED]) { |
|
412
|
412
|
$output->writeln('<info>In the same directories, migrations currently executing: ' . $this->migrationsAlreadyDone[Migration::STATUS_STARTED] . '</info>'); |
|
413
|
413
|
} |
|
@@ -420,7 +420,7 @@ discard block |
|
|
block discarded – undo |
|
420
|
420
|
protected function groupMigrationsByPath($toExecute) |
|
421
|
421
|
{ |
|
422
|
422
|
$paths = array(); |
|
423
|
|
- foreach($toExecute as $name => $migrationDefinition) { |
|
|
423
|
+ foreach ($toExecute as $name => $migrationDefinition) { |
|
424
|
424
|
$path = dirname($migrationDefinition->path); |
|
425
|
425
|
if (!isset($paths[$path])) { |
|
426
|
426
|
$paths[$path] = 1; |
|
@@ -497,12 +497,12 @@ discard block |
|
|
block discarded – undo |
|
497
|
497
|
$builderArgs[] = '--separate-process'; |
|
498
|
498
|
} |
|
499
|
499
|
if ($input->getOption('set-reference')) { |
|
500
|
|
- foreach($input->getOption('set-reference') as $refSpec) { |
|
|
500
|
+ foreach ($input->getOption('set-reference') as $refSpec) { |
|
501
|
501
|
$builderArgs[] = '--set-reference=' . $refSpec; |
|
502
|
502
|
} |
|
503
|
503
|
} |
|
504
|
504
|
if ($input->getOption('child-process-php-ini-config')) { |
|
505
|
|
- foreach($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
|
505
|
+ foreach ($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
506
|
506
|
$builderArgs[] = '--child-process-php-ini-config=' . $iniSpec; |
|
507
|
507
|
} |
|
508
|
508
|
} |