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 /extensions/Example | |
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 'extensions/Example')
-rw-r--r-- | extensions/Example/Extension.pm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm index 0fb56a32f..ab773561d 100644 --- a/extensions/Example/Extension.pm +++ b/extensions/Example/Extension.pm @@ -386,6 +386,20 @@ sub install_before_final_checks { print "Install-before_final_checks hook\n" unless $args->{silent}; } +sub job_map { + my ($self, $args) = @_; + + my $job_map = $args->{job_map}; + + # This adds the named class (an instance of TheSchwartz::Worker) as a + # handler for when a job is added with the name "some_task". + $job_map->{'some_task'} = 'Bugzilla::Extension::Example::Job::SomeClass'; + + # Schedule a job like this: + # my $queue = Bugzilla->job_queue(); + # $queue->insert('some_task', { some_parameter => $some_variable }); +} + sub mailer_before_send { my ($self, $args) = @_; |