From bf61efd874547e9cee7c0eb1fdae63e9e79d8c4e Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Thu, 22 Mar 2018 14:27:45 -0700 Subject: [PATCH 1/1] Deprecate $wgUseAjax, act as always-true Change-Id: Ia224c7ea1f902714e2c11bdebb9dadcd1ddfe43f --- RELEASE-NOTES-1.32 | 1 + includes/DefaultSettings.php | 2 ++ includes/MediaWiki.php | 2 +- includes/skins/Skin.php | 18 +++++++----------- includes/specials/forms/UploadForm.php | 6 ++---- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index d8eb2e2813..9018c11062 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -7,6 +7,7 @@ production. === Configuration changes in 1.32 === * (T115414) The $wgEnableAPI and $wgEnableWriteAPI settings, deprecated in 1.31, have been removed. +* The $wgUseAjax setting is now formally deprecated, and MediaWiki will act as if it is always set. * … === New features in 1.32 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 8ddf3101ed..f34b00aea1 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -8182,6 +8182,8 @@ $wgAPIUselessQueryPages = [ /** * Enable AJAX framework + * + * @deprecated since MediaWiki 1.32 and ignored */ $wgUseAjax = true; diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index b3abe7cfca..82ffcfb71e 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -758,7 +758,7 @@ class MediaWiki { $request = $this->context->getRequest(); // Send Ajax requests to the Ajax dispatcher. - if ( $this->config->get( 'UseAjax' ) && $request->getVal( 'action' ) === 'ajax' ) { + if ( $request->getVal( 'action' ) === 'ajax' ) { // Set a dummy title, because $wgTitle == null might break things $title = Title::makeTitle( NS_SPECIAL, 'Badtitle/performing an AJAX call in ' . __METHOD__ diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index 80a1f6eb63..f3276e87ec 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -171,8 +171,6 @@ abstract class Skin extends ContextSource { * @return array Array of modules with helper keys for easy overriding */ public function getDefaultModules() { - global $wgUseAjax; - $out = $this->getOutput(); $config = $this->getConfig(); $user = $out->getUser(); @@ -217,17 +215,15 @@ abstract class Skin extends ContextSource { } // Add various resources if required - if ( $wgUseAjax ) { - if ( $user->isLoggedIn() - && $user->isAllowedAll( 'writeapi', 'viewmywatchlist', 'editmywatchlist' ) - && $this->getRelevantTitle()->canExist() - ) { - $modules['watch'][] = 'mediawiki.page.watch.ajax'; - } - - $modules['search'][] = 'mediawiki.searchSuggest'; + if ( $user->isLoggedIn() + && $user->isAllowedAll( 'writeapi', 'viewmywatchlist', 'editmywatchlist' ) + && $this->getRelevantTitle()->canExist() + ) { + $modules['watch'][] = 'mediawiki.page.watch.ajax'; } + $modules['search'][] = 'mediawiki.searchSuggest'; + if ( $user->getBoolOption( 'editsectiononrightclick' ) ) { $modules['user'][] = 'mediawiki.action.view.rightClickEdit'; } diff --git a/includes/specials/forms/UploadForm.php b/includes/specials/forms/UploadForm.php index a316374f4b..e561fe5882 100644 --- a/includes/specials/forms/UploadForm.php +++ b/includes/specials/forms/UploadForm.php @@ -406,13 +406,11 @@ class UploadForm extends HTMLForm { protected function addUploadJS() { $config = $this->getConfig(); - $useAjaxDestCheck = $config->get( 'UseAjax' ) && $config->get( 'AjaxUploadDestCheck' ); - $useAjaxLicensePreview = $config->get( 'UseAjax' ) && $config->get( 'AjaxLicensePreview' ); $this->mMaxUploadSize['*'] = UploadBase::getMaxUploadSize(); $scriptVars = [ - 'wgAjaxUploadDestCheck' => $useAjaxDestCheck, - 'wgAjaxLicensePreview' => $useAjaxLicensePreview, + 'wgAjaxUploadDestCheck' => $config->get( 'AjaxUploadDestCheck' ), + 'wgAjaxLicensePreview' => $config->get( 'AjaxLicensePreview' ), 'wgUploadAutoFill' => !$this->mForReUpload && // If we received mDestFile from the request, don't autofill // the wpDestFile textbox -- 2.20.1