MediaWiki
1.30.0
|
Implements uploading from a HTTP resource. More...
Public Member Functions | |
fetchFile ( $httpOptions=[]) | |
Download the file. More... | |
getSourceType () | |
initialize ( $name, $url) | |
Entry point for API upload. More... | |
initializeFromRequest (&$request) | |
Entry point for SpecialUpload. More... | |
saveTempFileChunk ( $req, $buffer) | |
Callback: save a chunk of the result of a HTTP request to the temporary file. More... | |
Static Public Member Functions | |
static | isAllowed ( $user) |
Checks if the user is allowed to use the upload-by-URL feature. More... | |
static | isAllowedHost ( $url) |
Checks whether the URL is for an allowed host The domains in the whitelist can include wildcard characters (*) in place of any of the domain levels, e.g. More... | |
static | isAllowedUrl ( $url) |
Checks whether the URL is not allowed. More... | |
static | isEnabled () |
Checks if the upload from URL feature is enabled. More... | |
static | isValidRequest ( $request) |
Public Attributes | |
$mTmpHandle | |
Protected Member Functions | |
makeTemporaryFile () | |
Create a new temporary file in the URL subdirectory of wfTempDir(). More... | |
reallyFetchFile ( $httpOptions=[]) | |
Download the file, save it to the temporary file and update the file size and set $mRemoveTempFile to true. More... | |
Protected Attributes | |
$mTempPath | |
$mUrl | |
Static Protected Attributes | |
static | $allowedUrls = [] |
Implements uploading from a HTTP resource.
Definition at line 31 of file UploadFromUrl.php.
UploadFromUrl::fetchFile | ( | $httpOptions = [] | ) |
Download the file.
array | $httpOptions | Array of options for MWHttpRequest. This could be used to override the timeout on the http request. |
Definition at line 185 of file UploadFromUrl.php.
References Http\isValidURI(), StatusValue\newFatal(), and reallyFetchFile().
UploadFromUrl::getSourceType | ( | ) |
Definition at line 174 of file UploadFromUrl.php.
UploadFromUrl::initialize | ( | $name, | |
$url | |||
) |
Entry point for API upload.
string | $name | |
string | $url |
MWException |
Definition at line 134 of file UploadFromUrl.php.
References $name, and makeTemporaryFile().
Referenced by initializeFromRequest(), and ApiUpload\selectUploadModule().
UploadFromUrl::initializeFromRequest | ( | & | $request | ) |
Entry point for SpecialUpload.
WebRequest | &$request |
Definition at line 146 of file UploadFromUrl.php.
References $request, and initialize().
|
static |
Checks if the user is allowed to use the upload-by-URL feature.
If the user is not allowed, return the name of the user right as a string. If the user is allowed, have the parent do further permissions checking.
User | $user |
Definition at line 47 of file UploadFromUrl.php.
References $user.
Referenced by UploadForm\getSourceSection().
|
static |
Checks whether the URL is for an allowed host The domains in the whitelist can include wildcard characters (*) in place of any of the domain levels, e.g.
'*.flickr.com' or 'upload.*.gov.uk'.
string | $url |
Definition at line 73 of file UploadFromUrl.php.
References $wgCopyUploadsDomains, as, captcha-old\count, global, and wfParseUrl().
Referenced by ApiUpload\selectUploadModule().
|
static |
Checks whether the URL is not allowed.
string | $url |
Definition at line 117 of file UploadFromUrl.php.
References Hooks\run().
Referenced by ApiUpload\selectUploadModule().
|
static |
Checks if the upload from URL feature is enabled.
Definition at line 59 of file UploadFromUrl.php.
References $wgAllowCopyUploads, and global.
Referenced by UploadForm\getSourceSection(), and ApiUpload\selectUploadModule().
|
static |
|
protected |
Create a new temporary file in the URL subdirectory of wfTempDir().
Definition at line 204 of file UploadFromUrl.php.
References TempFSFile\factory(), and wfTempDir().
Referenced by initialize().
|
protected |
Download the file, save it to the temporary file and update the file size and set $mRemoveTempFile to true.
array | $httpOptions | Array of options for MWHttpRequest |
Definition at line 245 of file UploadFromUrl.php.
References $options, $req, $wgCopyUploadProxy, $wgCopyUploadTimeout, MWHttpRequest\factory(), global, StatusValue\newFatal(), true, and wfDebugLog().
Referenced by fetchFile().
UploadFromUrl::saveTempFileChunk | ( | $req, | |
$buffer | |||
) |
Callback: save a chunk of the result of a HTTP request to the temporary file.
mixed | $req | |
string | $buffer |
Definition at line 218 of file UploadFromUrl.php.
References $buffer, and wfDebugLog().
|
staticprotected |
Definition at line 36 of file UploadFromUrl.php.
|
protected |
Definition at line 34 of file UploadFromUrl.php.
UploadFromUrl::$mTmpHandle |
Definition at line 34 of file UploadFromUrl.php.
|
protected |
Definition at line 32 of file UploadFromUrl.php.