[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Move EntitiesWithoutTermFinder::getEntitiesWithoutTerm
jenkins-bot has submitted this change and it was merged. Change subject: Move EntitiesWithoutTermFinder::getEntitiesWithoutTerm .. Move EntitiesWithoutTermFinder::getEntitiesWithoutTerm from EntityPerPageTable to the new SqlEntitiesWithoutTermFinder. This just copies code around. Manually tested the affected special pages (Special:EntitiesWithoutDescription/ Special:EntitiesWithoutLabel). Bug: T140891 Change-Id: I0c28fb7457ea955310a16791badc68fc6ff75ca4 --- M repo/includes/Store/Sql/EntityPerPageTable.php A repo/includes/Store/Sql/SqlEntitiesWithoutTermFinder.php M repo/includes/Store/Sql/SqlStore.php 3 files changed, 101 insertions(+), 54 deletions(-) Approvals: Addshore: Looks good to me, approved jenkins-bot: Verified diff --git a/repo/includes/Store/Sql/EntityPerPageTable.php b/repo/includes/Store/Sql/EntityPerPageTable.php index 5110694..fc07cc6 100644 --- a/repo/includes/Store/Sql/EntityPerPageTable.php +++ b/repo/includes/Store/Sql/EntityPerPageTable.php @@ -9,7 +9,6 @@ use Wikibase\DataModel\Entity\Int32EntityId; use Wikibase\Lib\EntityIdComposer; use Wikibase\Repo\Store\EntityPerPage; -use Wikibase\Repo\Store\EntitiesWithoutTermFinder; /** * Represents a lookup database table that makes the link between entities and pages. @@ -21,7 +20,7 @@ * @author Thomas Pellissier Tanon * @author Daniel Kinzler */ -class EntityPerPageTable implements EntityPerPage, EntitiesWithoutTermFinder { +class EntityPerPageTable implements EntityPerPage { /** * @var EntityIdParser @@ -232,57 +231,6 @@ */ public function clear() { return $this->loadBalancer->getConnection( DB_MASTER )->delete( 'wb_entity_per_page', '*', __METHOD__ ); - } - - /** -* @see EntityPerPage::getEntitiesWithoutTerm -* -* @since 0.2 -* -* @param string $termType Can be any member of the TermIndexEntry::TYPE_ enum -* @param string|null $language Restrict the search for one language. By default the search is done for all languages. -* @param string|null $entityType Can be "item", "property" or "query". By default the search is done for all entities. -* @param integer $limit Limit of the query. -* @param integer $offset Offset of the query. -* -* @return EntityId[] -*/ - public function getEntitiesWithoutTerm( $termType, $language = null, $entityType = null, $limit = 50, $offset = 0 ) { - $dbr = wfGetDB( DB_SLAVE ); - $conditions = array( - 'term_entity_type IS NULL' - ); - - $joinConditions = 'term_entity_id = epp_entity_id' . - ' AND term_entity_type = epp_entity_type' . - ' AND term_type = ' . $dbr->addQuotes( $termType ) . - ' AND epp_redirect_target IS NULL'; - - if ( $language !== null ) { - $joinConditions .= ' AND term_language = ' . $dbr->addQuotes( $language ); - } - - if ( $entityType !== null ) { - $conditions[] = 'epp_entity_type = ' . $dbr->addQuotes( $entityType ); - } - - $rows = $dbr->select( - array( 'wb_entity_per_page', 'wb_terms' ), - array( - 'entity_id' => 'epp_entity_id', - 'entity_type' => 'epp_entity_type', - ), - $conditions, - __METHOD__, - array( - 'OFFSET' => $offset, - 'LIMIT' => $limit, - 'ORDER BY' => 'epp_page_id DESC' - ), - array( 'wb_terms' => array( 'LEFT JOIN', $joinConditions ) ) - ); - - return $this->getEntityIdsFromRows( $rows ); } protected function getEntityIdsFromRows( $rows ) { diff --git a/repo/includes/Store/Sql/SqlEntitiesWithoutTermFinder.php b/repo/includes/Store/Sql/SqlEntitiesWithoutTermFinder.php new file mode 100644 index 000..8f0487d --- /dev/null +++ b/repo/includes/Store/Sql/SqlEntitiesWithoutTermFinder.php @@ -0,0 +1,98 @@ +entityIdComposer = $entityIdComposer; + } + + /** +* @see EntitiesWithoutTermFinder::getEntitiesWithoutTerm +* +* @since 0.2 +* +* @param string $termType Can be any member of the TermIndexEntry::TYPE_ enum +* @param string|null $language Restrict the search for one language. By default the search is done for all languages. +* @param string|null $entityType Can be "item", "property" or "query". By default the search is done for all entities. +* @param integer $limit Limit of the query. +* @param i
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Move EntitiesWithoutTermFinder::getEntitiesWithoutTerm
Hoo man has uploaded a new change for review. https://gerrit.wikimedia.org/r/314182 Change subject: Move EntitiesWithoutTermFinder::getEntitiesWithoutTerm .. Move EntitiesWithoutTermFinder::getEntitiesWithoutTerm from EntityPerPageTable to the new SqlEntitiesWithoutTermFinder. This just copies code around. Manually tested the affected special pages (Special:EntitiesWithoutDescription/ Special:EntitiesWithoutLabel). Bug: T140891 Change-Id: I0c28fb7457ea955310a16791badc68fc6ff75ca4 --- M repo/includes/Store/Sql/EntityPerPageTable.php A repo/includes/Store/Sql/SqlEntitiesWithoutTermFinder.php M repo/includes/Store/Sql/SqlStore.php 3 files changed, 101 insertions(+), 54 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/82/314182/1 diff --git a/repo/includes/Store/Sql/EntityPerPageTable.php b/repo/includes/Store/Sql/EntityPerPageTable.php index 5110694..fc07cc6 100644 --- a/repo/includes/Store/Sql/EntityPerPageTable.php +++ b/repo/includes/Store/Sql/EntityPerPageTable.php @@ -9,7 +9,6 @@ use Wikibase\DataModel\Entity\Int32EntityId; use Wikibase\Lib\EntityIdComposer; use Wikibase\Repo\Store\EntityPerPage; -use Wikibase\Repo\Store\EntitiesWithoutTermFinder; /** * Represents a lookup database table that makes the link between entities and pages. @@ -21,7 +20,7 @@ * @author Thomas Pellissier Tanon * @author Daniel Kinzler */ -class EntityPerPageTable implements EntityPerPage, EntitiesWithoutTermFinder { +class EntityPerPageTable implements EntityPerPage { /** * @var EntityIdParser @@ -232,57 +231,6 @@ */ public function clear() { return $this->loadBalancer->getConnection( DB_MASTER )->delete( 'wb_entity_per_page', '*', __METHOD__ ); - } - - /** -* @see EntityPerPage::getEntitiesWithoutTerm -* -* @since 0.2 -* -* @param string $termType Can be any member of the TermIndexEntry::TYPE_ enum -* @param string|null $language Restrict the search for one language. By default the search is done for all languages. -* @param string|null $entityType Can be "item", "property" or "query". By default the search is done for all entities. -* @param integer $limit Limit of the query. -* @param integer $offset Offset of the query. -* -* @return EntityId[] -*/ - public function getEntitiesWithoutTerm( $termType, $language = null, $entityType = null, $limit = 50, $offset = 0 ) { - $dbr = wfGetDB( DB_SLAVE ); - $conditions = array( - 'term_entity_type IS NULL' - ); - - $joinConditions = 'term_entity_id = epp_entity_id' . - ' AND term_entity_type = epp_entity_type' . - ' AND term_type = ' . $dbr->addQuotes( $termType ) . - ' AND epp_redirect_target IS NULL'; - - if ( $language !== null ) { - $joinConditions .= ' AND term_language = ' . $dbr->addQuotes( $language ); - } - - if ( $entityType !== null ) { - $conditions[] = 'epp_entity_type = ' . $dbr->addQuotes( $entityType ); - } - - $rows = $dbr->select( - array( 'wb_entity_per_page', 'wb_terms' ), - array( - 'entity_id' => 'epp_entity_id', - 'entity_type' => 'epp_entity_type', - ), - $conditions, - __METHOD__, - array( - 'OFFSET' => $offset, - 'LIMIT' => $limit, - 'ORDER BY' => 'epp_page_id DESC' - ), - array( 'wb_terms' => array( 'LEFT JOIN', $joinConditions ) ) - ); - - return $this->getEntityIdsFromRows( $rows ); } protected function getEntityIdsFromRows( $rows ) { diff --git a/repo/includes/Store/Sql/SqlEntitiesWithoutTermFinder.php b/repo/includes/Store/Sql/SqlEntitiesWithoutTermFinder.php new file mode 100644 index 000..8f0487d --- /dev/null +++ b/repo/includes/Store/Sql/SqlEntitiesWithoutTermFinder.php @@ -0,0 +1,98 @@ +entityIdComposer = $entityIdComposer; + } + + /** +* @see EntitiesWithoutTermFinder::getEntitiesWithoutTerm +* +* @since 0.2 +* +* @param string $termType Can be any member of the TermIndexEntry::TYPE_ enum +* @param string|null $language Restrict the search for one language. By default the search is done for all languages. +* @param string|null $entityType Can be "item", "property" or "query". By default the search is done for all entities. +* @param