Bug 26803

Summary: Fix PLUGIN_DIR when plugin_dirs is multivalued
Product: Koha Reporter: Frédéric Demians <frederic>
Component: Plugin architectureAssignee: Frédéric Demians <frederic>
Status: Pushed to master --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: arthur.suzuki, fridolin.somers, kyle.m.hall
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Text to go in the release notes:
Version(s) released in:
20.11.00
Bug Depends on: 22834, 23237    
Bug Blocks:    
Attachments: Bug 26803 - Fix PLUGIN_DIR when plugin_dirs is multivalued
Bug 26803 - Fix PLUGIN_DIR when plugin_dirs is multivalued
Bug 26803 - Fix PLUGIN_DIR when plugin_dirs is multivalued

Description Frédéric Demians 2020-10-23 16:17:28 UTC
When plugin_dir koha-conf.xml parameter contains more than one directory, PLUGIN_DIR parameter sent to templates doesn't contain the proper value, ie the base directory of the current plugin.
Comment 1 Frédéric Demians 2020-10-23 16:20:50 UTC
See bug 23237
Comment 2 Frédéric Demians 2020-10-23 16:21:39 UTC
Created attachment 112295 [details] [review]
Bug 26803 - Fix PLUGIN_DIR when plugin_dirs is multivalued

When plugin_dir koha-conf.xml parameter contains more than one
directory, PLUGIN_DIR parameter sent to templates doesn't contain the
proper value, ie the base directory of the current plugin.

See bug 23237
Comment 3 Arthur Suzuki 2020-10-24 03:03:46 UTC
Created attachment 112362 [details] [review]
Bug 26803 - Fix PLUGIN_DIR when plugin_dirs is multivalued

When plugin_dir koha-conf.xml parameter contains more than one
directory, PLUGIN_DIR parameter sent to templates doesn't contain the
proper value, ie the base directory of the current plugin.

See bug 23237

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 4 Arthur Suzuki 2020-10-24 03:19:59 UTC
I propose the following test plan :
1) install a plugin which make use of PLUGIN_DIR in templates and check it works
2) adding a new plugin dir to koha-conf.xml and restart_all
3) plugin doesn't work anymore.
4) apply patch and restart_all
5) the plugin should now work

As an example plugin which requires the variable I used this one : 
https://github.com/fredericd/Koha-Plugin-Tamil-Mirabel
Comment 5 Frédéric Demians 2020-10-24 07:02:28 UTC
Thanks Arthur for the test plan. The plugin concerned can be directly downloaded using this link:

https://www.tamil.fr/download/koha-plugin-tamil-mirabel-1.0.2.kpz
Comment 6 Fridolin Somers 2020-10-26 10:30:54 UTC
I'm ok this works, but I think its much better to keep get_plugin_dir() method.
There a chance it is used by some plugins.
Just change its content to return bundle_path().

Also this is a bug report more than enhancement no ?
Comment 7 Kyle M Hall 2020-10-26 13:49:28 UTC
Created attachment 112518 [details] [review]
Bug 26803 - Fix PLUGIN_DIR when plugin_dirs is multivalued

When plugin_dir koha-conf.xml parameter contains more than one
directory, PLUGIN_DIR parameter sent to templates doesn't contain the
proper value, ie the base directory of the current plugin.

See bug 23237

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Fridolin Somers 2020-10-26 14:58:13 UTC
(In reply to Fridolin SOMERS from comment #6)
> I'm ok this works, but I think its much better to keep get_plugin_dir()
> method.
> There a chance it is used by some plugins.
> Just change its content to return bundle_path().
> 
> Also this is a bug report more than enhancement no ?

Ah OK method plugin_dir() is quite new (19.11). So I'd say its OK to remove it.
Comment 9 Jonathan Druart 2020-11-04 12:04:26 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 10 Fridolin Somers 2020-11-05 09:54:09 UTC
This is a bug report more than enhancement no ?
Please backport.
Comment 11 Katrin Fischer 2020-11-05 12:03:11 UTC
(In reply to Fridolin SOMERS from comment #10)
> This is a bug report more than enhancement no ?
> Please backport.

Please change Importance in this case. :)
Comment 12 Fridolin Somers 2020-11-05 13:07:23 UTC
(In reply to Katrin Fischer from comment #11)
> (In reply to Fridolin SOMERS from comment #10)
> > This is a bug report more than enhancement no ?
> > Please backport.
> 
> Please change Importance in this case. :)

Ok cool I was waiting the assignee to agree ;)
Comment 13 Frédéric Demians 2020-11-05 16:10:53 UTC
Thks Fridolin. I agree with you. It could be backported down to 19.11