[Bug 43564] New: Add ability to pass arguments to plugins in plugins_nightly.pl
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43564 Bug ID: 43564 Summary: Add ability to pass arguments to plugins in plugins_nightly.pl Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Plugin architecture Assignee: koha-bugs@lists.koha-community.org Reporter: bastien.chauvet@inlibro.com QA Contact: testopia@bugs.koha-community.org CC: kyle@bywatersolutions.com, martin.renvoize@openfifth.co.uk, tomascohen@gmail.com Target Milestone: --- It would be beneficial for plugins_nightly.pl to accept arguments to pass to plugins using the cronjob_nightly() method. As it would allow those plugins to more easily adapt their behaviour depending on the situation. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43564 --- Comment #1 from Bastien Chauvet <bastien.chauvet@inlibro.com> --- Created attachment 206317 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206317&action=edit Bug 43564: Add ability to pass arguments to plugins in plugins_nightly.pl Added a new option '-a|--argument', accepting 'key=value' parameters, and gives its hashref to the cronjob_nightly() method used by plugins. Test plan: 1- Make sure you have any plugin you will be able to edit with cronjob_nightly() method installed. Run {PATH}/plugins_nightly.pl, to observe standard behaviour of your plugin. 2- Apply patch. 3- Run plugins_nightly.pl and check if plugin is running as intended. 4- Modify your plugin's cronjob_nightly() method to accept and use a hashref passed as argument : - modify the first line of the method: my ($self) = @_; --> my ($self, $args) = @_; - add a way to check on specific hash keys and values, e.g 'foo=Bob' and 'bar=Alice': say exists $args->{foo} ? $args->{foo} : "No foo"; if (exists $args->{bar}) { if ($args->{bar} eq "Alice") { say "bar is Alice"; } else { say "bar is not Alice"; } } - Feel free to adapt those lines to test deeper interactions. 5- Run plugins_nightly.pl again, mutiple times with different arguments : {PATH}/plugins_nightly.pl -a 'foo=Bob' 'bar=Alice' {PATH}/plugins_nightly.pl --argument 'foo=Bob' -a 'bar=Alice' {PATH}/plugins_nightly.pl -a 'foo=Bob' {PATH}/plugins_nightly.pl --argument 'bar=Alice' {PATH}/plugins_nightly.pl -a 'bar=John' {PATH}/plugins_nightly.pl -a 'unknownKey=unknownValue' Once again, you can try out more options (such as commands with --metadata, used to filter executed plugins), Also, make sure "{PATH}/plugins_nightly.pl" executed with no option still works as intended. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43564 Bastien Chauvet <bastien.chauvet@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org