- $class = $wgJobClasses[$command];
-
- $job = new $class( $title, $params );
- $job->command = $command;
+ $handler = $wgJobClasses[$command];
+
+ if ( is_callable( $handler ) ) {
+ $job = call_user_func( $handler, $title, $params );
+ } elseif ( class_exists( $handler ) ) {
+ $job = new $handler( $title, $params );
+ } else {
+ $job = null;
+ }