bug 23191 added a script to allow installation of plugins from the command line. There can be an issue when a plugin no longer compiles after an upgrade, Koha will not load, the script will not run either. We should repair the script so that it can remove plugin methods that no longer function or have been deleted.
Created attachment 105143 [details] [review] Bug 25549: Remove plugin methods for broken plugins To test: 1 - Enable plugins in the koha-conf 2 - Install the kitchen sink plugin 3 - Your staff client should be orange now :-) 4 - edit the plugin module /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm 5 - Add a line to break compilation, like: this won't compile 6 - Restart all 7 - Your koha is now broken 8 - kshell 9 - perl misc/devel/install_plugins.pl 10 - Restart all 11 - Koha remains broken 12 - Apply patch 13 - kshell 14 - perl misc/devel/install_plugins.pl 15 - Koha now works! 16 - Koha is not orange because the plugin methods are removed
Whaoo super, I had this issue when playing with plugins install. All perl is broken if a plugins is broken or its source removed.
Created attachment 110896 [details] [review] Bug 25549: Remove plugin methods for broken plugins To test: 1 - Enable plugins in the koha-conf 2 - Install the kitchen sink plugin 3 - Your staff client should be orange now :-) 4 - edit the plugin module /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm 5 - Add a line to break compilation, like: this won't compile 6 - Restart all 7 - Your koha is now broken 8 - kshell 9 - perl misc/devel/install_plugins.pl 10 - Restart all 11 - Koha remains broken 12 - Apply patch 13 - kshell 14 - perl misc/devel/install_plugins.pl 15 - Koha now works! 16 - Koha is not orange because the plugin methods are removed Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Whilst this is great and resolves the bug mentioned (I've hit this too), it breaks the output of the script as the 'existing_plugins' array used to contain the 'plugins before' call to InstallPlugins but now runs after the call to InstallPlugins and so will not be a comparison.
I think we need to move the call to GetPlugins in install_plugins.pl back up to where it we and add the option to run GetPlugins with 'can_load' in this case. It would be nice to report the deletions too.
Created attachment 111324 [details] [review] Bug 25549: Remove plugin methods for broken plugins To test: 1 - Enable plugins in the koha-conf 2 - Install the kitchen sink plugin 3 - Your staff client should be orange now :-) 4 - edit the plugin module /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm 5 - Add a line to break compilation, like: this won't compile 6 - Restart all 7 - Your koha is now broken 8 - kshell 9 - perl misc/devel/install_plugins.pl 10 - Restart all 11 - Koha remains broken 12 - Apply patch 13 - kshell 14 - perl misc/devel/install_plugins.pl 15 - Koha now works! 16 - Koha is not orange because the plugin methods are removed
Created attachment 111335 [details] [review] Bug 25549: Remove plugin methods for broken plugins To test: 1 - Enable plugins in the koha-conf 2 - Install the kitchen sink plugin 3 - Your staff client should be orange now :-) 4 - edit the plugin module /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm 5 - Add a line to break compilation, like: this won't compile 6 - Restart all 7 - Your koha is now broken 8 - kshell 9 - perl misc/devel/install_plugins.pl 10 - Restart all 11 - Koha remains broken 12 - Apply patch 13 - kshell 14 - perl misc/devel/install_plugins.pl 15 - Koha now works! 16 - Koha is not orange because the plugin methods are removed
Created attachment 111345 [details] [review] Bug 25549: Remove plugin methods for broken plugins To test: 1 - Enable plugins in the koha-conf 2 - Install the kitchen sink plugin 3 - Your staff client should be orange now :-) 4 - edit the plugin module /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm 5 - Add a line to break compilation, like: this won't compile 6 - Restart all 7 - Your koha is now broken 8 - kshell 9 - perl misc/devel/install_plugins.pl 10 - Restart all 11 - Koha remains broken 12 - Apply patch 13 - kshell 14 - perl misc/devel/install_plugins.pl 15 - Koha now works! 16 - Koha is not orange because the plugin methods are removed Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 111346 [details] [review] Bug 25549: Add error reporting to plugins-home This patch adds handling for the newly introduced 'errors' option in GetPlugins and reports erroroneos plugins to the user. To test: 1 - Enable plugins in the koha-conf 2 - Install the kitchen sink plugin 3 - Your staff client should be orange now :-) 4 - The plugin should display as installed in the table at tools/plugins. 5 - edit the plugin module /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm 6 - Add a line to break compilation, like: this won't compile 7 - Restart all 8 - Your Koha is not broken, but is no longer orange (The plugin is not loading). 9 - The plugin should display as unable to load in the table at tools/plugins. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This works really well.. the switch to using can_load in the GetPlugins call has the added benefit that the initial 'broken koha' issue goes away entirely.. just the plugin functionality won't load. I've added a followup that restores the InstallPlugins call such that erroneoes plugins are no longer removed by calling it (as they no longer cause an issue) and now use such occurrences along with the errors flag on GetPlugins to highlight broken plugins from the plugin management page.
Created attachment 111375 [details] [review] Bug 25549: Remove plugin methods for broken plugins To test: 1 - Enable plugins in the koha-conf 2 - Install the kitchen sink plugin 3 - Your staff client should be orange now :-) 4 - edit the plugin module /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm 5 - Add a line to break compilation, like: this won't compile 6 - Restart all 7 - Your koha is now broken 8 - kshell 9 - perl misc/devel/install_plugins.pl 10 - Restart all 11 - Koha remains broken 12 - Apply patch 13 - kshell 14 - perl misc/devel/install_plugins.pl 15 - Koha now works! 16 - Koha is not orange because the plugin methods are removed Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 111376 [details] [review] Bug 25549: Add error reporting to plugins-home This patch adds handling for the newly introduced 'errors' option in GetPlugins and reports erroroneos plugins to the user. To test: 1 - Enable plugins in the koha-conf 2 - Install the kitchen sink plugin 3 - Your staff client should be orange now :-) 4 - The plugin should display as installed in the table at tools/plugins. 5 - edit the plugin module /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm 6 - Add a line to break compilation, like: this won't compile 7 - Restart all 8 - Your Koha is not broken, but is no longer orange (The plugin is not loading). 9 - The plugin should display as unable to load in the table at tools/plugins. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 111816 [details] [review] Bug 25549: Remove plugin methods for broken plugins To test: 1 - Enable plugins in the koha-conf 2 - Install the kitchen sink plugin 3 - Your staff client should be orange now :-) 4 - edit the plugin module /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm 5 - Add a line to break compilation, like: this won't compile 6 - Restart all 7 - Your koha is now broken 8 - kshell 9 - perl misc/devel/install_plugins.pl 10 - Restart all 11 - Koha remains broken 12 - Apply patch 13 - kshell 14 - perl misc/devel/install_plugins.pl 15 - Koha now works! 16 - Koha is not orange because the plugin methods are removed Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 111817 [details] [review] Bug 25549: Add error reporting to plugins-home This patch adds handling for the newly introduced 'errors' option in GetPlugins and reports erroroneos plugins to the user. To test: 1 - Enable plugins in the koha-conf 2 - Install the kitchen sink plugin 3 - Your staff client should be orange now :-) 4 - The plugin should display as installed in the table at tools/plugins. 5 - edit the plugin module /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm 6 - Add a line to break compilation, like: this won't compile 7 - Restart all 8 - Your Koha is not broken, but is no longer orange (The plugin is not loading). 9 - The plugin should display as unable to load in the table at tools/plugins. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Should the change in Plugins.pm be covered by a regression test? I think it would be nice if we offered the uninstall option for broken plugins. Otherwise you are stuck with them forever until you can get someone on your server to remove them.
(In reply to Katrin Fischer from comment #15) > Should the change in Plugins.pm be covered by a regression test? > Probably, though I'm not entirely sure how to write one off the top of my head. > I think it would be nice if we offered the uninstall option for broken > plugins. Otherwise you are stuck with them forever until you can get > someone on your server to remove them. This is more difficult: The uninstall button actually calls an uninstall method from within the plugins themselves to allow for some cleanup that's plugin specific. If we wanted to expose something for broken plugins we would need to write a specific method for it and it would be more of a 'Partial remove' than an uninstall.. we would likely be left with data in the database as there's no easy way we could tell where the plugin put it's data. I think leave that one for another bug [U+1F609]
> > I think it would be nice if we offered the uninstall option for broken > > plugins. Otherwise you are stuck with them forever until you can get > > someone on your server to remove them. > > This is more difficult: The uninstall button actually calls an uninstall > method from within the plugins themselves to allow for some cleanup that's > plugin specific. If we wanted to expose something for broken plugins we > would need to write a specific method for it and it would be more of a > 'Partial remove' than an uninstall.. we would likely be left with data in > the database as there's no easy way we could tell where the plugin put it's > data. I think leave that one for another bug [U+1F609] It was meant to be - this one is passed :)
Pushed to master for 20.11, thanks to everybody involved!
backported to 20.05.x for 20.05.06
backported to 19.11.x for 19.11.12
Missing dependencies for 19.05.x, can't backport.