Bug 23168: Enable plugins using plain SQL

To test:
- On a clean 18.11.x, install a plugin [1]
- Run:
  $ sudo koha-mysql kohadev
  > SELECT * FROM plugin_data;
=> SUCCESS: Notice there's a __INSTALLED_VERSION__ line for your plugin
- Checkout latest master, restart all the things
- Run:
  $ updatedatabase
=> FAIL: It fails on 18.12.00.069 because the plugin_methods table doesn't exist
- Run:
  $ sudo koha-mysql kohadev
  > SELECT * FROM plugin_data;
=> FAIL: No __ENABLED__ line for your plugin
- Apply the patch
- Run:
  $ updatedatabase
=> SUCCESS: Update passes the 18.12.00.069 step correctly
- Run:
  $ sudo koha-mysql kohadev
  > SELECT * FROM plugin_data;
=> SUCCESS: There's an __ENABLED__ line for your plugin
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomás Cohen Arazi 2019-06-20 12:03:30 -03:00 committed by Martin Renvoize
parent c67ce9cc9b
commit 5be6c78e6e
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -18435,12 +18435,16 @@ if ( CheckVersion($DBversion) ) {
$DBversion = '18.12.00.069';
if( CheckVersion( $DBversion ) ) {
use Koha::Plugins;
my @plugins = Koha::Plugins->new({ enable_plugins => 1 })->GetPlugins({ all => 1 });
foreach my $plugin ( @plugins ) {
$plugin->enable;
}
$dbh->do(q{
INSERT INTO plugin_data
(plugin_class, plugin_key, plugin_value)
SELECT
plugin_class,
'__ENABLED__',
1
FROM plugin_data
WHERE plugin_key='__INSTALLED_VERSION__'
});
# Always end with this (adjust the bug info)
SetVersion( $DBversion );