Merge "Move category refreshes to a deferred update"
[lhc/web/wiklou.git] / includes / api / ApiHelp.php
index abec828..b1942bc 100644 (file)
@@ -91,7 +91,7 @@ class ApiHelp extends ApiBase {
         * @return string
         */
        public static function getHelp( IContextSource $context, $modules, array $options ) {
-               global $wgMemc, $wgContLang;
+               global $wgContLang;
 
                if ( !is_array( $modules ) ) {
                        $modules = array( $modules );
@@ -104,6 +104,7 @@ class ApiHelp extends ApiBase {
                }
                $out->setPageTitle( $context->msg( 'api-help-title' ) );
 
+               $cache = ObjectCache::getMainWANInstance();
                $cacheKey = null;
                if ( count( $modules ) == 1 && $modules[0] instanceof ApiMain &&
                        $options['recursivesubmodules'] && $context->getLanguage() === $wgContLang
@@ -114,7 +115,7 @@ class ApiHelp extends ApiBase {
                                $cacheKey = wfMemcKey( 'apihelp', $modules[0]->getModulePath(),
                                        (int)!empty( $options['toc'] ),
                                        str_replace( ' ', '_', SpecialVersion::getVersion( 'nodb' ) ) );
-                               $cached = $wgMemc->get( $cacheKey );
+                               $cached = $cache->get( $cacheKey );
                                if ( $cached ) {
                                        $out->addHTML( $cached );
                                        return;
@@ -151,7 +152,7 @@ class ApiHelp extends ApiBase {
                $out->addHTML( $html );
 
                if ( $cacheKey !== null ) {
-                       $wgMemc->set( $cacheKey, $out->getHTML(), $cacheHelpTimeout );
+                       $cache->set( $cacheKey, $out->getHTML(), $cacheHelpTimeout );
                }
        }
 
@@ -179,7 +180,7 @@ class ApiHelp extends ApiBase {
                                        $href = $m[2] === '' ? '#' . $m[1] : $m[2];
                                } elseif ( $helptitle !== null ) {
                                        $href = Title::newFromText( str_replace( '$1', $m[1], $helptitle ) . $m[2] )
-                                               ->getFullUrl();
+                                               ->getFullURL();
                                } else {
                                        $href = wfAppendQuery( wfScript( 'api' ), array(
                                                'action' => 'help',
@@ -309,6 +310,7 @@ class ApiHelp extends ApiBase {
                                );
                        }
 
+                       $flags = $module->getHelpFlags();
                        $help['flags'] .= Html::openElement( 'div',
                                array( 'class' => 'apihelp-block apihelp-flags' ) );
                        $msg = $context->msg( 'api-help-flags' );
@@ -318,7 +320,7 @@ class ApiHelp extends ApiBase {
                                );
                        }
                        $help['flags'] .= Html::openElement( 'ul' );
-                       foreach ( $module->getHelpFlags() as $flag ) {
+                       foreach ( $flags as $flag ) {
                                $help['flags'] .= Html::rawElement( 'li', null,
                                        self::wrap( $context->msg( "api-help-flag-$flag" ), "apihelp-flag-$flag" )
                                );
@@ -709,7 +711,6 @@ class ApiHelp extends ApiBase {
                                        $suboptions,
                                        $haveModules
                                );
-                               $numSubmodules = count( $submodules );
                        }
 
                        $module->modifyHelp( $help, $suboptions, $haveModules );
@@ -758,6 +759,8 @@ class ApiHelp extends ApiBase {
                return array(
                        'action=help'
                                => 'apihelp-help-example-main',
+                       'action=help&modules=query&submodules=1'
+                               => 'apihelp-help-example-submodules',
                        'action=help&recursivesubmodules=1'
                                => 'apihelp-help-example-recursive',
                        'action=help&modules=help'