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 = (SELECT id FROM {oauth_server_registry} WHERE consumer_key = ?)', array($dbserver->consumer_key));
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"
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:96a91f9a8657 16feca5030a456f 7154505c131e2d, 1:45349)
DETAIL: Key (id)=(1) is still referenced from table "lti_assessment".] in EXECUTE("
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 warn("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/ var/www/ mahara/ htdocs/ lib/errors. php:858 n->__construct( "Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/ var/www/ mahara/ htdocs/ lib/dml. php:1025 records_ sql(" DELETE FROM "oauth_ server_ reg..." , array(size 2)) at /var/www/ var/www/ mahara/ htdocs/ webservice/ libs/oauth- php/store/ OAuthStoreMahar a.php:156 ahara-> deleteServer( "96a91f9a865716 feca5030a456f71 54505c131e2d" , "45349", true) at /var/www/ var/www/ mahara/ htdocs/ webservice/ admin/oauthv1sr egister. php:120 _server_ submit( object( Pieform) , array(size 4)) at /var/www/ var/www/ mahara/ htdocs/ lib/pieforms/ pieform. php:542 >__construct( array(size 7)) at /var/www/ var/www/ mahara/ htdocs/ lib/pieforms/ pieform. php:164 :process( array(size 7)) at /var/www/ var/www/ mahara/ htdocs/ lib/mahara. php:5258 array(size 7)) at /var/www/ var/www/ mahara/ htdocs/ webservice/ admin/oauthv1sr egister. php:469 server_ list_form( array(size 9), array(size 3)) at /var/www/ var/www/ mahara/ htdocs/ webservice/ admin/oauthv1sr egister. php:58
log_
SQLExceptio
delete_
OAuthStoreM
webservices
Pieform-
Pieform:
pieform(
webservice_
[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"
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:96a91f9a8657 16feca5030a456f 7154505c131e2d, 1:45349)
DETAIL: Key (id)=(1) is still referenced from table "lti_assessment".] in EXECUTE("
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/ OAuthStoreMahar a.php:156 ahara-> deleteServer( "96a91f9a865716 feca5030a456f71 54505c131e2d" , "45349", true) at /var/www/ var/www/ mahara/ htdocs/ webservice/ admin/oauthv1sr egister. php:120 _server_ submit( object( Pieform) , array(size 4)) at /var/www/ var/www/ mahara/ htdocs/ lib/pieforms/ pieform. php:542 >__construct( array(size 7)) at /var/www/ var/www/ mahara/ htdocs/ lib/pieforms/ pieform. php:164 :process( array(size 7)) at /var/www/ var/www/ mahara/ htdocs/ lib/mahara. php:5258 array(size 7)) at /var/www/ var/www/ mahara/ htdocs/ webservice/ admin/oauthv1sr egister. php:469 server_ list_form( array(size 9), array(size 3)) at /var/www/ var/www/ mahara/ htdocs/ webservice/ admin/oauthv1sr egister. php:58
OAuthStoreM
webservices
Pieform-
Pieform:
pieform(
webservice_
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.oauthv1sr egister. php at line 120:
delete_ records_ sql('DELETE FROM {lti_assessment} WHERE oauthserver = (SELECT id FROM {oauth_ server_ registry} WHERE consumer_key = ?)', array($ dbserver- >consumer_ key));