@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | $this->writeln("Executed $executed migrations, failed $failed, skipped $skipped"); |
| 220 | 220 | if ($input->getOption('separate-process')) { |
| 221 | 221 | // in case of using subprocesses, we can not measure max memory used |
| 222 | - $this->writeln("Time taken: ".sprintf('%.2f', $time)." secs"); |
|
| 222 | + $this->writeln("Time taken: " . sprintf('%.2f', $time) . " secs"); |
|
| 223 | 223 | } else { |
| 224 | - $this->writeln("Time taken: ".sprintf('%.2f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB'); |
|
| 224 | + $this->writeln("Time taken: " . sprintf('%.2f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB'); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $builderArgs[] = '--no-debug'; |
| 370 | 370 | } |
| 371 | 371 | if ($input->getOption('siteaccess')) { |
| 372 | - $builderArgs[]='--siteaccess='.$input->getOption('siteaccess'); |
|
| 372 | + $builderArgs[] = '--siteaccess=' . $input->getOption('siteaccess'); |
|
| 373 | 373 | } |
| 374 | 374 | // 'optional' options |
| 375 | 375 | // note: options 'clear-cache', 'ignore-failures', 'no-interaction', 'path' and 'separate-process' we never propagate |
@@ -193,6 +193,9 @@ |
||
| 193 | 193 | ); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | + /** |
|
| 197 | + * @param ProcessBuilder $builder |
|
| 198 | + */ |
|
| 196 | 199 | protected function executeMigrationInSeparateProcess($migrationDefinition, $migrationService, $builder, $builderArgs, $feedback = true) |
| 197 | 200 | { |
| 198 | 201 | $process = $builder |
@@ -88,6 +88,12 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | + /** |
|
| 92 | + * @param InputInterface $input |
|
| 93 | + * @param OutputInterface $output |
|
| 94 | + * @param MigrationDefinition[] $toExecute |
|
| 95 | + * @param double $start |
|
| 96 | + */ |
|
| 91 | 97 | protected function executeAsParent($input, $output, $toExecute, $start) |
| 92 | 98 | { |
| 93 | 99 | $paths = $this->groupMigrationsByPath($toExecute); |
@@ -157,6 +163,12 @@ discard block |
||
| 157 | 163 | return $failed; |
| 158 | 164 | } |
| 159 | 165 | |
| 166 | + /** |
|
| 167 | + * @param InputInterface $input |
|
| 168 | + * @param OutputInterface $output |
|
| 169 | + * @param MigrationDefinition[] $toExecute |
|
| 170 | + * @param \Kaliop\eZMigrationBundle\Core\MigrationService $migrationService |
|
| 171 | + */ |
|
| 160 | 172 | protected function executeAsChild($input, $output, $toExecute, $force, $migrationService) |
| 161 | 173 | { |
| 162 | 174 | // @todo disable signal slots that are harmful during migrations, if any |
@@ -260,7 +272,7 @@ discard block |
||
| 260 | 272 | |
| 261 | 273 | /** |
| 262 | 274 | * @param string $paths |
| 263 | - * @param $migrationService |
|
| 275 | + * @param \Kaliop\eZMigrationBundle\Core\MigrationService $migrationService |
|
| 264 | 276 | * @param bool $force |
| 265 | 277 | * @param bool $isChild when not in child mode, do not waste time parsing migrations |
| 266 | 278 | * @return MigrationDefinition[] parsed or unparsed, depending on |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use Symfony\Component\Process\ProcessBuilder; |
| 13 | 13 | use Symfony\Component\Process\PhpExecutableFinder; |
| 14 | 14 | use Kaliop\eZMigrationBundle\Core\Helper\ProcessManager; |
| 15 | -use Symfony\Component\Console\Question\ConfirmationQuestion; |
|
| 16 | 15 | |
| 17 | 16 | class MassMigrateCommand extends MigrateCommand |
| 18 | 17 | { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | $processes = array(); |
| 114 | 114 | /** @var MigrationDefinition $migrationDefinition */ |
| 115 | - foreach($paths as $path => $count) { |
|
| 115 | + foreach ($paths as $path => $count) { |
|
| 116 | 116 | $this->writeln("<info>Queueing processing of: $path ($count migrations)</info>", OutputInterface::VERBOSITY_VERBOSE); |
| 117 | 117 | |
| 118 | 118 | $process = $builder |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $time = microtime(true) - $start; |
| 151 | 151 | |
| 152 | - $this->writeln('<info>'.$this->migrationsDone[0].' migrations executed, '.$this->migrationsDone[1].' failed, '.$this->migrationsDone[2].' skipped</info>'); |
|
| 152 | + $this->writeln('<info>' . $this->migrationsDone[0] . ' migrations executed, ' . $this->migrationsDone[1] . ' failed, ' . $this->migrationsDone[2] . ' skipped</info>'); |
|
| 153 | 153 | |
| 154 | 154 | // since we use subprocesses, we can not measure max memory used |
| 155 | - $this->writeln("Time taken: ".sprintf('%.2f', $time)." secs"); |
|
| 155 | + $this->writeln("Time taken: " . sprintf('%.2f', $time) . " secs"); |
|
| 156 | 156 | |
| 157 | 157 | return $failed; |
| 158 | 158 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | foreach ($toExecute as $name => $migrationDefinition) { |
| 180 | 180 | // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway |
| 181 | 181 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 182 | - $this->writeln("<comment>Skipping migration (invalid definition?) Path: ".$migrationDefinition->path."</comment>", self::VERBOSITY_CHILD); |
|
| 182 | + $this->writeln("<comment>Skipping migration (invalid definition?) Path: " . $migrationDefinition->path . "</comment>", self::VERBOSITY_CHILD); |
|
| 183 | 183 | $skipped++; |
| 184 | 184 | continue; |
| 185 | 185 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input); |
| 211 | 211 | |
| 212 | 212 | $executed++; |
| 213 | - } catch(\Exception $e) { |
|
| 213 | + } catch (\Exception $e) { |
|
| 214 | 214 | $failed++; |
| 215 | 215 | if ($input->getOption('ignore-failures')) { |
| 216 | 216 | $this->writeln("<error>Migration failed! Path: " . $migrationDefinition->path . ", Reason: " . $e->getMessage() . "</error>", self::VERBOSITY_CHILD); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | //return $failed; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - public function onSubProcessOutput($type, $buffer, $process=null) |
|
| 238 | + public function onSubProcessOutput($type, $buffer, $process = null) |
|
| 239 | 239 | { |
| 240 | 240 | $lines = explode("\n", trim($buffer)); |
| 241 | 241 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | // we tag the output from the different processes |
| 255 | 255 | if (trim($line) !== '') { |
| 256 | - echo '[' . ($process ? $process->getPid() : ''). '] ' . trim($line) . "\n"; |
|
| 256 | + echo '[' . ($process ? $process->getPid() : '') . '] ' . trim($line) . "\n"; |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | // filter away all migrations except 'to do' ones |
| 283 | 283 | $toExecute = array(); |
| 284 | - foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
| 284 | + foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
| 285 | 285 | if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && in_array($migration->status, $allowedStatuses))) { |
| 286 | 286 | $toExecute[$name] = $isChild ? $migrationService->parseMigrationDefinition($migrationDefinition) : $migrationDefinition; |
| 287 | 287 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | { |
| 324 | 324 | $output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories'); |
| 325 | 325 | $output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] . |
| 326 | - ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
| 326 | + ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
| 327 | 327 | if ($this->migrationsAlreadyDone[Migration::STATUS_STARTED]) { |
| 328 | 328 | $output->writeln('<info>In the same directories, migrations currently executing: ' . $this->migrationsAlreadyDone[Migration::STATUS_STARTED] . '</info>'); |
| 329 | 329 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | protected function groupMigrationsByPath($toExecute) |
| 337 | 337 | { |
| 338 | 338 | $paths = array(); |
| 339 | - foreach($toExecute as $name => $migrationDefinition) { |
|
| 339 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
| 340 | 340 | $path = dirname($migrationDefinition->path); |
| 341 | 341 | if (!isset($paths[$path])) { |
| 342 | 342 | $paths[$path] = 1; |
@@ -23,7 +23,6 @@ |
||
| 23 | 23 | * @param array $conditions |
| 24 | 24 | * @param array $sort |
| 25 | 25 | * @param int $offset |
| 26 | - * @param int $limit |
|
| 27 | 26 | * @return mixed |
| 28 | 27 | * @throws \Kaliop\eZMigrationBundle\API\Exception\InvalidMatchConditionsException |
| 29 | 28 | * @throws \Kaliop\eZMigrationBundle\API\Exception\InvalidSortConditionsException |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | // allow user to pass in selection values by name |
| 38 | 38 | $fieldSettings = null; |
| 39 | - foreach($fieldValue as $key => $val) { |
|
| 39 | + foreach ($fieldValue as $key => $val) { |
|
| 40 | 40 | |
| 41 | 41 | $val = $this->referenceResolver->resolveReference($val); |
| 42 | 42 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | if ($fieldSettings === null) { |
| 48 | 48 | $fieldSettings = $this->loadFieldSettings($context['contentTypeIdentifier'], $context['fieldIdentifier']); |
| 49 | 49 | } |
| 50 | - foreach($fieldSettings['options'] as $pos => $name) { |
|
| 50 | + foreach ($fieldSettings['options'] as $pos => $name) { |
|
| 51 | 51 | if ($name === $val) { |
| 52 | 52 | $fieldValue[$key] = $pos; |
| 53 | 53 | break; |