Go to the documentation of this file.
23 if ( isset(
$params[
'options'] ) ) {
26 if ( is_callable( [ $this,
'dieWithError' ] ) ) {
27 $this->
dieWithError(
'apierror-categorytree-invalidjson',
'invalidjson' );
29 $this->dieUsage(
'Options must be valid a JSON object',
'invalidjson' );
38 if ( is_callable( [ $this,
'dieWithError' ] ) ) {
54 $ctConfig->get(
'CategoryTreeHTTPCache' ) &&
55 $config->get(
'SquidMaxage' ) &&
56 $config->get(
'UseSquid' )
58 if ( $config->get(
'UseESI' ) ) {
60 'Surrogate-Control: max-age=' . $config->get(
'SquidMaxage' ) .
', content="ESI/1.0"'
62 $this->
getMain()->setCacheMaxAge( 0 );
64 $this->
getMain()->setCacheMaxAge( $config->get(
'SquidMaxage' ) );
67 $this->
getRequest()->response()->header(
'Vary: Accept-Encoding, Cookie' );
80 if ( $condition ===
'last-modified' ) {
86 'page_title' =>
$title->getDBkey(),
107 md5(
$title->getDBkey() ),
108 md5( $ct->getOptionsAsCacheKey( $depth ) ),
110 $wgContLang->getExtraHashOptions(),
111 $ctConfig->get(
'RenderHashAppend' )
116 $mcvalue =
$wgMemc->get( $mckey );
117 if ( $mcvalue && $touched <= $mcvalue[
'timestamp'] ) {
118 $html = $mcvalue[
'value'];
122 if ( !isset(
$html ) ) {
134 return trim(
$html );
const PARAM_REQUIRED
(boolean) Is the parameter required?
static capDepth( $mode, $depth)
Internal function to cap depth.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
Core functions for the CategoryTree extension, an AJAX based gadget to display the category structure...
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
This abstract class implements many basic API functions, and is the base of all API classes.
getHTML( $ct, $title, $depth, $ctConfig)
Get category tree HTML for the given tree, title, depth and config.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
namespace and then decline to actually register it file or subcat img or subcat $title
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
static getDefaultInstance()
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
isInternal()
Indicates whether this module is "internal" Internal API modules are not (yet) intended for 3rd party...
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
getModuleName()
Get the name of the module being executed by this instance.
static makeTitle( $title)
Creates a Title object from a user provided (and thus unsafe) string.
getMain()
Get the main module.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
wfMemcKey(... $args)
Make a cache key for the local wiki.
getConditionalRequestData( $condition)