PleaseStand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/63259


Change subject: Remove $wgEnableAPI, $wgEnableWriteAPI, etc.
......................................................................

Remove $wgEnableAPI, $wgEnableWriteAPI, etc.

The API isn't just an experiment any more, and many scripts just
assume it is available. So remove the settings because running
without the API is no longer a supported configuration.

Change-Id: I983bfc247f6fd424cba5f52329513d9308218658
---
M RELEASE-NOTES-1.22
M api.php
M includes/DefaultSettings.php
M includes/OutputPage.php
M includes/Preferences.php
M includes/Setup.php
M includes/User.php
M includes/api/ApiBase.php
M includes/api/ApiMain.php
M includes/api/ApiParamInfo.php
M includes/api/ApiQuerySiteinfo.php
M includes/resourceloader/ResourceLoaderStartUpModule.php
M includes/specials/SpecialUpload.php
M languages/messages/MessagesEn.php
M maintenance/fuzz-tester.php
M maintenance/language/messages.inc
M opensearch_desc.php
M tests/phpunit/includes/api/ApiTestCase.php
M tests/phpunit/includes/api/ApiTestCaseUpload.php
M tests/phpunit/includes/upload/UploadFromUrlTest.php
20 files changed, 64 insertions(+), 128 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/59/63259/1

diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 07afffe..44cc69f 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -15,6 +15,8 @@
   activated; when $wgUseVFormCreateAccount is true, the redesign of
   Special:UserLogin/signup is activated.
 * $wgVectorUseIconWatch is now enabled by default.
+* Removed $wgEnableAPI, $wgEnableWriteAPI, and the 'writeapi' user right;
+  the MediaWiki API is now unconditionally enabled.
 
 === New features in 1.22 ===
 * (bug 44525) mediawiki.jqueryMsg can now parse (whitelisted) HTML elements 
and attributes.
diff --git a/api.php b/api.php
index 9d7f648..ccc5b6e 100644
--- a/api.php
+++ b/api.php
@@ -2,13 +2,10 @@
 /**
  * This file is the entry point for all API queries.
  *
- * It begins by checking whether the API is enabled on this wiki; if not,
- * it informs the user that s/he should set $wgEnableAPI to true and exits.
- * Otherwise, it constructs a new ApiMain using the parameter passed to it
- * as an argument in the URL ('?action=') and with write-enabled set to the
- * value of $wgEnableWriteAPI as specified in LocalSettings.php.
- * It then invokes "execute()" on the ApiMain object instance, which
- * produces output in the format specified in the URL.
+ * It constructs a new ApiMain using the parameter passed to it as an
+ * argument in the URL ('?action=') and then invokes "execute()" on the
+ * ApiMain object instance, which produces output in the format specified
+ * in the URL.
  *
  * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
@@ -51,14 +48,6 @@
        return;
 }
 
-// Verify that the API has not been disabled
-if ( !$wgEnableAPI ) {
-       header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration 
Error', true, 500 );
-       echo 'MediaWiki API is not enabled for this site. Add the following 
line to your LocalSettings.php'
-               . '<pre><b>$wgEnableAPI=true;</b></pre>';
-       die( 1 );
-}
-
 // Set a dummy $wgTitle, because $wgTitle == null breaks various things
 // In a perfect world this wouldn't be necessary
 $wgTitle = Title::makeTitle( NS_MAIN, 'API' );
@@ -67,7 +56,7 @@
  * is some form of an ApiMain, possibly even one that produces an error 
message,
  * but we don't care here, as that is handled by the ctor.
  */
-$processor = new ApiMain( RequestContext::getMain(), $wgEnableWriteAPI );
+$processor = new ApiMain( RequestContext::getMain() );
 
 // Process data & print results
 $processor->execute();
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 5330caf..b5a47d3 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -3882,7 +3882,6 @@
 $wgGroupPermissions['*']['edit'] = true;
 $wgGroupPermissions['*']['createpage'] = true;
 $wgGroupPermissions['*']['createtalk'] = true;
-$wgGroupPermissions['*']['writeapi'] = true;
 #$wgGroupPermissions['*']['patrolmarks'] = false; // let anons see what was 
patrolled
 
 // Implicit group for all logged-in accounts
@@ -3894,7 +3893,6 @@
 $wgGroupPermissions['user']['edit'] = true;
 $wgGroupPermissions['user']['createpage'] = true;
 $wgGroupPermissions['user']['createtalk'] = true;
-$wgGroupPermissions['user']['writeapi'] = true;
 $wgGroupPermissions['user']['upload'] = true;
 $wgGroupPermissions['user']['reupload'] = true;
 $wgGroupPermissions['user']['reupload-shared'] = true;
@@ -3913,7 +3911,6 @@
 $wgGroupPermissions['bot']['autopatrol'] = true;
 $wgGroupPermissions['bot']['suppressredirect'] = true;
 $wgGroupPermissions['bot']['apihighlimits'] = true;
-$wgGroupPermissions['bot']['writeapi'] = true;
 #$wgGroupPermissions['bot']['editprotected'] = true; // can edit all protected 
pages without cascade protection enabled
 
 // Most extra permission abilities go to this group
@@ -5924,21 +5921,6 @@
  */
 
 /**
- * Enable the MediaWiki API for convenient access to
- * machine-readable data via api.php
- *
- * See http://www.mediawiki.org/wiki/API
- */
-$wgEnableAPI = true;
-
-/**
- * Allow the API to be used to perform write operations
- * (page edits, rollback, etc.) when an authorised user
- * accesses it
- */
-$wgEnableWriteAPI = true;
-
-/**
  *
  *     WARNING: SECURITY THREAT - debug use only
  *
@@ -6023,7 +6005,7 @@
 $wgAjaxUploadDestCheck = true;
 
 /**
- * Enable previewing licences via AJAX. Also requires $wgEnableAPI to be true.
+ * Enable previewing licenses via AJAX.
  */
 $wgAjaxLicensePreview = true;
 
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 746cd0e..4912e7b 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -3133,7 +3133,7 @@
         * @return array in format "link name or number => 'link html'".
         */
        public function getHeadLinksArray( $addContentType = false ) {
-               global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, 
$wgEnableAPI,
+               global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon,
                        $wgSitename, $wgVersion, $wgHtml5, $wgMimeType,
                        $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
                        $wgDisableLangConversion, $wgCanonicalLanguageLinks,
@@ -3255,19 +3255,17 @@
                        'title' => $this->msg( 'opensearch-desc' 
)->inContentLanguage()->text(),
                ) );
 
-               if ( $wgEnableAPI ) {
-                       # Real Simple Discovery link, provides auto-discovery 
information
-                       # for the MediaWiki API (and potentially additional 
custom API
-                       # support such as WordPress or Twitter-compatible APIs 
for a
-                       # blogging extension, etc)
-                       $tags['rsd'] = Html::element( 'link', array(
-                               'rel' => 'EditURI',
-                               'type' => 'application/rsd+xml',
-                               // Output a protocol-relative URL here if 
$wgServer is protocol-relative
-                               // Whether RSD accepts relative or 
protocol-relative URLs is completely undocumented, though
-                               'href' => wfExpandUrl( wfAppendQuery( wfScript( 
'api' ), array( 'action' => 'rsd' ) ), PROTO_RELATIVE ),
-                       ) );
-               }
+               # Real Simple Discovery link, provides auto-discovery 
information
+               # for the MediaWiki API (and potentially additional custom API
+               # support such as WordPress or Twitter-compatible APIs for a
+               # blogging extension, etc)
+               $tags['rsd'] = Html::element( 'link', array(
+                       'rel' => 'EditURI',
+                       'type' => 'application/rsd+xml',
+                       // Output a protocol-relative URL here if $wgServer is 
protocol-relative
+                       // Whether RSD accepts relative or protocol-relative 
URLs is completely undocumented, though
+                       'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' 
), array( 'action' => 'rsd' ) ), PROTO_RELATIVE ),
+               ) );
 
                # Language variants
                if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
diff --git a/includes/Preferences.php b/includes/Preferences.php
index 0d765fa..c7ca948 100644
--- a/includes/Preferences.php
+++ b/includes/Preferences.php
@@ -877,7 +877,7 @@
         * @param $defaultPreferences
         */
        static function watchlistPreferences( $user, IContextSource $context, 
&$defaultPreferences ) {
-               global $wgUseRCPatrol, $wgEnableAPI, $wgRCMaxAge;
+               global $wgUseRCPatrol, $wgRCMaxAge;
 
                $watchlistdaysMax = ceil( $wgRCMaxAge / ( 3600 * 24 ) );
 
@@ -938,18 +938,16 @@
                        );
                }
 
-               if ( $wgEnableAPI ) {
-                       # Some random gibberish as a proposed default
-                       // @todo Fixme: this should use CryptRand but we may 
not want to read urandom on every view
-                       $hash = sha1( mt_rand() . microtime( true ) );
+               # Some random gibberish as a proposed default
+               // @todo Fixme: this should use CryptRand but we may not want 
to read urandom on every view
+               $hash = sha1( mt_rand() . microtime( true ) );
 
-                       $defaultPreferences['watchlisttoken'] = array(
-                               'type' => 'text',
-                               'section' => 'watchlist/advancedwatchlist',
-                               'label-message' => 'prefs-watchlist-token',
-                               'help' => $context->msg( 
'prefs-help-watchlist-token', $hash )->escaped()
-                       );
-               }
+               $defaultPreferences['watchlisttoken'] = array(
+                       'type' => 'text',
+                       'section' => 'watchlist/advancedwatchlist',
+                       'label-message' => 'prefs-watchlist-token',
+                       'help' => $context->msg( 'prefs-help-watchlist-token', 
$hash )->escaped()
+               );
 
                $watchTypes = array(
                        'edit' => 'watchdefault',
diff --git a/includes/Setup.php b/includes/Setup.php
index 565ca49..3a85d83 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -144,6 +144,12 @@
 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
 
 /**
+ * The MediaWiki API is always enabled as of 1.22.
+ * These variables are set for extension compatibility and are deprecated.
+ */
+$wgEnableAPI = $wgEnableWriteAPI = true;
+
+/**
  * Initialise $wgLockManagers to include basic FS version
  */
 $wgLockManagers[] = array(
diff --git a/includes/User.php b/includes/User.php
index d114b99..6ee4c0d 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -164,7 +164,6 @@
                'upload_by_url',
                'userrights',
                'userrights-interwiki',
-               'writeapi',
        );
        /**
         * String Cached results of getAllRights()
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index c500370..981a681 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -286,14 +286,10 @@
                        if ( $this->isReadMode() ) {
                                $msg .= "\nThis module requires read rights";
                        }
-                       if ( $this->isWriteMode() ) {
-                               $msg .= "\nThis module requires write rights";
-                       }
                        if ( $this->mustBePosted() ) {
                                $msg .= "\nThis module only accepts POST 
requests";
                        }
-                       if ( $this->isReadMode() || $this->isWriteMode() ||
-                                       $this->mustBePosted() ) {
+                       if ( $this->isReadMode() || $this->mustBePosted() ) {
                                $msg .= "\n";
                        }
 
@@ -1296,8 +1292,6 @@
 
                // API-specific messages
                'readrequired' => array( 'code' => 'readapidenied', 'info' => 
"You need read permission to use this module" ),
-               'writedisabled' => array( 'code' => 'noapiwrite', 'info' => 
"Editing of this wiki through the API is disabled. Make sure the 
\$wgEnableWriteAPI=true; statement is included in the wiki's LocalSettings.php 
file" ),
-               'writerequired' => array( 'code' => 'writeapidenied', 'info' => 
"You're not allowed to edit this wiki through the API" ),
                'missingparam' => array( 'code' => 'no$1', 'info' => "The \$1 
parameter must be set" ),
                'invalidtitle' => array( 'code' => 'invalidtitle', 'info' => 
"Bad title \"\$1\"" ),
                'nosuchpageid' => array( 'code' => 'nosuchpageid', 'info' => 
"There is no page with ID \$1" ),
@@ -1488,7 +1482,8 @@
                return true;
        }
        /**
-        * Indicates whether this module requires write mode
+        * Indicates whether this module writes to the database; whether to
+        * ensure the wiki is not in read-only mode prior to execution.
         * @return bool
         */
        public function isWriteMode() {
@@ -1590,11 +1585,6 @@
 
                if ( $this->isReadMode() ) {
                        $ret[] = array( 'readrequired' );
-               }
-
-               if ( $this->isWriteMode() ) {
-                       $ret[] = array( 'writerequired' );
-                       $ret[] = array( 'writedisabled' );
                }
 
                if ( $this->needsToken() ) {
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index 5ddb3ab..75c82e4 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -117,14 +117,10 @@
         *                          );
         */
        private static $mRights = array(
-               'writeapi' => array(
-                       'msg' => 'Use of the write API',
-                       'params' => array()
-               ),
                'apihighlimits' => array(
                        'msg' => 'Use higher limits in API queries (Slow 
queries: $1 results; Fast queries: $2 results). The limits for slow queries 
also apply to multivalue parameters.',
                        'params' => array( ApiBase::LIMIT_SML2, 
ApiBase::LIMIT_BIG2 )
-               )
+               ),
        );
 
        /**
@@ -134,7 +130,6 @@
 
        private $mModuleMgr, $mResult;
        private $mAction;
-       private $mEnableWrite;
        private $mInternalMode, $mSquidMaxage, $mModule;
 
        private $mCacheMode = 'private';
@@ -145,9 +140,8 @@
         * Constructs an instance of ApiMain that utilizes the module and 
format specified by $request.
         *
         * @param $context IContextSource|WebRequest - if this is an instance 
of FauxRequest, errors are thrown and no printing occurs
-        * @param bool $enableWrite should be set to true if the api may modify 
data
         */
-       public function __construct( $context = null, $enableWrite = false ) {
+       public function __construct( $context = null ) {
                if ( $context === null ) {
                        $context = RequestContext::getMain();
                } elseif ( $context instanceof WebRequest ) {
@@ -189,7 +183,6 @@
                $this->mModuleMgr->addModules( self::$Formats, 'format' );
 
                $this->mResult = new ApiResult( $this );
-               $this->mEnableWrite = $enableWrite;
 
                $this->mSquidMaxage = - 1; // flag for 
executeActionWithErrorHandling()
                $this->mCommit = false;
@@ -774,16 +767,8 @@
                {
                        $this->dieUsageMsg( 'readrequired' );
                }
-               if ( $module->isWriteMode() ) {
-                       if ( !$this->mEnableWrite ) {
-                               $this->dieUsageMsg( 'writedisabled' );
-                       }
-                       if ( !$user->isAllowed( 'writeapi' ) ) {
-                               $this->dieUsageMsg( 'writerequired' );
-                       }
-                       if ( wfReadOnly() ) {
-                               $this->dieReadOnly();
-                       }
+               if ( $module->isWriteMode() && wfReadOnly() ) {
+                       $this->dieReadOnly();
                }
 
                // Allow extensions to stop execution for arbitrary reasons.
diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php
index 3e1a753..d739231 100644
--- a/includes/api/ApiParamInfo.php
+++ b/includes/api/ApiParamInfo.php
@@ -116,6 +116,8 @@
                        $retval['readrights'] = '';
                }
                if ( $obj->isWriteMode() ) {
+                       // The property is called 'writerights' because these 
modules used to
+                       // require a 'writeapi' right to be executed (until 
1.22).
                        $retval['writerights'] = '';
                }
                if ( $obj->mustBePosted() ) {
diff --git a/includes/api/ApiQuerySiteinfo.php 
b/includes/api/ApiQuerySiteinfo.php
index 37b22f1..d3bdab0 100644
--- a/includes/api/ApiQuerySiteinfo.php
+++ b/includes/api/ApiQuerySiteinfo.php
@@ -194,9 +194,7 @@
                        $data['readonly'] = '';
                        $data['readonlyreason'] = wfReadOnlyReason();
                }
-               if ( $GLOBALS['wgEnableWriteAPI'] ) {
-                       $data['writeapi'] = '';
-               }
+               $data['writeapi'] = '';
 
                $tz = $GLOBALS['wgLocaltimezone'];
                $offset = $GLOBALS['wgLocalTZoffset'];
diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php 
b/includes/resourceloader/ResourceLoaderStartUpModule.php
index 861ff18..7c4b1b9 100644
--- a/includes/resourceloader/ResourceLoaderStartUpModule.php
+++ b/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -36,11 +36,9 @@
         * @return array
         */
        protected function getConfig( $context ) {
-               global $wgLoadScript, $wgScript, $wgStylePath, 
$wgScriptExtension,
-                       $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang,
-                       $wgVariantArticlePath, $wgActionPaths, $wgVersion,
-                       $wgEnableAPI, $wgEnableWriteAPI, $wgDBname,
-                       $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath,
+               global $wgLoadScript, $wgScript, $wgStylePath, 
$wgScriptExtension, $wgArticlePath,
+                       $wgScriptPath, $wgServer, $wgContLang, 
$wgVariantArticlePath, $wgActionPaths,
+                       $wgVersion, $wgDBname, $wgSitename, $wgFileExtensions, 
$wgExtensionAssetsPath,
                        $wgCookiePrefix, $wgResourceLoaderMaxQueryLength;
 
                $mainPage = Title::newMainPage();
@@ -78,8 +76,10 @@
                        'wgUserLanguage' => $context->getLanguage(),
                        'wgContentLanguage' => $wgContLang->getCode(),
                        'wgVersion' => $wgVersion,
-                       'wgEnableAPI' => $wgEnableAPI,
-                       'wgEnableWriteAPI' => $wgEnableWriteAPI,
+                       // The MediaWiki API is always enabled as of 1.22.
+                       // Use of the below two variables in scripts is 
deprecated.
+                       'wgEnableAPI' => true,
+                       'wgEnableWriteAPI' => true,
                        'wgMainPageTitle' => $mainPage->getPrefixedText(),
                        'wgFormattedNamespaces' => 
$wgContLang->getFormattedNamespaces(),
                        'wgNamespaceIds' => $namespaceIds,
diff --git a/includes/specials/SpecialUpload.php 
b/includes/specials/SpecialUpload.php
index ee737c6..421d3fa 100644
--- a/includes/specials/SpecialUpload.php
+++ b/includes/specials/SpecialUpload.php
@@ -1068,10 +1068,10 @@
         * Add upload JS to the OutputPage
         */
        protected function addUploadJS() {
-               global $wgUseAjax, $wgAjaxUploadDestCheck, 
$wgAjaxLicensePreview, $wgEnableAPI, $wgStrictFileExtensions;
+               global $wgUseAjax, $wgAjaxUploadDestCheck, 
$wgAjaxLicensePreview, $wgStrictFileExtensions;
 
                $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck;
-               $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview && 
$wgEnableAPI;
+               $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview;
                $this->mMaxUploadSize['*'] = UploadBase::getMaxUploadSize();
 
                $scriptVars = array(
diff --git a/languages/messages/MessagesEn.php 
b/languages/messages/MessagesEn.php
index 2bc5b6a..5233e6e 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -2055,7 +2055,6 @@
 'right-bot'                   => 'Be treated as an automated process',
 'right-nominornewtalk'        => 'Not have minor edits to discussion pages 
trigger the new messages prompt',
 'right-apihighlimits'         => 'Use higher limits in API queries',
-'right-writeapi'              => 'Use of the write API',
 'right-delete'                => 'Delete pages',
 'right-bigdelete'             => 'Delete pages with large histories',
 'right-deletelogentry'        => 'Delete and undelete specific log entries',
@@ -2118,7 +2117,6 @@
 'action-reupload'             => 'overwrite this existing file',
 'action-reupload-shared'      => 'override this file on a shared repository',
 'action-upload_by_url'        => 'upload this file from a URL',
-'action-writeapi'             => 'use the write API',
 'action-delete'               => 'delete this page',
 'action-deleterevision'       => 'delete this revision',
 'action-deletedhistory'       => "view this page's deleted history",
diff --git a/maintenance/fuzz-tester.php b/maintenance/fuzz-tester.php
index b3d8174..4d44c34 100644
--- a/maintenance/fuzz-tester.php
+++ b/maintenance/fuzz-tester.php
@@ -123,8 +123,6 @@
   $wgDBerrorLog = "/root/mediawiki-db-error-log.txt";  // log DB errors, 
replace with suitable path.
   $wgShowSQLErrors = true;    // Show SQL errors (instead of saying the query 
was hidden).
   $wgShowExceptionDetails = true;  // want backtraces.
-  $wgEnableAPI = true;        // enable API.
-  $wgEnableWriteAPI = true;   // enable API.
 
   // Install & enable Parser Hook extensions to increase code coverage. E.g.:
   require_once("extensions/ParserFunctions/ParserFunctions.php");
diff --git a/maintenance/language/messages.inc 
b/maintenance/language/messages.inc
index 7b4e1d9..288cebf 100644
--- a/maintenance/language/messages.inc
+++ b/maintenance/language/messages.inc
@@ -1183,7 +1183,6 @@
                'right-bot',
                'right-nominornewtalk',
                'right-apihighlimits',
-               'right-writeapi',
                'right-delete',
                'right-bigdelete',
                'right-deletelogentry',
@@ -1246,7 +1245,6 @@
                'action-reupload',
                'action-reupload-shared',
                'action-upload_by_url',
-               'action-writeapi',
                'action-delete',
                'action-deleterevision',
                'action-deletedhistory',
diff --git a/opensearch_desc.php b/opensearch_desc.php
index cb8b1be..7b3a916 100644
--- a/opensearch_desc.php
+++ b/opensearch_desc.php
@@ -78,14 +78,12 @@
        'method' => 'get',
        'template' => $searchPage->getCanonicalURL( 'search={searchTerms}' ) );
 
-if ( $wgEnableAPI ) {
-       // JSON interface for search suggestions.
-       // Supported in Firefox 2 and later.
-       $urls[] = array(
-               'type' => 'application/x-suggestions+json',
-               'method' => 'get',
-               'template' => SearchEngine::getOpenSearchTemplate() );
-}
+// JSON interface for search suggestions.
+// Supported in Firefox 2 and later.
+$urls[] = array(
+       'type' => 'application/x-suggestions+json',
+       'method' => 'get',
+       'template' => SearchEngine::getOpenSearchTemplate() );
 
 // Allow hooks to override the suggestion URL settings in a more
 // general way than overriding the whole search engine...
diff --git a/tests/phpunit/includes/api/ApiTestCase.php 
b/tests/phpunit/includes/api/ApiTestCase.php
index 1559bef..94d00f3 100644
--- a/tests/phpunit/includes/api/ApiTestCase.php
+++ b/tests/phpunit/includes/api/ApiTestCase.php
@@ -91,7 +91,7 @@
                // set up local environment
                $context = $this->apiContext->newTestContext( $wgRequest, 
$wgUser );
 
-               $module = new ApiMain( $context, true );
+               $module = new ApiMain( $context );
 
                // run it!
                $module->execute();
diff --git a/tests/phpunit/includes/api/ApiTestCaseUpload.php 
b/tests/phpunit/includes/api/ApiTestCaseUpload.php
index 7e18b6e..b1df52c 100644
--- a/tests/phpunit/includes/api/ApiTestCaseUpload.php
+++ b/tests/phpunit/includes/api/ApiTestCaseUpload.php
@@ -11,13 +11,8 @@
        protected function setUp() {
                parent::setUp();
 
-               $this->setMwGlobals( array(
-                       'wgEnableUploads' => true,
-                       'wgEnableAPI' => true,
-               ) );
-
+               $this->setMwGlobals( 'wgEnableUploads', true );
                wfSetupSession();
-
                $this->clearFakeUploads();
        }
 
diff --git a/tests/phpunit/includes/upload/UploadFromUrlTest.php 
b/tests/phpunit/includes/upload/UploadFromUrlTest.php
index a75fba6..f7f966c 100644
--- a/tests/phpunit/includes/upload/UploadFromUrlTest.php
+++ b/tests/phpunit/includes/upload/UploadFromUrlTest.php
@@ -26,7 +26,7 @@
                session_write_close();
 
                $req = new FauxRequest( $params, true, $_SESSION );
-               $module = new ApiMain( $req, true );
+               $module = new ApiMain( $req );
                $module->execute();
 
                wfSetupSession( $sessionId );

-- 
To view, visit https://gerrit.wikimedia.org/r/63259
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I983bfc247f6fd424cba5f52329513d9308218658
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>

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

Reply via email to