Manual:Hooks/IsUploadAllowedFromUrl

From mediawiki.org
Jump to navigation Jump to search
IsUploadAllowedFromUrl
Available from version 1.22.0 (Gerrit change 65102)
Allows overriding the result of UploadFromUrl::isAllowedUrl()
Define function:
public static function onIsUploadAllowedFromUrl( string $url, bool &$allowed ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"IsUploadAllowedFromUrl": "MyExtensionHooks::onIsUploadAllowedFromUrl"
	}
}
Called from:File(s): upload/UploadFromUrl.php
Function(s): isAllowedUrl
Interface:IsUploadAllowedFromUrlHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:IsUploadAllowedFromUrl extensions.

Details[edit]

  • $url: URL used to upload from
  • &$allowed: Boolean indicating if uploading is allowed for given URL