+
+=cut
--- a/Makefile.PL
+++ a/Makefile.PL
@@ -230,6 +230,10 @@ Directory for Apache and Zebra logs produced by Koha.
Directory for backup files produced by Koha.
+=item PLUGINS_DIR
+
+Directory for external Koha plugins.
+
=item PAZPAR2_CONF_DIR
Directory for PazPar2 configuration files.
@@ -309,6 +313,7 @@ my $target_map = {
'./skel/var/lib/koha/zebradb/biblios/register' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
'./skel/var/lib/koha/zebradb/biblios/shadow' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
'./skel/var/lib/koha/zebradb/biblios/tmp' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
+ './skel/var/lib/koha/plugins' => { target => 'PLUGINS_DIR', trimdir => 6 },
'./sms' => 'INTRANET_CGI_DIR',
'./suggestion' => 'INTRANET_CGI_DIR',
'./svc' => 'INTRANET_CGI_DIR',
@@ -1235,6 +1240,7 @@ sub get_target_directories {
$dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
$dirmap{'LOG_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'log');
$dirmap{'BACKUP_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'spool');
+ $dirmap{'PLUGINS_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'koha', 'plugins');
$dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
$dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
} elsif ($mode eq 'dev') {
@@ -1265,6 +1271,7 @@ sub get_target_directories {
$dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
$dirmap{'LOG_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'log');
$dirmap{'BACKUP_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'spool');
+ $dirmap{'PLUGINS_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'plugins');
$dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
$dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
} else {
@@ -1287,6 +1294,7 @@ sub get_target_directories {
$dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package, 'zebradb');
$dirmap{'LOG_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'log', $package);
$dirmap{'BACKUP_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'spool', $package);
+ $dirmap{'PLUGINS_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'plugins');
$dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'zebradb');
$dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'zebradb');
}
@@ -1560,7 +1568,7 @@ make_upgrade_backup ::
\t\$(NOECHO) umask 022; \$(MOD_BACKUP) \\
/;
foreach my $key (qw/KOHA_CONF_DIR INTRANET_TMPL_DIR INTRANET_WWW_DIR OPAC_TMPL_DIR OPAC_WWW_DIR
- PAZPAR2_CONF_DIR ZEBRA_CONF_DIR/) {
+ PAZPAR2_CONF_DIR ZEBRA_CONF_DIR PLUGINS_DIR/) {
$upgrade .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or
exists $skip_directories->{$key} or
--- a/debian/templates/koha-conf-site.xml.in
+++ a/debian/templates/koha-conf-site.xml.in
@@ -257,6 +257,8 @@
1
authorities
1
+ __PLUGINS_DIR__
+ 0
/usr/share/koha/intranet/cgi-bin
/usr/share/koha/opac/cgi-bin/opac
/usr/share/koha/opac/htdocs/opac-tmpl
--- a/etc/koha-conf.xml
+++ a/etc/koha-conf.xml
@@ -276,6 +276,7 @@ __PAZPAR2_TOGGLE_XML_POST__
1
authorities
1
+ __PLUGINS_DIR__
__INTRANET_CGI_DIR__
__OPAC_CGI_DIR__/opac
__OPAC_TMPL_DIR__
--- a/etc/koha-httpd.conf
+++ a/etc/koha-httpd.conf
@@ -105,6 +105,7 @@
ScriptAlias /cgi-bin/koha/ "__INTRANET_CGI_DIR__/"
ScriptAlias /index.html "__INTRANET_CGI_DIR__/mainpage.pl"
ScriptAlias /search "__INTRANET_CGI_DIR__/search.pl"
+ Alias /plugin/ "__PLUGINS_DIR__/"
ErrorLog __LOG_DIR__/koha-error_log
# TransferLog __LOG_DIR__/koha-access.log
SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
--- a/installer/data/mysql/kohastructure.sql
+++ a/installer/data/mysql/kohastructure.sql
@@ -3056,6 +3056,17 @@ CREATE TABLE IF NOT EXISTS `borrower_modifications` (
KEY `borrowernumber` (`borrowernumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+--
+-- Table structure for table 'plugin_data'
+--
+
+CREATE TABLE IF NOT EXISTS plugin_data (
+ plugin_class varchar(255) NOT NULL,
+ plugin_key varchar(255) NOT NULL,
+ plugin_value text,
+ PRIMARY KEY (plugin_class,plugin_key)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
--- a/installer/data/mysql/sysprefs.sql
+++ a/installer/data/mysql/sysprefs.sql
@@ -416,3 +416,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES (
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number staff client searches', 'YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UNIMARCField100Language', 'fre','UNIMARC field 100 default language',NULL,'short');
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('Persona',0,'Use Mozilla Persona for login','','YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseKohaPlugins','1','Enable or disable the ability to use Koha Plugins.','','YesNo');
--- a/installer/data/mysql/updatedatabase.pl
+++ a/installer/data/mysql/updatedatabase.pl
@@ -6437,6 +6437,29 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
+$DBversion = "3.11.00.XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES ('19', 'plugins', 'Koha plugins', '0')");
+ $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES
+ ('19', 'manage', 'Manage plugins ( install / uninstall )'),
+ ('19', 'tool', 'Use tool plugins'),
+ ('19', 'report', 'Use report plugins'),
+ ('19', 'configure', 'Configure plugins')
+ ");
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseKohaPlugins','1','Enable or disable the ability to use Koha Plugins.','','YesNo')");
+
+ $dbh->do("
+ CREATE TABLE IF NOT EXISTS plugin_data (
+ plugin_class varchar(255) NOT NULL,
+ plugin_key varchar(255) NOT NULL,
+ plugin_value text,
+ PRIMARY KEY (plugin_class,plugin_key)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ ");
+
+ print "Upgrade to $DBversion done (Added plugin system.)\n";
+ SetVersion($DBversion);
+}
=head1 FUNCTIONS
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
@@ -30,6 +30,9 @@
[% IF ( CAN_user_tools ) %]
Tools
[% END %]
+ [% IF ( UseKohaPlugins && CAN_user_plugins ) %]
+ Plugins
+ [% END %]
[% IF ( CAN_user_parameters ) %]
Administration
[% END %]
@@ -93,4 +96,4 @@
[% IF ( intranetbookbag ) %]Your cart is empty.
[% END %]
-
+
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref
@@ -319,3 +319,10 @@ Enhanced Content:
- pref: HTML5MediaExtensions
class: multi
- (separated with |).
+ Plugins:
+ -
+ - pref: UseKohaPlugins
+ choices:
+ yes: Enable
+ no: "Don't enable"
+ - the ability to use Koha Plugins. Note, the plugin system must also be enabled in the Koha configuration file to be fully enabled.
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt
@@ -0,0 +1,116 @@
+[% USE KohaDates %]
+[% INCLUDE 'doc-head-open.inc' %]
+Koha › Tools › Plugins
+[% INCLUDE 'doc-head-close.inc' %]
+[% INCLUDE 'calendar.inc' %]
+
+
+
+[% INCLUDE 'header.inc' %]
+[% INCLUDE 'circ-search.inc' %]
+
+
+
+
+
+
+
+
+
Plugins
+
+ [% UNLESS ( plugins ) %]
+ [% UNLESS ( method ) %]
+
No plugins installed
+ [% ELSE %]
+ [% IF method == 'tool' %]
+
No plugins that can be used as a tool are installed
+ [% ELSIF method == 'report' %]
+
No plugins that can create a report are installed
+ [% ELSE %]
+
Unknown plugin type [% method %]
+ [% END %]
+ [% END %]
+ [% ELSE %]
+
+
+ Name |
+ |
+ Description |
+ Author |
+ Plugin Version |
+ Minimum Koha Version |
+ Maximum Koha Version |
+ Last Updated |
+ [% IF ( CAN_user_plugins_configure ) %]Configure | [% END %]
+ [% IF ( CAN_user_plugins_manage ) %]Uninstall | [% END %]
+
+
+ [% FOREACH plugin IN plugins %]
+
+ [% plugin.metadata.name %] |
+
+ [% IF ( CAN_user_plugins_report ) %]
+ [% IF plugin.can('report') %]
+ Run report
+ [% END %]
+ [% END %]
+
+ [% IF ( CAN_user_plugins_tool ) %]
+ [% IF plugin.can('tool') %]
+ Run tool
+ [% END %]
+ [% END %]
+ |
+
+ [% plugin.metadata.description %]
+
+ [% IF ( plugin.metadata.minimum_version && koha_version < plugin.metadata.minimum_version ) %]
+ Warning: This report was written for a newer version of Koha. Run at your own risk.
+ [% END %]
+
+ [% IF ( plugin.metadata.maximum_version && koha_version > plugin.metadata.maximum_version ) %]
+ Warning: This report was written for an older version of Koha. Run at your own risk.
+ [% END %]
+ |
+ [% plugin.metadata.author %] |
+ [% plugin.metadata.version %] |
+ [% plugin.metadata.minimum_version %] |
+ [% plugin.metadata.maximum_version %] |
+ [% plugin.metadata.date_updated | $KohaDates %] |
+ [% IF ( CAN_user_plugins_configure ) %]
+
+ [% IF plugin.can('configure') %]
+ Configure
+ [% END %]
+ |
+ [% END %]
+ [% IF ( CAN_user_plugins_manage ) %]
+
+ [% IF plugin.can('uninstall') %]
+ Uninstall
+ [% END %]
+ |
+ [% END %]
+ [% END %]
+
+ [% END %]
+
+
+
+
+
+
+
+
+
+
+
+[% INCLUDE 'intranet-bottom.inc' %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-upload.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-upload.tt
@@ -0,0 +1,55 @@
+[% INCLUDE 'doc-head-open.inc' %]
+Koha › Tools › Plugins › Upload Plugin
+
+[% INCLUDE 'doc-head-close.inc' %]
+[% INCLUDE 'calendar.inc' %]
+
+
+
+[% INCLUDE 'header.inc' %]
+[% INCLUDE 'circ-search.inc' %]
+
+
+
+
+
+
+
+
+
+
Upload Koha Plugin
+ [% IF ( ERRORS ) %]
+
+ [% FOREACH ERROR IN ERRORS %]
+ [% IF ( ERROR.NOTKPZ ) %]
The upload file does not appear to be a kpz file. The extention is not '.kpz'.
+ [% ELSIF ( ERROR.NOWRITETEMP ) %]This script is not able to create/write to the necessary temporary directory.
+ [% ELSIF ( ERROR.EMPTYUPLOAD ) %]The upload file appears to be empty.
+ [% ELSIF ( ERROR.UZIPFAIL ) %][% ERROR.UZIPFAIL %] failed to unpack.
Please verify the integrity of the zip file and retry.
+ [% ELSIF ( ERROR.NOWRITEPLUGINS ) %]Cannot unpack file to the plugins directory.
Please verify that the Apache user can write to the plugins directory.
+ [% ELSE %][% ERROR.CORERR %] An unknown error has occurred.
Please review the error log for more details.[% END %]
+ [% END %]
+
+ [% END %]
+
+
+
+
+
+
+[% INCLUDE 'intranet-bottom.inc' %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt
@@ -35,7 +35,16 @@
Circulation
Serials
Holds
-
+
+
+ [% IF UseKohaPlugins %]
+
Report Plugins
+
+ [% END %]
+
+
Top lists
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt
@@ -97,6 +97,11 @@
- Quote editor for Quote-of-the-day feature in OPAC
[% END %]
+ [% IF ( UseKohaPlugins && CAN_user_plugins_tool ) %]
+ - Tool Plugins
+ - Use tool plugins
+ [% END %]
+
--- a/plugins/plugins-home.pl
+++ a/plugins/plugins-home.pl
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+
+# Copyright 2010 Kyle M Hall
+#
+# 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 2 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use warnings;
+
+use CGI;
+
+use Koha::Plugins;
+use C4::Auth;
+use C4::Output;
+use C4::Dates;
+use C4::Debug;
+use C4::Context;
+
+die("Koha plugins are disabled!")
+ unless C4::Context->preference('UseKohaPlugins');
+
+my $input = new CGI;
+my $method = $input->param('method');
+
+my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+ { template_name => "plugins/plugins-home.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { plugins => '*' },
+ debug => 1,
+ }
+);
+
+$template->param(
+ koha_version => C4::Context->preference("Version"),
+ method => $method,
+);
+
+my @plugins = Koha::Plugins->new()->GetPlugins($method);
+
+$template->param( plugins => \@plugins );
+
+output_html_with_http_headers( $input, $cookie, $template->output );
--- a/plugins/plugins-uninstall.pl
+++ a/plugins/plugins-uninstall.pl
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+#
+# 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 2 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use warnings;
+
+use Archive::Extract;
+use File::Temp;
+use File::Copy;
+use CGI;
+
+use C4::Context;
+use C4::Auth;
+use C4::Output;
+use C4::Members;
+use C4::Debug;
+use Koha::Plugins::Handler;
+
+die("Koha plugins are disabled!")
+ unless C4::Context->preference('UseKohaPlugins');
+
+my $input = new CGI;
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ { template_name => "plugins/plugins-upload.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { plugins => 'manage' },
+ debug => 1,
+ }
+);
+
+my $class = $input->param('class');
+
+Koha::Plugins::Handler->delete( { class => $class } );
+
+print $input->redirect("/cgi-bin/koha/plugins/plugins-home.pl");
--- a/plugins/plugins-upload.pl
+++ a/plugins/plugins-upload.pl
@@ -0,0 +1,98 @@
+#!/usr/bin/perl
+#
+# 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 2 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use warnings;
+
+use Archive::Extract;
+use File::Temp;
+use File::Copy;
+use CGI;
+
+use C4::Context;
+use C4::Auth;
+use C4::Output;
+use C4::Members;
+use C4::Debug;
+use Koha::Plugins;
+
+die("Koha plugins are disabled!")
+ unless C4::Context->preference('UseKohaPlugins');
+
+my $input = new CGI;
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ { template_name => "plugins/plugins-upload.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { plugins => 'manage' },
+ debug => 1,
+ }
+);
+
+my $uploadfilename = $input->param('uploadfile');
+my $uploadfile = $input->upload('uploadfile');
+my $op = $input->param('op');
+
+my ( $total, $handled, @counts, $tempfile, $tfh );
+
+my %errors;
+
+if ( ( $op eq 'Upload' ) && $uploadfile ) {
+ my $plugins_dir = C4::Context->config("pluginsdir");
+
+ my $dirname = File::Temp::tempdir( CLEANUP => 1 );
+ $debug and warn "dirname = $dirname";
+
+ my $filesuffix;
+ $filesuffix = $1 if $uploadfilename =~ m/(\..+)$/i;
+ ( $tfh, $tempfile ) = File::Temp::tempfile( SUFFIX => $filesuffix, UNLINK => 1 );
+
+ $debug and warn "tempfile = $tempfile";
+
+ $errors{'NOTKPZ'} = 1 if ( $uploadfilename !~ /\.kpz$/i );
+ $errors{'NOWRITETEMP'} = 1 unless ( -w $dirname );
+ $errors{'NOWRITEPLUGINS'} = 1 unless ( -w $plugins_dir );
+ $errors{'EMPTYUPLOAD'} = 1 unless ( length($uploadfile) > 0 );
+
+ if (%errors) {
+ $template->param( ERRORS => [ \%errors ] );
+ } else {
+ while (<$uploadfile>) {
+ print $tfh $_;
+ }
+ close $tfh;
+
+ my $ae = Archive::Extract->new( archive => $tempfile, type => 'zip' );
+ unless ( $ae->extract( to => $plugins_dir ) ) {
+ warn "ERROR: " . $ae->error;
+ $errors{'UZIPFAIL'} = $uploadfilename;
+ $template->param( ERRORS => [ \%errors ] );
+ output_html_with_http_headers $input, $cookie, $template->output;
+ exit;
+ }
+ }
+} elsif ( ( $op eq 'Upload' ) && !$uploadfile ) {
+ warn "Problem uploading file or no file uploaded.";
+}
+
+if ( $uploadfile && !%errors && !$template->param('ERRORS') ) {
+ print $input->redirect("/cgi-bin/koha/plugins/plugins-home.pl");
+} else {
+ output_html_with_http_headers $input, $cookie, $template->output;
+}
--- a/plugins/run.pl
+++ a/plugins/run.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+# Copyright 2010 Kyle M Hall
+#
+# 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 2 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use warnings;
+
+use CGI;
+
+use Koha::Plugins::Handler;
+use C4::Auth;
+use C4::Output;
+use C4::Dates;
+use C4::Debug;
+use C4::Context;
+
+die("Koha plugins are disabled!")
+ unless C4::Context->preference('UseKohaPlugins');
+
+my $cgi = new CGI;
+
+my $class = $cgi->param('class');
+my $method = $cgi->param('method');
+
+my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+ { template_name => "plugins/plugins-home.tmpl",
+ query => $cgi,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { plugins => $method },
+ debug => 1,
+ }
+);
+
+my $plugin = Koha::Plugins::Handler->run( { class => $class, method => $method, cgi => $cgi } );
--- a/rewrite-config.PL
+++ a/rewrite-config.PL
@@ -43,7 +43,7 @@ guesses worked out by the script.
The following configuration keywords are available:
PREFIX,
-BASE_DIR, CGI_DIR, LOG_DIR, INSTALL_BASE,
+BASE_DIR, CGI_DIR, LOG_DIR, PLUGINS_DIR, INSTALL_BASE,
DB_TYPE, DB_HOST, DB_PORT, DB_NAME, DB_PASS, DB_USER, WEBMASTER_EMAIL, WEBSERVER_DOMAIN,
WEBSERVER_HOST, WEBSERVER_IP, WEBSERVER_PORT, WEBSERVER_PORT_LIBRARIAN, ZEBRA_PASS, ZEBRA_USER
@@ -82,6 +82,7 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr";
%configuration = (
"__KOHA_INSTALLED_VERSION__" => "no_version_found",
"__LOG_DIR__" => "/var/log",
+ "__PLUGINS_DIR__" => "/var/lib/koha/plugins",
"__DB_TYPE__" => "mysql",
"__DB_NAME__" => "koha",
"__DB_HOST__" => $myhost,
--- a/skel/var/lib/koha/plugins/README
+++ a/skel/var/lib/koha/plugins/README
@@ -0,0 +1, @@
+plugins dir
--