/**
  * @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;
     }
     $reporter = new ObservableMessageReporter();
     $reporter->registerReporterCallback(array($this, 'report'));
     $table = new PropertyInfoTable(false);
     $wikibaseRepo = WikibaseRepo::getDefaultInstance();
     $entityLookup = $wikibaseRepo->getEntityLookup();
     $propertyInfoBuilder = $wikibaseRepo->newPropertyInfoBuilder();
     $builder = new PropertyInfoTableBuilder($table, $entityLookup, $propertyInfoBuilder);
     $builder->setReporter($reporter);
     $builder->setBatchSize((int) $this->getOption('batch-size', 100));
     $builder->setRebuildAll($this->getOption('rebuild-all', false));
     $builder->setFromId((int) $this->getOption('start-row', 1));
     $n = $builder->rebuildPropertyInfo();
     $this->output("Done. Updated {$n} property info entries.\n");
     return true;
 }
 /**
  * Wrapper for invoking PropertyInfoTableBuilder from DatabaseUpdater
  * during a database update.
  *
  * @param DatabaseUpdater $updater
  */
 public static function rebuildPropertyInfo(DatabaseUpdater $updater)
 {
     $reporter = new ObservableMessageReporter();
     $reporter->registerReporterCallback(function ($msg) use($updater) {
         $updater->output("..." . $msg . "\n");
     });
     $table = new PropertyInfoTable(false);
     $wikibaseRepo = WikibaseRepo::getDefaultInstance();
     $contentCodec = $wikibaseRepo->getEntityContentDataCodec();
     $propertyInfoBuilder = $wikibaseRepo->newPropertyInfoBuilder();
     $wikiPageEntityLookup = new WikiPageEntityRevisionLookup($contentCodec, new WikiPageEntityMetaDataLookup($wikibaseRepo->getEntityIdParser()), false);
     $cachingEntityLookup = new CachingEntityRevisionLookup($wikiPageEntityLookup, new HashBagOStuff());
     $entityLookup = new RevisionBasedEntityLookup($cachingEntityLookup);
     $builder = new PropertyInfoTableBuilder($table, $entityLookup, $propertyInfoBuilder);
     $builder->setReporter($reporter);
     $builder->setUseTransactions(false);
     $updater->output('Populating ' . $table->getTableName() . "\n");
     $builder->rebuildPropertyInfo();
 }