Page MenuHomePhabricator

Remove unchecked calls to Title::getTalkPage from extensions
Open, Needs TriagePublic

Description

As per T165149, the contract of Title::getTalkPage changes to throw an exception if called on a page in a namespace that does not have a talk namespace associated.

All calls to Title::getTalkPage must either be changed to getTalkPageIfDefined, or they must first check canHaveTalkPage(). These checks can be omitted only for the User namespace, since user pages can always have talk pages. Note that some of the below may be calls to User::getTalkPage instead; those also don't need checks, since users can always have talk pages.

Offending calls to getTalkPage() should be removed from all extensions. They MUST be removed from all extensions deployed on the Wikimedia cluster before merging Icee208dc.

Here is a list of files with potentially offending calls to getTalkNamespace():

Deployed on Wikimedia cluster:

Not deployed on Wikimedia cluster:

More can be found using https://github.com/search?l=&p=7&q=org%3Awikimedia+getTalkPage+language%3APHP&ref=advsearch&type=Code&utf8=%E2%9C%93

Event Timeline

daniel created this task.Jul 31 2017, 6:59 PM
Restricted Application removed a project: Patch-For-Review. · View Herald TranscriptJul 31 2017, 6:59 PM
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptJul 31 2017, 7:00 PM

I can't find getTalkPageIfDefined, is it not in master yet or something?

Catrope updated the task description. (Show Details)Jul 31 2017, 10:07 PM

I can't find getTalkPageIfDefined, is it not in master yet or something?

Oh, I see, it's part of this commit which can't be merged until this task is done. Perhaps getTalkPageIfDefined could be broken out and merged now, so that new code can be written that relies on it?

Change 368943 had a related patch set uploaded (by Catrope; owner: Catrope):
[mediawiki/extensions/Echo@master] Check canHaveTalkPage() before calling getTalkPage()

https://gerrit.wikimedia.org/r/368943

SamanthaNguyen updated the task description. (Show Details)EditedJul 31 2017, 10:54 PM

Removed SiteScout from the list as those 2 cases are false positives (those calls are getting the user talk)

Change 369424 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Introduce Title::getTalkPageIfDefined.

https://gerrit.wikimedia.org/r/369424

daniel added a comment.Aug 1 2017, 5:24 PM

Perhaps getTalkPageIfDefined could be broken out and merged now, so that new code can be written that relies on it?

Good idea, done! I6d2613d8f7105048

Change 369424 merged by jenkins-bot:
[mediawiki/core@master] Introduce Title::getTalkPageIfDefined.

https://gerrit.wikimedia.org/r/369424

daniel updated the task description. (Show Details)Aug 1 2017, 5:59 PM
Restricted Application added a subscriber: PokestarFan. · View Herald TranscriptAug 1 2017, 5:59 PM
demon added a subscriber: demon.Aug 1 2017, 6:15 PM

Removed SiteScout from the list as those 2 cases are false positives (those calls are getting the user talk)

Is that actually true? With the underlying RFC, couldn't a wiki potentially make NS_USER not have a corresponding talk?

daniel updated the task description. (Show Details)Aug 1 2017, 6:16 PM

Change 369470 had a related patch set uploaded (by Ladsgroup; owner: Amir Sarabadani):
[mediawiki/extensions/WikibaseQualityConstraints@master] Fix call to Title::getTalkPage

https://gerrit.wikimedia.org/r/369470

Ladsgroup updated the task description. (Show Details)Aug 1 2017, 8:23 PM

Change 369470 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Fix call to Title::getTalkPage

https://gerrit.wikimedia.org/r/369470

daniel added a comment.Aug 2 2017, 1:19 PM

Is that actually true? With the underlying RFC, couldn't a wiki potentially make NS_USER not have a corresponding talk?

Not legally. $wgCanonicalNamespaceNames is private and is not supposed to be changed per install. Anything defined there can be assumed to be the same on all installs.
In fact, we currently guarantee talk namespaces for all default namespaces. But the User namespace is special, in that linking to the user talk page is very common. So it is useful to explicitly guarantee that the User_talk namespace is always defined.

daniel updated the task description. (Show Details)Aug 2 2017, 1:56 PM
SBisson updated the task description. (Show Details)Aug 2 2017, 4:14 PM

Change 368943 merged by jenkins-bot:
[mediawiki/extensions/Echo@master] Check canHaveTalkPage() before calling getTalkPage()

https://gerrit.wikimedia.org/r/368943

demon added a comment.Aug 3 2017, 5:18 AM

Is that actually true? With the underlying RFC, couldn't a wiki potentially make NS_USER not have a corresponding talk?

Not legally. $wgCanonicalNamespaceNames is private and is not supposed to be changed per install. Anything defined there can be assumed to be the same on all installs.
In fact, we currently guarantee talk namespaces for all default namespaces. But the User namespace is special, in that linking to the user talk page is very common. So it is useful to explicitly guarantee that the User_talk namespace is always defined.

I suppose... But for what it's worth we can't enforce that unless we moved it to like static data within MWNamespace.

Soooo, back in like 2008 when I was doing internal MW work for $DAYJOB-2 one of the requests was to get rid of talk pages. I was able to do it, and this included NS_USER_TALK

Anyway, it's mostly me just pontificating over something I don't have a really strong opinion over. Carry on 😃

Change 370283 had a related patch set uploaded (by SrishtiSethi; owner: srish):
[mediawiki/extensions/EducationProgram@master] Check canHaveTalkPage() before calling getTalkPage()

https://gerrit.wikimedia.org/r/370283

Change 370326 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/extensions/News@master] Check Title::canHaveTalkPage before calling getTalkPage()

https://gerrit.wikimedia.org/r/370326

daniel updated the task description. (Show Details)Aug 5 2017, 6:49 PM

Change 370326 merged by jenkins-bot:
[mediawiki/extensions/News@master] Check Title::canHaveTalkPage before calling getTalkPage()

https://gerrit.wikimedia.org/r/370326

Change 370283 abandoned by SrishtiSethi:
Check canHaveTalkPage() before calling getTalkPage()

https://gerrit.wikimedia.org/r/370283

Could this be a good Google-Code-in-2018 task? If so, is there anyone willing to mentor this?

I can mentor this.

I can mentor this.

Created associated tasks in GCI.

Aklapper updated the task description. (Show Details)Nov 22 2018, 6:30 PM
Aklapper updated the task description. (Show Details)Nov 22 2018, 6:35 PM

@Mholloway: Thanks! I've tweaked the descriptions a bit on the GCI site and published part of them (more to come)! :)

Change 475584 had a related patch set uploaded (by Arcayn; owner: Arcayn):
[mediawiki/skins/CologneBlue@master] Change check to canHaveTalkPage before calling getTalkPage()

https://gerrit.wikimedia.org/r/475584

Change 475594 had a related patch set uploaded (by Pjht; owner: Pjht):
[mediawiki/extensions/GoogleNewsSitemap@master] Change getTalkPage() to getTalkPageIfDefined()

https://gerrit.wikimedia.org/r/475594

Change 475584 merged by jenkins-bot:
[mediawiki/skins/CologneBlue@master] Change check to canHaveTalkPage before calling getTalkPage()

https://gerrit.wikimedia.org/r/475584

Stibba updated the task description. (Show Details)Nov 25 2018, 7:16 PM
Stibba added a subscriber: Stibba.Nov 25 2018, 7:18 PM

The getTalkPage in the WikiLove extension is to a User talk page and therefore doesn't have to be checked.
I checked it off.

Platonides updated the task description. (Show Details)Nov 25 2018, 7:44 PM
Aklapper updated the task description. (Show Details)Nov 25 2018, 11:55 PM

Thanks @Aklapper for the updates, and thanks to Platonides (not subscribed) for review assistance so far!

Change 475594 merged by jenkins-bot:
[mediawiki/extensions/GoogleNewsSitemap@master] Only set $commentsURL in FeedSMIItem.php when there is one for the page

https://gerrit.wikimedia.org/r/475594

Stibba removed a subscriber: Stibba.Nov 26 2018, 8:32 PM

Change 476066 had a related patch set uploaded (by Rafidaslam; owner: Rafid Aslam):
[mediawiki/extensions/BlueSpiceFoundation@master] ArticleHelper.class.php: Change getTalkPage() to getTalkPageIfDefined()

https://gerrit.wikimedia.org/r/476066

Change 476066 merged by jenkins-bot:
[mediawiki/extensions/BlueSpiceFoundation@master] ArticleHelper.class.php: Change getTalkPage() to getTalkPageIfDefined()

https://gerrit.wikimedia.org/r/476066

Change 477178 had a related patch set uploaded (by Mogmog123; owner: Mogmog123):
[mediawiki/extensions/EducationProgram@master] Changing Title::getTalkPage to getTalkPageIfDefined.

https://gerrit.wikimedia.org/r/477178

Mholloway updated the task description. (Show Details)Dec 3 2018, 4:45 AM

Change 477338 had a related patch set uploaded (by Arcayn; owner: Arcayn):
[mediawiki/extensions/EditSubpages@master] Add canHaveTalkPage() check before calling getTalkPage()

https://gerrit.wikimedia.org/r/477338

Change 477338 merged by jenkins-bot:
[mediawiki/extensions/EditSubpages@master] Add canHaveTalkPage() check before calling getTalkPage()

https://gerrit.wikimedia.org/r/477338

Mholloway updated the task description. (Show Details)Dec 3 2018, 10:01 PM

Change 477550 had a related patch set uploaded (by Bjornskjald; owner: Bjornskjald):
[mediawiki/extensions/BlueSpiceBlog@master] Remove unchecked calls to Title::getTalkPage

https://gerrit.wikimedia.org/r/477550

Change 477178 abandoned by Mholloway:
Changing Title::getTalkPage to getTalkPageIfDefined.

Reason:
The author abandoned this task on the GCI site.

https://gerrit.wikimedia.org/r/477178

Change 477550 merged by jenkins-bot:
[mediawiki/extensions/BlueSpiceBlog@master] Remove unchecked calls to Title::getTalkPage

https://gerrit.wikimedia.org/r/477550

Mholloway updated the task description. (Show Details)Dec 5 2018, 6:27 PM

Change 477867 had a related patch set uploaded (by Bjornskjald; owner: Bjornskjald):
[mediawiki/extensions/EducationProgram@master] Remove unchecked calls to Title::getTalkPage

https://gerrit.wikimedia.org/r/477867

Change 477867 merged by jenkins-bot:
[mediawiki/extensions/EducationProgram@master] Remove unchecked calls to Title::getTalkPage

https://gerrit.wikimedia.org/r/477867

ssastry removed a subscriber: ssastry.Dec 6 2018, 5:30 PM
Mholloway updated the task description. (Show Details)Dec 6 2018, 5:34 PM
demon removed a subscriber: demon.Dec 7 2018, 3:37 AM