From: Aaron Schulz Date: Thu, 21 Jun 2007 14:12:50 +0000 (+0000) Subject: *Add $wgCustomJobs for adding functions/subclasses to jobqueue X-Git-Tag: 1.31.0-rc.0~52475 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=b8cd62a85828bbba1c0b00ca3b9e5677caa849bd;p=lhc%2Fweb%2Fwiklou.git *Add $wgCustomJobs for adding functions/subclasses to jobqueue --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 253a87c1ed..6315c4d8c9 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1359,6 +1359,12 @@ $wgWantedPagesThreshold = 1; /** Enable slow parser functions */ $wgAllowSlowParserFunctions = false; +/** + * Extra custom jobs can be added to the Job Queue system. + * This array should consist of job name => job queue subclass pairs + */ +$wgCustomJobs = array(); + /** * To use inline TeX, you need to compile 'texvc' (in the 'math' subdirectory of * the MediaWiki package and have latex, dvips, gs (ghostscript), andconvert diff --git a/includes/JobQueue.php b/includes/JobQueue.php index a4e49635ef..ba10b28516 100644 --- a/includes/JobQueue.php +++ b/includes/JobQueue.php @@ -174,14 +174,23 @@ abstract class Job { case 'refreshLinks': return new RefreshLinksJob( $title, $params, $id ); case 'htmlCacheUpdate': + return; case 'html_cache_update': # BC return new HTMLCacheUpdateJob( $title, $params['table'], $params['start'], $params['end'], $id ); case 'sendMail': - return new EmaillingJob($params); + return new EmaillingJob( $params ); case 'enotifNotify': - return new EnotifNotifyJob($title, $params); - default: - throw new MWException( "Invalid job command \"$command\"" ); + return new EnotifNotifyJob( $title, $params ); + } + // OK, check if this is a custom job + global $wgCustomJobs; + wfLoadAllExtensions(); // This may be for an extension + + if( isset($wgCustomJobs[$command]) ) { + $class = $wgCustomJobs[$command]; + return new $class($title, $params, $id); + } else { + throw new MWException( "Invalid job command \"$command\"" ); } }