Available from version 1.13.0
When a file is deleted
Define function:
public static function onFileDeleteComplete( $file, $oldimage, $article, $user, $reason ) { ... }
Attach hook: In extension.json:
	"Hooks": {
		"FileDeleteComplete": "MediaWiki\\Extension\\MyExtension\\Hooks::onFileDeleteComplete"
Called from: File(s): FileDeleteForm.php
Interface: FileDeleteCompleteHook.php

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

Details edit

  • $file: reference to the deleted file
  • $oldimage: in case of the deletion of an old image, the name of the old file
  • $article: in case all revisions of the file are deleted a reference to the article associated with the file.
  • $user: user who performed the deletion
  • $reason: reason