/** * Static wrapper for EntityUsageTableBuilder::fillUsageTable * * @param DatabaseUpdater $dbUpdater * @param string $table */ public static function fillSubscriptionTable(DatabaseUpdater $dbUpdater, $table) { $primer = new ChangesSubscriptionTableBuilder(wfGetLB(), $table, 1000); $reporter = new ObservableMessageReporter(); $reporter->registerReporterCallback(function ($msg) use($dbUpdater) { $dbUpdater->output("\t{$msg}\n"); }); $primer->setProgressReporter($reporter); $primer->fillSubscriptionTable(); }
/** * @see LoggedUpdateMaintenance::doDBUpdates * * @throws EntityIdParsingException * @return bool */ public function doDBUpdates() { if (!defined('WB_VERSION')) { $this->error("You need to have Wikibase enabled in order to use this maintenance script!", 1); } $idParser = WikibaseRepo::getDefaultInstance()->getEntityIdParser(); $startItemOption = $this->getOption('start-item'); $startItem = $startItemOption === null ? null : $idParser->parse($startItemOption); if ($startItem !== null && !$startItem instanceof ItemId) { throw new EntityIdParsingException('Not an Item ID: ' . $startItemOption); } $verbose = (bool) $this->getOption('verbose', false); $reporter = new ObservableMessageReporter(); $reporter->registerReporterCallback(array($this, 'report')); $builder = new ChangesSubscriptionTableBuilder(wfGetLB(), 'wb_changes_subscription', $this->mBatchSize, $verbose ? 'verbose' : 'standard'); $builder->setProgressReporter($reporter); $builder->setExceptionHandler(new ReportingExceptionHandler($reporter)); $builder->fillSubscriptionTable($startItem); return true; }