MaxSem has uploaded a new change for review.
https://gerrit.wikimedia.org/r/246449
Change subject: Remove support for running without API
......................................................................
Remove support for running without API
This kills support for $wgEnableAPI. The variable itself is
preserved for now both in PHP and JS, to avoid bugs in extensions/JS
that still check it. While I agree that $wgEnableWriteAPI needs to
die too, it should be done in a separate patch - especially since
it involves a user right. Documenting in 1.26 release notes because
people on bug discusiion seem to support backporting.
Bug: T115414
Change-Id: I05ff4c7d288cbc9cf79481590299c8b90d28168d
---
M RELEASE-NOTES-1.26
M api.php
M includes/DefaultSettings.php
M includes/diff/DifferenceEngine.php
M includes/page/Article.php
M includes/resourceloader/ResourceLoaderStartUpModule.php
M includes/skins/Skin.php
M opensearch_desc.php
M tests/phpunit/includes/api/ApiTestCaseUpload.php
9 files changed, 17 insertions(+), 27 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/49/246449/1
diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index 53d9188..dd42b31 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -45,6 +45,8 @@
blocked users to edit their talk pages unless explicitly disabled
when they are being blocked.
* CLDRPluralRule* classes have been replaced with
wikimedia/cldr-plural-rule-parser.
+* (T115414) $wgEnableAPI has been removed, MediaWiki now always requires API
for
+ normal functioning.
=== New features in 1.26 ===
* (T51506) Now action=info gives estimates of actual watchers for a page.
@@ -158,6 +160,9 @@
and will honor corresponding If-None-Match and If-Modified-Since on such
requests.
* (T47988) The protect log event details now use new-style formatting.
+* (T115414) $wgEnableAPI has been removed, MediaWiki now always requires API
for
+ normal functioning.
+
=== Action API internal changes in 1.26 ===
* New metadata item ApiResult::META_KVP_MERGE to allow for merging the KVP key
diff --git a/api.php b/api.php
index af7c452..89dcee2 100644
--- a/api.php
+++ b/api.php
@@ -2,9 +2,7 @@
/**
* 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
+ * 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
@@ -47,14 +45,6 @@
// URL safety checks
if ( !$wgRequest->checkUrlExtension() ) {
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
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 9eff602..49dffbb 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -7178,10 +7178,8 @@
*/
/**
- * Enable the MediaWiki API for convenient access to
- * machine-readable data via api.php
- *
- * See https://www.mediawiki.org/wiki/API
+ * @deprecated Since 1.26, does nothing.
+ * To be completely removed in a later release.
*/
$wgEnableAPI = true;
@@ -7344,7 +7342,7 @@
$wgAjaxUploadDestCheck = true;
/**
- * Enable previewing licences via AJAX. Also requires $wgEnableAPI to be true.
+ * Enable previewing licences via AJAX.
*/
$wgAjaxLicensePreview = true;
diff --git a/includes/diff/DifferenceEngine.php
b/includes/diff/DifferenceEngine.php
index 6544078..d9281ae 100644
--- a/includes/diff/DifferenceEngine.php
+++ b/includes/diff/DifferenceEngine.php
@@ -466,7 +466,7 @@
* @return string
*/
protected function markPatrolledLink() {
- global $wgUseRCPatrol, $wgEnableAPI, $wgEnableWriteAPI;
+ global $wgUseRCPatrol, $wgEnableWriteAPI;
$user = $this->getUser();
if ( $this->mMarkPatrolledLink === null ) {
@@ -500,9 +500,7 @@
// Build the link
if ( $rcid ) {
$this->getOutput()->preventClickjacking();
- if ( $wgEnableAPI && $wgEnableWriteAPI
- && $user->isAllowed( 'writeapi'
)
- ) {
+ if ( $wgEnableWriteAPI &&
$user->isAllowed( 'writeapi' ) ) {
$this->getOutput()->addModules(
'mediawiki.page.patrol.ajax' );
}
diff --git a/includes/page/Article.php b/includes/page/Article.php
index 4fdaea1..15ea211 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -1071,7 +1071,7 @@
* @return bool
*/
public function showPatrolFooter() {
- global $wgUseNPPatrol, $wgUseRCPatrol, $wgEnableAPI,
$wgEnableWriteAPI;
+ global $wgUseNPPatrol, $wgUseRCPatrol, $wgEnableWriteAPI;
$outputPage = $this->getContext()->getOutput();
$user = $this->getContext()->getUser();
@@ -1160,7 +1160,7 @@
$token = $user->getEditToken( $rcid );
$outputPage->preventClickjacking();
- if ( $wgEnableAPI && $wgEnableWriteAPI && $user->isAllowed(
'writeapi' ) ) {
+ if ( $wgEnableWriteAPI && $user->isAllowed( 'writeapi' ) ) {
$outputPage->addModules( 'mediawiki.page.patrol.ajax' );
}
diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php
b/includes/resourceloader/ResourceLoaderStartUpModule.php
index 4a672f2..3809c20 100644
--- a/includes/resourceloader/ResourceLoaderStartUpModule.php
+++ b/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -80,7 +80,7 @@
'wgContentLanguage' => $wgContLang->getCode(),
'wgTranslateNumerals' => $conf->get(
'TranslateNumerals' ),
'wgVersion' => $conf->get( 'Version' ),
- 'wgEnableAPI' => $conf->get( 'EnableAPI' ),
+ 'wgEnableAPI' => true, // @todo: b/c, remove in 1.28
'wgEnableWriteAPI' => $conf->get( 'EnableWriteAPI' ),
'wgMainPageTitle' => $mainPage->getPrefixedText(),
'wgFormattedNamespaces' =>
$wgContLang->getFormattedNamespaces(),
diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index 4e6201c..68a03ed 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -180,7 +180,7 @@
* @return array Array of modules with helper keys for easy overriding
*/
public function getDefaultModules() {
- global $wgUseAjax, $wgAjaxWatch, $wgEnableAPI,
$wgEnableWriteAPI;
+ global $wgUseAjax, $wgAjaxWatch, $wgEnableWriteAPI;
$out = $this->getOutput();
$user = $out->getUser();
@@ -200,7 +200,7 @@
);
// Add various resources if required
- if ( $wgUseAjax && $wgEnableAPI ) {
+ if ( $wgUseAjax ) {
if ( $wgEnableWriteAPI && $wgAjaxWatch &&
$user->isLoggedIn()
&& $user->isAllowedAll( 'writeapi',
'viewmywatchlist', 'editmywatchlist' )
&& $this->getRelevantTitle()->canExist()
diff --git a/opensearch_desc.php b/opensearch_desc.php
index 0d6a76c..6c00917 100644
--- a/opensearch_desc.php
+++ b/opensearch_desc.php
@@ -80,7 +80,7 @@
'template' => $searchPage->getCanonicalURL( 'search={searchTerms}' ) );
foreach ( $wgOpenSearchTemplates as $type => $template ) {
- if ( !$template && $wgEnableAPI ) {
+ if ( !$template ) {
$template = ApiOpenSearch::getOpenSearchTemplate( $type );
}
diff --git a/tests/phpunit/includes/api/ApiTestCaseUpload.php
b/tests/phpunit/includes/api/ApiTestCaseUpload.php
index 87f794c..1f70120 100644
--- a/tests/phpunit/includes/api/ApiTestCaseUpload.php
+++ b/tests/phpunit/includes/api/ApiTestCaseUpload.php
@@ -12,7 +12,6 @@
$this->setMwGlobals( array(
'wgEnableUploads' => true,
- 'wgEnableAPI' => true,
) );
wfSetupSession();
--
To view, visit https://gerrit.wikimedia.org/r/246449
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I05ff4c7d288cbc9cf79481590299c8b90d28168d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits