From 29c594f9a465af9fe99a1cee8854cd97a118e728 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 9 Sep 2009 12:54:56 +0000 Subject: [PATCH] Follow-up to r55639: per CR comment, make API help caching disableable, and let the cache key depend on the version string --- includes/DefaultSettings.php | 6 ++++++ includes/api/ApiMain.php | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index eadfdc0468..957a7a6853 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3845,6 +3845,12 @@ $wgAPIMaxUncachedDiffs = 1; */ $wgAPIRequestLog = false; +/** + * Cache the API help text for up to an hour. Disable this during API + * debugging and development + */ +$wgAPICacheHelp = true; + /** * Parser test suite files to be run by parserTests.php when no specific * filename is passed to it. diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index d338365477..779a83cbf1 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -555,15 +555,19 @@ class ApiMain extends ApiBase { * Override the parent to generate help messages for all available modules. */ public function makeHelpMsg() { - global $wgMemc; + global $wgMemc, $wgAPICacheHelp; $this->mPrinter->setHelp(); // Get help text from cache if present - $key = wfMemcKey( 'apihelp', $this->getModuleName() ); - $cached = $wgMemc->get( $key ); - if ( $cached ) - return $cached; + $key = wfMemcKey( 'apihelp', $this->getModuleName(), + SpecialVersion::getVersion( 'nodb' ) ); + if ( $wgAPICacheHelp ) { + $cached = $wgMemc->get( $key ); + if ( $cached ) + return $cached; + } $retval = $this->reallyMakeHelpMsg(); - $wgMemc->set( $key, $retval, 60*60 ); + if ( $wgAPICacheHelp ) + $wgMemc->set( $key, $retval, 60*60 ); return $retval; } -- 2.20.1