Expand all

mw.ForeignUpload

Upload to another MediaWiki site.

Subclassed to upload to a foreign API, with no other goodies. Use this for a generic foreign image repository on your wiki farm.

Note you can provide the target or not - if the first argument is an object, we assume you want the default, and treat it as apiconfig instead.

Extends

Constructor

new mw.ForeignUpload([target], [apiconfig]) #

Used to represent an upload in progress on the frontend.

Parameters:

Name Type Attributes Description
target string optional

Used to set up the target wiki. If not remote, this class behaves identically to mw.Upload (unless further subclassed) Use the same names as set in $wgForeignFileRepos for this. Also, make sure there is an entry in the $wgForeignUploadTargets array for this name.

apiconfig Object optional

Passed to the constructor of mw.ForeignApi or mw.Api, as needed.

Source:

Properties

target :stringstatic #

Used to specify the target repository of the upload.

If you set this to something that isn't 'local', you must be sure to add that target to $wgForeignUploadTargets in LocalSettings, and the repository must be set up to use CORS and CentralAuth.

Most wikis use "shared" to refer to Wikimedia Commons, we assume that in this class and in the messages linked to it.

Defaults to the first available foreign upload target, or to local uploads if no foreign target is configured.

Type:

Source:
Used to specify the target repository of the upload.

Methods

finishStashUpload() → {jQuery.Promise} #

Finish a stash upload.

Inherited from:
Source:

Returns:

Type
jQuery.Promise
Finish a stash upload.

getApi() → {jQuery.Promise.<mw.Api>} #

Get the mw.Api instance used by this Upload object.

Inherited from:
Source:

Returns:

Type
jQuery.Promise.<mw.Api>
Get the mw.Api instance used by this Upload object.

getBasename(path) → {string} #

Gets the base filename from a path name.

Parameters:

Name Type Description
path string
Inherited from:
Source:

Returns:

Type
string
Gets the base filename from a path name.

getComment() → {string} #

Get the current value of the edit comment for the upload.

Inherited from:
Source:

Returns:

Type
string
Get the current value of the edit comment for the upload.

getFile() → {HTMLInputElement|File|Blob} #

Get the file being uploaded.

Inherited from:
Source:

Returns:

Type
HTMLInputElement | File | Blob
Get the file being uploaded.

getFilename() → {string} #

Get the filename, to be finalized on upload.

Inherited from:
Source:

Returns:

Type
string
Get the filename, to be finalized on upload.

getImageInfo() → {Object|undefined} #

Get the imageinfo object for the finished upload. Only available once the upload is finished! Don't try to get it beforehand.

Inherited from:
Source:

Returns:

Type
Object | undefined
Get the imageinfo object for the finished upload.

getState() → {mw.Upload.State} #

Gets the state of the upload.

Inherited from:
Source:

Returns:

Type
mw.Upload.State
Gets the state of the upload.

getStateDetails() → {string} #

Gets details of the current state.

Inherited from:
Source:

Returns:

Type
string
Gets details of the current state.

getText() → {string} #

Get the text of the file page, to be created on file upload.

Inherited from:
Source:

Returns:

Type
string
Get the text of the file page, to be created on file upload.

getWatchlist() → {boolean} #

Get the boolean for whether the file will be watchlisted after upload.

Inherited from:
Source:

Returns:

Type
boolean
Get the boolean for whether the file will be watchlisted after upload.

setComment(comment) #

Set the edit comment for the upload.

Parameters:

Name Type Description
comment string
Inherited from:
Source:
Set the edit comment for the upload.

setFile(file) #

Set the file to be uploaded.

Parameters:

Name Type Description
file HTMLInputElement | File | Blob
Inherited from:
Source:
Set the file to be uploaded.

setFilekey(filekey) #

Set the stashed file to finish uploading.

Parameters:

Name Type Description
filekey string
Inherited from:
Source:
Set the stashed file to finish uploading.

setFilename(filename) #

Set the filename, to be finalized on upload.

Parameters:

Name Type Description
filename string
Inherited from:
Source:
Set the filename, to be finalized on upload.

setFilenameFromFile() #

Sets the filename based on the filename as it was on the upload.

Inherited from:
Source:
Sets the filename based on the filename as it was on the upload.

setState(state, stateDetails) #

Sets the state and state details (if any) of the upload.

Parameters:

Name Type Description
state mw.Upload.State
stateDetails Object
Inherited from:
Source:
Sets the state and state details (if any) of the upload.

setText(text) #

Set the text of the file page, to be created on file upload.

Parameters:

Name Type Description
text string
Inherited from:
Source:
Set the text of the file page, to be created on file upload.

setWatchlist(watchlist) #

Set whether the file should be watchlisted after upload.

Parameters:

Name Type Description
watchlist boolean
Inherited from:
Source:
Set whether the file should be watchlisted after upload.

upload() → {jQuery.Promise} #

Upload the file directly.

Inherited from:
Source:

Returns:

Type
jQuery.Promise
Upload the file directly.

uploadToStash() → {jQuery.Promise} #

Upload the file to the stash to be completed later.

Inherited from:
Source:

Returns:

Type
jQuery.Promise
Upload the file to the stash to be completed later.