This is a list of known events and parameters; please add to it if
you're going to add events to the MediaWiki code.
+'ArticleDelete': before an article is deleted
+$article: the article (object) being deleted
+$user: the user (object) deleting the article
+$reason: the reason (string) the article is being deleted
+
+'ArticleDeleteComplete': after an article is deleted
+$article: the article that was deleted
+$user: the user that deleted the article
+$reason: the reason the article was deleted
+
'ArticleProtect': before an article is protected
$article: the article being protected
$user: the user doing the protection
"' for '" . $reason . "' " . (($moveonly) ? "(moves only)" : "") );
return true;
}
+
+ function syslogArticleDelete(&$article, &$user, &$reason) {
+ $title = $article->mTitle;
+ syslog(LOG_NOTICE, "User '" . $user->getName() . "' deleted '" .
+ $title->getPrefixedText() .
+ "' for '" . $reason . "' ");
+ return true;
+ }
+
# Setup -- called once environment is configured
function setupSyslog() {
$wgHooks['UserLogout'][] = 'syslogUserLogout';
$wgHooks['BlockIpComplete'][] = 'syslogBlockIp';
$wgHooks['ArticleProtectComplete'][] = 'syslogArticleProtect';
+ $wgHooks['ArticleDeleteComplete'][] = 'syslogArticleDelete';
return true;
}
$fname = 'Article::doDelete';
wfDebug( $fname."\n" );
- if ( $this->doDeleteArticle( $reason ) ) {
- $deleted = $this->mTitle->getPrefixedText();
-
- $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
- $wgOut->setRobotpolicy( 'noindex,nofollow' );
-
- $sk = $wgUser->getSkin();
- $loglink = $sk->makeKnownLink( $wgContLang->getNsText( NS_PROJECT ) .
- ':' . wfMsgForContent( 'dellogpage' ), wfMsg( 'deletionlog' ) );
-
- $text = wfMsg( 'deletedtext', $deleted, $loglink );
-
- $wgOut->addHTML( '<p>' . $text . "</p>\n" );
- $wgOut->returnToMain( false );
- } else {
- $wgOut->fatalError( wfMsg( 'cannotdelete' ) );
+ if (wfRunHooks('ArticleDelete', $this, $wgUser, $reason)) {
+ if ( $this->doDeleteArticle( $reason ) ) {
+ $deleted = $this->mTitle->getPrefixedText();
+
+ $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
+
+ $sk = $wgUser->getSkin();
+ $loglink = $sk->makeKnownLink( $wgContLang->getNsText( NS_PROJECT ) .
+ ':' . wfMsgForContent( 'dellogpage' ),
+ wfMsg( 'deletionlog' ) );
+
+ $text = wfMsg( 'deletedtext', $deleted, $loglink );
+
+ $wgOut->addHTML( '<p>' . $text . "</p>\n" );
+ $wgOut->returnToMain( false );
+ wfRunHooks('ArticleDeleteComplete', $this, $wgUser, $reason);
+ } else {
+ $wgOut->fatalError( wfMsg( 'cannotdelete' ) );
+ }
}
}