aboutsummaryrefslogtreecommitdiffstats
path: root/includes/context/IContextSource.php
Commit message (Collapse)AuthorAgeFilesLines
* Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-191-1/+1
| | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* context: Fix documentation for IContextSource::getLanguageUmherirrender2024-02-091-1/+2
| | | | | | | | The function is not defined in the extends interfaces to inherit documentation from. Follow-Up: I8334cc89dcf0f293298b82e004116be50a90f0d1 Change-Id: I14b2adfaa3c859ce7b196fc639b0974bbbf01834
* Namespace includes/contextJames D. Forrester2024-02-081-0/+8
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Move creation of BlockErrorFormatter into FormatterFactorydaniel2024-01-261-2/+3
| | | | | | | | The idea is that all formatters that need the user language or other request specific context should be instantiated by FormatterFactory. Change-Id: I8334cc89dcf0f293298b82e004116be50a90f0d1
* IContextSource: Minor comment tweaksReedy2024-01-021-3/+6
| | | | Change-Id: Ie71bf8f949c87533da254c91cdd688d5be27fe07
* Namespace Config-related classes under \MediaWiki\ConfigJames D. Forrester2023-09-211-0/+1
| | | | | Bug: T166010 Change-Id: I4066885a7ea071d22497abcdb3f95e73e154d08c
* Namespace User under \MediaWiki\UserJames D. Forrester2023-09-191-0/+1
| | | | | Bug: T166010 Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
* Reorg: Move WebRequest to includes\RequestAmir Sarabadani2023-09-111-0/+1
| | | | | | | This has been approved as part of RFC T166010 Bug: T321882 Change-Id: I6bbdbbe6ea48cc1f50bc568bb8780fc7c5361a6f
* Reorg: Move three output related classes to includes/Output/Amir Sarabadani2023-09-051-0/+1
| | | | | | | | | | And namesapce them: - StreamFile - OutputHandler - OutputPage Bug: T321882 Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* Revert "Reorg: Move some of request related classes to MediaWiki/Request"Zabe2022-10-271-1/+0
| | | | | | | | | This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922. Reason for revert: T166010#8349431 Bug: T166010 Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-261-0/+1
| | | | | | | | | | | | | Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequest - WebRequestUpload Bug: T166010 Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
* context: Remove deprecated IContextSource::getStats() implementationsUmherirrender2022-09-301-8/+0
| | | | | | Hard-deprecated since a6fe660. Change-Id: Id26aabcb6cbcedfe45224af161a998bda3aff451
* pager: Clean up file headers and `@ingroup`Timo Tijhof2022-09-291-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Follows similar commits to the objectcache, rdbms, filerepo, jobqueue components and other areas [1]. * Remove duplicate descriptions from file blocks in favour of class doc blocks. This reduces needless duplication and was often incorrect or outdated, and helps (ironically) to make the file header more consistently visually ignorable. * Remove `ingroup` from file blocks in class files as otherwise the file is indexed twice (e.g. in Doxygen) which makes navigation more messy. * Fix non-standard `@unstable for implementation` annotations in favour of `@stable to type` as per T257789 and <https://www.mediawiki.org/wiki/Stable_interface_policy>. While at it, fix the only other outstanding uses of `@stable for` in core as well in a handful of context/, logging/ and search/ files. [1] https://gerrit.wikimedia.org/r/q/message:ingroup+owner:Krinkle Bug: T257789 Change-Id: Ided3c5ab69e1b587b1b76a3c97a7cdb88f21e130
* context: Add a cached RequestContext::getActionName methodTimo Tijhof2022-03-251-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method is dependent on, and inherently must depend on, all of Title, WikiPage, and WebRequest. And, like Title and WikiPage, which also have getters in RequestContext, Action is also derived from a query parameter that is widely recognised in almost all web requests to index.php. The status quo in core and extensions, is to obtain this value via Action::getActionName(), which as a static method that bypasses dependency injection and also has the problem of not being cached. Caching it within ActionFactory seems hard and awkward, due to varying by context. In change I61d66211bd (22f9a32853f) a cached wrapper method was added internally to the Skin class. In change I8cbc4bba4d248d9 (235820d631) another cached wrapper was added in the Gadgets extension. This change takes this approach further by making it a stable public method on RequestContext. To facilitate testing and to offer basic confidence in this working correctly, this commit also adopts the new method in two place that are considered "safe" (Skin, and OutputPage). Both of these are called relatively late in the PHP proccess and well after any Setup code and overrides (such as in MediaWiki.php), during which it is more complex to call this. I'll audit and update those in a subsequent change. Change-Id: I1e259b54dca48a32be5a8c6cbb8eb69aec2da115
* Move CRSF token generation to CsrfTokenSetPetr Pchelko2021-06-181-1/+2
| | | | Change-Id: Idf68f1cc63fb2e01e004ff353fcda026fa4ec10f
* Remove unstable marker from Authority interfacedaniel2021-04-131-1/+1
| | | | | | | NOTE: this should be backported to 1.36 before the RC0 release! Bug: T275768 Change-Id: I86c1f6e497dcda820944be5adfd80aed7b9c63bb
* Add Authority to ContextPetr Pchelko2021-01-201-0/+8
| | | | | Bug: T271460 Change-Id: If1038c94ccf8f3e59b5242f5c33b66f076c60816
* Stability annotations for interfaces.daniel2020-07-071-0/+2
| | | | | | | | | Per the Stable Interface Policy, PHP interfaces should not be directly implemented by extensions, unless they are marked to be safe for that purpose. Bug: T247862 Change-Id: Idd5783b70fc00c03d57f5b1a887f0e47c4d7b146
* Improve 1-letter variable names in MutableContext and implementationsThiemo Mättig2018-01-071-16/+1
| | | | | | | | | | I'm also removing obsolete short comments that don't add anything to whats already obvious from the method header. For example, I really don't need a comment to understand that a method that's called "setUser" and accepts a parameter named "$user" of type "User" is meant to "set the User object". I mean, how more obvious can it be? ;-) Change-Id: Ib079108457a5aa2a6896e95837542ab93b465144
* build: Updating mediawiki/mediawiki-codesniffer to 13.0.0Umherirrender2017-09-251-2/+0
| | | | Change-Id: Ia24dbf015f2b4781683ca980a460d0ac3e85674e
* statsd: Rename MediawikiStatsdDataFactory to IBufferingStatsdDataFactoryTimo Tijhof2017-07-071-1/+1
| | | | | | | | | | | | | Follows-up I2874175647e (7fdc3d09a3b). * Avoid "MediaWiki" in class names. If unavoidable, always camelcase. * Use a more descriptive name, matching the implementing the class ("Buffering"). * Use "I" prefix for consistency with other MediaWiki-provided interfaces. (Avoid "Interface" suffix, which is foreign to MediaWiki and is only used in the StatsdClient namespace, which this interface is not in). Bug: T166354 Change-Id: I06de59122625f9c23e7c1a1bfa69a7ddabbf379e
* Require $key in msg() functionsAmir Sarabadani2017-06-141-9/+1
| | | | | | | | | | | | Note: calling msg() with no parameter was never supported, doing this on a RequestContext for example would result in: PHP Warning: Missing argument 1 for wfMessage() ...followed by a bunch of fallout. So this patch only formally declares what was already a requirement in reality. Change-Id: I1864afb8bcc641698689828914949a06506d8f3a
* Refactor Statsd classes to enable null collector to work.Stanislav Malyshev2017-05-291-1/+1
| | | | | | | | | | | | | The following changes are added: - Created MediawikiStatsdDataFactory interface - Added hasData() method to see if there are any data to send - Added getData() method to fetch data - Made service infrastructure use MediawikiStatsdDataFactory interface - Made wfLogProfilingData() use MediawikiStatsdDataFactory interface - Added capability to enable/disable buffering collector Bug: T166354 Change-Id: I2874175647e987996a9a399829b3319674471aaa
* Add getStatsdDataFactory to MediawikiServicesaddshore2016-04-191-1/+5
| | | | Change-Id: Iaf89d5d7887f766064266874ea7ba73362531ed2
* Add Timing interfaceOri Livneh2015-11-031-0/+8
| | | | | | | | | * Add `Timing`, an interface which mimics the W3C User Timing API. It provides a canonical way to store and retrieve markers (timestamps) and measures (timestamps + duration). * As the initial use-case, use it to record 'requestShutdown'. Change-Id: I36b29162ffcc091406df025463b0e2797e52f19a
* Fixed some RequestContext IDEA errors with msg() callersAaron Schulz2015-08-251-0/+1
| | | | Change-Id: I2a382ee8498eafd9fe045550dd9c1f61a8933926
* Document IContextSource->msgMatthew Flaschen2015-04-251-1/+1
| | | | Change-Id: I4cc922c61f77bbb7cd4ece94f28d927c4753c24e
* Mention metrics in IContextSource docsAaron Schulz2015-03-111-2/+4
| | | | Change-Id: I9b654a12578758471978ffd1e1ae20476aeeaa0d
* Add StatsD metric loggingOri Livneh2015-03-091-0/+8
| | | | | | | | | | | | | | | | | | | | | This patch adds a metric data service object to the IContextSource interface, with full support for StatsD meters, gauges, counters and timing metrics, via the liuggio/statsd-php-client, which this patch also introduces. Usage example: $stats = $context->getStats(); $stats->increment( 'resourceloader.cache.hits' ); $stats->timing( 'resourceloader.cache.rtt', $rtt ); The metrics are flushed to a StatsD server, which may be specified via the 'StatsdServer' configuration key. If no such configuration key exists, the metrics are discarded. The StatsD client supplants MediaWiki's StatCounter class. wfIncrStats() will continue to work, but it will delegate to the StatsD data object. Change-Id: Ie10db1c154d225971398e189737de7c560bf0f90
* Added clarifying comments to IContextSourceAaron Schulz2015-03-071-3/+25
| | | | | | * Also removed some duplicated comments Change-Id: I2c967d0f3219f3533378ecd5f9fccc40c8f9b219
* Removed getLang() from IContextSource and subclasseswithoutaname2014-06-201-8/+0
| | | | Change-Id: I94c3df814c06c54c071f371101882dcc71c99417
* Document that IContextSource::getTitle can return nullMarius Hoch2014-04-241-1/+1
| | | | | | That can happen if wgTitle is null. Change-Id: I3d8aab232d408e75afb8be82ca714bf5c4fe2427
* Fixed some @params documentationumherirrender2014-04-141-1/+1
| | | | | | | | 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. Change-Id: I8c9f30128b46086064326708a4878228ba459447
* Config: Add Config and GlobalConfig classesKunal Mehta2014-01-271-1/+1
| | | | | | | | | | | | | | | | | | | Allows configuration options to be fetched from context. Only one implementation, GlobalConfig, is provided, which simply returns $GLOBALS[$name]. There can be more classes in the future, possibly a database-based one. For convinience the "wg" prefix is automatically added. Ironically, this adds the $wgConfigClass global variable which is used to determine which implementation of Config to use by default. The ContextSource getConfig and setConfig methods were introduced in I23194d1ba (1.23), but have no uses in Gerrit, so they can safely be re-purposed. Change-Id: I13baec0b6d4ea7badf20b9c5f9b40846348838e4
* Begin exposing SiteConfiguration via site contextsChad Horohoe2013-10-251-0/+8
| | | | | | | | | First step of providing configuration without relying on globals. You can use this in your code now as follows: $myvar = $context->getConfig()->get( 'wgMyVar' ) Change-Id: I23194d1ba747a9e0d925154ae065cbd612b4f591
* docs: Consistently use "since" phrasing in @deprecatedTimo Tijhof2013-05-151-1/+1
| | | | | | | | | Most have it already: https://doc.wikimedia.org/mediawiki-core/master/php/html/deprecated.html Ran a find/replace on "@deprecated \d" to fix the odd ones. Change-Id: I5217aaf75264a0036b5426cd8536116b4bb8f535
* Fixed importScopedSession() and moved exportUserSession() to RequestContext.Aaron Schulz2013-03-151-0/+9
| | | | | | | | | | | | * Renamed WebRequest::exportUserSession -> RequestContext::exportSession. Updated the only callers of this new function. * Init the user with User::newFromId() instead of relying on the session (which breaks when things like CentralAuth are enabled). * Made RequestContext::exportSession() include the user ID. * Removed now-redundant user ID checks in upload jobs. * Added unit tests for the session import function. Change-Id: I543e6766f7a8a828ea5d270328c3bc7738c6fe94
* Update doc comments and code formatting.Siebrand Mazeland2013-01-111-4/+2
| | | | Change-Id: I1896d7b1ab5d11d3a609fd97db7c503ad6c590e5
* Per Aaron, fix for r108274: added canUseWikiPage() to context objects to ↵Alexandre Emsenhuber2012-01-141-1/+14
| | | | | | | know whether getWikiPage() can be safely called Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/108902
* Push msg from ContextSource/RequestContext into IContextSourceSam Reed2012-01-131-0/+7
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/108787
* * Added WikiPage to RequestContext and related so that it can be shared to ↵Alexandre Emsenhuber2012-01-061-0/+8
| | | | | | | | | | | | avoid creating a new object each time and thus avoiding database queries to load the state of the object * Added Article::getPage() as accessor to the WikiPage object so that it can be set in the context from MediaWiki::initializeArticle() * Use it WikiPage::main() to call doViewUpdates() I'm doing to this now so that I can revert r105790 and use the WikiPage object before the 1.19 release Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/108274
* Add missing @since tags for getLanguage and deal with this sanitizeLangCode ↵Daniel Friesen2011-12-051-0/+1
| | | | | | | fatal that no-one bothered to fix. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/105205
* Bug 29524 - Rename RequestContext::getLang to getLanguageJohn Du Hart2011-11-211-0/+8
| | | | | | | I'll be amazed if this doens't break any tests. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/103817
* Separate RequestContext.php into separate files inside of context/Daniel Friesen2011-09-151-0/+73
Update the AutoLoader too. This is also a follow up to r97161 since I forgot to add the AutoLoader line. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/97179