← Back to team overview

mahara-contributors team mailing list archive

[Bug 1614805] A change has been merged

 

Reviewed:  https://reviews.mahara.org/6888
Committed: https://git.mahara.org/mahara/mahara/commit/3a6fcfb94d0bcda49a3ca97524f4e5360a807495
Submitter: Son Nguyen (son.nguyen@xxxxxxxxxxxxxxx)
Branch:    15.10_STABLE

commit 3a6fcfb94d0bcda49a3ca97524f4e5360a807495
Author: Aaron Wells <aaronw@xxxxxxxxxxxxxxx>
Date:   Fri Aug 19 15:04:27 2016 +1200

CLI upgrader, better handling of out-of-sequence plugin upgrades

Bug 1614805. When a plugin is installed "out of sequence" by a
call to plugin_upgrade in the core lib/db/upgrade.php file, the
AJAX-based web upgrader handles it gracefully, because it does
check_upgrade() before upgrading each plugin, detects the change
in status, and doesn't run the upgrade for that plugin a second
time.

The CLI upgrader, on the other hand, uses the same cached data
from check_upgrades() all the way through, causing it to re-run
upgrades for such plugins.

This patch makes it behave the same as the AJAX plugin, running
check_upgrade() again immediately before each component gets
upgraded. This does cause some redundancy in code execution,
but it shouldn't be enough to cause a noticeable performance hit.

Change-Id: Id5c431fc9e636df2cab05d22e6cc424271ce9f3d
behatnotneeded: Covered by existing tests
(cherry picked from commit 0e1704c1365bf372ee4a56cebe0785f130dc139e)

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1614805

Title:
  Make out-of-sequence plugin upgrades consistent in CLI upgrader & web
  upgrader

Status in Mahara:
  Fix Committed
Status in Mahara 15.04 series:
  Fix Committed
Status in Mahara 15.10 series:
  Fix Committed
Status in Mahara 16.04 series:
  Fix Committed
Status in Mahara 16.10 series:
  Fix Committed

Bug description:
  In Bug 1614298 there were some differences of behavior between the CLI
  upgrader and the web upgrader, due to how they handled the out-of-
  sequence installation of the module/webservices plugin. This plugin is
  installed in the core lib/db/upgrade.php file, by a call to
  plugin_upgrade(), in order to make sure it gets installed instead of
  leaving it as an optional user-initiated installation.

  The CLI upgrader operates by running "check_upgrades()" at the
  beginning, which then looks at every component and plugin in Mahara to
  see which ones need to be upgraded. The return data includes the
  "installed" version number (retrieved from the database) and the "new"
  version number (from the version.php files on the filesystem). It then
  passes this data to "upgrade_mahara($data)", which loops over the
  array and runs the installer for each component.

  As a result, the webservices plugin was listed as needing upgrading,
  and then it got installed during the "core" upgrade step by the call
  to "upgrade_plugin()", and again by upgrade_mahara() when it looped
  through the listed plugins needing installation. The version number
  passed to the upgrade function by upgrade_mahara() was based on the
  initial call to check_upgrades() at the start of the script, causing
  the same upgrade block in the plugin's db/upgrade.php script to be
  executed twice.

  The AJAX upgrader didn't have this problem, because it re-checks the
  status of each plugin before running the upgrade function for that
  plugin. First the parent script calls "check_plugins()" to find all
  the plugins that need to be upgraded. Then it sends a request to
  upgrade.json.php for each upgrade component. And then upgrade.json.php
  calls check_plugins() again. It does this in order to retrieve the
  full data about the plugin; but it has the side effect of preventing
  the double-upgrading of plugins that were upgraded or installed out of
  order by core.

  It'd be best if both installation routes performed the same.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1614805/+subscriptions


References