]> 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)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 1 Mar 2019 11:40:45 +0000 (11:40 +0000)
commitb19b36fb6260932dff3961ec9ed1202188d367de
treecc67424eb99525232487e507a3dad988374ba5f4
parent00fff866dd25c89f740b46e6366868027fe7512a
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>
Koha/Plugins/Base.pm