This command loads all the exchange rates from base_currency to all available
currencies.

@param InputInterface  $input  The input interface
@param OutputInterface $output The output interface
324753
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output);
        $pluginHash = $input->getArgument('hash');
        $plugin = $this
            ->pluginRepository
            ->findOneBy([
                'hash' => $pluginHash,
            ]);

        if (!($plugin instanceof Plugin)) {
            $this->printMessageFail(
                $output,
                'Plugin',
                'Plugin with hash "' . $pluginHash . '" not found'
            );

            return null;
        }

        $plugin->disable();
        $this
            ->pluginObjectManager
            ->flush($plugin);

        $this->printMessage(
            $output,
            'Plugin',
            'Plugin with hash "' . $pluginHash . '" disabled'
        );

        $this->finishCommand($output);
    }
227191
private function generateOutput(InputInterface $input): OutputInterface
    {
        return new Output(
            $this->name,
            array_merge(
                $this->evaluateInputExports($input),
                $this->generateOutputParams($input)
            )
        );
    }
1259806
protected function execute(InputInterface $input, OutputInterface $output)
    {
        // {{
        $this->title('配置信息');
        // }}

        $this->treeView(Config::get(''));
        $this->newLine();

        return 0;
    }
206416
protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var PairManagerInterface $pairManager */
        $pairManager = $this->getContainer()->get('tbbc_money.pair_manager');
        try {
            $pairManager->saveRatioListFromRatioProvider();
            $output->writeln('ratio fetched from provider'.PHP_EOL.print_r($pairManager->getRatioList(), true));
        } catch (MoneyException $e) {
            $output->writeln('ERROR during fetch ratio : '.$e->getMessage());
        }
    }
642598
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->modx = $this->console->loadMODX();
        $this->modx->cacheManager->refresh();
        $output->writeln('### Cache has been refreshed(cleared) ###');
    }
169857
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output);

        $this
            ->entityTranslationEventDispatcher
            ->dispatchTranslatorWarmUp();

        $this->finishCommand($output);
    }
350664
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output, false);
        $domains = $input->getOption('domain');
        $languages = $input->getOption('language');
        $project = $this->createProjectByInput($input);
        $questionHelper = $this->getHelper('question');

        while (true) {
            $randomTranslation = $project->getRandomMissingTranslation(
                $domains,
                $languages
            );

            if (!($randomTranslation instanceof Translation)) {
                $this
                    ->printMessage(
                        $output,
                        'Trans Server',
                        'No more translations for you!'
                    );

                break;
            }

            $this->printMessage(
                $output,
                'Trans Server',
                'Language : ' . $randomTranslation->getLanguage()
            );
            $this->printMessage(
                    $output,
                    'Trans Server',
                    'Key : ' . $randomTranslation->getKey()
                );
            $this->printMessage(
                    $output,
                    'Trans Server',
                    'Original : ' . $randomTranslation
                        ->getMasterTranslation()
                        ->getValue()
                );

            $question = new Question('[Trans Server] Translation : ');
            $translationValue = $questionHelper->ask(
                $input,
                $output,
                $question
            );

            if (false === $translationValue) {
                break;
            }

            $randomTranslation->setValue($translationValue);
            $masterStructure = $randomTranslation->getStructure();
            $this->overwriteLastValueFromStructure(
                $masterStructure,
                $translationValue
            );
            $randomTranslation->setStructure($masterStructure);

            $project->addTranslation($randomTranslation);
            $project->save();
            $output->writeln('');
        }

        $this->finishCommand($output);
    }
491684
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $method = $this->method;
        $this->setHelperSet($this->getApplication()->getHelperSet());
        if ($this->argument != null) {
            $argument = $input->getArgument($this->argument);
            $this->$method($argument);

            return;
        }

        $this->$method($input,$output);
    }
1014081
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $start = microtime(true);

        $this->setOutput($output);
        $this->setVerbosity($output->getVerbosity());

        if ($input->getOption('child') && $output->getVerbosity() <= OutputInterface::VERBOSITY_NORMAL) {
            $this->setVerbosity(self::VERBOSITY_CHILD);
        }

        $this->getContainer()->get('ez_migration_bundle.step_executed_listener.tracing')->setOutput($output);

        $migrationService = $this->getMigrationService();

        $force = $input->getOption('force');

        $toExecute = $this->buildMigrationsList($input->getOption('path'), $migrationService, $force);

        if (!count($toExecute)) {
            $output->writeln('<info>No migrations to execute</info>');
            return 0;
        }

        $this->printMigrationsList($toExecute, $input, $output);

        if (!$input->getOption('child')) {
            // ask user for confirmation to make changes
            if (!$this->askForConfirmation($input, $output)) {
                return 0;
            }
        }

        if ($input->getOption('separate-process')) {
            $builder = new ProcessBuilder();
            $executableFinder = new PhpExecutableFinder();
            if (false !== $php = $executableFinder->find()) {
                $builder->setPrefix($php);
            }
            $builderArgs = $this->createChildProcessArgs($input);
        }

        // For cli scripts, this means: do not die if anyone yanks out our stdout.
        if ($input->getOption('survive-disconnected-tty')) {
            ignore_user_abort(true);
        }

        // allow forcing handling of sigchild. Useful on eg. Debian and Ubuntu
        if ($input->getOption('force-sigchild-enabled')) {
            Process::forceSigchildEnabled(true);
        }

        $aborted = false;
        $executed = 0;
        $failed = 0;
        $skipped = 0;
        $total = count($toExecute);

        /** @var MigrationDefinition $migrationDefinition */
        foreach ($toExecute as $name => $migrationDefinition) {

            // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway
            if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
                $output->writeln("<comment>Skipping $name</comment>");
                $skipped++;
                continue;
            }

            $this->writeln("<info>Processing $name</info>");

            if ($input->getOption('separate-process')) {

                try {
                    $this->executeMigrationInSeparateProcess($migrationDefinition, $migrationService, $builder, $builderArgs);

                    $executed++;
                } catch (\Exception $e) {
                    $failed++;


                    $errorMessage = $e->getMessage();
                    // we probably have already echoed the error message while the subprocess was executing, avoid repeating it
                    if ($errorMessage != $this->subProcessErrorString) {
                        if ($e instanceof AfterMigrationExecutionException) {
                            $errorMessage = "Failure after migration end! Reason: " . $errorMessage;
                        } else {
                            $errorMessage = "Migration failed! Reason: " . $errorMessage;
                        }

                        $this->writeErrorln("\n<error>$errorMessage</error>");
                    }

                    if (!$input->getOption('ignore-failures')) {
                        $aborted = true;
                        break;
                    }
                }

            } else {

                try {
                    $this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input);

                    $executed++;
                } catch (\Exception $e) {
                    $failed++;

                    $this->writeErrorln("\n<error>Migration failed! Reason: " . $e->getMessage() . "</error>");

                    if (!$input->getOption('ignore-failures')) {
                        $aborted = true;
                        break;
                    }
                }

            }
        }

        $missed = $total - $executed - $failed - $skipped;

        if ($aborted) {
            if ($missed > 0) {
                $this->writeErrorln("\n<error>Migration execution aborted</error>");
            }
        } else {
            // NB: as per the Sf doc at https://symfony.com/doc/2.7/console/calling_commands.html, the 'cache:clear'
            // command should be run 'at the end', as they change some class definitions
            if ($input->getOption('clear-cache')) {
                $command = $this->getApplication()->find('cache:clear');
                $inputArray = new ArrayInput(array('command' => 'cache:clear'));
                $command->run($inputArray, $output);
            }
        }

        $this->writeln("\nExecuted $executed migrations, failed $failed, skipped $skipped" . ($missed ? ", missed $missed" : ''));

        $time = microtime(true) - $start;
        if ($input->getOption('separate-process')) {
            // in case of using subprocesses, we can not measure max memory used
            $this->writeln("<info>Time taken: ".sprintf('%.2f', $time)." secs</info>");
        } else {
            $this->writeln("<info>Time taken: ".sprintf('%.2f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB</info>');
        }

        return $failed;
    }
980225
public function doRun(InputInterface $input, OutputInterface $output)
    {
        $this->setIO($input, $output);
        parent::doRun($input, $output);
    }
1083551
public function execute(InputInterface $input, OutputInterface $output)
    {
        // graviton root
        $baseDir = __DIR__.'/../../../';

        // vendorized? - go back some more..
        if (strpos($baseDir, '/vendor/') !== false) {
            $baseDir .= '../../../';
        }

        $this->finder
            ->in($baseDir)
            ->path('Resources/config')
            ->name('/migrations.(xml|yml)/')
            ->files();

        foreach ($this->finder as $file) {
            if (!$file->isFile()) {
                continue;
            }

            $output->writeln('Found '.$file->getRelativePathname());

            $command = $this->getApplication()->find('mongodb:migrations:migrate');

            $helperSet = $command->getHelperSet();
            $helperSet->set($this->documentManager, 'dm');
            $command->setHelperSet($helperSet);

            $configuration = $this->getConfiguration($file->getPathname(), $output);
            self::injectContainerToMigrations($this->container, $configuration->getMigrations());
            $command->setMigrationConfiguration($configuration);

            $arguments = $input->getArguments();
            $arguments['command'] = 'mongodb:migrations:migrate';
            $arguments['--configuration'] = $file->getPathname();

            $migrateInput = new ArrayInput($arguments);
            $migrateInput->setInteractive($input->isInteractive());
            $returnCode = $command->run($migrateInput, $output);

            if ($returnCode !== 0) {
                $this->errors[] = sprintf(
                    'Calling mongodb:migrations:migrate failed for %s',
                    $file->getRelativePathname()
                );
            }
        }

        if (!empty($this->errors)) {
            $output->writeln(
                sprintf('<error>%s</error>', implode(PHP_EOL, $this->errors))
            );
            return -1;
        }

        return 0;
    }
1072702
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->modx->cacheManager->refresh();
        $output->writeln('### Cache has been refreshed(cleared) ###');
    }
391077
protected function execute(InputInterface $input, OutputInterface $output)
    {
		$this->input = $input;
		$this->output = $output;
		$this->force = $input->getOption('force');
		
		$helper = $this->getHelper('question');
		
        $userQuestion = new Question('User (root): ', 'root');
		
        $passwordQuestion = new Question('Password (): ', '');
		$passwordQuestion->setHidden(true);
		$passwordQuestion->setHiddenFallback(false);

        $hostQuestion = new Question('Host (localhost): ', 'localhost');
        $driverQuestion = new Question('Driver (pdo_mysql): ', 'pdo_mysql');
		
		$user = $helper->ask($input, $output, $userQuestion);
		$password = $helper->ask($input, $output, $passwordQuestion);
		$host = $helper->ask($input, $output, $hostQuestion);
		$driver = $helper->ask($input, $output, $driverQuestion);
		
		$connectionParams = array(
			'user' => $user,
			'password' => $password,
			'host' => $host,
			'driver' => $driver
		);
		
		try {
			$conn = $this->createConnection($connectionParams);
			
			$sm = $conn->getSchemaManager();
			
			$databases = $sm->listDatabases();
			
			$question = new ChoiceQuestion(
				'Database',
				$databases,
				0
			);
			$question->setErrorMessage('Selected database is not valid');

			$dbName = $helper->ask($input, $output, $question);
			$output->writeln('Chosen database: ' . $dbName);
			
			//Add the dbname property
			$connectionParams['dbname'] = $dbName;
			
			$conn = $this->createConnection($connectionParams);
			
			$sm = $conn->getSchemaManager();
		
			$tables = $sm->listTables();
			
			$this->loadConfiguration();
			
			$progress = new ProgressBar($output, count($tables));
			$progress->start();
			
			foreach ($tables as $table) {
				//$output->writeln($table->getName() . " columns:\n\n");
					
				//Columns
				/*
				foreach ($table->getColumns() as $column) {
					//$output->writeln(' - ' . $column->getName() . ': ' . $column->getType() . "\n");
				}
				*/
					
				//Foreign keys
				$name = $table->getName();
				$table = $sm->listTableDetails($name);
				//$foreignKeys = $table->getForeignKeys();
				//$output->writeln("Foreign keys (" . count($foreignKeys) . ")");
				/*
				foreach ($foreignKeys as $foreignKey) {
					//$output->writeln("\n");
					$foreignColumns = $foreignKey->getForeignColumns();
					$localColumns = $foreignKey->getLocalColumns();
					foreach($foreignColumns as $key => $foreignColumn){
						//$output->writeln($foreignKey->getLocalTableName() . "." . $localColumns[$key] . " <=> " . $foreignKey->getForeignTableName() . "." . $foreignColumn . "\n");
					}
				}
				*/
		
				$primaryKeys = $table->getPrimaryKeyColumns();
				//$output->writeln("Primary keys (" . count($primaryKeys) . ")");
				/*
				foreach ($primaryKeys as $primaryKey) {
					//$output->writeln("\n" . $primaryKey);
				}
				*/
				
				//$output->writeln("\n\n");
				$this->generateCode($name, reset($primaryKeys));
				
				$progress->advance();
			}
			
			$progress->finish();
		} catch(\Exception $ex){
			$output->writeln('Generator has found the current exception: ');
			$output->writeln($ex->getMessage());
		}
    }
1090741
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);
        $info = $this
            ->getSession()
            ->getInspector()
            ->getSchemas()
            ;
        $this->formatOutput($output, $info);
    }
482196
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->injectOutputIntoLogger($output, $this->logger);
        $adapter = $this->databaseImportExportAdapterManager->getAdapter($input->getOption('adapter'));
        $adapter->setLogger($this->logger);

        $database = $input->getArgument('database');
        $path = $input->getArgument('path');
        $ignoreTables = $input->getOption('ignore-tables') ? explode(',', $input->getOption('ignore-tables')) : [];

        $this->logger->info("Exporting database \"$database\".");
        $filename = $adapter->exportToFile(
            $database,
            $path,
            [
                'ignore_tables'   => $ignoreTables,
                'remove_definers' => !$input->getOption('no-remove-definers'),
            ]
        );
        $this->logger->info("Database \"$database\" exported to \"$filename\"!");
        return 0;
    }
942254
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output, false);
        $domains = $input->getOption('domain');
        $languages = $input->getOption('language');
        $project = $this->createProjectByInput($input);

        while (true) {
            $randomTranslation = $project->getRandomMissingTranslation(
                $domains,
                $languages
            );

            if (!($randomTranslation instanceof Translation)) {
                $this
                    ->printMessage(
                        $output,
                        'Trans Server',
                        'No more translations for you!'
                    );

                break;
            }

            $masterTranslation = $randomTranslation->getMasterTranslation();
            $translator = new TranslateClient(
                $masterTranslation->getLanguage(),
                $randomTranslation->getLanguage()
            );
            $translation = $translator->translate(
                $masterTranslation->getValue()
            );

            $this
                ->printMessage(
                    $output,
                    'Trans Server',
                    'Language : ' . $randomTranslation->getLanguage()
                );
            $this->printMessage(
                    $output,
                    'Trans Server',
                    'Key : ' . $randomTranslation->getKey()
                );
            $this->printMessage(
                    $output,
                    'Trans Server',
                    'Original : ' . $randomTranslation
                        ->getMasterTranslation()
                        ->getValue()
                );
            $this->printMessage(
                    $output,
                    'Trans Server',
                    'Translation : ' . $translation
                );

            $randomTranslation->setValue($translation);
            $masterStructure = $randomTranslation->getStructure();
            $this->overwriteLastValueFromStructure(
                $masterStructure,
                $translation
            );
            $randomTranslation->setStructure($masterStructure);

            $project
                ->addTranslation($randomTranslation)
                ->save();
            $output->writeln('');
        }

        $this->finishCommand($output);
    }
294624
public function run(InputInterface $input, OutputInterface $output): int
    {
        return $this->console->run($input, $output);
    }