Page MenuHomePhabricator

page_id should be 0 when testing filter against a page creation in RC
Closed, ResolvedPublicBUG REPORT

Description

Trying some filter code against past changes (known as RC, recent changes), when it is a page creation, page_id equals the current page id, which is faulty. When the filter had been executed "for real", the page_id was 0, as the page had not been created yet.

See the documentation about the page_id variable:

In theory this is 0 for new pages, but this is unreliable. If you need an exact result, use "page_age == 0" to identify new page creation. (note that it is slower, though.)

See also this discussion with the user who had spotted the issue.

Event Timeline

Change 908315 had a related patch set uploaded (by Gerrit Patch Uploader; author: Jean-Luc Hassec):

[mediawiki/extensions/AbuseFilter@master] When testing against a page creation in RC, set page_id to 0 as in the real filtering

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

The patch should be ready to merge :)

Any news on this? I would really love to migrate the filters on frwiki from page_age to page_id, which would save a few milliseconds on every page edit :-)

Change 908315 merged by jenkins-bot:

[mediawiki/extensions/AbuseFilter@master] When testing against a page creation in RC, set page_id to 0 as in the real filtering

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

matej_suchanek assigned this task to Od1n.