/** * @since 0.5 * * @param EntityIdPager $entityIdPager */ public function rebuild(EntityIdPager $entityIdPager) { $this->report('Start rebuild...'); $total = 0; while (true) { $ids = $entityIdPager->fetchIds($this->batchSize); if (!$ids) { break; } $total += $this->rebuildSiteLinks($ids); $this->report('Processed ' . $total . ' entities.'); } $this->report('Rebuild done.'); }
/** * Generates a dump, writing to the file handle provided to the constructor. * * @param EntityIdPager $idPager an Iterator that returns EntityId instances */ public function generateDump(EntityIdPager $idPager) { $dumpCount = 0; $this->preDump(); // Iterate over batches of IDs, maintaining the current position of the pager in the $position variable. while (true) { $ids = $idPager->fetchIds($this->batchSize); if (!$ids) { break; } $this->dumpEntities($ids, $dumpCount); $this->progressReporter->reportMessage('Processed ' . $dumpCount . ' entities.'); if ($this->limit && $dumpCount >= $this->limit) { break; } } $this->postDump(); }