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().