http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73510

Revision: 73510
Author:   tstarling
Date:     2010-09-22 08:14:19 +0000 (Wed, 22 Sep 2010)

Log Message:
-----------
Allow API modules to be disabled in configuration. To replace WMF live hack 
(see bug 25238).

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES
    trunk/phase3/includes/DefaultSettings.php
    trunk/phase3/includes/api/ApiMain.php

Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES  2010-09-22 07:42:59 UTC (rev 73509)
+++ trunk/phase3/RELEASE-NOTES  2010-09-22 08:14:19 UTC (rev 73510)
@@ -160,6 +160,7 @@
 * Added new hook GetIP
 * (bug 16574) Allow administrators to temporarily disable the account creation
   limit for IP addresses: [[MediaWiki:Ratelimit-excluded-ips]]
+* API modules can be disabled in configuration using $wgAPIDisabledActions.
 
 === Bug fixes in 1.17 ===
 * (bug 17560) Half-broken deletion moved image files to deletion archive

Modified: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php   2010-09-22 07:42:59 UTC (rev 
73509)
+++ trunk/phase3/includes/DefaultSettings.php   2010-09-22 08:14:19 UTC (rev 
73510)
@@ -4833,6 +4833,13 @@
 $wgAPIListModules = array();
 
 /**
+ * Disabled API actions. To disable an API action, add its name here, for 
+ * example:
+ *    $wgAPIDisabledActions[] = 'parse';
+ */
+$wgAPIDisabledActions = array();
+
+/**
  * Maximum amount of rows to scan in a DB query in the API
  * The default value is generally fine
  */

Modified: trunk/phase3/includes/api/ApiMain.php
===================================================================
--- trunk/phase3/includes/api/ApiMain.php       2010-09-22 07:42:59 UTC (rev 
73509)
+++ trunk/phase3/includes/api/ApiMain.php       2010-09-22 08:14:19 UTC (rev 
73510)
@@ -158,6 +158,11 @@
                global $wgAPIModules; // extension modules
                $this->mModules = $wgAPIModules + self::$Modules;
 
+               global $wgAPIDisabledActions;
+               foreach ( $wgAPIDisabledActions as $action ) {
+                       unset( $this->mModules[$action] );
+               }
+
                $this->mModuleNames = array_keys( $this->mModules );
                $this->mFormats = self::$Formats;
                $this->mFormatNames = array_keys( $this->mFormats );



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to