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
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 mahara/ htdocs/ admin/cli/ upgrade. php)
2. Check out the current 1.10 HEAD
3. Run the command-line installer (sudo -u www-data php /path/to/
Expected result: Should upgrade smoothly
Actual result: Errors out trying to upgrade blocktype.text:
(master) aaronw@ vegas:~ /www/mahara$ mahara-upgrade cli/upgrade. php:49) Upgrading Mahara php:221) Upgrading core php:221) Upgrading artefact. multirecipientn otification php:221) Upgrading blocktype.text php:745) Failed to get a recordset: postgres7 error: [-5: ERROR: duplicate key value violates unique constraint "blocinst_nam_pk" php:745) DETAIL: Key (name)=(text) already exists.] in adodb_throw(INSERT INTO "blocktype_ installed" ("name", "version", "release") VALUES (?, ?, ?), Array) php:745) Command was: INSERT INTO "blocktype_ installed" ("name", "version", "release") VALUES (?, ?, ?) and values was (text,201408220 0,1.0.0) www/mahara/ htdocs/ lib/errors. php:95 www/mahara/ htdocs/ lib/errors. php:745 >__construct( "Failed to get a recordset: postgres7 error: [-5: E...") at /home/aaronw/ www/mahara/ htdocs/ lib/dml. php:1046 record( "blocktype_ installed" , object(stdClass)) at /home/aaronw/ www/mahara/ htdocs/ lib/upgrade. php:454 plugin( object( stdClass) ) at /home/aaronw/ www/mahara/ htdocs/ lib/mahara. php:253 mahara( array(size 5)) at /home/aaronw/ www/mahara/ htdocs/ admin/cli/ upgrade. php:50
[INF] 61 (admin/
[INF] 61 (lib/mahara.
[INF] 61 (lib/mahara.
[INF] 61 (lib/mahara.
[WAR] 61 (lib/errors.
[WAR] 61 (lib/errors.
[WAR] 61 (lib/errors.
Call stack (most recent first):
* log_message("Failed to get a recordset: postgres7 error: [-5: E...", 8, true, true) at /home/aaronw/
* log_warn("Failed to get a recordset: postgres7 error: [-5: E...") at /home/aaronw/
* SQLException-
* insert_
* upgrade_
* upgrade_
[WAR] 61 (lib/dml.php:1046) Failed to get a recordset: postgres7 error: [-5: ERROR: duplicate key value violates unique constraint "blocinst_nam_pk" installed" ("name", "version", "release") VALUES (?, ?, ?), Array) installed" ("name", "version", "release") VALUES (?, ?, ?) and values was (text,201408220 0,1.0.0) record( "blocktype_ installed" , object(stdClass)) at /home/aaronw/ www/mahara/ htdocs/ lib/upgrade. php:454 plugin( object( stdClass) ) at /home/aaronw/ www/mahara/ htdocs/ lib/mahara. php:253 mahara( array(size 5)) at /home/aaronw/ www/mahara/ htdocs/ admin/cli/ upgrade. php:50
[WAR] 61 (lib/dml.php:1046) DETAIL: Key (name)=(text) already exists.] in adodb_throw(INSERT INTO "blocktype_
[WAR] 61 (lib/dml.php:1046) Command was: INSERT INTO "blocktype_
Call stack (most recent first):
* insert_
* upgrade_
* upgrade_
A nonrecoverable error occurred. This probably means you have encountered a bug in the system( master) aaronw@ vegas:~ /w