X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiHelp.php;h=192c039651c852db05a047cbf5f504d961d0f8b6;hp=e347a9f2c526acd261262ddc8ad113d73b293d2b;hb=f7e1770fb832aa77bf4e16ce8cc815f2b24dd10d;hpb=524b25dc301baee0b49fd04f355aa78c7040925d diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index e347a9f2c5..192c039651 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -25,6 +25,7 @@ */ use HtmlFormatter\HtmlFormatter; +use MediaWiki\MediaWikiServices; /** * Class to output help for an API module @@ -108,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 @@ -116,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 ); @@ -488,12 +489,22 @@ class ApiHelp extends ApiBase { if ( is_array( $type ) ) { $count = count( $type ); + $deprecatedValues = isset( $settings[ApiBase::PARAM_DEPRECATED_VALUES] ) + ? $settings[ApiBase::PARAM_DEPRECATED_VALUES] + : []; $links = isset( $settings[ApiBase::PARAM_VALUE_LINKS] ) ? $settings[ApiBase::PARAM_VALUE_LINKS] : []; - $values = array_map( function ( $v ) use ( $links ) { - // We can't know whether this contains LTR or RTL text. - $ret = $v === '' ? $v : Html::element( 'span', [ 'dir' => 'auto' ], $v ); + $values = array_map( function ( $v ) use ( $links, $deprecatedValues ) { + $attr = []; + if ( $v !== '' ) { + // We can't know whether this contains LTR or RTL text. + $attr['dir'] = 'auto'; + } + if ( isset( $deprecatedValues[$v] ) ) { + $attr['class'] = 'apihelp-deprecated-value'; + } + $ret = $attr ? Html::element( 'span', $attr, $v ) : $v; if ( isset( $links[$v] ) ) { $ret = "[[{$links[$v]}|$ret]]"; } @@ -844,9 +855,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', ]; } }