in Syslog extension.
$reason: Reason for protect
$moveonly: boolean whether it was for move only or not
+'ArticleSave': before an article is saved
+$article: the article (object) being saved
+$user: the user (object) saving the article
+$text: the new article text
+$summary: the article summary (comment)
+$isminor: minor flag
+$iswatch: watch flag
+$section: section #
+
+'ArticleSaveComplete': after an article is saved
+$article: the article (object) saved
+$user: the user (object) who saved the article
+$text: the new article text
+$summary: the article summary (comment)
+$isminor: minor flag
+$iswatch: watch flag
+$section: section #
+
'BlockIp': before an IP address or user is blocked
$block: the Block object about to be saved
$user: the user _doing_ the block (not the one being blocked)
return true;
}
+ # Hook for IP & user blocks
+
function syslogBlockIp(&$block, &$user) {
syslog(LOG_NOTICE, "User '" . $user->getName() .
"' blocked '" . (($block->mUser) ? $block->mUser : $block->mAddress) .
return true;
}
+ # Hook for article protection
+
function syslogArticleProtect(&$article, &$user, $protect, &$reason, &$moveonly) {
$title = $article->mTitle;
syslog(LOG_NOTICE, "User '" . $user->getName() . "' " .
return true;
}
+ # Hook for article deletion
+
function syslogArticleDelete(&$article, &$user, &$reason) {
$title = $article->mTitle;
syslog(LOG_NOTICE, "User '" . $user->getName() . "' deleted '" .
"' for '" . $reason . "' ");
return true;
}
+
+ # Hook for article save
+ function syslogArticleSave(&$article, &$user, &$text, $summary, $isminor, $iswatch, $section) {
+ $title = $article->mTitle;
+ syslog(LOG_NOTICE, "User '" . $user->getName() . "' saved '" .
+ $title->getPrefixedText() .
+ "' with comment '" . $summary . "' ");
+ return true;
+ }
# Setup -- called once environment is configured
$wgHooks['BlockIpComplete'][] = 'syslogBlockIp';
$wgHooks['ArticleProtectComplete'][] = 'syslogArticleProtect';
$wgHooks['ArticleDeleteComplete'][] = 'syslogArticleDelete';
+ $wgHooks['ArticleSaveComplete'][] = 'syslogArticleSave';
return true;
}
$wgOut->redirect( $this->mTitle->getFullURL() );
return;
}
- $this->mArticle->insertNewArticle( $this->textbox1, $this->summary, $this->minoredit, $this->watchthis );
+ if (wfRunHooks('ArticleSave', $this->mArticle, $wgUser, $this->textbox1,
+ $this->summary, $this->minoredit, $this->watchthis, NULL))
+ {
+ $this->mArticle->insertNewArticle( $this->textbox1, $this->summary,
+ $this->minoredit, $this->watchthis );
+ wfRunHooks('ArticleSaveComplete', $this->mArticle, $wgUser, $this->textbox1,
+ $this->summary, $this->minoredit, $this->watchthis, NULL);
+ }
return;
}
$sectionanchor = $this->sectionAnchor( $matches[2] );
}
}
-
- # update the article here
- if($this->mArticle->updateArticle( $text, $this->summary, $this->minoredit, $this->watchthis, '', $sectionanchor ))
- return;
- else
- $isConflict = true;
+
+ if (wfRunHooks('ArticleSave', $this, $wgUser, $text, $this->summary,
+ $this->minoredit, $this->watchthis, $sectionanchor))
+ {
+ # update the article here
+ if($this->mArticle->updateArticle( $text, $this->summary, $this->minoredit,
+ $this->watchthis, '', $sectionanchor ))
+ {
+ wfRunHooks('ArticleSaveComplete', $this, $wgUser, $text, $this->summary,
+ $this->minoredit, $this->watchthis, $sectionanchor);
+ return;
+ }
+ else
+ $isConflict = true;
+ }
}
}
# First time through: get contents, set time for conflict