protected function execute(InputInterface $input, OutputInterface $output) { $this->addArgument('url', InputArgument::OPTIONAL, 'What is the url of the issue to retrieve?'); $rtbc_queue = new RtbcQueue(); $issues_to_search = $rtbc_queue->getIssueUris(); $output->writeln(count($issues_to_search) . ' issues to search.'); $progress = new ProgressBar($output, 50); $progress->start(); foreach ($issues_to_search as $item) { $input->setArgument('url', $item); parent::execute($input, $output); $progress->advance(); } $progress->finish(); }
protected function execute(InputInterface $input, OutputInterface $output) { $this->addArgument('url', InputArgument::OPTIONAL, 'What is the url of the issue to retrieve?'); $rtbc_queue = new RtbcQueue(); $issues = $rtbc_queue->getIssueUris(); $output->writeln(count($issues) . ' issues to check.'); $progress = new ProgressBar($output, count($issues)); $failed_patches = array(); $progress->start(); foreach ($issues as $item) { $input->setArgument('url', $item); // Ignore NULL return where checkPatch() is unable to determine if patch // applies or not. This normally occurs because the issue does not have // a patch. if ($this->checkPatch($input, $output) === FALSE) { $failed_patches[] = array('issue' => $item, 'patch' => $this->getPatchName(), 'output' => $this->getOutput()); } $progress->advance(); } $progress->finish(); if (count($failed_patches)) { $output->writeln(array_map(function ($value) { return '<fg=red>' . $value['patch'] . ' on ' . $value['issue'] . ' no longer applies.</fg=red>'; }, $failed_patches)); if ($input->getOption('mark-needs-work') && $this->askConfirmation($input, $output, 'Post comments to these issues (yes/NO)? ')) { $browser = $this->login($input, $output); foreach ($failed_patches as $item) { $comment_form = $browser->getCommentForm($item['issue']); $comment_form->setStatusNeedsWork(); $comment_form->setCommentText($item['patch'] . " no longer applies.\n<code>\n" . $item['output'] . "\n</code>"); $comment_form->ensureTag($comment_form::TAG_NEEDS_REROLL); $browser->submitForm($comment_form->getForm()); } } } else { $output->writeln('<fg=green>All patches apply</fg=green>'); } }