Follow-up to r55639: per CR comment, make API help caching disableable, and let the...
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 9 Sep 2009 12:54:56 +0000 (12:54 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 9 Sep 2009 12:54:56 +0000 (12:54 +0000)
includes/DefaultSettings.php
includes/api/ApiMain.php

index eadfdc0..957a7a6 100644 (file)
@@ -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.
index d338365..779a83c 100644 (file)
@@ -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;
        }