diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-12-08 09:55:49 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-12-08 09:55:49 +0100 |
commit | 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch) | |
tree | af68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /includes/CallableUpdate.php | |
parent | af4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff) |
Update to MediaWiki 1.22.0
Diffstat (limited to 'includes/CallableUpdate.php')
-rw-r--r-- | includes/CallableUpdate.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/includes/CallableUpdate.php b/includes/CallableUpdate.php new file mode 100644 index 00000000..6eb55413 --- /dev/null +++ b/includes/CallableUpdate.php @@ -0,0 +1,30 @@ +<?php + +/** + * Deferrable Update for closure/callback + */ +class MWCallableUpdate implements DeferrableUpdate { + + /** + * @var closure/callabck + */ + private $callback; + + /** + * @param callable $callback + */ + public function __construct( $callback ) { + if ( !is_callable( $callback ) ) { + throw new MWException( 'Not a valid callback/closure!' ); + } + $this->callback = $callback; + } + + /** + * Run the update + */ + public function doUpdate() { + call_user_func( $this->callback ); + } + +} |