/** * Create an object of a subclass * $command has to match the job's classname! */ static function factory($command, $title, $params = false, $id = 0) { //Workaround //makes the existing jobs work with the new mechanism switch ($command) { case 'refreshLinks' : $jobfilename = 'RefreshLinksJob'; break; case 'htmlCacheUpdate': case 'html_cache_update': # BC return new HTMLCacheUpdateJob( $title, $params['table'], $params['start'], $params['end'], $id ); case 'sendMail': return new EmaillingJob($params); case 'enotifNotify': return new EnotifNotifyJob($title, $params); default : $jobfilename = $command; } try { wfProfileIn(__METHOD__.'-autoload'); __autoload($jobfilename); return new $jobfilename ($title, $params, $id); wfProfileOut(__METHOD__.'-autoload'); } catch (Exception $e) { throw new MWException("Invalid job command \"$command\"\\n. Could not load class ".$jobfilename." "); } }