Merge "filebackend: cleaned up the FileBackend constructor"
[mediawiki.git] / includes / deferred / CallableUpdate.php
blobf0569dde5c9dde3fec12363f0336bd64fd1af9ee
1 <?php
3 /**
4 * Deferrable Update for closure/callback
5 */
6 class MWCallableUpdate implements DeferrableUpdate {
7 /**
8 * @var closure/callback
9 */
10 private $callback;
12 /**
13 * @param callable $callback
14 * @throws MWException
16 public function __construct( $callback ) {
17 if ( !is_callable( $callback ) ) {
18 throw new MWException( 'Not a valid callback/closure!' );
20 $this->callback = $callback;
23 /**
24 * Run the update
26 public function doUpdate() {
27 call_user_func( $this->callback );