aboutsummaryrefslogtreecommitdiffstats
path: root/includes/cache/HTMLFileCache.php
Commit message (Collapse)AuthorAgeFilesLines
* Use namespaced classes (1)Umherirrender2024-06-161-0/+1
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: Ic4d4dd61de5ab896fb6173eb579c81f164a1e4a3
* Namespace includes/contextJames D. Forrester2024-02-081-0/+1
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* HTMLFileCache: Remove `@throws` for unchecked exceptionTimo Tijhof2023-07-241-13/+8
| | | | | | | While at it, move the array to a constant. Bug: T321683 Change-Id: I46db0f4b01711ff7304918708efb7776300bbcc8
* Replace internal Hooks::runnerUmherirrender2023-05-111-5/+6
| | | | | | | | | The Hooks class contains deprecated functions and the whole class is going to get removed, so remove the convenience function and inline the code. Bug: T335536 Change-Id: I8ef3468a64a0199996f26ef293543fcacdf2797f
* FileCache: Allow ?uselang= to utilize cache if set to content languagePlatonides2022-09-071-0/+3
| | | | | | | | | | | | | | Previously the mere presence of uselang made it disable the FileCache, even though requesting the wiki content language is equivalent to not providing it at all. The requested language being the content one is already checked in lines 124-138. This used to work but was broken with the 2008 refactoring of isFileCacheable() in e29274ca (r41274). Change-Id: I01320d36a3b31b7a69025d845b61d9eb05e9fca3
* Use User::isRegistered for readability instead of ::getId falsy checkUmherirrender2022-04-291-1/+1
| | | | Change-Id: I42aab149559e3e899cde6c77af76c66936ed0ef0
* Use MainConfigNames instead of string literals, #4Aryeh Gregor2022-04-261-3/+4
| | | | | | | | | | | | | | | | | | | | | Now largely automated: VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \ tr "\n" '|' | sed "s/|$/\n/;s/'//g") sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \ $(grep -ERIl "'($VARS)'" includes/) Then git add -p with lots of error-prone manual checking. Then semi-manually add all the necessary "use" lines: vim $(grep -L 'use MediaWiki\\MainConfigNames;' \ $(git diff --cached --name-only --diff-filter=M HEAD^)) I didn't bother fixing lines that were over 100 characters unless they were over 120 and triggered phpcs. Bug: T305805 Change-Id: I74e0ab511abecb276717ad4276a124760a268147
* cache: Introduce member to expose service options for configsDerick Alangi2022-04-131-3/+1
| | | | | | | | | | | | There are some static methods in sub-classes of FileCacheBase that use the service locator to get the main config object which maybe I think we can just use DI in the methods to pass this from the calling code. That could be in a follow-up patch, for now, we can leave things as they are here? Change-Id: Ic75e1e5f867faee7fc71c34552f9f0a7a124d7ae
* Fix typos in comments (E-H)Siddharth VP2021-12-301-1/+1
| | | | Change-Id: I0748e0d5962fa909fdd6b7fcae4ab259bde4cdf1
* HTMLFileCache: replace Title in method signaturesdaniel2021-04-141-8/+9
| | | | | Bug: T278459 Change-Id: I77fb37c1aec17d3e51056f85fdff59821f326cc3
* Remove terminating line breaks from debug messagesTim Starling2020-06-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | A terminating line break has not been required in wfDebug() since 2014, however no migration was done. Some of these line breaks found their way into LoggerInterface::debug() calls, where they mess up the formatting of the debug log. So, remove terminating line breaks from wfDebug() and LoggerInterface::debug() calls. Also: * Fix the stripping of leading line breaks from the log header emitted by Setup.php. This feature, accidentally broken in 2014, allows requests to be distinguished in the log file. * Avoid using the global variable $self. * Move the logging of the client IP back to Setup.php. It was moved to WebRequest in the hopes that it would not always be needed, however $wgRequest->getIP() is now called unconditionally a few lines up in Setup.php. This means that it is put in its proper place after the "start request" message. * Wrap the log header code in a closure so that variables like $name do not leak into global scope. * In Linker.php, remove a few instances of an unnecessary second parameter to wfDebug(). Change-Id: I96651d3044a95b9d210b51cb8368edc76bebbb9e
* Hooks::run() call site migrationTim Starling2020-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge "Use new TalkPageNotificationManager"jenkins-bot2020-05-201-1/+3
|\
| * Use new TalkPageNotificationManagerClara Andrew-Wani2020-05-151-1/+3
| | | | | | | | | | Bug: T239640 Change-Id: I7c06d145854ab39faaef528e169f6b51de1c8d99
* | Fix even more PSR12.Properties.ConstantVisibility.NotFoundReedy2020-05-161-3/+3
|/ | | | Change-Id: I4a30a44bc33fc98479799438d65342f6529e14f9
* Fix SingleSpaceBeforeSingleLineCommentReedy2020-05-111-1/+1
| | | | Change-Id: I285af438ce484af40741489797f20455726ec110
* Fix typo: 'the the' -> 'the'Ed Sanders2020-05-031-1/+1
| | | | Change-Id: Ia57fb787b43c8e49da4f33a65c265cbc37ee1f77
* Add small HtmlCacheUpdater service class to normalize purging code (2)Aaron Schulz2020-04-141-7/+7
| | | | | | | | | | | | | | | | | | | This is a re-submit of 35da1bbd7cb, which was accidentally merged before CR (and reverted with aa4da3c2e8e). The purge() method handles purging of both file cache and CDN, using a PRESEND deferred update. This avoids code duplication and missing file cache purge calls. Also: * Migrate HTMLCacheUpdate callers to just directly using HTMLCacheUpdateJob * Add HtmlFileCacheUpdate class and defer such updates just like with CDN * Simplify HTMLCacheUpdate constructor parameters * Remove BacklinkCache::clear() calls which do nothing since the backlink query does not actually happen until the job runs Bug: T230025 Change-Id: Ic1005e70e2c22d5bd1ca36dcdb618108ebe290f3
* Setup: Move MWDebug logic to MWDebug.phpTimo Tijhof2019-09-041-4/+0
| | | | | | | | | | | | | | | | | | | | | * Remove checks in HTMLFileCache.php and Article.php. These haven't been needed since the same check was added to Setup.php, many years ago. When FileCache is enabled, The Setup.php code disables MWDebug. There is no reason for FileCache to then also disable itself based on unused config. That means both of them lose. We now handle this logic in one place: MWDebug::setup(). * In rebuildFileCache.php, turn it off explicitly, just in case. The previous code there didn't work because finalSetup() is called after doMaintenance.php includes Setup.php, which is what checked this config var to decide on MWDebug::init. On the other hand, it's also always off in CLI mode. But, let's not depend on that, maybe we decide to enable it on CLI one day! Just keep it off explicitly here. Bug: T189966 Change-Id: I45a8f77092249751dc6f276aa5bb67ebf5b4f64c
* Revert "Add small HtmlCacheUpdater service class to normalize purging code"Daniel Kinzler2019-08-071-18/+6
| | | | | | | | This reverts commit 35da1bbd7cb8b4414c4fbcf331473f1024bc638d. Reason for revert: wrong tab, wrong patch. Ooops. Change-Id: I5828fff6308d43460a3b2b10f60996409181f8b3
* Add small HtmlCacheUpdater service class to normalize purging codeAaron Schulz2019-08-061-6/+18
| | | | | | | | | | | | | | | The purge() method handles purging of both file cache and CDN, using a PRESEND deferred update. This avoids code duplication and missing file cache purge calls. Also: * Migrate HTMLCacheUpdate callers to just directly using HTMLCacheUpdateJob * Add HtmlFileCacheUpdate class and defer such updates just like with CDN * Simplify HTMLCacheUpdate constructor parameters * Remove BacklinkCache::clear() calls which do nothing since the backlink query does not actually happen until the job runs Change-Id: Ic453b189a40109a73a9426538608eea87a76befa
* Collapse some nested if statementsReedy2019-04-041-14/+8
| | | | Change-Id: I9a97325d738d09370d29d35d5254bc0dadc57ff4
* Mass conversion of $wgContLang to serviceAryeh Gregor2018-08-111-4/+4
| | | | | | | Brought to you by vim macros. Bug: T200246 Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
* Use Language::equals to compare Language objectsFomafix2018-07-101-1/+2
| | | | | | | | | | | With I8a47a8500922906bd4e4936b59b657de3bb9abdc Language::equals can directly and faster compare the objects. $wgLanguageCode can differ from $wgContLang->getCode() when a deprecated language code is used. This change prevents this because Language replaces deprecated language codes in Language::factory(). Change-Id: I07f47eceff8b3a4192278b1e9e1cfd9a41816a1c
* Use short type bool/int in param documentationUmherirrender2017-08-201-2/+2
| | | | | | Enable the phpcs sniffs for this and used phpcbf Change-Id: Iaa36687154ddd2bf663b9dd519f5c99409d37925
* Remove HTMLFileCache::newFromTitle()addshore2017-01-281-13/+0
| | | | Change-Id: I0076801aa7b9af5083c5a7a66f2d1c9884b70ee9
* Don't use Config as an access method for global objectsFlorian Schmidt2016-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | | The Config interface (and it's implementation(s)) was never thought to be an access method for objects saved in the global state, even if it works with the current implementation GlobalVarConfig. Imagine, that MediaWiki core switches to another file-based configuratiion storage or a a database based one, we wouldn't be able to provide access to global objects anymore, without weird hacks in the new config-backend implementation or serializing objects to store in the database or something else. This all isn't the idea with the Config interface, as far as I know, so don't use it at all. This commit changes the access to wgContLang to use the global keyword, instead of accessing it through Config. Follow up: Ice4f40911c3761c2542430935bc1898bc4e7a4d4 Follow up: I46f376a82205a5c99b98c9e971f9e9d7868ce9fb Change-Id: I7a08b3bb649898abd445317a523051b07420b211
* Restore Content-Language header change from e53ff931aAaron Schulz2016-10-031-1/+2
| | | | | | This was lost in a rebase at some point. Change-Id: I46f376a82205a5c99b98c9e971f9e9d7868ce9fb
* Make rebuildFileCache cover ?action=historyAaron Schulz2016-09-201-15/+23
| | | | | | Also simplified the logic slightly Change-Id: I6145d52b6b701735fa4bd8e41e07fb2bf6fdcee3
* Apply wfBCP47() to HTTP response header Content-LanguageFomafix2016-09-161-2/+2
| | | | | | | | | | | | | | See https://tools.ietf.org/html/rfc7231#section-3.1.3 for Content-Language. This references https://tools.ietf.org/html/rfc5646 aka BCP 47. Example: curl -I https://crh.wikipedia.org/wiki/Ba%C5%9F_Saife | grep -i '^content-language:' should contain Content-language: crh-Latn instead of Content-language: crh-latn Change-Id: Ice4f40911c3761c2542430935bc1898bc4e7a4d4
* Fix $wgFileCache DB outage fallbackAaron Schulz2016-09-161-3/+22
| | | | Change-Id: I5c41b4669ca29d119de5c08a2c61dbadae7cf55c
* filecache: Remove unused ObjectFileCache classTimo Tijhof2016-09-061-3/+3
| | | | | | | | | | | | | | This was originally intended for use by ResourceLoader but it was incomplete and not actually used by ResourceLoader at first. Then 93d358cd added support for FileCache to ResourceLoader with a separate ResourceFileCache class. Also fixed typo in HTMLFileCache from 6559b8bf. ObjectFileCache is not mentioned anywhere else in Wikimedia Git. Change-Id: I69cca27ee7cd922da12f1793660432709c273be6
* Unbreak file cachingAaron Schulz2016-07-291-1/+1
| | | | | | This was totally broken by 796d62d0 Change-Id: I34ee08e926117b9472151d9fd415c1dfc6a57de1
* Language: Introduce new method equals( Language $lang )Fomafix2016-05-161-3/+2
| | | | | | | | | | | | Use $lang->equals( $wgContLang ) instead of $lang->getCode() === $wgContLang->getCode() Change-Id: Id7ed6a21ce5e2ea2887ec98c7bd9d3eba83d733b
* Convert all array() syntax to []Kunal Mehta2016-02-171-2/+2
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* Remove use of $dest = 'log' for wfDebugLogBryan Davis2015-12-301-1/+1
| | | | | | | | | | The functionality for marking a debug log message for delivery to a log file but not to MWDebug was removed in 1.25 with the introduction of the PSR-3 logging system. Convert the messages that were marked for this special handling in a7a0883 to use 'private' instead. Bug: T122644 Change-Id: Iefaac07a5922c16c2899904c7b678199c5b1efe9
* Improved personal toolbar for logged-out usersThis, that and the other2015-12-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, logged-out users either only saw "Create account" and "Log in" links in the personal area, or if $wgShowIPinHeader was true, they saw [icon] 127.0.0.1 Talk for this IP address Create account Log in where the IP address itself linked to the IP user page. Now, logged-out users by default see the following: [icon] Not logged in Talk Contributions Create account Log in The old $wgShowIPinHeader feature is removed. It is very unfriendly to show the user's IP address (in red, no less) at the top of every page, since this will mean nothing to most visitors. Caching means that this can't even be done reliably, anyway. Another improvement is that the "talk" and "contributions" links are not shown if anonymous users don't have the 'edit' right. Modelled after the loggedOutTalkPage() function at Dutch Wikipedia <https://nl.wikipedia.org/w/index.php?oldid=44706954> Bug: T112724 Change-Id: I6f44e3e5d97ea917e4a03af47f3795792e4ca122
* $wgUseGzip had no effectSeb352015-06-201-0/+1
| | | | | | | | | | Since MediaWiki 1.24 a constructor is defined in HTMLFileCache, so the constructor of the parent class, FileCacheBase, is no more called, and $wgUseGzip is no more used. This fix explicitely calls the parent constructor. Bug: T103237 Change-Id: I80c1871881049b9618c23aa76e6665867ecec2aa
* Replace wfRunHooks calls with direct Hooks::run callsAaron Schulz2014-12-101-1/+1
| | | | | | * This avoids the overhead of an extra function call Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
* Merge "Deprecate HTMLFileCache::newFromTitle() in favor of constructor"jenkins-bot2014-09-191-8/+15
|\
| * Deprecate HTMLFileCache::newFromTitle() in favor of constructorMax Semenik2014-09-191-8/+15
| | | | | | | | Change-Id: I903e68fc1f486501d790ca69146ecb835d90c9cc
* | Add a hook to allow extensions to prevent HTML file cachingMax Semenik2014-09-181-1/+5
|/ | | | | | | | | Needed for MobileFrontend on third-party sites that use this feature. Ideally, there should be a way to cache mobile requests too, but that's a different issue requiring much more effort to do properly. Bug: 68106 Change-Id: I01a76c571d9186b325f19a00cec136459707c791
* Fixed some @params documentation (includes/[cache|objectcache])umherirrender2014-04-191-6/+6
| | | | | | | | | Swapped some "$var type" to "type $var" or added missing types before the $var. Changed some other types to match the more common spelling. Makes beginning of some text in captial. Also added some missing @param. Change-Id: I86fd10e3f2d4bb80e7432533038d124693acfb3c
* Enhance the destination control parameter of wfDebug() and wfDebugLog()Alexandre Emsenhuber2014-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - The parameter is now a string, making is more understandable than boolean values - It takes the same values in both wfDebug() and wfDebugLog() (except for 'private' which is only used in the latter) - This adds a new possibility to wfDebugLog() to log the message either on the specific log or the general one, but not to the debug toolbar - Old boolean values are still recognised for backward compatibility - Also send the messages passed to wfDebugLog() to the debug toolbar when they are written to a specific log and not restricted to logs - Updated the calls of and wfDebug() and wfDebugLog() with the last parameter to change it into a string - Renamed MWDebug::sendWarning() to MWDebug::sendMessage() and added $group parameter to it; will not break anything since that method is marked as private - Changed the call to wfDebug() from MWDebug::sendMessage() to use wfDebugLog() with 'log' as thrid parameter, so that those messages can be logged separately from the main log and they don't show up a second time on the "debug log" tab of the debug toolbar Change-Id: I1be09d4c1d3408ed5b26a5db02691c17c0ec0926
* Update formattingSiebrand Mazeland2013-11-171-0/+4
| | | | Change-Id: I9aa56cbe0989d6f302ee0f47c4a6154101f73e90
* docs: Remove odd colons after @todoTimo Tijhof2013-05-151-1/+1
| | | | | | | | | | Most were this way already: https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html Ran a find/replace on the odd ones. Also made them all lower case. Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
* Fixed spacing around parenthesis in includesumherirrender2013-04-281-1/+1
| | | | Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397
* fix some spacingumherirrender2013-02-091-1/+1
| | | | | | | | | | Added/removed spaces after opening/before closing parentheses Added a space after a comma Removed unneeded parentheses in condition Change-Id: I306091347ccaaf11dee0cdfda3019cb0c12be51b
* fix some spacingumherirrender2013-02-041-2/+2
| | | | Change-Id: I93f0a87ba7129bc336083e7289247d3150feb606
* Update docs for return and exception infoSiebrand Mazeland2012-10-091-0/+1
| | | | | | | * Removed some inline tabs in the process. * IDE fixed some incorrect leading spaces, too. Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190