Bug 9890

Summary: Fix the new plugin system for package installs
Product: Koha Reporter: Magnus Enger <magnus>
Component: PackagingAssignee: Bugs List <koha-bugs>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: gmcharlt, kyle, robin, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9883
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 7804    
Bug Blocks:    
Attachments: Bug 9890 - Fix the new plugin system for package installs
[PASSED QA] Bug 9890 - Fix the new plugin system for package installs
Bug 9890 - Fix koha-create and koha-create-dirs
Bug 9890 - Fix koha-create and koha-create-dirs
Bug 9890 - Fix koha-create and koha-create-dirs
Signed off patch

Description Magnus Enger 2013-03-21 14:32:16 UTC
The packages need a couple of followup fixes for the new plugin system to work optimally, I think. 

On an installation running off the alpha2 packages (3.11-1~git+20130321124944.90dfa923) I have this in koha-conf.xml:

 <pluginsdir>__PLUGINS_DIR__</pluginsdir>
 <enable_plugins>0</enable_plugins>

This can be fixed manually if you want to enable the plugin system, of course, but I think it would be better if:

1. The <pluginsdir> came ready filled with a standard value. Something like /var/lib/koha/<instancename>/plugins perhaps? 

2. koha-create-dirs created the directory set by <pluginsdir>, with the right permissions
Comment 1 Magnus Enger 2013-03-21 15:24:16 UTC
Hm, another problem: The plugins/ dir is missing from /usr/share/koha/intranet/cgi-bin/, so when i choose "Plugins" from the "More" menu in an installation running off the packages i get a 404 error. 

I'm not sure what is responsible for putting it in the right place? Makefile.PL? Perhaps it needs a line like this around line 295?

  './plugins' => 'INTRANET_CGI_DIR',
Comment 2 Magnus Enger 2013-03-21 16:03:38 UTC
So I copied the necessary files to /usr/share/koha/intranet/cgi-bin/plugins/ to be able to test some more and I notice that the "Upload a plugin" link on the left hand side of plugins-home.pl is not showing, either when I am logged in as superlibrarian or as a "regular" user with all the plugin permissions. This might be caused by my ad hoc attempts to fix the previous problems, but it at least deserves another look when the other problems are fixed.
Comment 3 Magnus Enger 2013-03-21 16:09:41 UTC
When I access plugins-upload.pl directly, I can upload the KitchenSink plugin without trouble, so the problem is just related to the display of the "Upload a plugin" link.
Comment 4 Robin Sheat 2013-03-22 01:31:51 UTC
OK, so as I understand it, we'd need to:

1) koha-create: fill in __PLUGINS_DIR__
2) leave the enable_plugins as off (at least for now)
3) koha-create-dirs: create the directory, set permissions (writeable by the koha user)
4) I'm not sure what the deal is with the cgi-bin/plugins directory. What goes there? How is it generated in a normal installation?
Comment 5 Magnus Enger 2013-03-22 06:03:58 UTC
(In reply to comment #4)
> OK, so as I understand it, we'd need to:
> 
> 1) koha-create: fill in __PLUGINS_DIR__
> 2) leave the enable_plugins as off (at least for now)
> 3) koha-create-dirs: create the directory, set permissions (writeable by the
> koha user)

3 x yup.

> 4) I'm not sure what the deal is with the cgi-bin/plugins directory. What
> goes there? How is it generated in a normal installation?

The contents of the plugins/ directory, which contains plugins- home.pl etc, in the same way as all the other top level dirs for the intranet.
Comment 6 Robin Sheat 2013-03-22 06:24:07 UTC
Why is that not created by the makefile like everything else?
Comment 7 Magnus Enger 2013-03-22 07:14:51 UTC
(In reply to comment #6)
> Why is that not created by the makefile like everything else?

Beats me, Im afraid...
Comment 8 Kyle M Hall (khall) 2013-03-22 08:15:25 UTC
One note, /plugins/ is where the plugin system lives ( plugins-home.pl, etc ) and /plugin/ is an Alias in the Apache config to the directory where installed plugins live ( var/lib/plugins )
Comment 9 Katrin Fischer 2013-03-22 11:40:23 UTC
Some more comments after digging around some more:

(In reply to comment #4)
> OK, so as I understand it, we'd need to:
> 
> 1) koha-create: fill in __PLUGINS_DIR__

And we probably want to have some standard location, so all we really need to fill in is the instancename.

> 2) leave the enable_plugins as off (at least for now)

Yeah, Jared seems very set on making sure plugins are not enabled by accident... ;-)

> 3) koha-create-dirs: create the directory, set permissions (writeable by the
> koha user)

An alternative approach could be to have a separate script like koha-plugins-enable that creates the dirs only when they are actually needed. But putting it in koha-create-dirs is probably a lot less work...

> 4) I'm not sure what the deal is with the cgi-bin/plugins directory. What
> goes there? How is it generated in a normal installation?s 

As far as I can tell, the problem is that the new plugins/ dir we have in the repository is not mentioned in Makefile.PL. I wonder if this will result in the same problem Im seeing on a standard install?

I got the paths slightly wrong. This is the URL from Plugins in the More menu, which gives me a 404:

/cgi-bin/koha/plugins/plugins-home.pl

As Kyle pointed out there is another problem too:

5) The Alias /plugin/ ... stuff is missing from the Apache configs installed by the packages.
Comment 10 Kyle M Hall (khall) 2013-03-22 13:31:58 UTC Comment hidden (obsolete)
Comment 11 Katrin Fischer 2013-03-22 14:04:35 UTC Comment hidden (obsolete)
Comment 12 Katrin Fischer 2013-03-22 14:09:15 UTC
(14:58:28) jcamins: bug 9890 just needs one sign off or QA.
(14:58:29) huginn: Bug http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9890 normal, P5 - low, ---, koha-bugs, Needs Signoff , Fix the new plugin system for package installs
(14:58:49) jcamins: I will QA it myself.
Comment 13 Jared Camins-Esakov 2013-03-22 20:54:28 UTC
This patch has been pushed to master.
Comment 14 Robin Sheat 2013-03-24 21:39:55 UTC
OK, so that patch solves the bit I was unsure of, so that leaves setting up the directories and the koha-conf, right?
Comment 15 Magnus Enger 2013-03-24 23:16:46 UTC
(In reply to comment #14)
> OK, so that patch solves the bit I was unsure of, so that leaves setting up
> the directories and the koha-conf, right?

Yea, and the Apache conf.
Comment 16 Katrin Fischer 2013-04-17 05:22:04 UTC
Any news on this?
Comment 17 Tomás Cohen Arazi (tcohen) 2013-05-27 15:33:25 UTC Comment hidden (obsolete)
Comment 18 Tomás Cohen Arazi (tcohen) 2013-05-27 15:34:22 UTC
I'm not sure if anything else is needed for packages, and no one is around today to ask :-(
Comment 19 Tomás Cohen Arazi (tcohen) 2013-05-31 19:02:02 UTC Comment hidden (obsolete)
Comment 20 Kyle M Hall (khall) 2013-06-03 11:50:35 UTC Comment hidden (obsolete)
Comment 21 Katrin Fischer 2013-06-16 07:26:01 UTC
Robin, could you ake a look at this maybe?
Comment 22 Robin Sheat 2013-06-24 03:16:55 UTC
Created attachment 19200 [details] [review]
Signed off patch

Attached is the signed off patch.

(git bz is broken.)
Comment 23 Galen Charlton 2013-06-24 13:57:39 UTC
Pushed to master.  Thanks, Tomás!
Comment 24 Tomás Cohen Arazi (tcohen) 2013-07-07 00:11:58 UTC
This patch has been pushed to 3.12.x, will be in 3.12.2.