Page MenuHomePhabricator

WikiRevision::getText() needs fixing up
Open, Needs TriagePublic

Description

It was marked as "deprecated" in MW 1.21 as part of the CH cleanup in T145728, this seems that although it was right, it was also wrong

cf https://gerrit.wikimedia.org/r/#/c/324703

Just to summarise what was said in IRC, I think this function was deprecated in error. WikiRevision is supposed to be a thin wrapper for the XML dump <revision> tag, and the $text field stores the raw content of the <text> element. Nothing scary at all about it.

and

@TTO ah, I see. In the context of WikiRevision, it makes sense to allow access to the raw data. I suggest to rename the function to make clear that what you get may not be "text". It may in fact be binary garbage. So the function should be called getData() or getBlob() or getBytes() or something like that.
Direct access to the $text member should be avoided, I suggest to change all direct access to using the getter, and to make the member private.

Event Timeline

Reedy created this task.Dec 3 2016, 12:21 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 3 2016, 12:21 PM

Change 329322 had a related patch set uploaded (by Subins2000):
Removed incorrect deprecated notice from function WikiRevision::getText()

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

Change 329322 merged by jenkins-bot:
Remove incorrect deprecated notice from function WikiRevision::getText()

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

Reedy added a comment.Jan 4 2017, 7:20 PM

We should also fix up any similar documentation that say it was deprecated.. Not sure if/what there is about

Jdforrester-WMF added a subscriber: Jdforrester-WMF.

As this is explicitly not deprecated, it shouldn't block a task about removing deprecated things. :-)