CLI upgrader can't handle plugin forced-installs

Bug #1372322 reported by Aaron Wells
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Aaron Wells

Bug Description

Another side-effect from Bug1311428. The problem occurs when you're trying to run a site upgrade, where the core upgrade includes a forced install of a new plugin (such as we have for the new blocktype/text plugin).

This used to work -- you can see in lib/db/upgrade.php that we installed several earlier core plugins this way. The most recent was artefact/comment, installed as part of the Mahara 1.5.0 upgrade.

But, the change for Bug 1311428 causes not-yet-installed plugins to be included in the return results from check_upgrades(), and then assumes that the calling script will filter these out. The GUI upgrader was modified to filter these out, but the CLI upgrader was not.

To replicate:

1. Install Mahara 1.9
2. Check out the current 1.10 HEAD
3. Run the command-line upgrader (sudo -u www-data php /path/to/mahara/htdocs/admin/cli/upgrade.php)

Expected result: Should upgrade smoothly

Actual result: Errors out trying to upgrade blocktype.text:

(master)aaronw@vegas:~/www/mahara$ mahara-upgrade
[INF] 61 (admin/cli/upgrade.php:49) Upgrading Mahara
[INF] 61 (lib/mahara.php:221) Upgrading core
[INF] 61 (lib/mahara.php:221) Upgrading artefact.multirecipientnotification
[INF] 61 (lib/mahara.php:221) Upgrading blocktype.text
[WAR] 61 (lib/errors.php:745) Failed to get a recordset: postgres7 error: [-5: ERROR: duplicate key value violates unique constraint "blocinst_nam_pk"
[WAR] 61 (lib/errors.php:745) DETAIL: Key (name)=(text) already exists.] in adodb_throw(INSERT INTO "blocktype_installed" ("name", "version", "release") VALUES (?, ?, ?), Array)
[WAR] 61 (lib/errors.php:745) Command was: INSERT INTO "blocktype_installed" ("name", "version", "release") VALUES (?, ?, ?) and values was (text,2014082200,1.0.0)
Call stack (most recent first):
  * log_message("Failed to get a recordset: postgres7 error: [-5: E...", 8, true, true) at /home/aaronw/www/mahara/htdocs/lib/errors.php:95
  * log_warn("Failed to get a recordset: postgres7 error: [-5: E...") at /home/aaronw/www/mahara/htdocs/lib/errors.php:745
  * SQLException->__construct("Failed to get a recordset: postgres7 error: [-5: E...") at /home/aaronw/www/mahara/htdocs/lib/dml.php:1046
  * insert_record("blocktype_installed", object(stdClass)) at /home/aaronw/www/mahara/htdocs/lib/upgrade.php:454
  * upgrade_plugin(object(stdClass)) at /home/aaronw/www/mahara/htdocs/lib/mahara.php:253
  * upgrade_mahara(array(size 5)) at /home/aaronw/www/mahara/htdocs/admin/cli/upgrade.php:50

[WAR] 61 (lib/dml.php:1046) Failed to get a recordset: postgres7 error: [-5: ERROR: duplicate key value violates unique constraint "blocinst_nam_pk"
[WAR] 61 (lib/dml.php:1046) DETAIL: Key (name)=(text) already exists.] in adodb_throw(INSERT INTO "blocktype_installed" ("name", "version", "release") VALUES (?, ?, ?), Array)
[WAR] 61 (lib/dml.php:1046) Command was: INSERT INTO "blocktype_installed" ("name", "version", "release") VALUES (?, ?, ?) and values was (text,2014082200,1.0.0)
Call stack (most recent first):
  * insert_record("blocktype_installed", object(stdClass)) at /home/aaronw/www/mahara/htdocs/lib/upgrade.php:454
  * upgrade_plugin(object(stdClass)) at /home/aaronw/www/mahara/htdocs/lib/mahara.php:253
  * upgrade_mahara(array(size 5)) at /home/aaronw/www/mahara/htdocs/admin/cli/upgrade.php:50

A nonrecoverable error occurred. This probably means you have encountered a bug in the system(master)aaronw@vegas:~/w

Tags: regression
Revision history for this message
Aaron Wells (u-aaronw) wrote :

I'm not sure what the best fix is here. We *do* need check_upgrades() to return data about the uninstalled plugins, so that it can be displayed in the list of "new plugins to install" on admin/upgrade.php. Maybe we should move the uninstalled plugins list to the "settings" array of check_upgrades()?

description: updated
Revision history for this message
Dominique-Alain JAN (dajan) wrote :

I noticed this problem when I tied to upgrade from 1.8 and 1.9 to 1.10dev. I thought that my installations were faulty. Apparently they where not.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/3712

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/3712
Committed: http://gitorious.org/mahara/mahara/commit/d8ee426e29053e7d00323cd5d57ca9af111d18fa
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit d8ee426e29053e7d00323cd5d57ca9af111d18fa
Author: Aaron Wells <email address hidden>
Date: Tue Sep 23 13:03:23 2014 +1200

check_plugins(): Move data about potential installs, into $settings

Bug 1372322

Change-Id: I00bc97920a0c38b8e17758ac7173c10bbcf5c718

Robert Lyon (robertl-9)
Changed in mahara:
status: Confirmed → Fix Committed
Aaron Wells (u-aaronw)
Changed in mahara:
assignee: nobody → Aaron Wells (u-aaronw)
Aaron Wells (u-aaronw)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.