@@ -, +, @@
method
shows up there every time the cronjob is run
---
.../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
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt
@@ -36,6 +36,7 @@
View MARC conversion plugins
View online payment plugins
View intranet catalog biblio enhancement plugins
+ View cronjob plugins
@@ -56,6 +57,8 @@
No plugins that can process online payments via the public catalog are installed
[% ELSIF method == 'intranet_catalog_biblio_enhancements' %]
No plugins that can enhance the intranet catalog biblio records are installed
+ [% ELSIF method == 'cronjob' %]
+ No plugins that are run regularly via cronjob are installed
[% ELSE %]
Unknown plugin type [% method | html %]
[% END %]
--- a/misc/cronjobs/run_cronjob_plugins.pl
+++ a/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 .
+
+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
--