Merge "Make it possible to disable the upload dialog functionality"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 13 Jun 2016 23:38:27 +0000 (23:38 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 13 Jun 2016 23:38:27 +0000 (23:38 +0000)
RELEASE-NOTES-1.28
includes/DefaultSettings.php
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki/mediawiki.ForeignUpload.js

index 7885f04..360f6d5 100644 (file)
@@ -13,6 +13,9 @@ production.
   is configurable via $wgSessionPbkdf2Iterations.
 * Upload dialog's file upload log comment can now be configured separately for
   local and foreign uploads.
+* $wgForeignUploadTargets now defaults to `[ 'local' ]`, where `'local'`
+  signifies local uploads. A value of `[]` (empty array) now means that
+  no upload targets are allowed, effectively disabling the upload dialog.
 
 === New features in 1.28 ===
 * User::isBot() method for checking if an account is a bot role account.
index 2607797..f176556 100644 (file)
@@ -529,11 +529,12 @@ $wgUseInstantCommons = false;
  * Array of foreign file repo names (set in $wgForeignFileRepos above) that
  * are allowable upload targets. These wikis must have some method of
  * authentication (i.e. CentralAuth), and be CORS-enabled for this wiki.
+ * The string 'local' signifies the default local file repository.
  *
  * Example:
  * $wgForeignUploadTargets = array( 'shared' );
  */
-$wgForeignUploadTargets = [];
+$wgForeignUploadTargets = [ 'local' ];
 
 /**
  * Configuration for file uploads using the embeddable upload dialog
index cc58b13..0d7d047 100644 (file)
        "upload-copy-upload-invalid-domain": "Copy uploads are not available from this domain.",
        "upload-foreign-cant-upload": "This wiki is not configured to upload files to the requested foreign file repository.",
        "upload-foreign-cant-load-config": "Loading file upload configuration for the foreign file repository failed.",
+       "upload-dialog-disabled": "File uploads using this dialog are disabled on this wiki.",
        "upload-dialog-title": "Upload file",
        "upload-dialog-button-cancel": "Cancel",
        "upload-dialog-button-done": "Done",
index dfe755e..7dbacb1 100644 (file)
        "upload-copy-upload-invalid-domain": "Error message shown if a user is trying to upload (i.e. copy) a file from a website that is not in $wgCopyUploadsDomains (if set).\n\nSee also:\n* {{msg-mw|http-invalid-url}}\n* {{msg-mw|tmp-create-error}}\n* {{msg-mw|tmp-write-error}}",
        "upload-foreign-cant-upload": "Error message shown when a user is trying to upload a file to foreign repository that is not configured to receive file uploads from current wiki.",
        "upload-foreign-cant-load-config": "Error message shown when a user is trying to upload a file to foreign repository and the foreign wiki is down or otherwise unable to respond to API requests.",
+       "upload-dialog-disabled": "Message shown when the upload dialog functionality is disabled. (This doesn't mean that uploads in general are disabled, only this specific method of uploading.)",
        "upload-dialog-title": "Title of the upload dialog box\n{{Identical|Upload file}}",
        "upload-dialog-button-cancel": "Button to cancel the dialog\n{{Identical|Cancel}}",
        "upload-dialog-button-done": "Button to close the dialog once upload is complete\n{{Identical|Done}}",
index 1e80c26..8130b26 100644 (file)
@@ -1183,6 +1183,7 @@ return [
                ],
                'messages' => [
                        'uploaddisabledtext',
+                       'upload-dialog-disabled',
                        'upload-foreign-cant-upload',
                ]
        ],
index eeeab68..781c1df 100644 (file)
@@ -43,7 +43,9 @@
                // However, if the target is a remote wiki, we must check the API
                // to confirm that the target is one that this site is configured to
                // support.
-               if ( this.target === 'local' ) {
+               if ( validTargets.length === 0 ) {
+                       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' ) ) {
                                this.apiPromise = $.Deferred().reject( 'uploaddisabledtext' );