https://bugzilla.wikimedia.org/show_bug.cgi?id=57201
Web browser: ---
Bug ID: 57201
Summary: SpecialRecentChangesFilters hook is not executed for
feeds
Product: MediaWiki
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: Recent changes
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Mobile Platform: ---
When using the `SpecialRecentChangesFilters` [1] and
`SpecialRecentChangesQuery` [2] hooks to enhance the recent changes, the former
is never called when recent changes are displayed as a feed. This can cause
exceptions when trying to access the value of filter options in the query hook.
In `SpecialRecentChanges::getOptions` [3] a special setup method for feeds is
called when a feed output was requested. It seems that this was previously done
to have some better caching for feeds; that however was removed later [4]. In
any way, there is not much difference to the normal setup method, except that
custom filters [5] are not added.
Nothing in the hook descriptions however suggests that this is the case, and
given that the hook is the only way to modify the default options [6], I
strongly suggest that the custom filters are added in the `feedSetup` method as
well.
And at that point, merging the two setup functions should be considered. The
only thing that really differs then would be the feed limit—which can be just
respected by doing the check with `$isFeed` inside the setup method—and that
subpage behavior which is not triggered anyway when no parameters are passed to
the setup function.
In any way, not adding the custom filters in the feed setup breaks the
extension setup and requires a further check inside the
`SpecialRecentChangesQuery` hook handler to ensure that the option exists. I.e.
something like this:
if (!$opts->validateName('optionname')) {
global $wgDefaultUserOptions;
$opts->add('optionname', $wgDefaultUserOptions['rcoptionname']);
}
[1]: https://www.mediawiki.org/wiki/Manual:Hooks/SpecialRecentChangesFilters
[2]: https://www.mediawiki.org/wiki/Manual:Hooks/SpecialRecentChangesQuery
[3]:
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/d7379debd2bd61fda592c144e6574bf99ed60e83/includes%2Fspecials%2FSpecialRecentchanges.php#L132
[4]:
https://git.wikimedia.org/commit/mediawiki%2Fcore.git/52b59f06859c337a56b10bb0171d199b19688773
[5]:
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/d7379debd2bd61fda592c144e6574bf99ed60e83/includes%2Fspecials%2FSpecialRecentchanges.php#L99
[6]:
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/d7379debd2bd61fda592c144e6574bf99ed60e83/includes%2Fspecials%2FSpecialRecentchanges.php#L42
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l