From f6a3f8319d442e832edc901ff12169ba17dceb81 Mon Sep 17 00:00:00 2001 From: Gervase Markham Date: Wed, 5 Jan 2011 11:48:49 +0000 Subject: Allow extensions to add new Jobs. r,a=mkanat. https://bugzilla.mozilla.org/show_bug.cgi?id=617012 --- extensions/Example/Extension.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'extensions') 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) = @_; -- cgit v1.2.3-24-g4f1b