Bugzilla – Attachment 153746 Details for
Bug 34335
Run Koha plugin method from CLI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34335: Add a script to run Koha plugin methods from the CLI
Bug-34335-Add-a-script-to-run-Koha-plugin-methods-.patch (text/plain), 2.58 KB, created by
David Cook
on 2023-07-21 01:27:58 UTC
(
hide
)
Description:
Bug 34335: Add a script to run Koha plugin methods from the CLI
Filename:
MIME Type:
Creator:
David Cook
Created:
2023-07-21 01:27:58 UTC
Size:
2.58 KB
patch
obsolete
>From 216d8b2985336982948ab3ea755b594fff6d34f0 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 21 Jul 2023 01:25:21 +0000 >Subject: [PATCH] Bug 34335: Add a script to run Koha plugin methods from the > CLI > >This change adds a script which allows you to run a method from >a Koha plugin. > >Test plan: >0. Apply patch >1. Upload test plugin >2. Run the following: >perl misc/run_koha_plugin.pl --class Koha::Plugin::Prosentient::CustomMethodPlugin --method awesome_method >3. Note the following CLI message: >This is a custom method that you're seeing on the CLI! > at /var/lib/koha/kohadev/plugins/Koha/Plugin/Prosentient/CustomMethodPlugin.pm line 42. >--- > misc/run_koha_plugin.pl | 69 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 69 insertions(+) > create mode 100755 misc/run_koha_plugin.pl > >diff --git a/misc/run_koha_plugin.pl b/misc/run_koha_plugin.pl >new file mode 100755 >index 0000000000..9e01842f33 >--- /dev/null >+++ b/misc/run_koha_plugin.pl >@@ -0,0 +1,69 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Copyright 2023 Koha Development Team >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+ >+=head1 NAME >+ >+run_koha_plugin.pl - Script to execute a Koha plugin from the CLI >+ >+=head1 SYNOPSIS >+ >+./run_koha_plugin --class Koha::Plugin::Awesome --method awesome_method >+ >+=head1 DESCRIPTION >+ >+This script will load the specified Koha plugin class and run the specified method >+ >+=head1 OPTIONS >+ >+=over >+ >+=item B<--class> >+ >+This is the class/package name of the Koha plugin in Perl module syntax >+ >+=item B<--method> >+ >+This is the name of the method to run. It must already be registered in Koha's >+database. >+ >+=back >+ >+=cut >+ >+use Modern::Perl; >+use Getopt::Long; >+use Pod::Usage; >+ >+use Koha::Script; >+use Koha::Plugins::Handler; >+ >+my $class; >+my $method; >+ >+GetOptions( >+ "class=s" => \$class, >+ "method=s" => \$method, >+) || pod2usage(1); >+ >+if ( $class && $method ) { >+ my $result = Koha::Plugins::Handler->run( { class => $class, method => $method } ); >+} else { >+ pod2usage(1); >+} >-- >2.30.2
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 34335
:
153746
|
153747
|
153748
|
153749
|
153760