diff options
author | Gervase Markham <gerv@gerv.net> | 2011-01-05 12:48:49 +0100 |
---|---|---|
committer | Gervase Markham <gerv@mozilla.org> | 2011-01-05 12:48:49 +0100 |
commit | f6a3f8319d442e832edc901ff12169ba17dceb81 (patch) | |
tree | 6626516d9161aa9ca50e1c92dcb6b4dc7ac24591 /Bugzilla/JobQueue.pm | |
parent | 237e21f002e1211113976fd08fce793e7f03c73e (diff) | |
download | bugzilla-f6a3f8319d442e832edc901ff12169ba17dceb81.tar.gz bugzilla-f6a3f8319d442e832edc901ff12169ba17dceb81.tar.xz |
Allow extensions to add new Jobs. r,a=mkanat.
https://bugzilla.mozilla.org/show_bug.cgi?id=617012
Diffstat (limited to 'Bugzilla/JobQueue.pm')
-rw-r--r-- | Bugzilla/JobQueue.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Bugzilla/JobQueue.pm b/Bugzilla/JobQueue.pm index 1046cf2c3..2804b9179 100644 --- a/Bugzilla/JobQueue.pm +++ b/Bugzilla/JobQueue.pm @@ -35,6 +35,16 @@ use constant JOB_MAP => { send_mail => 'Bugzilla::Job::Mailer', }; +sub job_map { + if (!defined(Bugzilla->request_cache->{job_map})) { + my $job_map = JOB_MAP; + Bugzilla::Hook::process('job_map', { job_map => $job_map }); + Bugzilla->request_cache->{job_map} = $job_map; + } + + return Bugzilla->request_cache->{job_map}; +} + sub new { my $class = shift; @@ -69,7 +79,7 @@ sub insert { my $self = shift; my $job = shift; - my $mapped_job = JOB_MAP->{$job}; + my $mapped_job = Bugzilla::JobQueue->job_map()->{$job}; ThrowCodeError('jobqueue_no_job_mapping', { job => $job }) if !$mapped_job; unshift(@_, $mapped_job); |