Page MenuHomePhabricator

Extension should not create LogPager, use LogEventsList::showLogExtract or custom select query instead
Closed, ResolvedPublic

Description

The LogPager is a pager for Special:Log, not a helper for querying logs and not stable to use, LogEventsList::showLogExtract or custom select query (e.g. via SelectQueryBuilder) should be used instead.

https://codesearch.wmcloud.org/search/?q=new%5Cs%2BLogPager

Event Timeline

One use case that I can think of that would prevent just using LogEventsList::showLogExtract is when you just want to show a specific log entry ($id of LogPager::__construct).

One use case that I can think of that would prevent just using LogEventsList::showLogExtract is when you just want to show a specific log entry ($id of LogPager::__construct).

This can be done by using [ 'conds' => [ 'log_ld' => $id ] ] as the 5th param to showLogExtract().

How can this be fixed for the Approved Revs extension? As you can see in, for example, lines 195 to 215 here, the Approved Revs code is not simply printing out a section of the log - it queries one row of the log, then does its own formatting of the data and prints that out. showLogExtract() doesn't seem to provide the necessary level of flexibility in terms of displaying the output.

Change 931923 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/ApprovedRevs@master] SpecialApprovedRevs: Provide approval logs by ::getQueryInfo()

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

Change 931923 merged by jenkins-bot:

[mediawiki/extensions/ApprovedRevs@master] SpecialApprovedRevs: Provide approval logs by ::getQueryInfo()

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

Yaron_Koren claimed this task.

Thank you @Func - I believe this is now resolved.

Func removed Yaron_Koren as the assignee of this task.

There are two other extensions to work on, I think keep using this task should be fine.

Func renamed this task from Extension should not instance LogPager, use LogEventsList::showLogExtract to Extension should not instance LogPager, use LogEventsList::showLogExtract or custom select query instead.Jun 26 2023, 9:08 PM
Func updated the task description. (Show Details)

Change 932811 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/GrowthExperiments@master] Use custom select query for logs instead of LogPager

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

Change 932811 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Use custom select query for logs instead of LogPager

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

Change 936823 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/ArticleRatings@master] SpecialChangeRating: Use showLogExtract() instead of LogPager

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

Change 936824 had a related patch set uploaded (by Func; author: Func):

[mediawiki/core@master] LogEventsList: Remove the @stable to call notation on the constructor

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

Krinkle renamed this task from Extension should not instance LogPager, use LogEventsList::showLogExtract or custom select query instead to Extension should not create LogPager, use LogEventsList::showLogExtract or custom select query instead.Aug 22 2023, 3:42 PM

Change 936824 merged by jenkins-bot:

[mediawiki/core@master] LogEventsList: Remove the @stable to call notation on the constructor

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

Change #936823 merged by Jack Phoenix:

[mediawiki/extensions/ArticleRatings@master] SpecialChangeRating: Use showLogExtract() instead of LogPager

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

Func claimed this task.