当前位置: 首页>>代码示例>>PHP>>正文


PHP ArgvInput::setInteractive方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Input\ArgvInput::setInteractive方法的典型用法代码示例。如果您正苦于以下问题:PHP ArgvInput::setInteractive方法的具体用法?PHP ArgvInput::setInteractive怎么用?PHP ArgvInput::setInteractive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Input\ArgvInput的用法示例。


在下文中一共展示了ArgvInput::setInteractive方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initComposer

 public function initComposer(OutputInterface $output)
 {
     $input = new ArgvInput(['composer', 'init']);
     $input->setInteractive(true);
     /** @var InitCommand $command */
     $command = $this->getHelperSet()->getCommand()->getApplication()->find('init');
     return $this->execute($input, $output, $command);
 }
开发者ID:quickstrap,项目名称:quickstrap,代码行数:8,代码来源:InitHelper.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->write('loading all fixtures...........');
     $input = new ArgvInput();
     $input->setInteractive(false);
     $command = $this->getApplication()->find('doctrine:fixtures:load');
     $command->run($input, new NullOutput());
     $output->writeln('<info>OK</info>');
     $output->write('setting up match fixtures......');
     $this->getContainer()->get('oss.league.service.fixture')->createFixtures(1);
     $output->writeln('<info>OK</info>');
 }
开发者ID:kosak83,项目名称:OpenSoccerStar,代码行数:12,代码来源:SetupCommand.php

示例3: requirePackage

 public function requirePackage(OutputInterface $output, $package, $version = null, $dev = true)
 {
     $packageArg = sprintf("%s%s", $package, $version != null ? ':' . $version : null);
     $args = ['composer', 'require'];
     if ($dev) {
         $args[] = '--dev';
     }
     $args[] = $packageArg;
     $input = new ArgvInput($args);
     $input->setInteractive(true);
     /** @var RequireCommand $command */
     $command = $this->getHelperSet()->getCommand()->getApplication()->find('require');
     return $this->execute($input, $output, $command);
 }
开发者ID:quickstrap,项目名称:quickstrap,代码行数:14,代码来源:RequireHelper.php

示例4: testExecute

 public function testExecute()
 {
     // Mocks
     $configuration = $this->buildMock('AntiMattr\\MongoDB\\Migrations\\Configuration\\Configuration');
     $availableVersion = $this->buildMock('AntiMattr\\MongoDB\\Migrations\\Version');
     $migration = $this->buildMock('AntiMattr\\MongoDB\\Migrations\\Migration');
     // Variables and Objects
     $numVersion = '000123456789';
     $input = new ArgvInput(array(MigrateCommand::NAME, $numVersion));
     $interactive = false;
     $availableVersions = array($availableVersion);
     // Set properties on objects
     $input->setInteractive($interactive);
     $this->command->setMigration($migration);
     $this->command->setMigrationConfiguration($configuration);
     // Expectations
     $configuration->expects($this->once())->method('getMigratedVersions')->will($this->returnValue(array()));
     $configuration->expects($this->once())->method('getAvailableVersions')->will($this->returnValue($availableVersions));
     $migration->expects($this->once())->method('migrate')->with($numVersion);
     // Run command, run.
     $this->command->run($input, $this->output);
 }
开发者ID:xtx-dev,项目名称:mongodb-migrations,代码行数:22,代码来源:MigrateCommandTest.php

示例5: testExecuteUpWithInteraction

 public function testExecuteUpWithInteraction()
 {
     // Mocks
     $dialog = $this->buildMock('Symfony\\Component\\Console\\Helper\\DialogHelper');
     // Variables and Objects
     $application = new Application();
     $helperSet = new HelperSet(array('dialog' => $dialog));
     $numVersion = '1234567890';
     $interactive = true;
     // Arguments and Options
     $input = new ArgvInput(array('application-name', ExecuteCommand::NAME, $numVersion));
     // Set properties on objects
     $application->setHelperSet($helperSet);
     $this->command->setApplication($application);
     $this->command->setMigrationConfiguration($this->config);
     $input->setInteractive($interactive);
     // Expectations
     $this->config->expects($this->once())->method('getVersion')->with($numVersion)->will($this->returnValue($this->version));
     $dialog->expects($this->once())->method('askConfirmation')->will($this->returnValue(true));
     $this->version->expects($this->once())->method('execute')->with('up');
     // Run command, run.
     $this->command->run($input, $this->output);
 }
开发者ID:xtx-dev,项目名称:mongodb-migrations,代码行数:23,代码来源:ExecuteCommandTest.php

示例6: execute


//.........这里部分代码省略.........
     }
     $zipper->close();
     // Define this just in case
     defined('MAUTIC_ENV') or define('MAUTIC_ENV', isset($options['env']) ? $options['env'] : 'prod');
     // Make sure we have a deleted_files list otherwise we can't process this step
     if (file_exists($appRoot . '/deleted_files.txt')) {
         $progressBar->setMessage($translator->trans('mautic.core.update.remove.deleted.files') . "                  ");
         $progressBar->advance();
         $deletedFiles = json_decode(file_get_contents($appRoot . '/deleted_files.txt'), true);
         $errorLog = [];
         // Before looping over the deleted files, add in our upgrade specific files
         $deletedFiles += ['deleted_files.txt', 'upgrade.php'];
         foreach ($deletedFiles as $file) {
             $path = $appRoot . '/' . $file;
             if (file_exists($path)) {
                 // Try setting the permissions to 777 just to make sure we can get rid of the file
                 @chmod($path, 0777);
                 if (!@unlink($path)) {
                     // Failed to delete, reset the permissions to 644 for safety
                     @chmod($path, 0644);
                     $errorLog[] = $translator->trans('mautic.core.update.error.removing.file', ['%path%' => $file]);
                 }
             }
         }
         // If there were any errors, add them to the error log
         if (count($errorLog)) {
             // Check if the error log exists first
             if (file_exists($appRoot . '/upgrade_errors.txt')) {
                 $errors = file_get_contents($appRoot . '/upgrade_errors.txt');
             } else {
                 $errors = '';
             }
             $errors .= implode(PHP_EOL, $errorLog);
             @file_put_contents($appRoot . '/upgrade_errors.txt', $errors);
         }
     }
     // Clear the dev and prod cache instances to reset the system
     $progressBar->setMessage($translator->trans('mautic.core.update.clear.cache') . "                  ");
     $progressBar->advance();
     $cacheHelper = $this->getContainer()->get('mautic.helper.cache');
     $cacheHelper->nukeCache();
     // Update languages
     $supportedLanguages = $this->getContainer()->get('mautic.factory')->getParameter('supported_languages');
     // If there is only one language, assume it is 'en_US' and skip this
     if (count($supportedLanguages) > 1) {
         $progressBar->setMessage($translator->trans('mautic.core.command.update.step.update_languages' . "                  "));
         $progressBar->advance();
         /** @var \Mautic\CoreBundle\Helper\LanguageHelper $languageHelper */
         $languageHelper = $this->getContainer()->get('mautic.factory')->getHelper('language');
         // First, update the cached language data
         $result = $languageHelper->fetchLanguages(true);
         // Only continue if not in error
         if (!isset($result['error'])) {
             foreach ($supportedLanguages as $locale => $name) {
                 // We don't need to update en_US, that comes with the main package
                 if ($locale == 'en_US') {
                     continue;
                 }
                 // Update time
                 $extractResult = $languageHelper->extractLanguagePackage($locale);
                 if ($extractResult['error']) {
                     $output->writeln("\n\n<error>" . $translator->trans('mautic.core.update.error_updating_language', ['%language%' => $name]) . '</error>');
                 }
             }
         }
     }
     // Migrate the database to the current version
     $progressBar->setMessage($translator->trans('mautic.core.update.migrating.database.schema' . "                  "));
     $progressBar->advance();
     $migrationApplication = new Application($this->getContainer()->get('kernel'));
     $migrationApplication->setAutoExit(false);
     $migrationCommandArgs = new ArgvInput(['console', 'doctrine:migrations:migrate', '--quiet', '--no-interaction']);
     $migrationCommandArgs->setInteractive(false);
     $migrateExitCode = $migrationApplication->run($migrationCommandArgs, new NullOutput());
     unset($migrationApplication);
     $progressBar->setMessage($translator->trans('mautic.core.update.step.wrapping_up' . "                  "));
     $progressBar->advance();
     // Clear the cached update data and the download package now that we've updated
     if (empty($package)) {
         @unlink($zipFile);
     } else {
         @unlink($this->getContainer()->getParameter('kernel.cache_dir') . '/lastUpdateCheck.txt');
     }
     @unlink($appRoot . '/deleted_files.txt');
     @unlink($appRoot . '/upgrade.php');
     // Update successful
     $progressBar->setMessage($translator->trans('mautic.core.update.update_successful', ['%version%' => $version]) . "                  ");
     $progressBar->finish();
     // Check for a post install message
     if ($postMessage = $this->getContainer()->get('session')->get('post_upgrade_message', false)) {
         $postMessage = strip_tags($postMessage);
         $this->getContainer()->get('session')->remove('post_upgrade_message');
         $output->writeln("\n\n<info>{$postMessage}</info>");
     }
     // Output the error (if exists) from the migrate command after we've finished the progress bar
     if ($migrateExitCode !== 0) {
         $output->writeln("\n\n<error>" . $translator->trans('mautic.core.update.error_performing_migration') . '</error>');
     }
     return 0;
 }
开发者ID:Yame-,项目名称:mautic,代码行数:101,代码来源:ApplyUpdatesCommand.php

示例7: runCommand

 /**
  * Builds up the environment to run the given command.
  *
  * @param string $name
  * @param array  $params
  *
  * @return string
  */
 protected static function runCommand($name, array $params = [])
 {
     $kernel = self::getContainer()->get('kernel');
     $application = new Application($kernel);
     $application->setAutoExit(false);
     $argv = ['application', $name];
     foreach ($params as $k => $v) {
         if (is_bool($v)) {
             if ($v) {
                 $argv[] = $k;
             }
         } else {
             if (!is_int($k)) {
                 $argv[] = $k;
             }
             $argv[] = $v;
         }
     }
     $input = new ArgvInput($argv);
     $input->setInteractive(false);
     $fp = fopen('php://temp/maxmemory:' . 1024 * 1024 * 1, 'r+');
     $output = new StreamOutput($fp);
     $application->run($input, $output);
     rewind($fp);
     return stream_get_contents($fp);
 }
开发者ID:nmallare,项目名称:platform,代码行数:34,代码来源:WebTestCase.php


注:本文中的Symfony\Component\Console\Input\ArgvInput::setInteractive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。