Error while deleting an External App if LTI plugin was never installed

Bug #1928999 reported by Ghada El-Zoghbi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Ghada El-Zoghbi
20.04
Fix Released
High
Unassigned
20.10
Fix Released
High
Unassigned
21.04
Fix Released
High
Unassigned

Bug Description

Mahara: 20.10.1
OS: Linux 18.04
DB: Postgres
Browser: any

An error is generated when a user deletes an External App if the LTI plugin was never installed on the site.

To replicate:
- Create a new Mahara instance
- DO NOT enable the LTI plugin
- Add an External App ( Site admin > Web services > External apps )
- Delete the External App - confirm yes,you want to delete.
- The following error is generated:

[WAR] bd (lib/errors.php:853) Failed to get a recordset: postgres8 error: [-18: ERROR: relation "lti_assessment" does not exist
LINE 1: DELETE FROM "lti_assessment"
                    ^] in EXECUTE("
                                DELETE FROM "lti_assessment"
                                WHERE oauthserver = ?
                                ")Command was:
                                DELETE FROM "lti_assessment"
                                WHERE oauthserver = ?
                                and values was (0:1)

Call stack (most recent first):
log_message("Failed to get a recordset: postgres8 error: [-18: ...", 8, true, true) at /siteroot/htdocs/lib/errors.php:89
log_warn("Failed to get a recordset: postgres8 error: [-18: ...") at /siteroot/htdocs/lib/errors.php:853
SQLException->__construct("Failed to get a recordset: postgres8 error: [-18: ...") at /siteroot/htdocs/lib/dml.php:1156
delete_records_sql(" DELETE FROM "lti_...", array(size 1)) at /siteroot/htdocs/webservice/admin/oauthv1sregister.php:143
webservices_server_submit(object(Pieform), array(size 4)) at /siteroot/htdocs/lib/pieforms/pieform.php:568
Pieform->__construct(array(size 7)) at /siteroot/htdocs/lib/pieforms/pieform.php:168
Pieform::process(array(size 7)) at /siteroot/htdocs/lib/mahara.php:5499
pieform(array(size 7)) at /siteroot/htdocs/webservice/admin/oauthv1sregister.php:558
webservice_server_list_form(array(size 7), array(size 2)) at /siteroot/htdocs/webservice/admin/oauthv1sregister.php:68

The reason is because the table from the LTI plugin was never installed. A check that the table exists needs to be applied first. Please note - check not that the plugin is enabled but if the table exists.

A situation can arise where the plugin was installed, some data is in the table, then the plugin is disabled. Disabling a plugin does not remove its existing data/tables.

Changed in mahara:
assignee: nobody → Ghada El-Zoghbi (ghada-z)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/11794

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

Reviewed: https://reviews.mahara.org/11794
Committed: https://git.mahara.org/mahara/mahara/commit/fb04b1643c4234f4887bd891a48081af3f366258
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit fb04b1643c4234f4887bd891a48081af3f366258
Author: Ghada El-Zoghbi <email address hidden>
Date: Thu May 20 12:18:07 2021 +1000

Bug #1928999: Validate LTI table exists before deleting

While deleting an external app, we need to first check
that the LTI table exist.

behatnotneeded

Change-Id: I5702152afbe480badbc0e1ca65ec98afd9eed5a6

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

Patch for "21.04_STABLE" branch: https://reviews.mahara.org/11795

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "20.10_STABLE" branch: https://reviews.mahara.org/11796

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "20.04_STABLE" branch: https://reviews.mahara.org/11797

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

Reviewed: https://reviews.mahara.org/11795
Committed: https://git.mahara.org/mahara/mahara/commit/939aaaedb2dc92de4147ccc87e09de0c75fb6cdd
Submitter: Robert Lyon (<email address hidden>)
Branch: 21.04_STABLE

commit 939aaaedb2dc92de4147ccc87e09de0c75fb6cdd
Author: Ghada El-Zoghbi <email address hidden>
Date: Thu May 20 12:18:07 2021 +1000

Bug #1928999: Validate LTI table exists before deleting

While deleting an external app, we need to first check
that the LTI table exist.

behatnotneeded

Change-Id: I5702152afbe480badbc0e1ca65ec98afd9eed5a6
(cherry picked from commit fb04b1643c4234f4887bd891a48081af3f366258)

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/11796
Committed: https://git.mahara.org/mahara/mahara/commit/ecde0ae735f5ade5cf4fb6d48a65a1c39fa63356
Submitter: Robert Lyon (<email address hidden>)
Branch: 20.10_STABLE

commit ecde0ae735f5ade5cf4fb6d48a65a1c39fa63356
Author: Ghada El-Zoghbi <email address hidden>
Date: Thu May 20 12:18:07 2021 +1000

Bug #1928999: Validate LTI table exists before deleting

While deleting an external app, we need to first check
that the LTI table exist.

behatnotneeded

Change-Id: I5702152afbe480badbc0e1ca65ec98afd9eed5a6
(cherry picked from commit fb04b1643c4234f4887bd891a48081af3f366258)

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/11797
Committed: https://git.mahara.org/mahara/mahara/commit/8a99e6b68ad82eb14c6f2ea955dc733ce957354b
Submitter: Robert Lyon (<email address hidden>)
Branch: 20.04_STABLE

commit 8a99e6b68ad82eb14c6f2ea955dc733ce957354b
Author: Ghada El-Zoghbi <email address hidden>
Date: Thu May 20 12:18:07 2021 +1000

Bug #1928999: Validate LTI table exists before deleting

While deleting an external app, we need to first check
that the LTI table exist.

behatnotneeded

Change-Id: I5702152afbe480badbc0e1ca65ec98afd9eed5a6
(cherry picked from commit fb04b1643c4234f4887bd891a48081af3f366258)

no longer affects: mahara/21.10
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.