Upgrade form 1.10 to 15.04 fails if 3rd party plugins are not present

Bug #1455122 reported by Dominique-Alain JAN
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Aaron Wells
15.04
Fix Released
High
Aaron Wells
15.10
Fix Released
High
Aaron Wells

Bug Description

When upgrading from 1.10 (latest build) to 15.04 (latest build) today I get the following error because some 3rd party plugins are not present on my server but, due to the lack on auto-unstallation, their traces remain in the database.

If I run again the command later I get the second error message (see below).

The upgrade process should be resilient when 3rd party plugins are not here. I think we already had this with previous versions of Mahara and it has been fixed. My only way to upgrade to 15.04 is either :

1/ Find all the bit of information related to the missing plugins and delete them from the database
or
2/ Reinstall everything from scratch loosing all the data from the Groups (no option to export group work in Leap2a)
or
3/ Reinstall the missing plugins. I already tried this solution without success; some plugins are so old and unmaintaned that they crash the server when re-introduced inside Mahara.

---- Message I got after the first attempt for upgrading the system

root@ubuntu:/var/www/html/mahara/htdocs# php admin/cli/upgrade.php
[INF] 61 (admin/cli/upgrade.php:49) Mise à jour de Mahara
[INF] 61 (lib/mahara.php:221) Mise à jour de core
[WAR] 61 (lib/mahara.php:1429) File /var/www/html/mahara/htdocs/blocktype/chemnih/lib.php did not exist
Call stack (most recent first):
  * safe_require("blocktype", "chemnih") at /var/www/html/mahara/htdocs/lib/upgrade.php:1128
  * install_blocktype_categories_for_plugin("chemnih") at /var/www/html/mahara/htdocs/lib/db/upgrade.php:3974
  * xmldb_core_upgrade("2014092314") at /var/www/html/mahara/htdocs/lib/upgrade.php:359
  * upgrade_core(object(stdClass)) at /var/www/html/mahara/htdocs/lib/mahara.php:253
  * upgrade_mahara(array(size 40)) at /var/www/html/mahara/htdocs/admin/cli/upgrade.php:50

A nonrecoverable error occurred. This probably means you have encountered a bug in the systemroot@ubuntu:/var/www/html/mahara/htdocs# git pull

------- Message I got after my second attempt
root@ubuntu:/var/www/html/mahara/htdocs# php admin/cli/upgrade.php
[INF] 87 (admin/cli/upgrade.php:49) Mise à jour de Mahara
[INF] 87 (lib/mahara.php:221) Mise à jour de core
[WAR] 87 (lib/errors.php:747) Failed to get a recordset: mysqli error: [1062: Duplicate entry 'shortcut' for key 'PRIMARY'] in adodb_throw(INSERT INTO "blocktype_category" ("name", "sort") VALUES ('shortcut', '0'), )
[WAR] 87 (lib/errors.php:747) Command was: INSERT INTO "blocktype_category" ("name", "sort") VALUES (?, ?) and values was (shortcut,0)
Call stack (most recent first):
  * log_message("Failed to get a recordset: mysqli error: [1062: Du...", 8, true, true) at /var/www/html/mahara/htdocs/lib/errors.php:97
  * log_warn("Failed to get a recordset: mysqli error: [1062: Du...") at /var/www/html/mahara/htdocs/lib/errors.php:747
  * SQLException->__construct("Failed to get a recordset: mysqli error: [1062: Du...") at /var/www/html/mahara/htdocs/lib/dml.php:1054
  * insert_record("blocktype_category", object(stdClass)) at /var/www/html/mahara/htdocs/lib/db/upgrade.php:3856
  * xmldb_core_upgrade("2014092314") at /var/www/html/mahara/htdocs/lib/upgrade.php:359
  * upgrade_core(object(stdClass)) at /var/www/html/mahara/htdocs/lib/mahara.php:253
  * upgrade_mahara(array(size 40)) at /var/www/html/mahara/htdocs/admin/cli/upgrade.php:50

[WAR] 87 (lib/dml.php:1054) Failed to get a recordset: mysqli error: [1062: Duplicate entry 'shortcut' for key 'PRIMARY'] in adodb_throw(INSERT INTO "blocktype_category" ("name", "sort") VALUES ('shortcut', '0'), )
[WAR] 87 (lib/dml.php:1054) Command was: INSERT INTO "blocktype_category" ("name", "sort") VALUES (?, ?) and values was (shortcut,0)
Call stack (most recent first):
  * insert_record("blocktype_category", object(stdClass)) at /var/www/html/mahara/htdocs/lib/db/upgrade.php:3856
  * xmldb_core_upgrade("2014092314") at /var/www/html/mahara/htdocs/lib/upgrade.php:359
  * upgrade_core(object(stdClass)) at /var/www/html/mahara/htdocs/lib/mahara.php:253
  * upgrade_mahara(array(size 40)) at /var/www/html/mahara/htdocs/admin/cli/upgrade.php:50

A nonrecoverable error occurred. This probably means you have encountered a bug in the systemroot@ubuntu:/var/www/html/mahara/htdocs#

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

Confirmed. This does not happen when upgrading from 1.9 -> 1.10. It appears that it's due to the blocktype category code that we added in 15.04 to store block sortorders.

While we don't yet support fully uninstalling plugins (that's bug 505732), Mahara shouldn't crash like this if you've just deleted the plugin.

Another possible workaround to those listed above, would be to put in a "dummy" placeholder plugin with no functionality, but with the same name as the expected plugin. But I'm going to try to get this bug fixed for 15.04.1.

Cheers,
Aaron

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

This one would require some intense effort to test in behat, because it requires you to remove some files from the installation.

tags: added: no-behat-needed
Revision history for this message
Aaron Wells (u-aaronw) wrote :

To replicate:

1. Install Mahara 1.10 (or earlier)

2. Delete the Creative Commons block

3. Upgrade to Mahara 15.04 or 15.10. (If you're doing this with git, make sure the creativecommons blocktype is still completely missing after your checkout)

Expected Result: Upgrade should carry through okay

Actual Result: Upgrade crashes

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

Reviewed: https://reviews.mahara.org/4763
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/344028675f588263e68b78b3d497ceb9c7b6b2b0
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 344028675f588263e68b78b3d497ceb9c7b6b2b0
Author: Aaron Wells <email address hidden>
Date: Fri May 15 15:51:41 2015 +1200

Bug 1455122: Missing block plugin causes upgrade to crash

Change-Id: I607830471cd4ffe2555421b05a2e99eabf74bb06

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

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/4781

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

Reviewed: https://reviews.mahara.org/4781
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/17e0154633ba9ec737f50913f6dd3d51c89f25e2
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit 17e0154633ba9ec737f50913f6dd3d51c89f25e2
Author: Aaron Wells <email address hidden>
Date: Fri May 15 15:51:41 2015 +1200

Bug 1455122: Missing block plugin causes upgrade to crash

Change-Id: I607830471cd4ffe2555421b05a2e99eabf74bb06
(cherry picked from commit 344028675f588263e68b78b3d497ceb9c7b6b2b0)

Robert Lyon (robertl-9)
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.