* @file
*/
-/**
- * Call hook functions defined in $wgHooks
- *
- * Because programmers assign to $wgHooks, we need to be very
- * careful about its contents. So, there's a lot more error-checking
- * in here than would normally be necessary.
- *
- * @param $event String: event name
- * @param $args Array: parameters passed to hook functions
- * @return Boolean
- */
-function wfRunHooks( $event, $args = array() ) {
- return Hooks::run( $event, $args );
-}
-
-function hookErrorHandler( $errno, $errstr ) {
- return Hooks::hookErrorHandler( $errno, $errstr );
-}
-
class MWHookException extends MWException {}
/**
*
* @param $event String: event name
* @param $args Array: parameters passed to hook functions
- * @return Boolean
+ * @return Boolean True if no handler aborted the hook
*/
public static function run( $event, $args = array() ) {
global $wgHooks;
/* String return is an error; false return means stop processing. */
if ( is_string( $retval ) ) {
- global $wgOut;
- $wgOut->showFatalError( $retval );
- return false;
+ throw new FatalError( $retval );
} elseif( $retval === null ) {
if ( $closure ) {
$prettyFunc = "$event closure";
'should return true to continue hook processing or false to abort.'
);
}
- } else if ( !$retval ) {
+ } elseif ( !$retval ) {
return false;
}
}
/**
* This REALLY should be protected... but it's public for compatibility
*
- * @param $errno Unused
+ * @param $errno int Unused
* @param $errstr String: error message
* @return Boolean: false
*/