Manual:Hooks/ImgAuthModifyHeaders

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
ImgAuthModifyHeaders
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 496705)</tvar></translate>
Executed just before a file is streamed to a user, allowing headers to be modified beforehand.
<translate> Define function:</translate>
public static function onImgAuthModifyHeaders( \MediaWiki\Linker\LinkTarget $title, array &$headers ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"ImgAuthModifyHeaders": "MediaWiki\\Extension\\MyExtension\\Hooks::onImgAuthModifyHeaders"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> ../img_auth.php
<translate> Function(s):</translate> wfImageAuthMain
<translate> Interface:</translate> ImgAuthModifyHeadersHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:ImgAuthModifyHeaders extensions</tvar>.</translate>


Details

  • $title: MediaWiki\Linker\LinkTarget instance
  • &$headers: Associative array of HTTP headers