Merge "Move mediawiki.ForeignUpload configuration settings to package files"

This commit is contained in:
jenkins-bot 2021-10-13 23:18:28 +00:00 committed by Gerrit Code Review
commit 9730926907
4 changed files with 17 additions and 6 deletions

View file

@ -130,6 +130,9 @@ because of Phabricator reports.
interwiki title through by default, logging a deprecation warning.
* The `UndeleteForm::undelete` hook, deprecated in 1.37, was removed.
* The `jquery.mw-jump` ResourceLoader module was removed.
* The `wgForeignUploadTargets` and `wgEnableUploads` configuration values
were removed from mw.config, they had previously been documented as being
included for internal use by the mediawiki.ForeignUpload module.
* Several Skin methods, hard deprecated in 1.36, have been removed. These
include Skin::privacyLink(), aboutLink(), disclaimerLink(), makeUrl()
getIndicatorsHTML(), getLogo(), subPageSubtitle(), getSearchLink(),

View file

@ -1984,9 +1984,6 @@ MESSAGE;
// @internal For mediawiki.Title
'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass( Title::legalChars() ),
'wgIllegalFileChars' => Title::convertByteClassToUnicodeClass( $illegalFileChars ),
// @internal For mediawiki.ForeignUpload
'wgForeignUploadTargets' => $conf->get( 'ForeignUploadTargets' ),
'wgEnableUploads' => $conf->get( 'EnableUploads' ),
];
Hooks::runner()->onResourceLoaderGetConfigVars( $vars, $skin, $conf );

View file

@ -949,7 +949,15 @@ return [
],
],
'mediawiki.ForeignUpload' => [
'scripts' => 'resources/src/mediawiki.ForeignUpload.js',
'localBasePath' => "$IP/resources/src",
'remoteBasePath' => "$wgResourceBasePath/resources/src",
'packageFiles' => [
'mediawiki.ForeignUpload.js',
[
'name' => 'config.json',
'config' => [ 'ForeignUploadTargets', 'EnableUploads' ],
],
],
'dependencies' => [
'mediawiki.ForeignApi',
'mediawiki.Upload',

View file

@ -1,4 +1,7 @@
( function () {
var config = require( './config.json' );
/**
* Used to represent an upload in progress on the frontend.
*
@ -21,7 +24,7 @@
*/
function ForeignUpload( target, apiconfig ) {
var api,
validTargets = mw.config.get( 'wgForeignUploadTargets' ),
validTargets = config.ForeignUploadTargets,
upload = this;
if ( typeof target === 'object' ) {
@ -47,7 +50,7 @@
this.apiPromise = $.Deferred().reject( 'upload-dialog-disabled' );
} else if ( this.target === 'local' ) {
// If local uploads were requested, but they are disabled, fail.
if ( !mw.config.get( 'wgEnableUploads' ) ) {
if ( !config.EnableUploads ) {
this.apiPromise = $.Deferred().reject( 'uploaddisabledtext' );
} else {
// We'll ignore the CORS and centralauth stuff if the target is