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


PHP SymfonyStyle::progressStart方法代码示例

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


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

示例1: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $allJournals = $this->getAllJournals();
     $this->io->progressStart(count($allJournals));
     foreach ($allJournals as $journal) {
         $this->normalizeLastIssuesByJournal($journal);
     }
 }
开发者ID:ojs,项目名称:ojs,代码行数:14,代码来源:NormalizeLastIssuesCommand.php

示例2: removeIssues

 private function removeIssues(InputInterface $input)
 {
     $this->refreshJournal($input);
     $journalIssues = $this->em->getRepository('OjsJournalBundle:Issue')->findBy(['journal' => $this->journal]);
     $this->io->progressStart(count($journalIssues));
     foreach ($journalIssues as $issue) {
         $this->io->progressAdvance();
         $this->em->remove($issue);
     }
     $this->em->flush();
 }
开发者ID:ojs,项目名称:ojs,代码行数:11,代码来源:DeleteJournalCommand.php

示例3: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->progressStart(count($this->allJournals));
     $counter = 1;
     foreach ($this->allJournals as $journal) {
         $this->normalizeSetting($journal);
         $this->io->progressAdvance(1);
         $counter = $counter + 1;
         if ($counter % 50 == 0) {
             $this->em->flush();
         }
     }
     $this->em->flush();
 }
开发者ID:ojs,项目名称:ojs,代码行数:21,代码来源:JournalArticleTypeNormalizeCommand.php

示例4: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->progressStart(count($this->getJournals()));
     $counter = 1;
     foreach ($this->getJournals() as $journal) {
         $this->addTranslation($journal);
         $this->io->progressAdvance(1);
         $counter = $counter + 1;
         if ($counter % 50 == 0) {
             $this->em->flush();
         }
     }
     $this->em->flush();
     $this->io->success('All process finished');
 }
开发者ID:ojs,项目名称:ojs,代码行数:22,代码来源:JournalFooterTextNormalizeCommand.php

示例5: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->progressStart(count($this->getAnnouncements()));
     $counter = 1;
     foreach ($this->getAnnouncements() as $announcement) {
         if (!$this->haveTranslation($announcement['id'])) {
             $this->addTranslation($announcement);
             $this->io->progressAdvance(1);
             $counter = $counter + 1;
             if ($counter % 50 == 0) {
                 $this->em->flush();
             }
         }
     }
     $this->em->flush();
     $this->io->success('All process finished');
 }
开发者ID:ojs,项目名称:ojs,代码行数:24,代码来源:JournalAnnouncementNormalizeCommand.php

示例6: clearCache

 private function clearCache(SymfonyStyle $io, $env)
 {
     $io->section("Clearing cache ({$env})...");
     $io->progressStart(1);
     $input = $this->getEnvsInput($env);
     $command = $this->getApplication()->find('cache:clear');
     $cmdOutput = new BufferedOutput();
     $returnCode = $command->run($input, $cmdOutput);
     if ($returnCode !== 0) {
         $io->error("cache:clear command failed. You may need to manually delete the cache folders.");
         return;
     }
     $io->progressFinish();
 }
开发者ID:redelivre,项目名称:login-cidadao,代码行数:14,代码来源:DeployCommand.php

示例7: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return null|int null or 0 if everything went fine, or an error code
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title("[ QCharts updating ]");
     //update the ones that are due
     $date = new DateTime();
     $_code = 0;
     try {
         $debugMode = $input->getOption("debug");
         $queryService = $this->getContainer()->get("qcharts.query");
         $queries = $queryService->getPreFetchedQueries();
         $dateFormat = SnapshotService::FILE_DATE_FORMAT;
         $io->note("QCharts date format: '{$dateFormat}', date now: {$date->format($dateFormat)}");
         $queriesQty = count($queries);
         $paths = $this->getContainer()->getParameter("qcharts.paths");
         $io->note("Saving in directory: {$paths['snapshots']}");
         $io->progressStart($queriesQty);
         $io->newLine(2);
         foreach ($queries as $query) {
             /** @var QueryRequest $query */
             try {
                 $this->updateQuery($query, $io, $date);
             } catch (\Exception $e) {
                 $io->error("Error updating '{$query->getTitle()}', {$e->getMessage()}, moving along...");
                 if ($debugMode && !$io->confirm("Want to continue?", true)) {
                     throw new AbortedOperationException("The operation was aborted by the user", 1);
                 }
             }
         }
     } catch (AbortedOperationException $e) {
         $_code = $e->getCode();
         $io->error($e->getMessage());
     } catch (\Exception $e) {
         $_code = 1;
         $io->error("{$e->getMessage()}");
     } finally {
         $_code ? $io->progressFinish() : null;
         $io->newLine(3);
         $io->text("[ QCharts finished with code: {$_code} ]");
     }
     $io->title("[ QCharts end updating ]");
 }
开发者ID:arnulfojr,项目名称:qcharts,代码行数:47,代码来源:QueryUpdateCommand.php

示例8: execute

 /**
  * @{inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->application = $this->getApplication()->getApplication();
     $this->fixtureLoader = $this->getContainer()->get('demo.website_loader');
     $this->dataRepository = $this->getBundle()->getBaseDirectory() . DIRECTORY_SEPARATOR . 'Data' . DIRECTORY_SEPARATOR;
     $output = new SymfonyStyle($input, $output);
     $output->title('BackBee Demonstration Website Importer');
     $output->progressStart(3);
     $lines = $this->loadFixtures();
     $output->progressAdvance();
     $output->note('✓ Updated BackBee Application');
     $website = $this->updateWebsite();
     $output->progressAdvance();
     $output->note(sprintf('✓ Updated Domain to ``%s`` with label ``%s``', $website['domain'], $website['label']));
     $this->importAssets();
     $output->progressAdvance();
     $output->note('✓ Imported pictures assets');
     $output->newline();
     $output->success('Website loaded with success.');
 }
开发者ID:Amalec78,项目名称:DemoBundle,代码行数:23,代码来源:LoadDemoWebsiteCommand.php

示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Slack import');
     $io->comment('Requesting slack history…');
     $om = $this->container->get('doctrine')->getManager();
     $slack = $this->container->get('slack.api');
     $args = ['channel' => $slack->findChannelId($this->container->getParameter('slack_web_channel')), 'count' => 1000];
     try {
         $latest = $om->getRepository(ProcessedSlackMessage::class)->findMostRecent();
         $args['oldest'] = $latest->getDate()->format('U.u');
     } catch (NoResultException $e) {
     }
     $response = $slack->request('channels.history', $args);
     $messages = json_decode($response)->messages;
     $io->progressStart(count($messages));
     foreach ($messages as $message) {
         $io->progressAdvance();
         if (!(new AndX(new IsSlackMessage(), new IsHumanMessage()))->isSatisfiedBy($message)) {
             continue;
         }
         try {
             $url = $this->container->get('parser.slack_message')->parseUrl($message->text);
             $tags = $this->container->get('parser.slack_message')->parseTags($message->text);
             $watchLink = $this->container->get('extractor.watch_link_metadata')->extract($url, $tags);
             $watchLink->setCreatedAt((new \DateTime())->setTimestamp($message->ts));
             $processedMessage = new ProcessedSlackMessage($watchLink->getCreatedAt());
             $om->persist($processedMessage);
             $om->persist($watchLink);
             // Flush required at each round for tags unicity
             $om->flush();
         } catch (\InvalidArgumentException $e) {
             $this->container->get('logger')->addNotice('Unable to insert watchlink', ['exception' => $e, 'message' => $message->text]);
         } catch (\Exception $e) {
             $this->container->get('logger')->addError('Unknow exception', ['exception' => $e, 'message' => $message->text]);
         }
     }
     $io->progressFinish();
     $io->comment('Flush links…');
     $io->comment('Done.');
 }
开发者ID:un-zero-un,项目名称:Veilleur,代码行数:41,代码来源:SlackImportCommand.php

示例10: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $finder = new Finder();
     $finder->in(sys_get_temp_dir())->ignoreUnreadableDirs()->sortByType();
     $fs = new Filesystem();
     $files = $finder->name("backup_*");
     if (count($files) == 0) {
         $io->success('No olders backups removed');
         return;
     }
     $io->progressStart(count($files));
     foreach ($files as $file) {
         if ($fs->exists($file->getRealpath())) {
             $fs->remove($file->getRealpath());
         }
         sleep(1);
         $io->progressAdvance();
     }
     $io->progressFinish();
 }
开发者ID:PiktalentCom,项目名称:backup,代码行数:21,代码来源:CleanLocalBackupCommand.php

示例11: normalizePeriods

 private function normalizePeriods()
 {
     $this->io->newLine();
     $this->io->text('normalizing periods');
     $this->getContainer()->getParameter('locale');
     $this->io->progressStart();
     $periods = $this->em->getRepository('OjsJournalBundle:Period')->findAll();
     foreach ($periods as $period) {
         $getTranslation = $this->em->getRepository('OjsJournalBundle:PeriodTranslation')->findOneBy(['translatable' => $period, 'locale' => $this->locale]);
         if (!$getTranslation) {
             $this->io->progressAdvance();
             $newPeriodTranslation = new PeriodTranslation();
             $newPeriodTranslation->setTranslatable($period);
             $newPeriodTranslation->setLocale($this->locale);
             $newPeriodTranslation->setPeriod('-');
             $this->em->persist($newPeriodTranslation);
         }
     }
     $this->em->flush();
     $this->io->newLine();
 }
开发者ID:ojs,项目名称:ojs,代码行数:21,代码来源:NormalizeTranslatableObjectsCommand.php

示例12: createServerManagers

 private function createServerManagers()
 {
     /** @var Discord $discord */
     /* @var ObjectManager $manager */
     $discord = $this->getContainer()->get('discord');
     $manager = $this->getContainer()->get('default_manager');
     $repo = $manager->getRepository($this->getContainer()->getParameter('server_class'));
     /** @var Collection $servers */
     $servers = $discord->guilds;
     $ids = [];
     foreach ($discord->guilds as $guild) {
         $ids[] = $guild->id;
     }
     $dbServers = $repo->findBy(['identifier' => $ids]);
     $this->output->text('Creating server managers for ' . $servers->count() . ' servers.');
     $this->output->progressStart($servers->count());
     /** @var ServerManagerFactory $factory */
     $factory = $this->getContainer()->get('factory.server_manager');
     foreach ($discord->guilds as $server) {
         $dbServer = $this->findDbServer($dbServers, $server);
         try {
             $this->serverManagers[] = $factory->create($server, $dbServer);
         } catch (\Exception $e) {
             $this->output->progressFinish();
             $this->logError($e->getMessage());
             exit(0);
         }
         $this->output->progressAdvance();
     }
     $this->output->progressFinish();
     $delay = $this->getContainer()->getParameter('database_save_delay');
     if ($delay !== false) {
         $this->getContainer()->get('default_manager')->flush();
         $discord->loop->addPeriodicTimer($delay, function () {
             $this->output->note('Saving current UoW to database.');
             $this->getContainer()->get('default_manager')->flush();
         });
     }
 }
开发者ID:lfgamers,项目名称:discord-base-bot,代码行数:39,代码来源:RunCommand.php

示例13: doGenerate

 /**
  * @return array
  */
 private function doGenerate()
 {
     $numberOfChars = count($this->possibleChars) - 1;
     $codesList = [];
     $this->io->progressStart($this->numberOfCodesToGenerate);
     for ($i = 0; $i < $this->numberOfCodesToGenerate; $i++) {
         do {
             $code = '';
             for ($j = 0; $j < $this->codeLength; $j++) {
                 $code .= $this->possibleChars[rand(0, $numberOfChars)];
             }
         } while (isset($codesList[$code]));
         $codesList[$code] = $code;
         $this->io->progressAdvance();
         if ($this->sleepTime) {
             usleep($this->sleepTime);
         }
     }
     $this->io->progressFinish();
     if ($this->sort) {
         sort($codesList);
     }
     return array_unique($codesList);
 }
开发者ID:Orbitale,项目名称:RandomStringGenerator,代码行数:27,代码来源:GenerateCommand.php

示例14: executeJobs

 /**
  * Search for open jobs and executes them
  * then show a report about the done job.
  */
 protected function executeJobs()
 {
     // Get the Jobs to be processed.
     $jobsInQueue = $this->em->getRepository('CampaignChainCoreBundle:Job')->getOpenJobsForScheduler($this->scheduler);
     if (empty($jobsInQueue)) {
         return;
     }
     $this->io->section('Executing jobs now:');
     $this->logger->info('Executing {counter} jobs now:', ['counter' => count($jobsInQueue)]);
     $this->io->progressStart(count($jobsInQueue));
     foreach ($jobsInQueue as $jobInQueue) {
         // Execute job.
         $this->executeJob($jobInQueue);
         $this->io->progressAdvance();
     }
     // ensure that the progress bar is at 100%
     $this->io->progressFinish();
     $this->em->clear();
     // Get the processed jobs.
     $jobsProcessed = $this->em->getRepository('CampaignChainCoreBundle:Job')->getProcessedJobsForScheduler($this->scheduler);
     if (empty($jobsProcessed)) {
         return;
     }
     // Display the results of the execution.
     $tableHeader = ['Job ID', 'Operation ID', 'Process ID', 'Job Name', 'Job Start Date', 'Job End Date', 'Duration', 'Status', 'Message'];
     $outputTableRows = [];
     foreach ($jobsProcessed as $jobProcessed) {
         $startDate = null;
         $endDate = null;
         if ($jobProcessed->getStartDate()) {
             $startDate = $jobProcessed->getStartDate()->format('Y-m-d H:i:s');
         }
         if ($jobProcessed->getEndDate()) {
             $endDate = $jobProcessed->getEndDate()->format('Y-m-d H:i:s');
         }
         $jobData = [$jobProcessed->getId(), $jobProcessed->getActionId(), $jobProcessed->getPid(), $jobProcessed->getName(), $startDate, $endDate, $jobProcessed->getDuration() . ' ms', $jobProcessed->getStatus(), $jobProcessed->getMessage()];
         $outputTableRows[] = $jobData;
         if (Job::STATUS_ERROR === $jobProcessed->getStatus()) {
             $context = array_combine($tableHeader, $jobData);
             $this->logger->error($jobProcessed->getMessage(), $context);
         }
     }
     $this->io->text('Results of executed actions:');
     $this->io->table($tableHeader, $outputTableRows);
 }
开发者ID:CampaignChain,项目名称:core,代码行数:49,代码来源:SchedulerCommand.php

示例15: execute

    /**
     * @param InputInterface $input
     * @param OutputInterface $output
     *
     * @return void
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->io->title($this->getDescription());
        $totalAuthorCount = $this->getAuthorCount();
        $this->io->progressStart($totalAuthorCount);
        $rsm = new ResultSetMapping();
        for ($count = 0; $count <= $totalAuthorCount; $count += self::STEP) {
            $sql = <<<SQL
        UPDATE author
        SET user_id = users.id
        FROM users
        WHERE author.email = users.email
        AND author.id > ?
        and author.id < ?
        and author.user_id is null
SQL;
            $query = $this->em->createNativeQuery($sql, $rsm);
            $query->setParameter(1, $count);
            $query->setParameter(2, $count + self::STEP);
            $query->getResult();
            if (self::STEP > $totalAuthorCount) {
                $this->io->progressFinish();
            } else {
                $this->io->progressAdvance(self::STEP);
            }
        }
        $this->io->newLine(2);
        $this->io->success('All process finished');
    }
开发者ID:ojs,项目名称:ojs,代码行数:35,代码来源:GuessAuthorUserCommand.php


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