Reviewed:  https://reviews.mahara.org/9300
Committed: 
https://git.mahara.org/mahara/mahara/commit/0199aaf63f832c7497d0f894de0c90b6369fe354
Submitter: Robert Lyon ([email protected])
Branch:    18.04_STABLE

commit 0199aaf63f832c7497d0f894de0c90b6369fe354
Author: Ghada El-Zoghbi <[email protected]>
Date:   Wed Nov 7 16:59:58 2018 +1100

Bug #1802046: Clean up old lti settings from oauth_server_config

During an upgrade, the clean up should also remove records from
the oauth_server_config table.

behatnotneeded

Change-Id: Ia0ae61ddb7cf7b05241466ec0d6900d2025d662b
(cherry picked from commit 6b06c240532a1d55fee07ba57be0b4d587130875)

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

Title:
  Upgrade to 18.10 error on oAuth clean up

Status in Mahara:
  Fix Committed
Status in Mahara 18.04 series:
  Fix Committed
Status in Mahara 18.10 series:
  Fix Committed
Status in Mahara 19.04 series:
  Fix Committed

Bug description:
  Mahara: 18.10.0
  DB: Postgres
  OS: Linux
  Brower: N/A

  During an upgrade from 17.04 to 18.10, the following error occurs:

  [INF] 79 (lib/mahara.php:238) Upgrading auth.webservice
  [WAR] 79 (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 "oautservconf_oau_fk" on table "oauth_server_config"
  [WAR] 79 (lib/errors.php:858) DETAIL:  Key (id)=(7) is still referenced from 
table "oauth_server_config".] in adodb_throw(DELETE FROM 
"oauth_server_registry" WHERE externalserviceid IN (SELECT id FROM 
"external_services" WHERE component = ?), Array)Command was: DELETE FROM 
"oauth_server_registry" WHERE externalserviceid IN (SELECT id FROM 
"external_services" WHERE component = ?) and values was (0:module/lti)
  Call stack (most recent first):
    * log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, 
true, true) at /var/www/mahara/htdocs/lib/errors.php:95
    * log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at 
/var/www/mahara/htdocs/lib/errors.php:858
    * SQLException->__construct("Failed to get a recordset: postgres8 error: 
[-1: E...") at /var/www/mahara/htdocs/lib/dml.php:1025
    * delete_records_sql("DELETE FROM "oauth_server_registry" WHERE 
external...", array(size 1)) at /var/www/mahara/htdocs/lib/dml.php:1002
    * delete_records_select("oauth_server_registry", "WHERE externalserviceid 
IN (SELECT id FROM {extern...", array(size 1)) at 
/var/www/mahara/htdocs/webservice/lib.php:1529
    * external_delete_descriptions("module/lti") at 
/var/www/mahara/htdocs/webservice/lib.php:1570
    * external_reload_webservices() at 
/var/www/mahara/htdocs/auth/webservice/db/upgrade.php:594
    * xmldb_auth_webservice_upgrade("2017030600") at 
/var/www/mahara/htdocs/lib/upgrade.php:450
    * upgrade_plugin(object(stdClass)) at 
/var/www/mahara/htdocs/lib/mahara.php:272
    * upgrade_mahara(array(size 1)) at 
/var/www/mahara/htdocs/admin/cli/upgrade.php:56

  [WAR] 79 (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 "oautservconf_oau_fk" on table "oauth_server_config"
  [WAR] 79 (lib/dml.php:1025) DETAIL:  Key (id)=(7) is still referenced from 
table "oauth_server_config".] in adodb_throw(DELETE FROM 
"oauth_server_registry" WHERE externalserviceid IN (SELECT id FROM 
"external_services" WHERE component = ?), Array)Command was: DELETE FROM 
"oauth_server_registry" WHERE externalserviceid IN (SELECT id FROM 
"external_services" WHERE component = ?) and values was (0:module/lti)
  Call stack (most recent first):
    * delete_records_sql("DELETE FROM "oauth_server_registry" WHERE 
external...", array(size 1)) at /var/www/mahara/htdocs/lib/dml.php:1002
    * delete_records_select("oauth_server_registry", "WHERE externalserviceid 
IN (SELECT id FROM {extern...", array(size 1)) at 
/var/www/mahara/htdocs/webservice/lib.php:1529
    * external_delete_descriptions("module/lti") at 
/var/www/mahara/htdocs/webservice/lib.php:1570
    * external_reload_webservices() at 
/var/www/mahara/htdocs/auth/webservice/db/upgrade.php:594
    * xmldb_auth_webservice_upgrade("2017030600") at 
/var/www/mahara/htdocs/lib/upgrade.php:450
    * upgrade_plugin(object(stdClass)) at 
/var/www/mahara/htdocs/lib/mahara.php:272
    * upgrade_mahara(array(size 1)) at 
/var/www/mahara/htdocs/admin/cli/upgrade.php:56


  The lti service had been configured in the past but is now disabled.
  During the upgrade, it tries to clean up the tables for unused modules
  and the lti comes up in the list.

  But, it's failing due to a foreign key constraint on the
  oauth_server_config table.

  The external_delete_descriptions() needs to also remove records from
  the oauth_server_config table before removing records from the
  oauth_server_registry table.

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

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to