Bugzilla – Attachment 173557 Details for
Bug 37495
Add ability to use metadata to filter plugins to run for plugins_nightly.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37495: Add ability to use metadata to filter plugins to run for plugins_nightly.pl
Bug-37495-Add-ability-to-use-metadata-to-filter-pl.patch (text/plain), 3.43 KB, created by
Martin Renvoize (ashimema)
on 2024-10-28 15:25:47 UTC
(
hide
)
Description:
Bug 37495: Add ability to use metadata to filter plugins to run for plugins_nightly.pl
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-10-28 15:25:47 UTC
Size:
3.43 KB
patch
obsolete
>From 2187eff61dcdef95f8da74c0eb6a158ef18d9a48 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 26 Jul 2024 10:48:17 -0400 >Subject: [PATCH] Bug 37495: Add ability to use metadata to filter plugins to > run for plugins_nightly.pl > >It would be nice to be able to filter the plugins run by plugins >nightly for development and testing, and for added flexibility >as to when to run cronjob_nightly for different plugins if need be. > >Test Plan: >1) Apply this patch >2) Check the metadata for an installed plugin, copy the name or another > metadata value. >3) Run plugins_nightly.pl with a filter that does not match > e.g. plugins_nightly.pl -m name="No plugin has this name" >4) Note no plugins cronjob methods are run >5) Run plugins_nightly.pl with a filter that *does* match > e.g. plugins_nightly.pl -m name="Example Kitchen-Sink Plugin" >6) Not only the matching plugin runs! >7) Run plugins_nightly with no filter > e.g. plugins_nightly.pl >8) Note all plugins with nightly cronjobs are run! > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > misc/cronjobs/plugins_nightly.pl | 30 ++++++++++++++++++++++-------- > 1 file changed, 22 insertions(+), 8 deletions(-) > >diff --git a/misc/cronjobs/plugins_nightly.pl b/misc/cronjobs/plugins_nightly.pl >index f30633ff074..8c8cce7eac6 100755 >--- a/misc/cronjobs/plugins_nightly.pl >+++ b/misc/cronjobs/plugins_nightly.pl >@@ -2,7 +2,9 @@ > > use Modern::Perl; > >-use Try::Tiny qw( catch try ); >+use Getopt::Long qw( GetOptions ); >+use Pod::Usage qw( pod2usage ); >+use Try::Tiny qw( catch try ); > > use C4::Context; > use C4::Log qw( cronlogaction ); >@@ -10,14 +12,23 @@ use Koha::Logger; > use Koha::Plugins; > use Koha::Script -cron; > >-my $command_line_options = join(" ",@ARGV); >-cronlogaction({ info => $command_line_options }); >+my $command_line_options = join( " ", @ARGV ); >+cronlogaction( { info => $command_line_options } ); >+ >+my $metadata; >+my $help; >+GetOptions( >+ 'm|metadata=s%' => \$metadata, >+ 'h|help' => \$help, >+) or pod2usage(2); >+pod2usage(1) if $help; > > my $logger = Koha::Logger->get(); > if ( C4::Context->config("enable_plugins") ) { > my @plugins = Koha::Plugins->new->GetPlugins( > { >- method => 'cronjob_nightly', >+ method => 'cronjob_nightly', >+ metadata => $metadata, > } > ); > >@@ -27,8 +38,7 @@ if ( C4::Context->config("enable_plugins") ) { > cronlogaction( { info => "$plugin_name" } ); > $plugin->cronjob_nightly(); > cronlogaction( { action => "End", info => "$plugin_name COMPLETED" } ); >- } >- catch { >+ } catch { > cronlogaction( { action => "Error", info => "$plugin_name FAILED with error: $_" } ); > warn "$_"; > $logger->warn("$_"); >@@ -36,7 +46,7 @@ if ( C4::Context->config("enable_plugins") ) { > } > } > >-cronlogaction({ action => 'End', info => "COMPLETED" }); >+cronlogaction( { action => 'End', info => "COMPLETED" } ); > > =head1 NAME > >@@ -44,7 +54,11 @@ plugins_nightly.pl - Run nightly tasks specified by plugins > > =head1 SYNOPSIS > >-plugins_nightly.pl >+plugins_nightly.pl [-m|--metadata key=value] >+ >+-m --metadata, repeatable, specify a metadata key and value to run only plugins >+ with nightly_cronjob methods and matching metadata. >+ e.g. plugins_nightly.pl -m name="My Awesome Plugin" > > =head1 AUTHOR > >-- >2.47.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37495
:
169741
|
169826
|
172200
| 173557