jenkins-bot has submitted this change and it was merged. Change subject: Remove duplicate method from ItemHandler ......................................................................
Remove duplicate method from ItemHandler Change-Id: Ia41d3be0449a5ce2ee0b8fbc928d14f732c0f857 --- M repo/includes/content/ItemHandler.php M repo/includes/specials/SpecialItemByTitle.php 2 files changed, 11 insertions(+), 39 deletions(-) Approvals: Daniel Kinzler: Looks good to me, approved jenkins-bot: Verified diff --git a/repo/includes/content/ItemHandler.php b/repo/includes/content/ItemHandler.php index 6416677..4530ca0 100644 --- a/repo/includes/content/ItemHandler.php +++ b/repo/includes/content/ItemHandler.php @@ -8,26 +8,7 @@ /** * Content handler for Wikibase items. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 - * - * @file - * @ingroup WikibaseRepo - * * @licence GNU GPL v2+ * @author Jeroen De Dauw < [email protected] > * @author Daniel Kinzler @@ -95,7 +76,13 @@ */ public function getContentFromSiteLink( $siteId, $pageName ) { $id = $this->getIdForSiteLink( $siteId, $pageName ); - return $id === false ? null : WikibaseRepo::getDefaultInstance()->getEntityContentFactory()->getFromId( new EntityId( Item::ENTITY_TYPE, $id ) ); + + if ( $id === false ) { + return null; + } + + $entityId = new EntityId( Item::ENTITY_TYPE, $id ); + return WikibaseRepo::getDefaultInstance()->getEntityContentFactory()->getFromId( $entityId ); } /** @@ -111,21 +98,6 @@ */ public function getIdForSiteLink( $siteId, $pageName ) { return StoreFactory::getStore()->newSiteLinkCache()->getItemIdForLink( $siteId, $pageName ); - } - - /** - * Get the item corresponding to the provided site and title pair, or null if there is no such item. - * - * @since 0.1 - * - * @param string $siteId - * @param string $pageName - * - * @return ItemContent|null - */ - public function getFromSiteLink( $siteId, $pageName ) { - $id = $this->getIdForSiteLink( $siteId, $pageName ); - return $id === false ? null : WikibaseRepo::getDefaultInstance()->getEntityContentFactory()->getFromId( new EntityId( Item::ENTITY_TYPE, $id ) ); } /** @@ -146,8 +118,8 @@ return null; } - $eid = new EntityId( Item::ENTITY_TYPE, $id ); - return WikibaseRepo::getDefaultInstance()->getEntityContentFactory()->getTitleForId( $eid ); + $entityId = new EntityId( Item::ENTITY_TYPE, $id ); + return WikibaseRepo::getDefaultInstance()->getEntityContentFactory()->getTitleForId( $entityId ); } /** diff --git a/repo/includes/specials/SpecialItemByTitle.php b/repo/includes/specials/SpecialItemByTitle.php index 9ae1131..d7ba2ca 100644 --- a/repo/includes/specials/SpecialItemByTitle.php +++ b/repo/includes/specials/SpecialItemByTitle.php @@ -61,14 +61,14 @@ } $itemHandler = new ItemHandler(); - $itemContent = $itemHandler->getFromSiteLink( $siteId, $pageName ); + $itemContent = $itemHandler->getContentFromSiteLink( $siteId, $pageName ); // Do we have an item content, and if not can we try harder? if ( $itemContent === null && Settings::get( 'normalizeItemByTitlePageNames' ) === true ) { // Try harder by requesting normalization on the external site $siteObj = \SiteSQLStore::newInstance()->getSite( $siteId ); if ( $siteObj instanceof Site ) { $pageName = $siteObj->normalizePageName( $page ); - $itemContent = $itemHandler->getFromSiteLink( $siteId, $pageName ); + $itemContent = $itemHandler->getContentFromSiteLink( $siteId, $pageName ); } } -- To view, visit https://gerrit.wikimedia.org/r/88021 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia41d3be0449a5ce2ee0b8fbc928d14f732c0f857 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Addshore <[email protected]> Gerrit-Reviewer: Addshore <[email protected]> Gerrit-Reviewer: Anja Jentzsch <[email protected]> Gerrit-Reviewer: Ataherivand <[email protected]> Gerrit-Reviewer: Aude <[email protected]> Gerrit-Reviewer: Daniel Kinzler <[email protected]> Gerrit-Reviewer: Daniel Werner <[email protected]> Gerrit-Reviewer: Denny Vrandecic <[email protected]> Gerrit-Reviewer: Henning Snater <[email protected]> Gerrit-Reviewer: Hoo man <[email protected]> Gerrit-Reviewer: Jens Ohlig <[email protected]> Gerrit-Reviewer: Jeroen De Dauw <[email protected]> Gerrit-Reviewer: John Erling Blad <[email protected]> Gerrit-Reviewer: Liangent <[email protected]> Gerrit-Reviewer: Lydia Pintscher <[email protected]> Gerrit-Reviewer: Markus Kroetzsch <[email protected]> Gerrit-Reviewer: Nikola Smolenski <[email protected]> Gerrit-Reviewer: Nilesh <[email protected]> Gerrit-Reviewer: Tobias Gritschacher <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
