Page MenuHomePhabricator

The parameter "rvdiffto" has been deprecated
Open, NormalPublic

Description

lun jul 3 19:54:53 2017  WARNING: API query (revisions): The parameter "rvdiffto" has been deprecated.
lun jul 3 19:54:53 2017  WARNING: API query (main): Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes. Use [[Special:ApiFeatureUsage]] to see usage of deprecated features by your application.

I guess the queries should be amended to omit that parameter? Regards

There are 3 files that need update:

  • reportuser.cpp:
this->qDiff = new ApiQuery(ActionQuery, this->ReportedUser->GetSite());
this->qDiff->Parameters = "prop=revisions&rvprop=" + QUrl::toPercentEncoding( "ids|user|timestamp|comment" ) +
                  "&rvlimit=1&rvstartid=" + this->ui->tableWidget->item(index.row(), 3)->text() +
                  "&rvendid=" + this->ui->tableWidget->item(index.row(), 3)->text() + "&rvdiffto=prev&titles=" +
                  QUrl::toPercentEncoding(ui->tableWidget->item(index.row(), 0)->text());
  • wikiutil.cpp:
ApiQuery *qPage = new ApiQuery(ActionQuery, site);
    RetrieveEditByRevid_SourceInfo *i = new RetrieveEditByRevid_SourceInfo();
    i->edit = edit;
    i->source = source;
    i->error = callback_er;
    i->success = callback_success;
    qPage->CallbackOwner = i;
    qPage->callback = (Callback) RetrieveEditByRevid_Page_OK;
    qPage->FailureCallback = (Callback) RetrieveEditByRevid_Page_ER;
    qPage->Parameters = "prop=revisions&revids=" + QString::number(revid) + "&rvprop=" +
                          QUrl::toPercentEncoding("ids|flags|timestamp|user|contentmodel|comment|size") + "&rvdiffto=prev";
  • wikiedit.cpp:
this->qDifference = new ApiQuery(ActionQuery, this->GetSite());
if (this->RevID != WIKI_UNKNOWN_REVID)
{
    // &rvprop=content can't be used because of fuck up of mediawiki
    this->qDifference->Parameters = "prop=revisions&rvprop=" + QUrl::toPercentEncoding("ids|tags|user|timestamp|comment") +
                                    "&rvlimit=1&rvstartid=" + QString::number(this->RevID) + "&rvdiffto=" + this->DiffTo + "&titles=" +
                                    QUrl::toPercentEncoding(this->Page->PageName);
} else
{
    this->qDifference->Parameters = "prop=revisions&rvprop=" + QUrl::toPercentEncoding("ids|tags|user|timestamp|comment") +
                                    "&rvlimit=1&rvdiffto=" + this->DiffTo + "&titles=" +
                                    QUrl::toPercentEncoding(this->Page->PageName);
}

https://github.com/huggle/huggle3-qt-lx/pull/261/files

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 3 2017, 6:03 PM
Petrb added a subscriber: Petrb.Jul 11 2017, 9:22 PM

Hello, we can't just "omit" this parameter, we need to figure out some replacement, so someone has to go through MW documentation, figure out why it was deprecated and what this feature was replaced with.

Petrb triaged this task as Normal priority.Jul 11 2017, 9:23 PM

I think @Anomie can help us identify that?

figure out why it was deprecated and what this feature was replaced with.

The replacement for rvdiffto is action=compare. This is mentioned in the auto-generated documentation for prop=revisions, BTW.

It was deprecated in large part because the whole 'notcached' thing that rvdiffto would do was broken, and the code duplication between rvdiffto and action=compare was a maintenance burden that necessitated T164529 and would have made T30047 harder to properly resolve.

Restricted Application added a project: User-MarcoAurelio. · View Herald TranscriptAug 10 2017, 8:48 AM

So, I got some time now so let's finish this.

From my understanding, it's now necessary to execute an extra API query just for the diff? This is technically possible, but it might slow things down.

Petrb updated the task description. (Show Details)Nov 17 2017, 10:22 PM

@Anomie: first thing that I am having troubles with is that old method required me to only know the revision ID of the actual edit made by someone in order to compare it with previous edit. All I did was to provide current edit as rvstartid and then "prev" as rvdiffto.

This new model requires me to know both "from" and "to" revision ID's, meaning I would have to execute an extra API query just to fetch the history of a page in order to figure out what the previous ID was. Meaning I would need to replace this 1 API request with 3 to do exactly same job.

Isn't there some easier way to do that?

browsing through docs I found "torelative=prev": https://www.mediawiki.org/w/api.php?action=compare&fromrev=2620781&torelative=prev

which seems to do exactly this job.

Petrb updated the task description. (Show Details)Nov 17 2017, 11:40 PM
Petrb updated the task description. (Show Details)Nov 18 2017, 10:17 AM

here we go: https://github.com/huggle/huggle3-qt-lx/commit/ee445353807e2466e1b9aba97f23333273bf185e

This replaces the obsolete call almost everywhere, except for wikiutil, where I need to figure out of a way to do that, the logic there is relatively complicated, full of callbacks on that 1 API request and it needs to be split into 2 API calls now.

Petrb added a comment.Sep 10 2018, 6:50 PM

No,

There is still one rare occurrence, see task desc for detail.