Bug 20438 - Allow uninstalling plugins not implementing the 'uninstall' method
Summary: Allow uninstalling plugins not implementing the 'uninstall' method
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-16 18:16 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2019-10-14 19:55 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 20438: Allow uninstalling plugins not implementing the 'uninstall' method (2.56 KB, patch)
2018-03-16 18:21 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 20438: Allow uninstalling plugins not implementing the 'uninstall' method (2.60 KB, patch)
2018-03-19 01:56 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 20438: Allow uninstalling plugins not implementing the 'uninstall' method (2.68 KB, patch)
2018-03-20 13:05 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2018-03-16 18:16:57 UTC
The plugins handling code expects plugins implementing an 'uninstall' method for cleanup purposes. It executes this method, and then moves on with removing the configuration entries in the storage, and the plugin itself.

But the 'plugins-home.tt' template makes the tool display the 'Uninstall' link in the dropdown ONLY when the plugin has the 'uninstall' method.

This is incorrect!

To reproduce:
- Install the KitchenSink plugin [1]
=> SUCCESS: The 'actions' dropdown for KitchenSink shows an 'Uninstall' option
- Edit the code for the plugin:
  $ sudo vim /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm
- Remove the uninstall sub
- Restart everything:
  $ restart_all
- Reload the browser
=> FAIL: There's no 'Uninstall' option in the actions dropdown.


[1] https://github.com/bywatersolutions/koha-plugin-kitchen-sink/releases
Comment 1 Tomás Cohen Arazi (tcohen) 2018-03-16 18:21:47 UTC
Created attachment 73056 [details] [review]
Bug 20438: Allow uninstalling plugins not implementing the 'uninstall' method

The plugins handling code expects plugins implementing an 'uninstall' method for
cleanup purposes. It executes this method, and then moves on with removing the
configuration entries in the storage, and the plugin itself.

But the 'plugins-home.tt' template makes the tool display the 'Uninstall'
link in the dropdown ONLY when the plugin has the 'uninstall' method.

This patch fixes the issue.

To reproduce:
- Install the KitchenSink plugin [1]
=> SUCCESS: The 'actions' dropdown for KitchenSink shows an 'Uninstall' option
- Edit the code for the plugin:
  $ sudo vim /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm
- Remove the uninstall sub
- Restart everything:
  $ restart_all
- Reload the browser
=> FAIL: There's no 'Uninstall' option in the actions dropdown.
- Apply this patch
- Restart everything
  $ restart_all
- Reload the browser
=> SUCCESS: The 'actions' dropdown for KitchenSink shows an 'Uninstall' option
- Sign off :-D

[1] https://github.com/bywatersolutions/koha-plugin-kitchen-sink/releases

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Mark Tompsett 2018-03-19 01:56:52 UTC
Created attachment 73080 [details] [review]
Bug 20438: Allow uninstalling plugins not implementing the 'uninstall' method

The plugins handling code expects plugins implementing an 'uninstall' method for
cleanup purposes. It executes this method, and then moves on with removing the
configuration entries in the storage, and the plugin itself.

But the 'plugins-home.tt' template makes the tool display the 'Uninstall'
link in the dropdown ONLY when the plugin has the 'uninstall' method.

This patch fixes the issue.

To reproduce:
- Install the KitchenSink plugin [1]
=> SUCCESS: The 'actions' dropdown for KitchenSink shows an 'Uninstall' option
- Edit the code for the plugin:
  $ sudo vim /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm
- Remove the uninstall sub
- Restart everything:
  $ restart_all
- Reload the browser
=> FAIL: There's no 'Uninstall' option in the actions dropdown.
- Apply this patch
- Restart everything
  $ restart_all
- Reload the browser
=> SUCCESS: The 'actions' dropdown for KitchenSink shows an 'Uninstall' option
- Sign off :-D

[1] https://github.com/bywatersolutions/koha-plugin-kitchen-sink/releases

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 3 Kyle M Hall (khall) 2018-03-20 13:05:19 UTC
Created attachment 73102 [details] [review]
Bug 20438: Allow uninstalling plugins not implementing the 'uninstall' method

The plugins handling code expects plugins implementing an 'uninstall' method for
cleanup purposes. It executes this method, and then moves on with removing the
configuration entries in the storage, and the plugin itself.

But the 'plugins-home.tt' template makes the tool display the 'Uninstall'
link in the dropdown ONLY when the plugin has the 'uninstall' method.

This patch fixes the issue.

To reproduce:
- Install the KitchenSink plugin [1]
=> SUCCESS: The 'actions' dropdown for KitchenSink shows an 'Uninstall' option
- Edit the code for the plugin:
  $ sudo vim /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm
- Remove the uninstall sub
- Restart everything:
  $ restart_all
- Reload the browser
=> FAIL: There's no 'Uninstall' option in the actions dropdown.
- Apply this patch
- Restart everything
  $ restart_all
- Reload the browser
=> SUCCESS: The 'actions' dropdown for KitchenSink shows an 'Uninstall' option
- Sign off :-D

[1] https://github.com/bywatersolutions/koha-plugin-kitchen-sink/releases

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Jonathan Druart 2018-03-26 20:38:54 UTC
Pushed to master for 18.05, thanks to everybody involved!