X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiHelp.php;h=2a6c938a4796ec606d88f4204b53cd9729d6d881;hb=aaf1e17088d1f8349e386167ca0f2585f7dbdae5;hp=02efd7b5c95c8c2607b0bce4d5cb8bbaee6febce;hpb=19cd639835938da66507a1cc3623073c3217b416;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index 02efd7b5c9..60b95a5ba3 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -4,7 +4,7 @@ * * Created on Aug 29, 2014 * - * Copyright © 2014 Brad Jorsch + * Copyright © 2014 Wikimedia Foundation and contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ */ use HtmlFormatter\HtmlFormatter; +use MediaWiki\MediaWikiServices; /** * Class to output help for an API module @@ -90,7 +91,6 @@ class ApiHelp extends ApiBase { * @param IContextSource $context * @param ApiBase[]|ApiBase $modules * @param array $options Formatting options (described above) - * @return string */ public static function getHelp( IContextSource $context, $modules, array $options ) { global $wgContLang; @@ -109,7 +109,7 @@ class ApiHelp extends ApiBase { } $out->setPageTitle( $context->msg( 'api-help-title' ) ); - $cache = ObjectCache::getMainWANInstance(); + $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); $cacheKey = null; if ( count( $modules ) == 1 && $modules[0] instanceof ApiMain && $options['recursivesubmodules'] && $context->getLanguage() === $wgContLang @@ -117,7 +117,7 @@ class ApiHelp extends ApiBase { $cacheHelpTimeout = $context->getConfig()->get( 'APICacheHelpTimeout' ); if ( $cacheHelpTimeout > 0 ) { // Get help text from cache if present - $cacheKey = wfMemcKey( 'apihelp', $modules[0]->getModulePath(), + $cacheKey = $cache->makeKey( 'apihelp', $modules[0]->getModulePath(), (int)!empty( $options['toc'] ), str_replace( ' ', '_', SpecialVersion::getVersion( 'nodb' ) ) ); $cached = $cache->get( $cacheKey ); @@ -548,6 +548,12 @@ class ApiHelp extends ApiBase { case 'namespace': $namespaces = MWNamespace::getValidNamespaces(); + if ( isset( $settings[ApiBase::PARAM_EXTRA_NAMESPACES] ) && + is_array( $settings[ApiBase::PARAM_EXTRA_NAMESPACES] ) + ) { + $namespaces = array_merge( $namespaces, $settings[ApiBase::PARAM_EXTRA_NAMESPACES] ); + } + sort( $namespaces ); $count = count( $namespaces ); $info[] = $context->msg( 'api-help-param-list' ) ->params( $multi ? 2 : 1 ) @@ -645,6 +651,20 @@ class ApiHelp extends ApiBase { if ( $extra ) { $info[] = implode( ' ', $extra ); } + + $allowAll = isset( $settings[ApiBase::PARAM_ALL] ) + ? $settings[ApiBase::PARAM_ALL] + : false; + if ( $allowAll || $settings[ApiBase::PARAM_TYPE] === 'namespace' ) { + if ( $settings[ApiBase::PARAM_TYPE] === 'namespace' ) { + $allSpecifier = ApiBase::ALL_DEFAULT_STRING; + } else { + $allSpecifier = ( is_string( $allowAll ) ? $allowAll : ApiBase::ALL_DEFAULT_STRING ); + } + $info[] = $context->msg( 'api-help-param-multi-all' ) + ->params( $allSpecifier ) + ->parse(); + } } } @@ -825,9 +845,9 @@ class ApiHelp extends ApiBase { public function getHelpUrls() { return [ - 'https://www.mediawiki.org/wiki/API:Main_page', - 'https://www.mediawiki.org/wiki/API:FAQ', - 'https://www.mediawiki.org/wiki/API:Quick_start_guide', + 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page', + 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:FAQ', + 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Quick_start_guide', ]; } }