*Add $wgCustomJobs for adding functions/subclasses to jobqueue
authorAaron Schulz <aaron@users.mediawiki.org>
Thu, 21 Jun 2007 14:12:50 +0000 (14:12 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Thu, 21 Jun 2007 14:12:50 +0000 (14:12 +0000)
includes/DefaultSettings.php
includes/JobQueue.php

index 253a87c..6315c4d 100644 (file)
@@ -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
index a4e4963..ba10b28 100644 (file)
@@ -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\"" );
                }
        }