From: Chad Horohoe Date: Tue, 24 Jun 2008 13:03:16 +0000 (+0000) Subject: Bit of work to AbortMove hook, in preparation for making the SpamBlacklist work on... X-Git-Tag: 1.31.0-rc.0~46898 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22sites_tous%22%29%20.%20%22?a=commitdiff_plain;h=13d510bf55431f02a5e93e6b596d2d65345e1f8f;p=lhc%2Fweb%2Fwiklou.git Bit of work to AbortMove hook, in preparation for making the SpamBlacklist work on move logs. --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 6916a779d8..2357c654c2 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -254,6 +254,7 @@ $old: old title $nt: new title $user: user who is doing the move $err: error message +$reason: the reason for the move (added in 1.13) 'AbortNewAccount': Return false to cancel account creation. $user: the User object about to be created (read-only, incomplete) diff --git a/includes/Title.php b/includes/Title.php index dad2bc45cc..459a7aead1 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2394,9 +2394,10 @@ class Title { * @param Title &$nt the new title * @param bool $auth indicates whether $wgUser's permissions * should be checked + * @param string $reason is the log summary of the move, used for spam checking * @return mixed True on success, getUserPermissionsErrors()-like array on failure */ - public function isValidMoveOperation( &$nt, $auth = true ) { + public function isValidMoveOperation( &$nt, $auth = true, $reason = '' ) { $errors = array(); if( !$nt ) { // Normally we'd add this to $errors, but we'll get @@ -2446,7 +2447,7 @@ class Title { global $wgUser; $err = null; - if( !wfRunHooks( 'AbortMove', array( $this, $nt, $wgUser, &$err ) ) ) { + if( !wfRunHooks( 'AbortMove', array( $this, $nt, $wgUser, &$err, $reason ) ) ) { $errors[] = array('hookaborted', $err); } @@ -2481,7 +2482,7 @@ class Title { * @return mixed true on success, getUserPermissionsErrors()-like array on failure */ public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) { - $err = $this->isValidMoveOperation( $nt, $auth ); + $err = $this->isValidMoveOperation( $nt, $auth, $reason ); if( is_array( $err ) ) { return $err; }