MediaWiki fundraising/REL1_35
|
UploadBase and subclasses are the backend of MediaWiki's file uploads. More...
Public Member Functions | |
__construct () | |
Stable to call. | |
checkSvgScriptCallback ( $element, $attribs, $data=null) | |
checkWarnings ( $user=null) | |
Check for non fatal problems with the file. | |
cleanupTempFile () | |
If we've modified the upload file we need to manually remove it on exit to clean up. | |
convertVerifyErrorToStatus ( $error) | |
fetchFile () | |
Fetch the file. | |
getFileSize () | |
Return the file size. | |
getImageInfo ( $result) | |
Gets image info about the file just uploaded. | |
getLocalFile () | |
Return the local file and initializes if necessary. | |
getRealPath ( $srcPath) | |
getSourceType () | |
Returns the upload type. | |
getStashFile () | |
getTempFileSha1Base36 () | |
Get the base 36 SHA1 of the file Stable to override. | |
getTempPath () | |
getTitle () | |
Returns the title of the file to be uploaded. | |
getVerificationErrorCode ( $error) | |
initializeFromRequest (&$request) | |
Initialize from a WebRequest. | |
initializePathInfo ( $name, $tempPath, $fileSize, $removeTempFile=false) | |
isEmptyFile () | |
Return true if the file is empty. | |
performUpload ( $comment, $pageText, $watch, $user, $tags=[], ?string $watchlistExpiry=null) | |
Really perform the upload. | |
postProcessUpload () | |
Perform extra steps after a successful upload. | |
stashFile (User $user=null) | |
If the user does not supply all necessary information in the first upload form submission (either by accident or by design) then we may want to stash the file temporarily, get more information, and publish the file later. | |
tryStashFile (User $user, $isPartial=false) | |
Like stashFile(), but respects extensions' wishes to prevent the stashing. | |
validateName () | |
Verify that the name is valid and, if necessary, that we can overwrite. | |
verifyPermissions ( $user) | |
Alias for verifyTitlePermissions. | |
verifyTitlePermissions ( $user) | |
Check whether the user can edit, upload and create the image. | |
verifyUpload () | |
Verify whether the upload is sane. | |
zipEntryCallback ( $entry) | |
Callback for ZipDirectoryReader to detect Java class files. | |
Static Public Member Functions | |
static | checkFileExtension ( $ext, $list) |
Perform case-insensitive match against a list of file extensions. | |
static | checkFileExtensionList ( $ext, $list) |
Perform case-insensitive match against a list of file extensions. | |
static | checkSvgExternalDTD ( $type, $publicId, $systemId) |
Verify that DTD urls referenced are only the standard dtds. | |
static | checkSvgPICallback ( $target, $data) |
Callback to filter SVG Processing Instructions. | |
static | checkXMLEncodingMissmatch ( $file) |
Check a whitelist of xml encodings that are known not to be interpreted differently by the server's xml parser (expat) and some common browsers. | |
static | createFromRequest (&$request, $type=null) |
Create a form of UploadBase depending on wpSourceType and initializes it. | |
static | detectScript ( $file, $mime, $extension) |
Heuristic for detecting files that could contain JavaScript instructions or things that may look like HTML to a browser and are thus potentially harmful. | |
static | detectVirus ( $file) |
Generic wrapper function for a virus scanner program. | |
static | getExistsWarning ( $file) |
Helper function that does various existence checks for a file. | |
static | getFilenamePrefixBlacklist () |
Get a list of blacklisted filename prefixes from [[MediaWiki:Filename-prefix-blacklist]]. | |
static | getMaxPhpUploadSize () |
Get the PHP maximum uploaded file size, based on ini settings. | |
static | getMaxUploadSize ( $forType=null) |
Get MediaWiki's maximum uploaded file size for given type of upload, based on $wgMaxUploadSize. | |
static | getSessionStatus (User $user, $statusKey) |
Get the current status of a chunked upload (used for polling) | |
static | isAllowed (UserIdentity $user) |
Returns true if the user can use this upload module or else a string identifying the missing permission. | |
static | isEnabled () |
Returns true if uploads are enabled. | |
static | isThrottled ( $user) |
Returns true if the user has surpassed the upload rate limit, false otherwise. | |
static | isThumbName ( $filename) |
Helper function that checks whether the filename looks like a thumbnail. | |
static | isValidRequest ( $request) |
Check whether a request if valid for this handler. | |
static | makeWarningsSerializable ( $warnings) |
Convert the warnings array returned by checkWarnings() to something that can be serialized. | |
static | setSessionStatus (User $user, $statusKey, $value) |
Set the current status of a chunked upload (used for polling) | |
static | splitExtensions ( $filename) |
Split a file into a base name and all dot-delimited 'extensions' on the end. | |
static | userCanReUpload (User $user, File $img) |
Check if a user is the last uploader. | |
static | verifyExtension ( $mime, $extension) |
Checks if the MIME type of the uploaded file matches the file extension. | |
Public Attributes | |
const | EMPTY_FILE = 3 |
const | FILE_TOO_LARGE = 12 |
const | FILENAME_TOO_LONG = 14 |
const | FILETYPE_BADTYPE = 9 |
const | FILETYPE_MISSING = 8 |
const | HOOK_ABORTED = 11 |
const | ILLEGAL_FILENAME = 5 |
const | MIN_LENGTH_PARTNAME = 4 |
const | OK = 0 |
const | OVERWRITE_EXISTING_FILE = 7 |
const | SUCCESS = 0 |
const | VERIFICATION_ERROR = 10 |
const | WINDOWS_NONASCII_FILENAME = 13 |
Protected Member Functions | |
detectScriptInSvg ( $filename, $partial) | |
doStashFile (User $user=null) | |
Implementation for stashFile() and tryStashFile(). | |
runUploadStashFileHook (User $user) | |
setTempFile ( $tempPath, $fileSize=null) | |
verifyFile () | |
Verifies that it's ok to include the uploaded file. | |
verifyMimeType ( $mime) | |
Verify the MIME type. | |
verifyPartialFile () | |
A verification routine suitable for partial files. | |
Protected Attributes | |
string[] | $mBlackListedExtensions |
string null | $mDesiredDestName |
string null | $mDestName |
array null | $mFileProps |
int null | $mFileSize |
string null | $mFilteredName |
string null | $mFinalExtension |
bool null | $mJavaDetected |
LocalFile null | $mLocalFile |
string null | $mRemoveTempFile |
string null | $mSourceType |
UploadStashFile null | $mStashFile |
string null | $mSVGNSError |
string | $mTempPath |
Local file system path to the file to upload (or a local copy) | |
Title bool | $mTitle = false |
int | $mTitleError = 0 |
TempFSFile null | $tempFileObj |
Wrapper to handle deleting the temp file. | |
Static Protected Attributes | |
static | $safeXmlEncodings |
Private Member Functions | |
checkAgainstArchiveDupes ( $hash, User $user) | |
checkAgainstExistingDupes ( $hash, $ignoreLocalDupes) | |
checkBadFileName ( $filename, $desiredFileName) | |
Check whether the resulting filename is different from the desired one, but ignore things like ucfirst() and spaces/underscore things. | |
checkFileSize ( $fileSize) | |
checkLocalFileExists (LocalFile $localFile, $hash) | |
checkLocalFileWasDeleted (LocalFile $localFile) | |
checkOverwrite ( $user) | |
Check if there's an overwrite conflict and, if so, if restrictions forbid this user from performing the upload. | |
checkUnwantedFileExtensions ( $fileExtension) | |
stripXmlNamespace ( $name) | |
Static Private Member Functions | |
static | checkCssFragment ( $value) |
Check a block of CSS or CSS fragment for anything that looks like it is bringing in remote code. | |
static | getUploadSessionKey (BagOStuff $store, User $user, $statusKey) |
static | getUploadSessionStore () |
static | splitXmlNamespace ( $element) |
Divide the element name passed by the xml parser to the callback into URI and prifix. | |
Static Private Attributes | |
static | $uploadHandlers = [ 'Stash', 'File', 'Url' ] |
UploadBase and subclasses are the backend of MediaWiki's file uploads.
The frontends are formed by ApiUpload and SpecialUpload.
Stable to extend
Definition at line 45 of file UploadBase.php.
UploadBase::__construct | ( | ) |
Stable to call.
Definition at line 238 of file UploadBase.php.
|
private |
string | $hash | sha1 hash of the file to check |
User | $user |
Definition at line 898 of file UploadBase.php.
Referenced by checkWarnings().
|
private |
string | $hash | sha1 hash of the file to check |
bool | $ignoreLocalDupes | True to ignore local duplicates |
Definition at line 875 of file UploadBase.php.
References $title, and getTitle().
Referenced by checkWarnings().
|
private |
Check whether the resulting filename is different from the desired one, but ignore things like ucfirst() and spaces/underscore things.
string | $filename | |
string | $desiredFileName |
Definition at line 775 of file UploadBase.php.
References NS_FILE.
Referenced by checkWarnings().
|
staticprivate |
Check a block of CSS or CSS fragment for anything that looks like it is bringing in remote code.
string | $value | a string of CSS |
Definition at line 1821 of file UploadBase.php.
References $matches.
|
static |
Perform case-insensitive match against a list of file extensions.
Returns true if the extension is in the list.
string | $ext | |
array | $list |
Definition at line 1264 of file UploadBase.php.
References $ext.
Referenced by checkUnwantedFileExtensions(), getTitle(), and verifyMimeType().
|
static |
Perform case-insensitive match against a list of file extensions.
Returns an array of matching extensions.
string[] | $ext | |
string[] | $list |
Definition at line 1276 of file UploadBase.php.
References $ext.
Referenced by getTitle().
|
private |
int | $fileSize |
Definition at line 816 of file UploadBase.php.
References $wgUploadSizeWarning, and Message\sizeParam().
Referenced by checkWarnings().
|
private |
LocalFile | $localFile | |
string | $hash | sha1 hash of the file to check |
Definition at line 841 of file UploadBase.php.
References LocalFile\getHistory(), and LocalFile\getSha1().
Referenced by checkWarnings().
|
private |
Definition at line 865 of file UploadBase.php.
References LocalFile\exists(), and File\wasDeleted().
Referenced by checkWarnings().
|
private |
Check if there's an overwrite conflict and, if so, if restrictions forbid this user from performing the upload.
User | $user |
Definition at line 1994 of file UploadBase.php.
Referenced by verifyTitlePermissions().
|
static |
Verify that DTD urls referenced are only the standard dtds.
Browsers seem to ignore external dtds. However just to be on the safe side, only allow dtds from the svg standard.
string | $type | PUBLIC or SYSTEM |
string | $publicId | The well-known public identifier for the dtd |
string | $systemId | The url for the external dtd |
Definition at line 1561 of file UploadBase.php.
References $type.
|
static |
Callback to filter SVG Processing Instructions.
string | $target | Processing instruction name |
string | $data | Processing instruction attribute and value |
Definition at line 1541 of file UploadBase.php.
UploadBase::checkSvgScriptCallback | ( | $element, | |
$attribs, | |||
$data = null ) |
string | $element | |
array | $attribs | |
string | null | $data |
Definition at line 1588 of file UploadBase.php.
References splitXmlNamespace(), stripXmlNamespace(), and wfDebug().
|
private |
string | $fileExtension | The file extension to check |
Definition at line 794 of file UploadBase.php.
References $wgCheckFileExtensions, $wgFileExtensions, $wgLang, and checkFileExtension().
Referenced by checkWarnings().
UploadBase::checkWarnings | ( | $user = null | ) |
Check for non fatal problems with the file.
This should not assume that mTempPath is set.
User | null | $user | Accepted since 1.35 |
Definition at line 686 of file UploadBase.php.
References checkAgainstArchiveDupes(), checkAgainstExistingDupes(), checkBadFileName(), checkFileSize(), checkLocalFileExists(), checkLocalFileWasDeleted(), checkUnwantedFileExtensions(), getLocalFile(), and getTempFileSha1Base36().
|
static |
Check a whitelist of xml encodings that are known not to be interpreted differently by the server's xml parser (expat) and some common browsers.
string | $file | Pathname to the temporary upload file |
Definition at line 1451 of file UploadBase.php.
References $file, $matches, $wgSVGMetadataCutoff, and wfDebug().
UploadBase::cleanupTempFile | ( | ) |
If we've modified the upload file we need to manually remove it on exit to clean up.
Definition at line 1228 of file UploadBase.php.
References wfDebug().
UploadBase::convertVerifyErrorToStatus | ( | $error | ) |
array | $error |
Definition at line 2215 of file UploadBase.php.
References getVerificationErrorCode().
|
static |
Create a form of UploadBase depending on wpSourceType and initializes it.
WebRequest | &$request | |
string | null | $type |
Definition at line 186 of file UploadBase.php.
|
static |
Heuristic for detecting files that could contain JavaScript instructions or things that may look like HTML to a browser and are thus potentially harmful.
The present implementation will produce false positives in some situations.
string | $file | Pathname to the temporary upload file |
string | $mime | The MIME type of the file |
string | $extension | The extension of the file |
Definition at line 1340 of file UploadBase.php.
|
protected |
string | $filename | |
bool | $partial |
Definition at line 1509 of file UploadBase.php.
Referenced by verifyFile(), and verifyPartialFile().
|
static |
Generic wrapper function for a virus scanner program.
This relies on the $wgAntivirus and $wgAntivirusSetup variables. $wgAntivirusRequired may be used to deny upload if the scan fails.
string | $file | Pathname to the temporary upload file |
Definition at line 1900 of file UploadBase.php.
References $command, $file, $wgAntivirus, $wgAntivirusRequired, $wgAntivirusSetup, $wgOut, AV_NO_VIRUS, AV_SCAN_ABORTED, AV_SCAN_FAILED, wfDebug(), wfMessage(), and wfShellExecWithStderr().
Referenced by verifyPartialFile().
|
protected |
Implementation for stashFile() and tryStashFile().
Stable to override
User | null | $user |
Reimplemented in UploadFromChunks.
Definition at line 1215 of file UploadBase.php.
References $file, and getSourceType().
Referenced by stashFile(), and tryStashFile().
UploadBase::fetchFile | ( | ) |
Fetch the file.
Usually a no-op Stable to override
Definition at line 298 of file UploadBase.php.
|
static |
Helper function that does various existence checks for a file.
The following checks are performed:
Definition at line 2056 of file UploadBase.php.
|
static |
Get a list of blacklisted filename prefixes from [[MediaWiki:Filename-prefix-blacklist]].
Definition at line 2161 of file UploadBase.php.
References $line, $lines, and wfMessage().
UploadBase::getFileSize | ( | ) |
UploadBase::getImageInfo | ( | $result | ) |
Gets image info about the file just uploaded.
Also has the effect of setting metadata to be an 'indexed tag name' in returned API result if 'metadata' was requested. Oddly, we have to pass the "result" object down just so it can do that with the appropriate format, presumably.
ApiResult | $result |
Definition at line 2195 of file UploadBase.php.
References ApiQueryImageInfo\getInfo(), getLocalFile(), ApiQueryImageInfo\getPropertyNames(), ApiQueryStashImageInfo\getPropertyNames(), and getStashFile().
UploadBase::getLocalFile | ( | ) |
Return the local file and initializes if necessary.
Stable to override
Definition at line 1124 of file UploadBase.php.
References getTitle().
Referenced by checkWarnings(), getImageInfo(), performUpload(), and validateName().
|
static |
Get the PHP maximum uploaded file size, based on ini settings.
If there is no limit or the limit can't be guessed, returns a very large number (PHP_INT_MAX).
Definition at line 2250 of file UploadBase.php.
References wfShorthandToInteger().
|
static |
Get MediaWiki's maximum uploaded file size for given type of upload, based on $wgMaxUploadSize.
null | string | $forType |
Definition at line 2229 of file UploadBase.php.
References $wgMaxUploadSize.
Referenced by UploadFromChunks\addChunk().
UploadBase::getRealPath | ( | $srcPath | ) |
string | $srcPath | The source path |
Definition at line 331 of file UploadBase.php.
References $path, and FileRepo\isVirtualUrl().
Referenced by UploadFromChunks\continueChunks(), and UploadFromStash\initialize().
|
static |
Get the current status of a chunked upload (used for polling)
The value will be read from cache.
User | $user | |
string | $statusKey |
Definition at line 2271 of file UploadBase.php.
UploadBase::getSourceType | ( | ) |
Returns the upload type.
Should be overridden by child classes
Reimplemented in UploadFromFile, UploadFromStash, and UploadFromUrl.
Definition at line 248 of file UploadBase.php.
Referenced by doStashFile(), and verifyUpload().
UploadBase::getStashFile | ( | ) |
Definition at line 1138 of file UploadBase.php.
Referenced by getImageInfo().
UploadBase::getTempFileSha1Base36 | ( | ) |
Get the base 36 SHA1 of the file Stable to override.
Reimplemented in UploadFromStash.
Definition at line 323 of file UploadBase.php.
References FSFile\getSha1Base36FromPath().
Referenced by checkWarnings().
UploadBase::getTempPath | ( | ) |
Definition at line 1236 of file UploadBase.php.
UploadBase::getTitle | ( | ) |
Returns the title of the file to be uploaded.
Sets mTitleError in case the name was illegal.
Definition at line 986 of file UploadBase.php.
References $ext, $mime, $mTitle, $title, $wgCheckFileExtensions, $wgFileBlacklist, $wgFileExtensions, $wgStrictFileExtensions, checkFileExtension(), checkFileExtensionList(), Title\getDBkey(), NS_FILE, splitExtensions(), and wfStripIllegalFilenameChars().
Definition at line 2307 of file UploadBase.php.
References User\getId(), User\getName(), and BagOStuff\makeKey().
|
staticprivate |
Definition at line 2318 of file UploadBase.php.
UploadBase::getVerificationErrorCode | ( | $error | ) |
int | $error |
Definition at line 118 of file UploadBase.php.
Referenced by UploadFromChunks\concatenateChunks(), and convertVerifyErrorToStatus().
|
abstract |
Initialize from a WebRequest.
Override this in a subclass.
WebRequest | &$request |
Reimplemented in UploadFromFile, UploadFromStash, and UploadFromUrl.
UploadBase::initializePathInfo | ( | $name, | |
$tempPath, | |||
$fileSize, | |||
$removeTempFile = false ) |
string | $name | The desired destination name |
string | null | $tempPath | |
int | null | $fileSize | |
bool | $removeTempFile | (false) remove the temporary file? |
MWException |
Definition at line 259 of file UploadBase.php.
References FileBackend\isStoragePath(), and setTempFile().
Referenced by UploadFromChunks\continueChunks(), UploadFromStash\initialize(), UploadFromUrl\initialize(), and UploadFromFile\initialize().
|
static |
Returns true if the user can use this upload module or else a string identifying the missing permission.
Can be overridden by subclasses.
UserIdentity | $user |
Reimplemented in UploadFromUrl.
Definition at line 155 of file UploadBase.php.
UploadBase::isEmptyFile | ( | ) |
Return true if the file is empty.
Definition at line 306 of file UploadBase.php.
Referenced by verifyUpload(), and UploadFromFile\verifyUpload().
|
static |
Returns true if uploads are enabled.
Can be override by subclasses. Stable to override
Reimplemented in UploadFromUrl.
Definition at line 141 of file UploadBase.php.
References $wgEnableUploads, and wfIniGetBool().
|
static |
Returns true if the user has surpassed the upload rate limit, false otherwise.
User | $user |
Definition at line 172 of file UploadBase.php.
|
static |
Helper function that checks whether the filename looks like a thumbnail.
string | $filename |
Definition at line 2145 of file UploadBase.php.
|
static |
Check whether a request if valid for this handler.
WebRequest | $request |
Reimplemented in UploadFromFile, UploadFromStash, and UploadFromUrl.
Definition at line 231 of file UploadBase.php.
|
static |
Convert the warnings array returned by checkWarnings() to something that can be serialized.
File objects will be converted to an associative array with the following keys:
mixed[] | $warnings |
Definition at line 750 of file UploadBase.php.
UploadBase::performUpload | ( | $comment, | |
$pageText, | |||
$watch, | |||
$user, | |||
$tags = [], | |||
?string | $watchlistExpiry = null ) |
Really perform the upload.
Stores the file in the local repo, watches if necessary and runs the UploadComplete hook.
string | $comment | |
string | $pageText | |
bool | $watch | Whether the file page should be added to user's watchlist. (This doesn't check $user's permissions.) |
User | $user | |
string[] | $tags | Change tags to add to the log entry and page revision. (This doesn't check $user's permissions.) |
string | null | $watchlistExpiry | Optional watchlist expiry timestamp in any format acceptable to wfTimestamp(). |
Definition at line 928 of file UploadBase.php.
References WatchAction\doWatch(), getLocalFile(), getTitle(), and postProcessUpload().
UploadBase::postProcessUpload | ( | ) |
Perform extra steps after a successful upload.
Stable to override
Reimplemented in UploadFromStash.
Definition at line 977 of file UploadBase.php.
Referenced by performUpload().
|
protected |
User | $user |
Definition at line 1173 of file UploadBase.php.
Referenced by UploadFromChunks\concatenateChunks(), and tryStashFile().
|
static |
Set the current status of a chunked upload (used for polling)
The value will be set in cache for 1 day
Avoid triggering this method on HTTP GET/HEAD requests
User | $user | |
string | $statusKey | |
array | bool | $value |
Definition at line 2290 of file UploadBase.php.
|
protected |
string | null | $tempPath | File system path to temporary file containing the upload |
int | null | $fileSize |
Definition at line 280 of file UploadBase.php.
Referenced by UploadFromChunks\concatenateChunks(), and initializePathInfo().
|
static |
Split a file into a base name and all dot-delimited 'extensions' on the end.
Some web server configurations will fall back to earlier pseudo-'extensions' to determine type and execute scripts, so the blacklist needs to check them all.
string | $filename |
Definition at line 1249 of file UploadBase.php.
Referenced by getTitle().
|
staticprivate |
Divide the element name passed by the xml parser to the callback into URI and prifix.
string | $element |
Definition at line 1870 of file UploadBase.php.
Referenced by checkSvgScriptCallback().
UploadBase::stashFile | ( | User | $user = null | ) |
If the user does not supply all necessary information in the first upload form submission (either by accident or by design) then we may want to stash the file temporarily, get more information, and publish the file later.
This method will stash a file in a temporary directory for later processing, and save the necessary descriptive info into the database. This method returns the file object, which also has a 'fileKey' property which can be passed through a form or API request to find this stashed file again.
User | null | $user |
Reimplemented in UploadFromChunks.
Definition at line 1202 of file UploadBase.php.
References doStashFile(), and wfDeprecated().
|
private |
string | $name |
Definition at line 1883 of file UploadBase.php.
Referenced by checkSvgScriptCallback().
UploadBase::tryStashFile | ( | User | $user, |
$isPartial = false ) |
Like stashFile(), but respects extensions' wishes to prevent the stashing.
verifyUpload() must be called before calling this method (unless $isPartial is true).
Upload stash exceptions are also caught and converted to an error status.
User | $user | |
bool | $isPartial | Pass true if this is a part of a chunked upload (not a complete file). |
Reimplemented in UploadFromChunks.
Definition at line 1154 of file UploadBase.php.
References $file, doStashFile(), and runUploadStashFileHook().
UploadBase::validateName | ( | ) |
Verify that the name is valid and, if necessary, that we can overwrite.
Definition at line 415 of file UploadBase.php.
References getLocalFile(), and getTitle().
Referenced by verifyUpload().
|
static |
Checks if the MIME type of the uploaded file matches the file extension.
string | $mime | The MIME type of the uploaded file |
string | $extension | The filename extension that the file is to be served with |
Definition at line 1287 of file UploadBase.php.
References $mime, and wfDebug().
Referenced by verifyFile().
|
protected |
Verifies that it's ok to include the uploaded file.
Definition at line 479 of file UploadBase.php.
References $mime, $wgDisableUploadScriptChecks, $wgVerifyMimeType, detectScriptInSvg(), MediaHandler\getHandler(), verifyExtension(), verifyPartialFile(), and wfDebug().
Referenced by verifyUpload().
|
protected |
Verify the MIME type.
verifyFile()
that MIME type and file extension correlate. string | $mime | Representing the MIME |
Definition at line 445 of file UploadBase.php.
References $mime, $wgMimeTypeBlacklist, $wgVerifyMimeType, $wgVerifyMimeTypeIE, checkFileExtension(), and wfDebug().
Referenced by verifyPartialFile().
|
protected |
A verification routine suitable for partial files.
Runs the blacklist checks, but not any checks that may assume the entire file is present.
Definition at line 540 of file UploadBase.php.
References $mime, $wgAllowJavaUploads, $wgDisableUploadScriptChecks, detectScriptInSvg(), detectVirus(), getTitle(), ZipDirectoryReader\read(), and verifyMimeType().
Referenced by UploadFromChunks\verifyChunk(), and verifyFile().
UploadBase::verifyPermissions | ( | $user | ) |
Alias for verifyTitlePermissions.
The function was originally 'verifyPermissions', but that suggests it's checking the user, when it's really checking the title + user combination.
Definition at line 630 of file UploadBase.php.
References verifyTitlePermissions().
UploadBase::verifyTitlePermissions | ( | $user | ) |
Check whether the user can edit, upload and create the image.
This checks only against the current title; if it returns errors, it may very well be that another title will not give errors. Therefore isAllowed() should be called as well for generic is-user-blocked or can-user-upload checking.
Definition at line 645 of file UploadBase.php.
References checkOverwrite(), getTitle(), and wfArrayDiff2().
Referenced by verifyPermissions().
UploadBase::verifyUpload | ( | ) |
Verify whether the upload is sane.
Return a status array representing the outcome of the verification. Possible keys are:
Stable to override
Reimplemented in UploadFromFile.
Definition at line 366 of file UploadBase.php.
References getSourceType(), isEmptyFile(), validateName(), and verifyFile().
UploadBase::zipEntryCallback | ( | $entry | ) |
Callback for ZipDirectoryReader to detect Java class files.
array | $entry |
Definition at line 601 of file UploadBase.php.
|
protected |
Definition at line 77 of file UploadBase.php.
|
protected |
Definition at line 53 of file UploadBase.php.
Referenced by UploadFromChunks\verifyChunk().
|
protected |
Definition at line 55 of file UploadBase.php.
|
protected |
Definition at line 75 of file UploadBase.php.
|
protected |
Definition at line 73 of file UploadBase.php.
|
protected |
Definition at line 65 of file UploadBase.php.
|
protected |
Definition at line 67 of file UploadBase.php.
|
protected |
Definition at line 79 of file UploadBase.php.
|
protected |
Definition at line 69 of file UploadBase.php.
|
protected |
Definition at line 57 of file UploadBase.php.
|
protected |
Definition at line 59 of file UploadBase.php.
|
protected |
Definition at line 71 of file UploadBase.php.
Referenced by UploadFromChunks\doStashFile().
|
protected |
Definition at line 81 of file UploadBase.php.
|
protected |
Local file system path to the file to upload (or a local copy)
Definition at line 49 of file UploadBase.php.
Referenced by UploadFromChunks\addChunk().
|
protected |
Definition at line 61 of file UploadBase.php.
|
protected |
Definition at line 63 of file UploadBase.php.
|
staticprotected |
Definition at line 83 of file UploadBase.php.
|
protected |
Wrapper to handle deleting the temp file.
Definition at line 51 of file UploadBase.php.
|
staticprivate |
Definition at line 177 of file UploadBase.php.
const UploadBase::EMPTY_FILE = 3 |
Definition at line 102 of file UploadBase.php.
const UploadBase::FILE_TOO_LARGE = 12 |
Definition at line 110 of file UploadBase.php.
Referenced by UploadFromFile\verifyUpload().
const UploadBase::FILENAME_TOO_LONG = 14 |
Definition at line 112 of file UploadBase.php.
const UploadBase::FILETYPE_BADTYPE = 9 |
Definition at line 107 of file UploadBase.php.
const UploadBase::FILETYPE_MISSING = 8 |
Definition at line 106 of file UploadBase.php.
const UploadBase::HOOK_ABORTED = 11 |
Definition at line 109 of file UploadBase.php.
const UploadBase::ILLEGAL_FILENAME = 5 |
Definition at line 104 of file UploadBase.php.
const UploadBase::MIN_LENGTH_PARTNAME = 4 |
Definition at line 103 of file UploadBase.php.
const UploadBase::OK = 0 |
Definition at line 101 of file UploadBase.php.
Referenced by UploadFromChunks\concatenateChunks().
const UploadBase::OVERWRITE_EXISTING_FILE = 7 |
Definition at line 105 of file UploadBase.php.
const UploadBase::SUCCESS = 0 |
Definition at line 100 of file UploadBase.php.
const UploadBase::VERIFICATION_ERROR = 10 |
Definition at line 108 of file UploadBase.php.
const UploadBase::WINDOWS_NONASCII_FILENAME = 13 |
Definition at line 111 of file UploadBase.php.