From befdcc8f9a30f55e91227bac0ee1813a661002b3 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Tue, 4 Oct 2011 18:43:47 -0400 Subject: more porting work --- extensions/Example/Extension.pm | 36 +++++++++++++++++++++++++++++------- extensions/Example/lib/Config.pm | 2 ++ 2 files changed, 31 insertions(+), 7 deletions(-) (limited to 'extensions/Example') diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm index ef20a28f0..4498d2b22 100644 --- a/extensions/Example/Extension.pm +++ b/extensions/Example/Extension.pm @@ -211,15 +211,12 @@ sub search_operator_field_override { sub _component_nonchanged { my $original = shift; - my $invocant = shift; - - my %func_args = @_; - $invocant->$original(%func_args); + my ($invocant, $args) = @_; + $invocant->$original($args); # Actually, it does not change anything in the result, # just an example. - my ($term) = @func_args{qw(term)}; - $$term = $$term . " OR 1=2"; + $args->{term} = $args->{term} . " OR 1=2"; } sub bugmail_recipients { @@ -264,9 +261,14 @@ sub config_modify_panels { my $auth_params = $panels->{'auth'}->{params}; my ($info_class) = grep($_->{name} eq 'user_info_class', @$auth_params); my ($verify_class) = grep($_->{name} eq 'user_verify_class', @$auth_params); - + push(@{ $info_class->{choices} }, 'CGI,Example'); push(@{ $verify_class->{choices} }, 'Example'); + + push(@$auth_params, { name => 'param_example', + type => 't', + default => 0, + checker => \&check_numeric }); } sub db_schema_abstract_schema { @@ -454,6 +456,26 @@ sub install_update_db { # $dbh->bz_add_index('example', 'example_new_column_idx', [qw(value)]); } +sub install_update_db_fielddefs { + my $dbh = Bugzilla->dbh; +# $dbh->bz_add_column('fielddefs', 'example_column', +# {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => ''}); +} + +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) = @_; diff --git a/extensions/Example/lib/Config.pm b/extensions/Example/lib/Config.pm index a126e82df..75db22957 100644 --- a/extensions/Example/lib/Config.pm +++ b/extensions/Example/lib/Config.pm @@ -25,6 +25,8 @@ use warnings; use Bugzilla::Config::Common; +our $sortkey = 5000; + sub get_param_list { my ($class) = @_; -- cgit v1.2.3-24-g4f1b