BadFileLookup to replace wfIsBadImage
authorAryeh Gregor <ayg@aryeh.name>
Sun, 18 Aug 2019 18:19:05 +0000 (21:19 +0300)
committerAryeh Gregor <ayg@aryeh.name>
Wed, 21 Aug 2019 17:45:37 +0000 (20:45 +0300)
commit5e2199c5b0c383337c78e0bc0160397b0f05b3b5
tree051f2ed8084b92eb3838bcf85c928289786f9771
parent5600df580a4b44427470082281a93680cd2d5c8c
BadFileLookup to replace wfIsBadImage

I think this probably shouldn't be directly in the MediaWiki namespace,
but I don't know where is a better place to put it.

In order to avoid gratuitous use of TitleFormatter, I changed the cache
format -- the old implementation used getPrefixedDBkey() and I switched
to an ns/dbkey pair. I also changed the cache keys to use SHA1 instead
of MD5, by Daniel's request.

The previous implementation cached the parsed blacklist for one minute
without invalidation, so it could return slightly stale results, but it
didn't retrieve the bad image list message on a cache hit. The new
implementation unconditionally retrieves the bad image list message, but
uses a hash of it in the cache key and caches for one day. The new
behavior happens to be more cleanly implementable in a service.

Bug: T200882
Bug: T139216
Change-Id: I69fed1b1f3cfc1aa149e0739780e67f6de01609d
16 files changed:
RELEASE-NOTES-1.34
autoload.php
includes/BadFileLookup.php [new file with mode: 0644]
includes/GlobalFunctions.php
includes/MediaWikiServices.php
includes/ServiceWiring.php
includes/api/ApiQueryImageInfo.php
includes/gallery/TraditionalImageGallery.php
includes/parser/Parser.php
includes/parser/ParserFactory.php
tests/common/TestsAutoLoader.php
tests/phpunit/MediaWikiIntegrationTestCase.php
tests/phpunit/MediaWikiTestCaseTrait.php [new file with mode: 0644]
tests/phpunit/MediaWikiUnitTestCase.php
tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php
tests/phpunit/unit/includes/BadFileLookupTest.php [new file with mode: 0644]