Deprecate $wgAjaxUploadDestCheck, act as always-true

Bug: T291375
Change-Id: Ib0aadad530373405a7f8f763bbad1db14e3222cf
This commit is contained in:
Fomafix 2021-09-20 12:00:40 +00:00
parent f253e8f4cb
commit 6c4ac7ddc5
4 changed files with 18 additions and 23 deletions

View file

@ -19,6 +19,7 @@ Some specific notes for MediaWiki 1.38 upgrades are below:
For notes on 1.36.x and older releases, see HISTORY.
=== Configuration changes for system administrators in 1.38 ===
* Deprecate $wgAjaxUploadDestCheck, act as always-true
* …
==== New configuration ====

View file

@ -9413,6 +9413,8 @@ $wgAjaxExportList = [];
/**
* Enable AJAX check for file overwrite, pre-upload
*
* @deprecated since MediaWiki 1.38 and ignored
*/
$wgAjaxUploadDestCheck = true;

View file

@ -449,7 +449,6 @@ class UploadForm extends HTMLForm {
$this->mMaxUploadSize['*'] = UploadBase::getMaxUploadSize();
$scriptVars = [
'wgAjaxUploadDestCheck' => $config->get( 'AjaxUploadDestCheck' ),
'wgAjaxLicensePreview' => $config->get( 'AjaxLicensePreview' ),
'wgUploadAutoFill' => !$this->mForReUpload &&
// If we received mDestFile from the request, don't autofill

View file

@ -10,7 +10,6 @@
( function () {
var uploadWarning, uploadTemplatePreview,
ajaxUploadDestCheck = mw.config.get( 'wgAjaxUploadDestCheck' ),
NS_FILE = mw.config.get( 'wgNamespaceIds' ).file,
$license = $( '#wpLicense' );
@ -22,9 +21,6 @@
timeoutID: false,
checkNow: function ( fname ) {
if ( !ajaxUploadDestCheck ) {
return;
}
if ( this.timeoutID ) {
clearTimeout( this.timeoutID );
}
@ -34,7 +30,7 @@
timeout: function () {
var $spinnerDestCheck, title;
if ( !ajaxUploadDestCheck || this.nameToCheck.trim() === '' ) {
if ( this.nameToCheck.trim() === '' ) {
return;
}
$spinnerDestCheck = $.createSpinner().insertAfter( '#wpDestFile' );
@ -132,23 +128,20 @@
};
$( function () {
// AJAX wpDestFile warnings
if ( ajaxUploadDestCheck ) {
// Insert an event handler that fetches upload warnings when wpDestFile
// has been changed
$( '#wpDestFile' ).on( 'change', function () {
uploadWarning.checkNow( $( this ).val() );
} );
// Insert a row where the warnings will be displayed just below the
// wpDestFile row
$( '#mw-htmlform-description tbody' ).append(
$( '<tr>' ).append(
$( '<td>' )
.attr( 'id', 'wpDestFile-warning' )
.attr( 'colspan', 2 )
)
);
}
// Insert an event handler that fetches upload warnings when wpDestFile
// has been changed
$( '#wpDestFile' ).on( 'change', function () {
uploadWarning.checkNow( $( this ).val() );
} );
// Insert a row where the warnings will be displayed just below the
// wpDestFile row
$( '#mw-htmlform-description tbody' ).append(
$( '<tr>' ).append(
$( '<td>' )
.attr( 'id', 'wpDestFile-warning' )
.attr( 'colspan', 2 )
)
);
if ( mw.config.get( 'wgAjaxLicensePreview' ) && $license.length ) {
// License selector check