Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -562,9 +562,23 @@ |
563 | 563 | &$list: List object (defaults to NULL, change it to an object instance and return |
564 | 564 | false override the list derivative used) |
565 | 565 | |
| 566 | +'FileDeleteComplete': When a file is deleted |
| 567 | +$file: reference to the deleted file |
| 568 | +$oldimage: in case of the deletion of an old image, the name of the old file |
| 569 | +$article: in case all revisions of the file are deleted a reference to the article |
| 570 | + associated with the file. |
| 571 | +$user: user who performed the deletion |
| 572 | +$reason: reason |
| 573 | + |
566 | 574 | 'FileUpload': When a file upload occurs |
567 | 575 | $file : Image object representing the file that was uploaded |
568 | 576 | |
| 577 | +'FileUndeleteComplete': When a file is undeleted |
| 578 | +$title: title object to the file |
| 579 | +$fileVersions: array of undeleted versions. Empty if all versions were restored |
| 580 | +$user: user who performed the undeletion |
| 581 | +$reason: reason |
| 582 | + |
569 | 583 | 'GetBlockedStatus': after loading blocking status of an user from the database |
570 | 584 | $user: user (object) being checked |
571 | 585 | |
— | — | @@ -1025,7 +1039,7 @@ |
1026 | 1040 | string &$error: output: HTML error to show if upload canceled by returning false |
1027 | 1041 | |
1028 | 1042 | 'UploadComplete': Upon completion of a file upload |
1029 | | -$image: Image object representing the file that was uploaded |
| 1043 | +$uploadForm: Upload form object. File can be accessed by $uploadForm->mLocalFile. |
1030 | 1044 | |
1031 | 1045 | 'userCan': To interrupt/advise the "user can do X to Y article" check. |
1032 | 1046 | If you want to display an error message, try getUserPermissionsErrors. |
Index: trunk/phase3/includes/SpecialUndelete.php |
— | — | @@ -1055,6 +1055,11 @@ |
1056 | 1056 | $this->mFileVersions ); |
1057 | 1057 | |
1058 | 1058 | if( is_array($ok) ) { |
| 1059 | + if ( $ok[1] ) // Undeleted file count |
| 1060 | + wfRunHooks( 'FileUndeleteComplete', array( |
| 1061 | + $this->mTargetObj, $this->mFileVersions, |
| 1062 | + $wgUser, $this->mComment) ); |
| 1063 | + |
1059 | 1064 | $skin = $wgUser->getSkin(); |
1060 | 1065 | $link = $skin->makeKnownLinkObj( $this->mTargetObj ); |
1061 | 1066 | $wgOut->addHtml( wfMsgWikiHtml( 'undeletedpage', $link ) ); |
Index: trunk/phase3/includes/FileDeleteForm.php |
— | — | @@ -72,6 +72,8 @@ |
73 | 73 | } elseif ( $reason == 'other' ) { |
74 | 74 | $reason = $this->DeleteReason; |
75 | 75 | } |
| 76 | + |
| 77 | + $article = null; |
76 | 78 | if( $this->oldimage ) { |
77 | 79 | $status = $this->file->deleteOld( $this->oldimage, $reason ); |
78 | 80 | if( $status->ok ) { |
— | — | @@ -90,6 +92,9 @@ |
91 | 93 | $article->doDeleteArticle( $reason ); |
92 | 94 | } |
93 | 95 | } |
| 96 | + if( $status->isGood() ) wfRunHooks('FileDeleteComplete', array( |
| 97 | + &$this->file, &$this->oldimage, &$article, &$wgUser, &$reason)); |
| 98 | + |
94 | 99 | if( !$status->isGood() ) |
95 | 100 | $wgOut->addWikiText( $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' ) ); |
96 | 101 | if( $status->ok ) { |