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

Details

ProjectBranchLines +/-Subject
mediawiki/extensions/CentralNoticemaster+17 -4
mediawiki/extensions/CollaborationKitmaster+98 -6
mediawiki/extensions/Translatemaster+8 -8
mediawiki/extensions/BlueSpiceInsertTemplatemaster+1 -1
mediawiki/extensions/Scribuntomaster+2 -2
mediawiki/extensions/Videomaster+1 -1
mediawiki/extensions/RSSmaster+1 -1
mediawiki/extensions/DidYouKnowmaster+1 -1
mediawiki/extensions/Lingomaster+2 -2
mediawiki/extensions/NotebookViewermaster+1 -1
mediawiki/extensions/OpenStackManagermaster+2 -2
mediawiki/extensions/EducationProgrammaster+2 -2
mediawiki/extensions/AbuseFiltermaster+1 -1
mediawiki/extensions/Babelmaster+1 -1
mediawiki/extensions/Echomaster+1 -1
mediawiki/extensions/Collectionmaster+1 -1
mediawiki/extensions/Gadgetsmaster+1 -1
mediawiki/coremaster+57 -59
mediawiki/coremaster+284 -108
mediawiki/coremaster+236 -66
Show related patches Customize query in gerrit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

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

@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.

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.

Task description edited to include WMF-maintained extensions.

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

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

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

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

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

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

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

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

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

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

Aklapper changed the task status from Stalled to Open.Oct 19 2020, 4:34 PM

The previous comments don't explain who or what (task?) exactly this task is stalled on ("If a report is waiting for further input (e.g. from its reporter or a third party) and can currently not be acted on"). Hence resetting task status.

(Smallprint, as general orientation for task management: If you wanted to express that nobody is currently working on this task, then the assignee should be removed and/or priority could be lowered instead. If work on this task is blocked by another task, then that other task should be added via Edit Related Tasks...Edit Subtasks. If this task is stalled on an upstream project, then the Upstream tag should be added. If this task requires info from the task reporter, then there should be instructions which info is needed. If this task needs retesting, then the TestMe tag should be added. If this task is either out of scope and nobody should ever work on this, or nobody else managed to reproduce the problem described in this task, then this task should have the "Declined" status. If the task is valid but should not appear on some team's workboard, then the team project tag should be removed while the task has another active project tag.)