Page MenuHomePhabricator

Make private methods of Parser.php actually private
Open, MediumPublic

Description

A number of the methods in Parser.php are unused outside the class itself, but are public for historical reasons.

We need to first deprecate these, then eventually make them private.

Event Timeline

cscott created this task.Oct 29 2019, 4:12 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 29 2019, 4:12 PM

Change 546793 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Deprecate Parser implementation methods (will be private in next release)

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

Change 546967 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Deprecate Parser::areSubpagesAllowed() / Parser::maybeDoSubpageLink()

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

Change 546968 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Deprecate Parser::armorLinks() / Parser::makeKnownLinkHolder()

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

Change 546969 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Deprecate Parser::splitWhitespace() / Parser::createAssocArgs()

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

Change 546981 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Deprecate Parser::replaceLinkHolders/replaceLinkHoldersText

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

Change 546982 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Deprecate Parser::getImageParams()

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

Change 546982 abandoned by C. Scott Ananian:
Deprecate Parser::getImageParams()

Reason:
squashed into I44458490fa86abd0ead048a4c94021da6be333f0

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

TK-999 added a subscriber: TK-999.Oct 29 2019, 7:02 PM

@cscott I was wondering if there is a preferred migration path away from Parser::replaceLinkHolders for code that relied on it. I see that the mLinkHolders field in Parser is public, but I imagine that won't stay that way either, right? Thanks in advance!

Change 547048 had a related patch set uploaded (by Krinkle; owner: C. Scott Ananian):
[mediawiki/core@REL1_34] Deprecate Parser implementation methods (will be private in next release)

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

Change 547048 merged by jenkins-bot:
[mediawiki/core@REL1_34] Deprecate Parser implementation methods (will be private in next release)

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

Change 546793 merged by jenkins-bot:
[mediawiki/core@master] Deprecate Parser implementation methods (will be private in next release)

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

Change 547259 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/extensions/DataTable2@master] Stop using the deprecated Parser::createAssocArgs() function from core

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

Change 547259 merged by jenkins-bot:
[mediawiki/extensions/DataTable2@master] Stop using the deprecated Parser::createAssocArgs() function from core

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

Change 546967 merged by jenkins-bot:
[mediawiki/core@master] Deprecate Parser::areSubpagesAllowed() / Parser::maybeDoSubpageLink()

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

Change 546969 merged by jenkins-bot:
[mediawiki/core@master] Deprecate Parser::splitWhitespace() / Parser::createAssocArgs()

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

Change 546968 merged by jenkins-bot:
[mediawiki/core@master] Deprecate additional public methods of Parser

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

Change 546981 merged by jenkins-bot:
[mediawiki/core@master] Deprecate Parser::replaceLinkHolders / replaceLinkHoldersText

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

Change 547315 had a related patch set uploaded (by Jforrester; owner: C. Scott Ananian):
[mediawiki/core@REL1_34] Deprecate Parser::areSubpagesAllowed() / Parser::maybeDoSubpageLink()

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

Change 547316 had a related patch set uploaded (by Jforrester; owner: C. Scott Ananian):
[mediawiki/core@REL1_34] Deprecate Parser::splitWhitespace() / Parser::createAssocArgs()

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

Change 547317 had a related patch set uploaded (by Jforrester; owner: C. Scott Ananian):
[mediawiki/core@REL1_34] Deprecate Parser::replaceLinkHolders / replaceLinkHoldersText

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

Change 547318 had a related patch set uploaded (by Jforrester; owner: C. Scott Ananian):
[mediawiki/core@REL1_34] Deprecate additional public methods of Parser

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

Change 547315 merged by jenkins-bot:
[mediawiki/core@REL1_34] Deprecate Parser::areSubpagesAllowed() / Parser::maybeDoSubpageLink()

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

Change 547316 merged by jenkins-bot:
[mediawiki/core@REL1_34] Deprecate Parser::splitWhitespace() / Parser::createAssocArgs()

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

Change 547317 merged by jenkins-bot:
[mediawiki/core@REL1_34] Deprecate Parser::replaceLinkHolders / replaceLinkHoldersText

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

Change 547318 merged by jenkins-bot:
[mediawiki/core@REL1_34] Deprecate additional public methods of Parser

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

Change 548458 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Parser: remove/make private historically-public methods

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

Change 548458 merged by jenkins-bot:
[mediawiki/core@master] Parser: remove/make private historically-public methods

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

ssastry edited projects, added Parsoid; removed Parsoid-PHP.Nov 5 2019, 5:53 PM
ssastry removed a subscriber: Parsing-Team.
cscott added a comment.Nov 5 2019, 6:38 PM

@cscott I was wondering if there is a preferred migration path away from Parser::replaceLinkHolders for code that relied on it. I see that the mLinkHolders field in Parser is public, but I imagine that won't stay that way either, right? Thanks in advance!

Good question. I haven't quite figured that out yet. You're right that public mLinkHolders needs to go away. Parsoid doesn't have any corresponding concept for "link holders"; we need to figure out if that needs to be added to Parsoid and/or replaced with something different for the eventual parser migration.

LGoto moved this task from Needs Triage to Backlog on the Parsoid board.Feb 15 2020, 12:05 AM
LGoto moved this task from Backlog to Non-Parsoid Tasks on the Parsoid board.Feb 21 2020, 5:28 PM
ssastry assigned this task to cscott.Mar 30 2020, 5:44 PM
ssastry triaged this task as Medium priority.
ssastry added a project: Parsing-Active-Work.
Naypta added a subscriber: Naypta.Sat, Jun 27, 12:01 PM

Hi folks, I see mLinkHolders is now private, and that Parser::replaceLinkHolders has a deprecation tag in its comment. Is there at this stage a recommended alternative for parsing linkHolders in a string that an extension has? If not, is there any other way to go about doing so, without having to re-parse the entire content within which the links are held?