Bugzilla – Attachment 99017 Details for
Bug 20897
Add generic cronjob to run plugins with a 'cronjob' method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20897: Add generic cronjob to run plugins with a cronjob method
Bug-20897-Add-generic-cronjob-to-run-plugins-with-.patch (text/plain), 4.66 KB, created by
Liz Rea
on 2020-02-14 19:07:43 UTC
(
hide
)
Description:
Bug 20897: Add generic cronjob to run plugins with a cronjob method
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2020-02-14 19:07:43 UTC
Size:
4.66 KB
patch
obsolete
>From cc0080ce9caf6e29da9f968bff64974388c47cb7 Mon Sep 17 00:00:00 2001 >From: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> >Date: Thu, 13 Feb 2020 10:43:49 +0200 >Subject: [PATCH] Bug 20897: Add generic cronjob to run plugins with a cronjob > method > >This adds a run_cronjob_plugins.pl script, which will run the >cronjob-methods of the installed plugins. > >Test plan: >1) Enable plugins, upload the Bug20897 test plugin >2) Set up the run_cronjob_plugins.pl in cronjob >3) Check the cron logs to see the message "PLUGIN Bug20897: CRONJOB" > shows up there every time the cronjob is run >4) Test that the plugins-home.pl -page can filter the cronjob plugins > >Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >--- > .../prog/en/modules/plugins/plugins-home.tt | 3 + > misc/cronjobs/run_cronjob_plugins.pl | 74 ++++++++++++++++++++++ > 2 files changed, 77 insertions(+) > create mode 100755 misc/cronjobs/run_cronjob_plugins.pl > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >index 5d598c525e..312f386c24 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >@@ -36,6 +36,7 @@ > <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=to_marc">View MARC conversion plugins</a></li> > <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=opac_online_payment">View online payment plugins</a></li> > <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=intranet_catalog_biblio_enhancements">View intranet catalog biblio enhancement plugins</a></li> >+ <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=cronjob">View cronjob plugins</a></li> > </ul> > </div> > </div> >@@ -56,6 +57,8 @@ > <div class="dialog message">No plugins that can process online payments via the public catalog are installed</div> > [% ELSIF method == 'intranet_catalog_biblio_enhancements' %] > <div class="dialog message">No plugins that can enhance the intranet catalog biblio records are installed</div> >+ [% ELSIF method == 'cronjob' %] >+ <div class="dialog message">No plugins that are run regularly via cronjob are installed</div> > [% ELSE %] > <div class="dialog message">Unknown plugin type <i>[% method | html %]</i></div> > [% END %] >diff --git a/misc/cronjobs/run_cronjob_plugins.pl b/misc/cronjobs/run_cronjob_plugins.pl >new file mode 100755 >index 0000000000..df75c89770 >--- /dev/null >+++ b/misc/cronjobs/run_cronjob_plugins.pl >@@ -0,0 +1,74 @@ >+#!/usr/bin/perl >+ >+# This script runs the 'cronjob' methods of installed plugins. >+ >+# Copyright 2020 Koha-Suomi >+# >+# This file is part of Koha. >+# >+# 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>. >+ >+use Modern::Perl; >+use Getopt::Long; >+use Pod::Usage; >+ >+BEGIN { >+ >+ # find Koha's Perl modules >+ # test carefully before changing this >+ use FindBin; >+ eval { require "$FindBin::Bin/../kohalib.pl" }; >+} >+ >+use Koha::Plugins; >+use C4::Context; >+ >+my $help = 0; >+ >+GetOptions( >+ 'h|help' => \$help, >+); >+ >+if ($help) { >+ pod2usage(1); >+} else { >+ if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) { >+ my @plugins = Koha::Plugins->new()->GetPlugins( { method => 'cronjob' } ); >+ foreach my $plugin (@plugins) { >+ $plugin->cronjob(); >+ } >+ } else { >+ warn "Koha plugins not enabled."; >+ } >+} >+ >+=head1 NAME >+ >+run_cronjob_plugins.pl >+ >+=head1 DESCRIPTION >+ >+Cron script to run the 'cronjob' methods of installed plugins. >+ >+=head1 SYNOPSIS >+ >+run_cronjob_plugins.pl >+ >+run_cronjob_plugins.pl -h >+ >+=head1 OPTIONS >+ >+-h : this help message >+ >+=cut >-- >2.11.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 20897
:
98803
|
98804
| 99017 |
99018