/**
  * @see LoggedUpdateMaintenance::doDBUpdates
  *
  * @return bool
  */
 public function doDBUpdates()
 {
     if (!defined('WB_VERSION')) {
         $this->output("You need to have Wikibase enabled in order to use this maintenance script!\n\n");
         exit;
     }
     $batchSize = (int) $this->getOption('batch-size', 100);
     $rebuildAll = $this->getOption('rebuild-all', false);
     $reporter = new ObservableMessageReporter();
     $reporter->registerReporterCallback(array($this, 'report'));
     $wikibaseRepo = WikibaseRepo::getDefaultInstance();
     $builder = new EntityPerPageBuilder($wikibaseRepo->getStore()->newEntityPerPage(), $wikibaseRepo->getEntityIdParser(), $wikibaseRepo->getEntityNamespaceLookup(), $wikibaseRepo->getContentModelMappings());
     $builder->setReporter($reporter);
     $builder->setBatchSize($batchSize);
     $builder->setRebuildAll($rebuildAll);
     $builder->rebuild();
     return true;
 }
 public function testRebuildAll()
 {
     $this->entityPerPageTable->clear();
     $this->assertEquals(0, $this->countEntityPerPageRows());
     $builder = new EntityPerPageBuilder($this->entityPerPageTable, $this->wikibaseRepo->getEntityIdParser(), $this->wikibaseRepo->getEntityNamespaceLookup(), $this->wikibaseRepo->getContentModelMappings());
     $builder->setRebuildAll(true);
     $builder->rebuild();
     $this->assertEquals(count($this->entityPerPageRows), $this->countEntityPerPageRows());
     $this->assertRows($this->entityPerPageRows);
 }