View | Details | Raw Unified | Return to bug 30410
Collapse All | Expand All

(-)a/Koha/BackgroundJob.pm (-13 / +13 lines)
Lines 260-281 Returns the available types to class mappings. Link Here
260
sub type_to_class_mapping {
260
sub type_to_class_mapping {
261
    my ($self) = @_;
261
    my ($self) = @_;
262
262
263
    my $plugins_mapping = $self->plugin_type_to_class;
263
    my $plugins_mapping = $self->plugin_types_to_classes;
264
264
265
    return ($plugins_mapping)
265
    return ($plugins_mapping)
266
      ? { %{ $self->core_type_to_class }, %{ $self->plugin_type_to_class } }
266
      ? { %{ $self->core_types_to_classes }, %{ $self->plugin_types_to_classes } }
267
      : $self->core_type_to_class;
267
      : $self->core_types_to_classes;
268
}
268
}
269
269
270
=head3 core_type_to_class
270
=head3 core_types_to_classes
271
271
272
    my $mappings = Koha::BackgrounJob->new->core_type_to_class
272
    my $mappings = Koha::BackgrounJob->new->core_types_to_classes
273
273
274
Returns the core background jobs types to class mappings.
274
Returns the core background jobs types to class mappings.
275
275
276
=cut
276
=cut
277
277
278
sub core_type_to_class {
278
sub core_types_to_classes {
279
    return {
279
    return {
280
        batch_authority_record_deletion     => 'Koha::BackgroundJob::BatchDeleteAuthority',
280
        batch_authority_record_deletion     => 'Koha::BackgroundJob::BatchDeleteAuthority',
281
        batch_authority_record_modification => 'Koha::BackgroundJob::BatchUpdateAuthority',
281
        batch_authority_record_modification => 'Koha::BackgroundJob::BatchUpdateAuthority',
Lines 287-301 sub core_type_to_class { Link Here
287
    };
287
    };
288
}
288
}
289
289
290
=head3 plugin_type_to_class
290
=head3 plugin_types_to_classes
291
291
292
    my $mappings = Koha::BackgroundJob->new->plugin_type_to_class
292
    my $mappings = Koha::BackgroundJob->new->plugin_types_to_classes
293
293
294
Returns the plugin-refined background jobs types to class mappings.
294
Returns the plugin-defined background jobs types to class mappings.
295
295
296
=cut
296
=cut
297
297
298
sub plugin_type_to_class {
298
sub plugin_types_to_classes {
299
    my ($self) = @_;
299
    my ($self) = @_;
300
300
301
    unless ( exists $self->{_plugin_mapping} ) {
301
    unless ( exists $self->{_plugin_mapping} ) {
Lines 308-316 sub plugin_type_to_class { Link Here
308
308
309
            unless ( $metadata->{namespace} ) {
309
            unless ( $metadata->{namespace} ) {
310
                Koha::Logger->get->warn(
310
                Koha::Logger->get->warn(
311
"The plugin includes the 'background_tasks' method, but doesn't provide the required 'namespace' method ("
311
                        q{A plugin includes the 'background_tasks' method, }
312
                      . $plugin->{class}
312
                      . q{but doesn't provide the required 'namespace' }
313
                      . ')' );
313
                      . qq{method ($plugin->{class})} );
314
                next;
314
                next;
315
            }
315
            }
316
316
(-)a/t/db_dependent/Koha/Plugins/BackgroundJob.t (-2 / +1 lines)
Lines 76-82 subtest 'background_tasks() hooks tests' => sub { Link Here
76
76
77
    $bj = Koha::BackgroundJob->new;
77
    $bj = Koha::BackgroundJob->new;
78
    $tasks = $bj->type_to_class_mapping;
78
    $tasks = $bj->type_to_class_mapping;
79
    $logger->warn_is("The plugin includes the 'background_tasks' method, but doesn't provide the required 'namespace' method (Koha::Plugin::Test)");
79
    $logger->warn_is("A plugin includes the 'background_tasks' method, but doesn't provide the required 'namespace' method (Koha::Plugin::Test)");
80
80
81
    $schema->storage->txn_rollback;
81
    $schema->storage->txn_rollback;
82
    Koha::Plugins::Methods->delete;
82
    Koha::Plugins::Methods->delete;
83
- 

Return to bug 30410