Last modified: 2013-12-19 17:37:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T59201, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57201 - SpecialRecentChangesFilters hook is not executed for feeds
SpecialRecentChangesFilters hook is not executed for feeds
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Recent changes (Other open bugs)
1.23.0
All All
: High normal (vote)
: 1.23.0 release
Assigned To: Patrick Westerhoff
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-18 17:42 UTC by Patrick Westerhoff
Modified: 2013-12-19 17:37 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Patrick Westerhoff 2013-11-18 17:42:25 UTC
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
Comment 1 Gerrit Notification Bot 2013-11-18 19:19:10 UTC
Change 96070 had a related patch set uploaded by Poke:
Integrate feed-specific setup into general setup

https://gerrit.wikimedia.org/r/96070
Comment 2 Gerrit Notification Bot 2013-12-19 17:35:44 UTC
Change 96070 merged by jenkins-bot:
Integrate feed-specific setup into general setup

https://gerrit.wikimedia.org/r/96070
Comment 3 Bartosz Dziewoński 2013-12-19 17:37:11 UTC
Fix merged, thank you!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links