/** * Delete all bundles from index */ public function deleteBundlesIndexes(Bundle $bundle = null) { $delete = $this->solarium->createUpdate(); $delete->addDeleteQuery(null !== $bundle ? $bundle->getFullName() : '*:*'); $delete->addCommit(); $this->solarium->update($delete); }
/** * @param Bundle $bundle * @param SolrIndexer $indexer * @param OutputInterface $output * @param boolean $verbose */ private function reindex(Bundle $bundle, $indexer, $output, $verbose) { if ($verbose) { $output->writeln('Indexing ' . $bundle->getFullName() . '...'); } try { $indexer->indexBundle($bundle); } catch (\Exception $e) { $output->writeln('<error>Exception: ' . $e->getMessage() . ', skipping bundle ' . $bundle->getFullName() . '.</error>'); } }
public function updateRepo(Bundle $bundle) { $this->output->write($bundle->getFullName()); $pad = 50 - strlen($bundle->getFullName()); if ($pad > 0) { $this->output->write(str_repeat(' ', $pad)); } if (!$this->githubRepoApi->update($bundle)) { $this->output->write(' - Fail, will be removed'); $bundle->getUser()->removeBundle($bundle); $this->em->remove($bundle); $this->em->flush(); return false; } else { $score = $this->em->getRepository('Knp\\Bundle\\KnpBundlesBundle\\Entity\\Score')->setScore(new \DateTime(), $bundle, $bundle->getScore()); $this->em->persist($score); } $this->output->writeln(' ' . $bundle->getScore()); $this->em->flush(); $contributorNames = $this->githubRepoApi->getContributorNames($bundle); $contributors = array(); foreach ($contributorNames as $contributorName) { $contributors[] = $this->getOrCreateUser($contributorName); } $this->output->writeln(sprintf('%s contributors: %s', $bundle->getFullName(), implode(', ', $contributors))); $bundle->setContributors($contributors); $this->em->flush(); if ($bundle->getUsesTravisCi()) { $this->travis->update($bundle); } }