Bug 14148 - stage-marc-import.pl broken if plugins not enabled
Summary: stage-marc-import.pl broken if plugins not enabled
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: master
Hardware: All All
: P5 - low blocker (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on: 12412
Blocks:
  Show dependency treegraph
 
Reported: 2015-05-05 12:44 UTC by Katrin Fischer
Modified: 2015-12-03 22:11 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 14148: marc import broken if plugins are not enabled (1.82 KB, patch)
2015-05-05 14:24 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
[SIGNED.OFF] Bug 14148: marc import broken if plugins are not enabled (1.94 KB, patch)
2015-05-05 18:34 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
[PASSED QA] Bug 14148: marc import broken if plugins are not enabled (2.00 KB, patch)
2015-05-06 15:16 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2015-05-05 12:44:08 UTC
Dobrica reported on bug 12412:

This bug will break Koha installation if there is no enable_plugins in koha-conf.xml with following error:

Can't call method "GetPlugins" on an undefined value at /srv/koha_ffzg/tools/stage-marc-import.pl line 206, <DATA> line 603.

This is not ideal, since it will break old installations.

Problem is line:

Koha::Plugins->new()->GetPlugins('to_marc');

where Koha::Plugins->new() will return undef is plugins are not enabled.

It seems we also have same syntax in plugins/plugins-home.pl so it should probably be fixed also.

--

It's a little bit worse: plugins had to be enabled. Even adding

 <enable_plugins>0</enable_plugins>

to koha-conf.xml won't help.
Comment 1 Tomás Cohen Arazi 2015-05-05 14:24:46 UTC Comment hidden (obsolete)
Comment 2 Bernardo Gonzalez Kriegel 2015-05-05 18:34:06 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2015-05-06 15:16:23 UTC
Created attachment 38887 [details] [review]
[PASSED QA] Bug 14148: marc import broken if plugins are not enabled

Bug 12412 introduced a way to use plugins to generate MARC records
out of any arbitrary format. But failed to properly check for
a valid configuration (plugins_enabled entry on koha-conf.xml, and
even the UseKohaPlugins syspref).

This patch makes tools/stage-marc-import.pl test for the required
configuration before attempting to create the Koha::Plugins object.

To test:
1/ Make sure you don't have a plugins_enabled entry on your koha-conf.xml file
2/ On master, browse to tools/stage-marc-import.pl
=> FAIL: You get a nasty "Can't call method "GetPlugins"..." error
3/ Apply the patch and reload
=> SUCCESS: Stage MARC for import page renders correctly

Repeat with plugins_enabled == 0 and == 1. Also UseKohaPlugins enabled/disabled.
It should work as expected.

Regards
Tomas

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as described, no koha-qa errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Tomás Cohen Arazi 2015-05-06 15:45:39 UTC
Patch pushed to master.