[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/upload/ -> UploadFromUrl.php (summary)

Backend for uploading files from a HTTP resource. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 384 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

UploadFromUrl:: (17 methods):
  isAllowed()
  isEnabled()
  isAllowedHost()
  isAllowedUrl()
  initialize()
  initializeFromRequest()
  isValidRequest()
  getSourceType()
  fetchFile()
  makeTemporaryFile()
  saveTempFileChunk()
  reallyFetchFile()
  verifyUpload()
  checkWarnings()
  verifyTitlePermissions()
  performUpload()
  insertJob()


Class: UploadFromUrl  - X-Ref

Implements uploading from a HTTP resource.

isAllowed( $user )   X-Ref
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.

param: User $user
return: bool|string

isEnabled()   X-Ref
Checks if the upload from URL feature is enabled

return: bool

isAllowedHost( $url )   X-Ref
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'.

param: string $url
return: bool

isAllowedUrl( $url )   X-Ref
Checks whether the URL is not allowed.

param: string $url
return: bool

initialize( $name, $url, $async = false )   X-Ref
Entry point for API upload

param: string $name
param: string $url
param: bool|string $async Whether the download should be performed

initializeFromRequest( &$request )   X-Ref
Entry point for SpecialUpload

param: WebRequest $request

isValidRequest( $request )   X-Ref

param: WebRequest $request
return: bool

getSourceType()   X-Ref

return: string

fetchFile( $httpOptions = array()   X-Ref
Download the file (if not async)

param: array $httpOptions Array of options for MWHttpRequest. Ignored if async.
return: Status

makeTemporaryFile()   X-Ref
Create a new temporary file in the URL subdirectory of wfTempDir().

return: string Path to the file

saveTempFileChunk( $req, $buffer )   X-Ref
Callback: save a chunk of the result of a HTTP request to the temporary file

param: mixed $req
param: string $buffer
return: int Number of bytes handled

reallyFetchFile( $httpOptions = array()   X-Ref
Download the file, save it to the temporary file and update the file
size and set $mRemoveTempFile to true.

param: array $httpOptions Array of options for MWHttpRequest
return: Status

verifyUpload()   X-Ref
Wrapper around the parent function in order to defer verifying the
upload until the file really has been fetched.

return: array|mixed

checkWarnings()   X-Ref
Wrapper around the parent function in order to defer checking warnings
until the file really has been fetched.

return: array

verifyTitlePermissions( $user )   X-Ref
Wrapper around the parent function in order to defer checking protection
until we are sure that the file can actually be uploaded

param: User $user
return: bool|mixed

performUpload( $comment, $pageText, $watch, $user )   X-Ref
Wrapper around the parent function in order to defer uploading to the
job queue for asynchronous uploads

param: string $comment
param: string $pageText
param: bool $watch
param: User $user
return: Status

insertJob( $comment, $pageText, $watch, $user )   X-Ref

param: string $comment
param: string $pageText
param: bool $watch
param: User $user
return: string



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1