Merge "Show dimensions in TraditionalImageGallery"
[lhc/web/wiklou.git] / includes / api / ApiHelp.php
index 9a0d3ff..7cd6d58 100644 (file)
@@ -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 );
@@ -547,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 )
@@ -838,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',
                ];
        }
 }