/** * Fetches the next batch of IDs. Calling this has the side effect of advancing the * internal state of the page, typically implemented by some underlying resource * such as a file pointer or a database connection. * * @note: After some finite number of calls, this method should eventually return * an empty list of IDs, indicating that no more IDs are available. * * @since 0.5 * * @param int $limit The maximum number of IDs to return. * * @return EntityId[] A list of EntityIds matching the given parameters. Will * be empty if there are no more entities to list from the given offset. */ public function fetchIds($limit) { $ids = $this->entityPerPage->listEntities($this->entityType, $limit, $this->position, $this->redirectMode); if (!empty($ids)) { $this->position = end($ids); reset($ids); } return $ids; }
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); }
/** * @param object $pageRow */ private function updateEntry($pageRow) { // Derive the entity id from the page title $entityId = $this->tryParseId($pageRow->page_title); if (!$entityId) { return; } // Derive the target id from the redirect target title $targetId = $pageRow->rd_title === null ? null : $this->tryParseId($pageRow->rd_title); if ($this->rebuildAll === true) { $this->entityPerPageTable->deleteEntity($entityId); } $pageId = (int) $pageRow->page_id; if ($targetId) { $this->entityPerPageTable->addRedirectPage($entityId, $pageId, $targetId); } else { $this->entityPerPageTable->addEntityPage($entityId, $pageId); } }
/** * @see SpecialWikibaseQueryPage::getResult * * @since 0.4 * * @param int $offset * @param int $limit * * @return EntityId[] */ protected function getResult($offset = 0, $limit = 0) { return $this->entityPerPage->getEntitiesWithoutTerm($this->termType, $this->language, $this->type, $limit, $offset); }