Followup r102785: fix typo in index name. Thanks to Platonides and his special page...
[lhc/web/wiklou.git] / includes / Hooks.php
index 87c677d..bfec82e 100644 (file)
  * @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 {}
 
 /**
@@ -203,8 +184,6 @@ class Hooks {
                        } elseif ( isset( $object ) ) {
                                $func = get_class( $object ) . '::' . $method;
                                $callback = array( $object, $method );
-                       } elseif ( false !== ( $pos = strpos( $func, '::' ) ) ) {
-                               $callback = array( substr( $func, 0, $pos ), substr( $func, $pos + 2 ) );
                        } else {
                                $callback = $func;
                        }
@@ -231,7 +210,7 @@ class Hooks {
                         * problem here.
                         */
                        $retval = null;
-                       set_error_handler( array( 'Hooks', 'hookErrorHandler' ) );
+                       set_error_handler( 'Hooks::hookErrorHandler' );
                        wfProfileIn( $func );
                        try {
                                $retval = call_user_func_array( $callback, $hook_args );
@@ -243,9 +222,7 @@ class Hooks {
 
                        /* 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";
@@ -271,7 +248,7 @@ class Hooks {
                                                'should return true to continue hook processing or false to abort.'
                                        );
                                }
-                       } else if ( !$retval ) {
+                       } elseif ( !$retval ) {
                                return false;
                        }
                }