Hoo man has uploaded a new change for review. https://gerrit.wikimedia.org/r/266440
Change subject: Use Title::getPrefixedText where appropriate ...................................................................... Use Title::getPrefixedText where appropriate Instead of Title::getFullText which also includes the section fragment. We already do that in many places, but there are also quite some where we use the wrong value (it's wrong as we only handle full titles, Wikibase doesn't know about sections). As suggested by Katie in https://phabricator.wikimedia.org/T47839#1954505. I don't think this will help with the bug… but it's a good thing to do in general. Change-Id: I2e6803210a0ed0bbf16b036bfd739e8f72361a0c --- M client/includes/DataAccess/PropertyParserFunction/Runner.php M client/includes/Hooks/DeletePageNoticeCreator.php M client/includes/Hooks/InfoActionHookHandler.php M client/includes/Hooks/MovePageNotice.php M client/includes/Hooks/OtherProjectsSidebarGenerator.php M client/includes/LangLinkHandler.php M client/includes/ParserOutput/ClientParserOutputDataUpdater.php M client/includes/SiteLinkCommentCreator.php M client/includes/UpdateRepo/UpdateRepo.php M client/tests/phpunit/includes/Changes/ChangeHandlerTest.php M client/tests/phpunit/includes/Hooks/InfoActionHookHandlerTest.php M client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php M client/tests/phpunit/includes/Usage/UsageTrackingIntegrationTest.php M client/tests/phpunit/includes/recentchanges/RecentChangeFactoryTest.php 14 files changed, 19 insertions(+), 19 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/40/266440/1 diff --git a/client/includes/DataAccess/PropertyParserFunction/Runner.php b/client/includes/DataAccess/PropertyParserFunction/Runner.php index c3ab086..d11b624 100644 --- a/client/includes/DataAccess/PropertyParserFunction/Runner.php +++ b/client/includes/DataAccess/PropertyParserFunction/Runner.php @@ -124,7 +124,7 @@ $entityId = $this->getEntityIdFromString( $parser, $from ); } else { $title = $parser->getTitle(); - $siteLink = new SiteLink( $this->siteId, $title->getFullText() ); + $siteLink = new SiteLink( $this->siteId, $title->getPrefixedText() ); $entityId = $this->siteLinkLookup->getItemIdForSiteLink( $siteLink ); } diff --git a/client/includes/Hooks/DeletePageNoticeCreator.php b/client/includes/Hooks/DeletePageNoticeCreator.php index 9f7452d..275b335 100644 --- a/client/includes/Hooks/DeletePageNoticeCreator.php +++ b/client/includes/Hooks/DeletePageNoticeCreator.php @@ -57,7 +57,7 @@ $entityId = $this->siteLinkLookup->getItemIdForSiteLink( new SiteLink( $this->siteId, - $title->getFullText() + $title->getPrefixedText() ) ); diff --git a/client/includes/Hooks/InfoActionHookHandler.php b/client/includes/Hooks/InfoActionHookHandler.php index 74296f8..71a7d9c 100644 --- a/client/includes/Hooks/InfoActionHookHandler.php +++ b/client/includes/Hooks/InfoActionHookHandler.php @@ -71,7 +71,7 @@ */ private function getPageInfoRow( IContextSource $context, Title $title ) { $entityId = $this->siteLinkLookup->getItemIdForSiteLink( - new SiteLink( $this->siteId, $title->getFullText() ) + new SiteLink( $this->siteId, $title->getPrefixedText() ) ); $row = $entityId ? $this->getItemPageInfo( $context, $entityId ) diff --git a/client/includes/Hooks/MovePageNotice.php b/client/includes/Hooks/MovePageNotice.php index c5abd36..1155179 100644 --- a/client/includes/Hooks/MovePageNotice.php +++ b/client/includes/Hooks/MovePageNotice.php @@ -114,7 +114,7 @@ $entityId = $this->siteLinkLookup->getItemIdForSiteLink( new SiteLink( $this->siteId, - $title->getFullText() + $title->getPrefixedText() ) ); diff --git a/client/includes/Hooks/OtherProjectsSidebarGenerator.php b/client/includes/Hooks/OtherProjectsSidebarGenerator.php index 285bbb5..d3d221e 100644 --- a/client/includes/Hooks/OtherProjectsSidebarGenerator.php +++ b/client/includes/Hooks/OtherProjectsSidebarGenerator.php @@ -191,7 +191,7 @@ * @return Item|null */ private function getItemId( Title $title ) { - $siteLink = new SiteLink( $this->localSiteId, $title->getFullText() ); + $siteLink = new SiteLink( $this->localSiteId, $title->getPrefixedText() ); return $this->siteLinkLookup->getItemIdForSiteLink( $siteLink ); } diff --git a/client/includes/LangLinkHandler.php b/client/includes/LangLinkHandler.php index 335b0f1..917f241 100644 --- a/client/includes/LangLinkHandler.php +++ b/client/includes/LangLinkHandler.php @@ -101,7 +101,7 @@ $itemId = $this->siteLinkLookup->getItemIdForLink( $this->siteId, - $title->getFullText() + $title->getPrefixedText() ); if ( $itemId !== null ) { @@ -116,7 +116,7 @@ $links = $this->indexLinksBySiteId( $links ); } else { wfLogWarning( __METHOD__ . ": Could not load item " . $itemId->getSerialization() - . " for " . $title->getFullText() ); + . " for " . $title->getPrefixedText() ); } } diff --git a/client/includes/ParserOutput/ClientParserOutputDataUpdater.php b/client/includes/ParserOutput/ClientParserOutputDataUpdater.php index e9fb5e2..9fc8e81 100644 --- a/client/includes/ParserOutput/ClientParserOutputDataUpdater.php +++ b/client/includes/ParserOutput/ClientParserOutputDataUpdater.php @@ -153,7 +153,7 @@ private function getItemIdForTitle( Title $title ) { return $this->siteLinkLookup->getItemIdForLink( $this->siteId, - $title->getFullText() + $title->getPrefixedText() ); } diff --git a/client/includes/SiteLinkCommentCreator.php b/client/includes/SiteLinkCommentCreator.php index 31c4448..75e2c44 100644 --- a/client/includes/SiteLinkCommentCreator.php +++ b/client/includes/SiteLinkCommentCreator.php @@ -116,8 +116,8 @@ return false; } - return $title->getFullText() === $diffOp->getOldValue() || - $title->getFullText() === $diffOp->getNewValue(); + return $title->getPrefixedText() === $diffOp->getOldValue() || + $title->getPrefixedText() === $diffOp->getNewValue(); } /** @@ -267,9 +267,9 @@ } elseif ( $diffOp instanceof DiffOpRemove ) { $params['message'] = 'wikibase-comment-unlink'; } elseif ( $diffOp instanceof DiffOpChange ) { - if ( $title && $title->getFullText() === $diffOp->getOldValue() ) { + if ( $title && $title->getPrefixedText() === $diffOp->getOldValue() ) { $params['message'] = 'wikibase-comment-unlink'; - } elseif ( $title && $title->getFullText() === $diffOp->getNewValue() ) { + } elseif ( $title && $title->getPrefixedText() === $diffOp->getNewValue() ) { $params['message'] = 'wikibase-comment-linked'; } else { $params['message'] = 'wikibase-comment-sitelink-change'; diff --git a/client/includes/UpdateRepo/UpdateRepo.php b/client/includes/UpdateRepo/UpdateRepo.php index 0ec1ce6..90e3faf 100644 --- a/client/includes/UpdateRepo/UpdateRepo.php +++ b/client/includes/UpdateRepo/UpdateRepo.php @@ -88,14 +88,14 @@ $this->entityId = $this->siteLinkLookup->getItemIdForSiteLink( new SiteLink( $this->siteId, - $this->title->getFullText() + $this->title->getPrefixedText() ) ); if ( $this->entityId === null ) { wfDebugLog( 'UpdateRepo', - "Couldn't find an item for {$this->title->getFullText()}" + "Couldn't find an item for {$this->title->getPrefixedText()}" ); } } diff --git a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php index 0de6c6e..6eddc94 100644 --- a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php +++ b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php @@ -382,7 +382,7 @@ public function provideHandleChange() { $changes = TestChanges::getChanges(); - $userEmmy2 = Title::newFromText( 'User:Emmy2' )->getFullText(); + $userEmmy2 = Title::newFromText( 'User:Emmy2' )->getPrefixedText(); $empty = array( 'purgeParserCache' => array(), diff --git a/client/tests/phpunit/includes/Hooks/InfoActionHookHandlerTest.php b/client/tests/phpunit/includes/Hooks/InfoActionHookHandlerTest.php index f31a089..b10c8c4 100644 --- a/client/tests/phpunit/includes/Hooks/InfoActionHookHandlerTest.php +++ b/client/tests/phpunit/includes/Hooks/InfoActionHookHandlerTest.php @@ -130,7 +130,7 @@ ->will( $this->returnValue( NS_MAIN ) ); $title->expects( $this->any() ) - ->method( 'getFullText' ) + ->method( 'getPrefixedText' ) ->will( $this->returnValue( 'Cat' ) ); $context = new RequestContext(); diff --git a/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php b/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php index ef49f1f..10f039b 100644 --- a/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php +++ b/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php @@ -116,7 +116,7 @@ ->getMock(); $title->expects( $this->any() ) - ->method( 'getFullText' ) + ->method( 'getPrefixedText' ) ->will( $this->returnValue( $fullText ) ); return $title; diff --git a/client/tests/phpunit/includes/Usage/UsageTrackingIntegrationTest.php b/client/tests/phpunit/includes/Usage/UsageTrackingIntegrationTest.php index c3ee1b8..7f43c7d 100644 --- a/client/tests/phpunit/includes/Usage/UsageTrackingIntegrationTest.php +++ b/client/tests/phpunit/includes/Usage/UsageTrackingIntegrationTest.php @@ -131,7 +131,7 @@ // Assume the state created by testUpdateUsageOnCreation(). // Change page content to use the template instead of {{#property}} directly. $text = "Just some text\n"; - $text .= "using a template: {{" . $this->templateTitle->getFullText() . "}}\n"; + $text .= "using a template: {{" . $this->templateTitle->getPrefixedText() . "}}\n"; $this->updatePage( $this->articleTitle, $text ); // Check that Q22, used via the template, is now tracked. diff --git a/client/tests/phpunit/includes/recentchanges/RecentChangeFactoryTest.php b/client/tests/phpunit/includes/recentchanges/RecentChangeFactoryTest.php index 0796d27..12900e5 100644 --- a/client/tests/phpunit/includes/recentchanges/RecentChangeFactoryTest.php +++ b/client/tests/phpunit/includes/recentchanges/RecentChangeFactoryTest.php @@ -90,7 +90,7 @@ // XXX: This assumes NS_MAIN. Getting namespace names right nicely is hard, they depend on the lang. $title->expects( $this->any() ) - ->method( 'getFullText' ) + ->method( 'getPrefixedText' ) ->will( $this->returnValue( $text ) ); $title->expects( $this->any() ) -- To view, visit https://gerrit.wikimedia.org/r/266440 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2e6803210a0ed0bbf16b036bfd739e8f72361a0c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Hoo man <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
