When there is an artefact plugin missing and one tries to upgrade another artefact plugin there is an error:
[WAR] cb (lib/errors.php:739) Failed to get a recordset: postgres7 error: [-1: ERROR: update or delete on table "artefact_installed_type" violates foreign key constraint "arte_art_fk" on table "artefact", referer: https://mahara-testing/admin/upgrade.php
[Tue Mar 04 08:52:46 2014] [error] [client 127.0.0.1] [WAR] cb (lib/errors.php:739) DETAIL: Key (name)=(socialprofile) is still referenced from table "artefact".] in adodb_throw(DELETE FROM "artefact_installed_type" WHERE (plugin = ? AND name NOT IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)), Array), referer: https://mahara-testing/admin/upgrade.php
This is due to the fact the missing plugin has artefacts in the artefact table.
This line in lib/upgrade.php (approx line 500)
delete_records_select('artefact_installed_type', $select,
array_merge(array($pluginname),$types));
needs to have some sort of checking if associated items exist for the plugin being removed and remove them first (or have some try { } catch (Exception $e) {} to let the user know that there was an issue with plugin A but still allow plugin B to be upgraded.
See also: https:/ /bugs.launchpad .net/mahara/ +bug/505732
Deleting plugins is semi-supported in Mahara. We don't provide a way to do it through the UI, but there is one sentence about it in the manual (http:// manual. mahara. org/en/ 1.5/site_ admin/extension s.html ): "In order to delete a plugin completely, you must delete the code and all database tables that pertain to the plugin."
It would appear that this advice is incomplete. It's not enough just to delete the plugin's own tables (e.g. "artefact_ resume_ book"). You also need to delete it from several system tables (e.g. "artefact", "artefact_config", "artefact_cron", etc). Here's an oldish wiki page showing all the many things you have to delete to clear out an artefact plugin: https:/ /wiki.mahara. org/index. php/Plugins/ Artefact/ My_Learning/ Uninstalling
So, the least we could do on this, is update the manual to be a bit more comprehensive.