mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #52300
[Bug 1808935] A change has been merged
Reviewed: https://reviews.mahara.org/9666
Committed: https://git.mahara.org/mahara/mahara/commit/73ca19ddc1a2955943bbe14f45005c7895c72a1e
Submitter: Robert Lyon (robertl@xxxxxxxxxxxxxxx)
Branch: 18.10_STABLE
commit 73ca19ddc1a2955943bbe14f45005c7895c72a1e
Author: Ghada El-Zoghbi <ghada@xxxxxxxxxxxxxxx>
Date: Wed Mar 13 11:02:51 2019 +1300
Bug 1808935: Error Deleting External App - Foreign Key Constraint
behatnotneeded
Change-Id: Ifb11779659e707753ab5305684a4f1281f03931f
(cherry picked from commit f994c8629fd5b52bc3054b07d2ad8c34a1d66245)
--
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/1808935
Title:
Error Deleting External App - Foreign Key Constraint
Status in Mahara:
Fix Committed
Status in Mahara 18.10 series:
Fix Committed
Status in Mahara 19.04 series:
Fix Committed
Bug description:
Mahara: 18.10.0
OS: Linux
DB: Postgres
Browser: FF
I created an LTI integration with a vanilla Moodle 3.5 and set it up
as an external app.
I did log in with it from Moodle with an assignment. I think decided
to delete the app. I get the following error:
[WAR] ff (lib/errors.php:858) Failed to get a recordset: postgres8 error: [-1: ERROR: update or delete on table "oauth_server_registry" violates foreign key constraint "ltiasse_oau_fk" on table "lti_assessment"
DETAIL: Key (id)=(1) is still referenced from table "lti_assessment".] in EXECUTE("
DELETE FROM "oauth_server_registry"
WHERE consumer_key = ?
AND (userid = ? OR userid IS NULL)
")Command was:
DELETE FROM "oauth_server_registry"
WHERE consumer_key = ?
AND (userid = ? OR userid IS NULL)
and values was (0:96a91f9a865716feca5030a456f7154505c131e2d,1:45349)
Call stack (most recent first):
log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /var/www/var/www/mahara/htdocs/lib/errors.php:95
log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/var/www/mahara/htdocs/lib/errors.php:858
SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/var/www/mahara/htdocs/lib/dml.php:1025
delete_records_sql(" DELETE FROM "oauth_server_reg...", array(size 2)) at /var/www/var/www/mahara/htdocs/webservice/libs/oauth-php/store/OAuthStoreMahara.php:156
OAuthStoreMahara->deleteServer("96a91f9a865716feca5030a456f7154505c131e2d", "45349", true) at /var/www/var/www/mahara/htdocs/webservice/admin/oauthv1sregister.php:120
webservices_server_submit(object(Pieform), array(size 4)) at /var/www/var/www/mahara/htdocs/lib/pieforms/pieform.php:542
Pieform->__construct(array(size 7)) at /var/www/var/www/mahara/htdocs/lib/pieforms/pieform.php:164
Pieform::process(array(size 7)) at /var/www/var/www/mahara/htdocs/lib/mahara.php:5258
pieform(array(size 7)) at /var/www/var/www/mahara/htdocs/webservice/admin/oauthv1sregister.php:469
webservice_server_list_form(array(size 9), array(size 3)) at /var/www/var/www/mahara/htdocs/webservice/admin/oauthv1sregister.php:58
[WAR] ff (lib/dml.php:1025) Failed to get a recordset: postgres8 error: [-1: ERROR: update or delete on table "oauth_server_registry" violates foreign key constraint "ltiasse_oau_fk" on table "lti_assessment"
DETAIL: Key (id)=(1) is still referenced from table "lti_assessment".] in EXECUTE("
DELETE FROM "oauth_server_registry"
WHERE consumer_key = ?
AND (userid = ? OR userid IS NULL)
")Command was:
DELETE FROM "oauth_server_registry"
WHERE consumer_key = ?
AND (userid = ? OR userid IS NULL)
and values was (0:96a91f9a865716feca5030a456f7154505c131e2d,1:45349)
Call stack (most recent first):
delete_records_sql(" DELETE FROM "oauth_server_reg...", array(size 2)) at /var/www/var/www/mahara/htdocs/webservice/libs/oauth-php/store/OAuthStoreMahara.php:156
OAuthStoreMahara->deleteServer("96a91f9a865716feca5030a456f7154505c131e2d", "45349", true) at /var/www/var/www/mahara/htdocs/webservice/admin/oauthv1sregister.php:120
webservices_server_submit(object(Pieform), array(size 4)) at /var/www/var/www/mahara/htdocs/lib/pieforms/pieform.php:542
Pieform->__construct(array(size 7)) at /var/www/var/www/mahara/htdocs/lib/pieforms/pieform.php:164
Pieform::process(array(size 7)) at /var/www/var/www/mahara/htdocs/lib/mahara.php:5258
pieform(array(size 7)) at /var/www/var/www/mahara/htdocs/webservice/admin/oauthv1sregister.php:469
webservice_server_list_form(array(size 9), array(size 3)) at /var/www/var/www/mahara/htdocs/webservice/admin/oauthv1sregister.php:58
The delete function needs to also remove records from the
lti_assessment table due to the foreign key constraint.
But, I'm not sure if that is the correct way to go. If there are
assignments, do we want to keep them and perhaps disable the external
app?
To delete, add the following to
/htdocs/webservice/admin.oauthv1sregister.php at line 120:
delete_records_sql('DELETE FROM {lti_assessment} WHERE oauthserver IN
(SELECT id FROM {oauth_server_registry} WHERE consumer_key = ?)',
array($dbserver->consumer_key));
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1808935/+subscriptions
References