Page MenuHomePhabricator

Create BadFileLookup service
Closed, ResolvedPublic


It would be good to refactor wfIsBadImage() into a BadFileLookup class service. The new class would just need to provide a isBadFile( $name, $contextTitle ) function at minimum. I would expect that the third parameter of $blacklist = null, which is just used for testing AFAIS would be dropped and probably turned into a constructor parameter?

Hopefully refactoring this out of a global function would make it less daunting for people who want to add new features to this functionality.

Event Timeline

Legoktm created this task.Aug 1 2018, 9:01 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 1 2018, 9:01 AM

What's the advantage of a class service over a global function? The function is stateless, so it seems like it should be global. AFAICT the actual function's code would remain unchanged if it became a class service, so I also don't understand what would make it less daunting.

Legoktm removed Simetrical as the assignee of this task.Sep 12 2018, 5:06 AM

Legoktm, ping?

kchapman moved this task from Next to Later on the Platform Team Legacy board.Mar 26 2019, 2:49 PM
kchapman added a subscriber: kchapman.

Do we still want/need this?

Change 530829 had a related patch set uploaded (by simetrical; owner: simetrical):
[mediawiki/core@master] BadFileLookup to replace wfIsBadImage

TheDJ added a subscriber: TheDJ.Aug 22 2019, 7:54 AM

Change 530829 merged by jenkins-bot:
[mediawiki/core@master] BadFileLookup to replace wfIsBadImage

Simetrical closed this task as Resolved.Aug 22 2019, 8:46 AM