← Back to team overview

mahara-contributors team mailing list archive

[Bug 1287344] Re: artefact installed upgrade problem

 

To test:

Check out an older version of mahara - say 1.8_STABLE and install it.

Then add some dummy data to the database to mimic this process:
- Install thirdparty plugin - use plugin to add an artefact to the artefact table - delete plugin before upgrading.

INSERT INTO artefact_installed_type values ('testing','internal');
INSERT INTO artefact VALUES ((SELECT MAX(id) + 1 FROM artefact), 'testing',0, null, 1, null,null, '2014-08-05 10:11:12', '2014-08-05 10:11:12', '2014-08-05 10:11:12', 0, 'testing', 'this is a test', null, 1, null, 0, 0, null, null, null);

Now checkout latest master and try to upgrade - we get the error.

The question is do we want to scrub the old data? I believe we want to
keep it due to this scenario:

- Using plugin fine before upgrade
- Plugin is not compatible with newer version of mahara so user removes it from disk
- Later on an updated version of plugin is available so we install it and expect our old data still to be there.

So we need a way for the system to ignore the deleting of
artefact_installed_type if the plugin is missing but still has artefact
data we want to keep.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1287344

Title:
  artefact installed upgrade problem

Status in Mahara ePortfolio:
  Confirmed

Bug description:
  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1287344/+subscriptions


References