]> git.koha-community.org Git - koha.git/commit
Bug 22084: Plugin upgrade method and database plugin version storage will never be...
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 8 Jan 2019 18:10:53 +0000 (13:10 -0500)
committerJesse Maseto <jesse@bywatersolutions.com>
Fri, 8 Mar 2019 19:31:10 +0000 (19:31 +0000)
commitccdc3afb148fb6b1e7ab2b295dc9adbf668184df
tree07177e5c3ed1a4247b3c95e62be8b6f23a8e6c69
parent6473493713fcb400829b17b71d8f48626426a461
Bug 22084: Plugin upgrade method and database plugin version storage will never be triggered for existing installs

If an existing plugin begins using the upgrade() method, it will never actually get triggered because the installation has already occurred and no database plugin version was stored at the time. Without that database version, the upgrade method will never be triggered.

In addition, if the plugin has no upgrade method, the installed version is never updated in the database!

Lastly, when an upgrade succeeds it prints a warning that the upgrade failed.

Test Plan:
1) Install an older version of the Kitchen sink plugin:
   * https://github.com/bywatersolutions/koha-plugin-kitchen-sink/releases/download/v2.1.0/koha-plugin-kitchen-sink-v2.1.0.kpz
2) Delete the "__INSTALLED_VERSION__" key, and the "last_upgraded" key from plugin_data for this plugin, to simulate having installed from an earlier version of Koha
3) Upgrade to the latest version of the Kitchen sink plugin:
   * https://github.com/bywatersolutions/koha-plugin-kitchen-sink/releases/download/v2.1.22/koha-plugin-kitchen-sink-v2.1.22.kpz
4) Note "__INSTALLED_VERSION__" still doesn't exist for the plugin, in the plugin_data table
5) Apply this patch
6) Restart all the things
7) Browse to the Kitchen sink configuration page, this should trigger the upgrade method
8) Note the "__INSTALLED_VERSION__" and "last_upgraded" keys exist in plugin_data for the Kitchen Sink plugin

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 8c2e03020dc02519dec70b9697794a3624c73937)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit b19b36fb6260932dff3961ec9ed1202188d367de)

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Koha/Plugins/Base.pm