* @return string
*/
public static function getHelp( IContextSource $context, $modules, array $options ) {
- global $wgMemc, $wgContLang;
+ global $wgContLang;
if ( !is_array( $modules ) ) {
$modules = array( $modules );
}
$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
$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;
$out->addHTML( $html );
if ( $cacheKey !== null ) {
- $wgMemc->set( $cacheKey, $out->getHTML(), $cacheHelpTimeout );
+ $cache->set( $cacheKey, $out->getHTML(), $cacheHelpTimeout );
}
}
$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',
);
}
+ $flags = $module->getHelpFlags();
$help['flags'] .= Html::openElement( 'div',
array( 'class' => 'apihelp-block apihelp-flags' ) );
$msg = $context->msg( 'api-help-flags' );
);
}
$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" )
);
$suboptions,
$haveModules
);
- $numSubmodules = count( $submodules );
}
$module->modifyHelp( $help, $suboptions, $haveModules );
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'