Comment 0 for bug 1372322

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

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 installer (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