Page MenuHomePhabricator

Deprecate Content::getNativeData(), defined TextContent::getText() to replace it.
Open, LowPublic

Description

Content::getNativeData() should be removed because it misguides calling code into making baseless assumptions about the return value, which cannot be used with confidence. This includes core and WMF-maintained extensions.

There is no good reason for Content::getNativeData() to exist, since it guarantees nothing about the structure or format of the content. The only sensible use cases are for textual content. For that use case, a more narrow method getText should be created in TextContent. Other code using getNativeData is conceptually flawed by definition, since the return value cannot be used confidently. Structured content models, like EntityContent in the Wikibase extension, should (and typically do) define their own specialized getter methods for the internal structure.

Below is the list of WMF maintained extensions that need to be updated.

  • AbuseFilter
  • AutoCategoriseUploads
  • Babel
  • BlueSpiceInsertTemplate
  • CentralNotice
  • CollaborationKit
  • Collection
  • ConfirmEdit
  • DidYouKnow
  • Echo
  • EducationProgram (Archived)
  • EventLogging
  • Flow
  • Gadgets
  • GlobalCssJs
  • GWToolset
  • JADE
  • JsonConfig
  • Lingo
  • LiquidThreads
  • MassMessage
  • Math
  • NotebookViewer
  • OpenStackManager
  • ProofreadPage
  • RSS
  • Scribunto
  • TemplateData
  • TemplateStyles
  • Translate
  • UploadWizard
  • Video
  • Wikibase
  • ZeroPortal

Event Timeline

daniel created this task.Jan 17 2017, 11:49 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 17 2017, 11:49 PM
daniel moved this task from Inbox to To Do on the User-Daniel board.Jan 30 2017, 11:26 AM

Change 359184 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Deprecate Content::getNativeData, add TextContent::getText

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

Change 472486 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Deprecate Content::getNativeData, add TextContent::getText

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

daniel added a subscriber: BPirkle.Jan 16 2019, 4:02 PM

@BPirkle do you want to work on this? My patch already introduces the new method and deprecates the old one, but there's a lot of code to be cleaned up that calls the old method. This is basic code hygiene.

BPirkle claimed this task.Jan 16 2019, 4:03 PM

Change 472486 merged by jenkins-bot:
[mediawiki/core@master] Deprecate Content::getNativeData, add TextContent::getText

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

Change 359184 abandoned by Jforrester:
Deprecate Content::getNativeData, add TextContent::getText

Reason:
Re-done as Id2c61dcd3, now merged.

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

Change 488633 had a related patch set uploaded (by BPirkle; owner: BPirkle):
[mediawiki/core@master] Refactor calls to deprecated function Content::getNativeData()

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

Change 488633 merged by jenkins-bot:
[mediawiki/core@master] Refactor calls to deprecated function Content::getNativeData()

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

All usages in core are gone. Now we should remove usages in extensions, at least in the ones WMF maintains. Dow we want to have a separate ticket for that? The current task description doesn't call for usages to be removed.

BPirkle updated the task description. (Show Details)Feb 18 2019, 4:10 PM

Task description edited to include WMF-maintained extensions.

holger.knust reassigned this task from BPirkle to Hknust.Mar 22 2019, 7:52 PM
holger.knust updated the task description. (Show Details)

Change 498469 had a related patch set uploaded (by Jayprakash12345; owner: Jayprakash12345):
[mediawiki/extensions/Gadgets@master] User getText() instead of getNativeData()

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

Change 498474 had a related patch set uploaded (by Jayprakash12345; owner: Jayprakash12345):
[mediawiki/extensions/Translate@master] User getText() instead of getNativeData()

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

Change 498477 had a related patch set uploaded (by Jayprakash12345; owner: Jayprakash12345):
[mediawiki/extensions/Babel@master] User getText() instead of getNativeData()

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

Change 498480 had a related patch set uploaded (by Jayprakash12345; owner: Jayprakash12345):
[mediawiki/extensions/CentralNotice@master] User getText() instead of getNativeData()

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

Change 498482 had a related patch set uploaded (by Jayprakash12345; owner: Jayprakash12345):
[mediawiki/extensions/Collection@master] Use getText() instead of getNativeData()

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

Change 498483 had a related patch set uploaded (by Jayprakash12345; owner: Jayprakash12345):
[mediawiki/extensions/Echo@master] Use getText() instead of getNativeData()

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

Change 498483 merged by jenkins-bot:
[mediawiki/extensions/Echo@master] Use getText() instead of getNativeData()

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

Change 498477 merged by jenkins-bot:
[mediawiki/extensions/Babel@master] Use getText() instead of getNativeData()

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

Change 498505 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/AbuseFilter@master] AbuseFilter: Swapped getNative for getText

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

holger.knust updated the task description. (Show Details)Mar 22 2019, 9:49 PM

Change 498505 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] AbuseFilter: Swapped getNative for getText

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

holger.knust added a subscriber: Hknust.

Change 499485 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/BlueSpiceInsertTemplate@master] Call method getText() instead of getNativeData()

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

Change 499489 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/DidYouKnow@master] Call method getText() instead of getNativeData()

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

holger.knust updated the task description. (Show Details)Mar 27 2019, 2:20 PM
holger.knust updated the task description. (Show Details)

Change 499493 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/EducationProgram@master] Call method getText() instead of getNativeData()

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

Change 499495 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/Lingo@master] Call method getText() instead of getNativeData()

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

Change 499496 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/NotebookViewer@master] Call method getText() instead of getNativeData()

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

holger.knust updated the task description. (Show Details)Mar 27 2019, 2:48 PM

Change 499498 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/OpenStackManager@master] Call method getText() instead of getNativeData()

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

Change 499499 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/RSS@master] Call method getText() instead of getNativeData()

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

Change 499501 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/Scribunto@master] Call method getText() instead of getNativeData()

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

Change 499502 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/Video@master] Call method getText() instead of getNativeData()

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

Change 499493 abandoned by Daniel Kinzler:
Call method getText() instead of getNativeData()

Reason:
This repository has been archived and new patches are not being accepted.

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

holger.knust updated the task description. (Show Details)Mar 27 2019, 3:19 PM

Change 499498 merged by jenkins-bot:
[mediawiki/extensions/OpenStackManager@master] Call method getText() instead of getNativeData()

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

Change 499496 merged by jenkins-bot:
[mediawiki/extensions/NotebookViewer@master] Call method getText() instead of getNativeData()

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

Change 499495 merged by jenkins-bot:
[mediawiki/extensions/Lingo@master] Call method getText() instead of getNativeData()

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

Change 499489 merged by jenkins-bot:
[mediawiki/extensions/DidYouKnow@master] Call method getText() instead of getNativeData()

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

Change 499485 merged by jenkins-bot:
[mediawiki/extensions/BlueSpiceInsertTemplate@master] Call method getText() instead of getNativeData()

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

Change 499502 merged by jenkins-bot:
[mediawiki/extensions/Video@master] Call method getText() instead of getNativeData()

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

Change 499499 merged by jenkins-bot:
[mediawiki/extensions/RSS@master] Call method getText() instead of getNativeData()

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

Change 499501 merged by jenkins-bot:
[mediawiki/extensions/Scribunto@master] Call method getText() instead of getNativeData()

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

holger.knust updated the task description. (Show Details)Mar 27 2019, 3:56 PM
holger.knust updated the task description. (Show Details)
holger.knust updated the task description. (Show Details)Mar 27 2019, 5:38 PM

Change 499826 had a related patch set uploaded (by Holger Knust; owner: Holger Knust):
[mediawiki/extensions/CollaborationKit@master] Call method getText() instead of getNativeData()

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

holger.knust updated the task description. (Show Details)Mar 28 2019, 7:54 PM

Change 499826 merged by jenkins-bot:
[mediawiki/extensions/CollaborationKit@master] Call method getText() instead of getNativeData()

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

holger.knust updated the task description. (Show Details)Apr 17 2019, 1:09 PM