Page MenuHomePhabricator

Replace Content::getNativeData() calls with TextContent::getText() in Wikibase
Open, Needs TriagePublic

Description

See parent task.

Wikibase/lib/includes/Store/WikiPagePropertyOrderProvider.php:		return strval( $pageContent->getNativeData() );
Wikibase/repo/includes/Content/EntityContent.php:	public function getNativeData() {
Wikibase/repo/includes/Content/EntityContent.php:		return strlen( serialize( $this->getNativeData() ) );
Wikibase/repo/includes/Content/EntityContent.php:	 * @see Content::getNativeData

Event Timeline

Change 769070 had a related patch set uploaded (by Russ Rogovetz; author: Russ Rogovetz):

[mediawiki/extensions/Wikibase@master] Replace getNativeData to getText for Wikibase

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

Hello team,
I'm working on those sub-tasks to replace Content::getNativeData() to TextContent::getText().
For me is not clear how to replace it in EntityContent as it didn't have any dependency with TextContent.
So we have public method getNativeData in EntityContent that implements from Content, we call this method in getSize(). As we deprecate Content::getNativeData we should remove any usage of this method there.
And as I understand well the propose was to replace it with TextContent::getText().
Could you please provide more details about better way to replace it?

Change 769070 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Replace getNativeData to getText for Wikibase

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

Hello team,
I'm working on those sub-tasks to replace Content::getNativeData() to TextContent::getText().
For me is not clear how to replace it in EntityContent as it didn't have any dependency with TextContent.
So we have public method getNativeData in EntityContent that implements from Content, we call this method in getSize(). As we deprecate Content::getNativeData we should remove any usage of this method there.
And as I understand well the propose was to replace it with TextContent::getText().
Could you please provide more details about better way to replace it?

The goal of removing getNativeData() is to avoid the mixed result type of this function, and replace it by other functions specialised for a given subclass of Content.

Reading the code of EntityContent, it seems the only real use of EntityContent::getNativeData() is in EntityContent::getSize(), and, except for redirected entities, getNativeData() is more or less the same thing than getEntity().

Change 827002 had a related patch set uploaded (by Seb35; author: Seb35):

[mediawiki/core@master] Define concrete method in order to deprecate it in subclasses

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

Wrong task number in my patch, I reaffected it. But related to this task to permit the removal of EntityContent::getNativeData().

Aklapper added a subscriber: RussRogovetz.

@RussRogovetz: Removing task assignee as this open task has been assigned for more than two years - see the email sent to all task assignees on 2024-04-15.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome! :)
If this task has been resolved in the meantime, or should not be worked on by anybody ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!