From 7c48fefa3f4d0568ddc699cff1a7cec4f232adc8 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Wed, 5 Apr 2006 09:16:28 +0000 Subject: [PATCH] Fix chaining of UserCan extension return results --- includes/Title.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 0408f51409..ba1539e7cc 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -966,12 +966,11 @@ class Title { global $wgUser; - $result = true; - if ( !wfRunHooks( 'userCan', array( &$this, &$wgUser, $action, &$result ) ) ) { + $result = null; + wfRunHooks( 'userCan', array( &$this, &$wgUser, $action, &$result ) ); + if ( $result !== null ) { wfProfileOut( $fname ); - // Allow advisory rights checking - if ( $result !== null ) - return $result; + return $result; } if( NS_SPECIAL == $this->mNamespace ) { @@ -1077,8 +1076,8 @@ class Title { function userCanRead() { global $wgUser; - $result = true; - if ( !wfRunHooks( 'userCan', array( &$this, &$wgUser, "read", &$result ) ) ) { + wfRunHooks( 'userCan', array( &$this, &$wgUser, 'read', &$result ) ); + if ( $result !== null ) { return $result; } -- 2.20.1