aboutsummaryrefslogtreecommitdiffstats
path: root/includes/BadFileLookup.php
Commit message (Collapse)AuthorAgeFilesLines
* Reorg: Move five page-related classes to page/ out of includes/Amir Sarabadani2023-02-231-141/+0
| | | | | | | | | | | | These classes: - MergeHistory - MovePage - ProtectionForm - BadFileLookup (to MediaWiki\Page\File) - FileDeleteForm (to MediaWiki\Page\File) Bug: T321882 Change-Id: Ibeb488ba322c62a34042a0307bbb5562773bcad1
* Use getWithSetCallback() instead of get() + set()Daimona Eaytoy2021-11-181-37/+45
| | | | | | | This allows the backend to do whatever it can to ensure atomicity, and is also easier to read, since the intent is obvious. Change-Id: Ibbfecd92a2c6d9a5997ca37ea101e068bd1e8202
* build: Update mediawiki/mediawiki-codesniffer to 35.0.0Umherirrender2021-01-311-2/+1
| | | | Change-Id: Idb413be4b8cba8611afdc022af59810ce1a4531e
* BadFile keeps a "bad file list", not a "blacklist"C. Scott Ananian2020-06-081-10/+10
| | | | | Bug: T254646 Change-Id: I23c76f42d451b8d22f178efd6a3edbc822617831
* Hooks::run() call site migrationTim Starling2020-05-301-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Migrate all callers of Hooks::run() to use the new HookContainer/HookRunner system. General principles: * Use DI if it is already used. We're not changing the way state is managed in this patch. * HookContainer is always injected, not HookRunner. HookContainer is a service, it's a more generic interface, it is the only thing that provides isRegistered() which is needed in some cases, and a HookRunner can be efficiently constructed from it (confirmed by benchmark). Because HookContainer is needed for object construction, it is also needed by all factories. * "Ask your friendly local base class". Big hierarchies like SpecialPage and ApiBase have getHookContainer() and getHookRunner() methods in the base class, and classes that extend that base class are not expected to know or care where the base class gets its HookContainer from. * ProtectedHookAccessorTrait provides protected getHookContainer() and getHookRunner() methods, getting them from the global service container. The point of this is to ease migration to DI by ensuring that call sites ask their local friendly base class rather than getting a HookRunner from the service container directly. * Private $this->hookRunner. In some smaller classes where accessor methods did not seem warranted, there is a private HookRunner property which is accessed directly. Very rarely (two cases), there is a protected property, for consistency with code that conventionally assumes protected=private, but in cases where the class might actually be overridden, a protected accessor is preferred over a protected property. * The last resort: Hooks::runner(). Mostly for static, file-scope and global code. In a few cases it was used for objects with broken construction schemes, out of horror or laziness. Constructors with new required arguments: * AuthManager * BadFileLookup * BlockManager * ClassicInterwikiLookup * ContentHandlerFactory * ContentSecurityPolicy * DefaultOptionsManager * DerivedPageDataUpdater * FullSearchResultWidget * HtmlCacheUpdater * LanguageFactory * LanguageNameUtils * LinkRenderer * LinkRendererFactory * LocalisationCache * MagicWordFactory * MessageCache * NamespaceInfo * PageEditStash * PageHandlerFactory * PageUpdater * ParserFactory * PermissionManager * RevisionStore * RevisionStoreFactory * SearchEngineConfig * SearchEngineFactory * SearchFormWidget * SearchNearMatcher * SessionBackend * SpecialPageFactory * UserNameUtils * UserOptionsManager * WatchedItemQueryService * WatchedItemStore Constructors with new optional arguments: * DefaultPreferencesFactory * Language * LinkHolderArray * MovePage * Parser * ParserCache * PasswordReset * Router setHookContainer() now required after construction: * AuthenticationProvider * ResourceLoaderModule * SearchEngine Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
* Use MediaWikiServices::getRepoGroup in file related classesUmherirrender2020-03-141-2/+2
| | | | Change-Id: Iceec961de4f0cc689f7d3b981afac923b46c98f6
* BadFileLookup to replace wfIsBadImageAryeh Gregor2019-08-211-0/+127
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