← Back to team overview

mahara-contributors team mailing list archive

[Bug 1471227] Re: Unable to delete an institution

 

Hi Howard,

Thanks for the analysis! :) It is quite likely that there are more bugs
in Mahara's code for deleting institutions than in the code for adding
and managing them, simply because populated institutions don't get
deleted that often. So this code doesn't get exercised as much, and the
bugs can hide out longer.

I don't have time to look into this bug in detail right now, but from a
quick inspection, it looks like all the code for deleting an institution
is in the htdocs/admin/users/institutions.php script itself.
Specifically, the "delete_validate()" and "delete_submit()" functions,
which are the callback functions that get executed by our forms manager
when you submit a request to delete an institution.

When you delete an auth instance from an institution, that also happens
in htdocs/admin/users/institutions.php. The code for it is present in
the "institution_submit()" function, specifically the block below the
comment "// TODO: Move handling of authentication instances within the
Institution class as well?" All the auth instances that you've chosen to
delete get moved into an array called
$values['authplugin']['deletearray'], and the code loops through them to
delete things.

Perhaps that will help you isolate the problem.

Cheers,
Aaron

** Changed in: mahara
       Status: Incomplete => Triaged

** Changed in: mahara
   Importance: Undecided => Medium

** Changed in: mahara
    Milestone: None => 15.04.2

** Also affects: mahara/15.04
   Importance: Undecided
       Status: New

** Also affects: mahara/15.10
   Importance: Medium
       Status: Triaged

** Changed in: mahara/15.10
    Milestone: 15.04.2 => 15.10.0

** Changed in: mahara/15.04
    Milestone: None => 15.04.2

** Changed in: mahara/15.04
   Importance: Undecided => Medium

** Changed in: mahara/15.04
       Status: New => Triaged

-- 
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/1471227

Title:
  Unable to delete an institution

Status in Mahara ePortfolio:
  Triaged
Status in Mahara 15.04 series:
  Triaged
Status in Mahara 15.10 series:
  Triaged

Bug description:
  Mahara 15.04. MySQL database

  Removed all users from an Institution and attempted to delete it. On
  confirmation am SQL error was generated:

  [WAR] f4 (lib/errors.php:747) Failed to get a recordset: mysqli error: [1451: Cannot delete or update a parent row: a foreign key constraint fails 
  ("mahara15"."auth_remote_user", CONSTRAINT "authremouser_aut_fk" FOREIGN KEY ("authinstance") REFERENCES "auth_instance" ("id"))] in adodb_throw(DELETE FROM "auth_instance"  WHERE "institution" = 'education' , )
  Command was: DELETE FROM "auth_instance"  WHERE "institution" = ?  and values was (education)

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


References