MediaWiki
1.34.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 (UserIdentity $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 34 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 192 of file UploadFromUrl.php.
References Http\isValidURI(), StatusValue\newFatal(), and reallyFetchFile().
UploadFromUrl::getSourceType | ( | ) |
Definition at line 181 of file UploadFromUrl.php.
UploadFromUrl::initialize | ( | $name, | |
$url | |||
) |
Entry point for API upload.
string | $name | |
string | $url |
MWException |
Definition at line 140 of file UploadFromUrl.php.
References makeTemporaryFile().
Referenced by initializeFromRequest(), and ApiUpload\selectUploadModule().
UploadFromUrl::initializeFromRequest | ( | & | $request | ) |
Entry point for SpecialUpload.
WebRequest | &$request |
Definition at line 152 of file UploadFromUrl.php.
References 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.
UserIdentity | $user |
Definition at line 50 of file UploadFromUrl.php.
References getPermissionManager().
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 79 of file UploadFromUrl.php.
References $wgCopyUploadsDomains, and wfParseUrl().
Referenced by ApiUpload\selectUploadModule().
|
static |
Checks whether the URL is not allowed.
string | $url |
Definition at line 123 of file UploadFromUrl.php.
References Hooks\run().
Referenced by ApiUpload\selectUploadModule().
|
static |
Checks if the upload from URL feature is enabled.
Definition at line 65 of file UploadFromUrl.php.
References $wgAllowCopyUploads.
Referenced by UploadForm\getSourceSection(), and ApiUpload\selectUploadModule().
|
static |
|
protected |
Create a new temporary file in the URL subdirectory of wfTempDir().
Definition at line 211 of file UploadFromUrl.php.
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 253 of file UploadFromUrl.php.
References $status, $wgCopyUploadProxy, $wgCopyUploadTimeout, MWHttpRequest\factory(), 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 226 of file UploadFromUrl.php.
References wfDebugLog().
|
staticprotected |
Definition at line 39 of file UploadFromUrl.php.
|
protected |
Definition at line 37 of file UploadFromUrl.php.
UploadFromUrl::$mTmpHandle |
Definition at line 37 of file UploadFromUrl.php.
|
protected |
Definition at line 35 of file UploadFromUrl.php.