[Mediawiki-l] Suggestion to add to code: TitleMoveHook
Eric K
ek79501 at yahoo.com
Mon Dec 15 19:06:15 UTC 2008
There's no code that can interrupt a Title Move. I have added a little snippet into Title.php that does this and allows me to stop a user from doing a Title Move under many userful conditions. One of them includes monitoring how many title moves they're doing in a certain amount of amount of time. That helps stop Page-move vandalism and has saved my wiki many times.
The Page Edit hook exists which is useful in a similiar way, but there was no hook for Title Move. Do the developers of MW think this Title Move hook is a good idea perhaps to include in the default code? Its only a few lines of code.
On line 2517 of /includes/Title.php, we have:
---------
$pageid = $this->getArticleID();
if( $nt->exists() ) {
---------
Between these two lines of code, I have included the following (in bold):
---------------
$pageid = $this->getArticleID();
global $wgUser;
$fname = 'Article::MoveArticle';
wfProfileIn( $fname );
if( !wfRunHooks( 'TitleMove', array( &$this, &$wgUser, &$nt, NULL ) ) ) {
wfDebug( "$fname: TitleMove hook aborted move!\n" );
wfProfileOut( $fname );
return false;
}
if( $nt->exists() ) {
---------------
More information about the MediaWiki-l
mailing list