X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FDeferredUpdates.php;h=a321414ae50c6476df74172eed2c3015486fd11c;hb=ae6e6edcca46dff2f367a782500f761c3ef0ac1d;hp=716e65c8c39421acc563dec374ed2a78156443c2;hpb=4b3c86cc6ee79647c10dcbb90a1d11db03501931;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/DeferredUpdates.php b/includes/DeferredUpdates.php index 716e65c8c3..a321414ae5 100644 --- a/includes/DeferredUpdates.php +++ b/includes/DeferredUpdates.php @@ -34,7 +34,7 @@ interface DeferrableUpdate { } /** - * Class for mananging the deferred updates. + * Class for managing the deferred updates. * * @since 1.19 */ @@ -63,10 +63,20 @@ class DeferredUpdates { self::addUpdate( new HTMLCacheUpdate( $title, $table ) ); } + /** + * Add a callable update. In a lot of cases, we just need a callback/closure, + * defining a new DeferrableUpdate object is not necessary + * @see MWCallableUpdate::__construct() + * @param callable $callable + */ + public static function addCallableUpdate( $callable ) { + self::addUpdate( new MWCallableUpdate( $callable ) ); + } + /** * Do any deferred updates and clear the list * - * @param $commit String: set to 'commit' to commit after every update to + * @param string $commit set to 'commit' to commit after every update to * prevent lock contention */ public static function doUpdates( $commit = '' ) {