"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "includes/Hooks.php" between
mediawiki-1.31.1.tar.gz and mediawiki-1.32.0.tar.gz

About: MediaWiki is a wiki engine (the collaborative editing software that runs for e.g. Wikipedia, the free encyclopedia).

Hooks.php  (mediawiki-1.31.1):Hooks.php  (mediawiki-1.32.0)
skipping to change at line 50 skipping to change at line 50
/** /**
* Attach an event handler to a given hook. * Attach an event handler to a given hook.
* *
* @param string $name Name of hook * @param string $name Name of hook
* @param callable $callback Callback function to attach * @param callable $callback Callback function to attach
* *
* @since 1.18 * @since 1.18
*/ */
public static function register( $name, $callback ) { public static function register( $name, $callback ) {
if ( !isset( self::$handlers[$name] ) ) {
self::$handlers[$name] = [];
}
self::$handlers[$name][] = $callback; self::$handlers[$name][] = $callback;
} }
/** /**
* Clears hooks registered via Hooks::register(). Does not touch $wgHooks . * Clears hooks registered via Hooks::register(). Does not touch $wgHooks .
* This is intended for use while testing and will fail if MW_PHPUNIT_TES T is not defined. * This is intended for use while testing and will fail if MW_PHPUNIT_TES T is not defined.
* *
* @param string $name The name of the hook to clear. * @param string $name The name of the hook to clear.
* *
* @since 1.21 * @since 1.21
* @throws MWException If not in testing mode. * @throws MWException If not in testing mode.
* @codeCoverageIgnore
*/ */
public static function clear( $name ) { public static function clear( $name ) {
if ( !defined( 'MW_PHPUNIT_TEST' ) && !defined( 'MW_PARSER_TEST' ) ) { if ( !defined( 'MW_PHPUNIT_TEST' ) && !defined( 'MW_PARSER_TEST' ) ) {
throw new MWException( 'Cannot reset hooks in operation.' ); throw new MWException( 'Cannot reset hooks in operation.' );
} }
unset( self::$handlers[$name] ); unset( self::$handlers[$name] );
} }
/** /**
 End of changes. 2 change blocks. 
4 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)