On 7/11/07, Jim Wilson wilson.jim.r@gmail.com wrote:
What is your suggestion with respect to this, then?
My understanding of userCan (which may be erroneous) was that the return value must be a boolean that means semantically "continue hook processing?" and that the $result var was to contain the result (if any).
It's possible that an implementor of userCan may only be interested in certain titles, and so returning true with no $result is totally valid. Consider for example an extension which limits access to User pages - returning true and not touching &$result would be the correct behavior for non-User pages.
It would seem to me appropriate to allow $result to be either a boolean or an array depending on whether the hook is an old implementation or wants to leverage the new api.
-- Jim
I've rewritten the hook call like so. Code review, et cetera welcomed:
$result = null; $hooked = false; $hooked = wfRunHooks( 'userCan', array( &$this, &$wgUser, $action, &$result ) ); if ( !$hooked ) { wfProfileOut( $fname ); return $result; }
-- Andrew