29 if ( isset( $params[
'options'] ) ) {
30 $options = FormatJson::decode( $params[
'options'] );
31 if ( !is_object( $options ) ) {
32 $this->
dieWithError(
'apierror-categorytree-invalidjson',
'invalidjson' );
34 $options = get_object_vars( $options );
42 $depth = isset( $options[
'depth'] ) ? (int)$options[
'depth'] : 1;
46 $ctConfig = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig(
'categorytree' );
49 $this->
getMain()->setCacheMode(
'public' );
60 if ( $condition ===
'last-modified' ) {
66 'page_title' =>
$title->getDBkey(),
85 $mckey = ObjectCache::getLocalClusterInstance()->makeKey(
89 $this->getLanguage()->getCode(),
90 MediaWikiServices::getInstance()->getContentLanguage()->getExtraHashOptions(),
91 $ctConfig->
get(
'RenderHashAppend' )
96 $mcvalue =
$wgMemc->get( $mckey );
97 if ( $mcvalue && $touched <= $mcvalue[
'timestamp'] ) {
98 $html = $mcvalue[
'value'];
102 if ( !isset( $html ) ) {
114 return trim( $html );
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
This abstract class implements many basic API functions, and is the base of all API classes.
const PARAM_REQUIRED
(boolean) Is the parameter required?
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
getMain()
Get the main module.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getModuleName()
Get the name of the module being executed by this instance.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
getConditionalRequestData( $condition)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getHTML(CategoryTree $ct, Title $title, $depth, Config $ctConfig)
Get category tree HTML for the given tree, title, depth and config.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.Concrete implementatio...
isInternal()
Indicates whether this module is "internal" Internal API modules are not (yet) intended for 3rd party...
Core functions for the CategoryTree extension, an AJAX based gadget to display the category structure...
renderChildren(Title $title, $depth=1)
Returns a string with an HTML representation of the children of the given category.
getOptionsAsCacheKey( $depth=null)
static makeTitle( $title)
Creates a Title object from a user provided (and thus unsafe) string.
static capDepth( $mode, $depth)
Internal function to cap depth PhanPluginDuplicateConditionalNullCoalescing until PHP7 is required.
Represents a title within MediaWiki.
Interface for configuration instances.
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".