Panopto / Moodle-2.0-plugin-for-Panopto

Panopto's integration with the Moodle LMS.
http://www.panopto.com
GNU General Public License v3.0
18 stars 40 forks source link

2017061000: upgrade.php dies on line 307 because course id does not exist in Moodle #102

Closed alex-rowe closed 7 years ago

alex-rowe commented 7 years ago

When upgrade.php is trying $oldpanoptocourse->provisioninginfo = $oldpanoptocourse->panopto->get_provisioning_info(); on line 307 we get the error can not find data record in the database table course.

This would be because in our foldermap table, there are rows where the defined Moodle Course ID does not exist any more.

It needs a way to skip/delete these rows rather than halting the upgrade process.

jmalmsten-panopto commented 7 years ago

Hi,

Thanks for report this, I was looking into it last night but it looks like all of the DB calls in that area should be returning false on non-existent rows (and be moved to the old_foldermap table that was created from the previous ticket).

I think this issue might be specific to your Moodle instance, could you please open a support ticket with Panopto so I can more directly assist you with this?

Joe M

alex-rowe commented 7 years ago

Hi Joe,

It looks like it is coming from the call to set_course_role_permissions() inside the get_provisioning_info() function. It is trying to get the course context of a course that does not exist any more.

See the trace below

PHP message: Default exception handler: Can not find data record in database table course.
Debug: SELECT id,category FROM {course} WHERE id = ?
[array (
  0 => '3112',
)]
Error code: invalidrecord
* line 1502 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
* line 1478 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
* line 6952 of /lib/accesslib.php: call to moodle_database->get_record()
* line 1152 of /blocks/panopto/lib/panopto_data.php: call to context_course::instance()
* line 342 of /blocks/panopto/lib/panopto_data.php: call to panopto_data::set_course_role_permissions()
* line 307 of /blocks/panopto/db/upgrade.php: call to panopto_data->get_provisioning_info()
* line 925 of /lib/upgradelib.php: call to xmldb_block_panopto_upgrade()
* line 434 of /lib/upgradelib.php: call to upgrade_plugins_blocks()
* line 1742 of /lib/upgradelib.php: call to upgrade_plugins()
* line 683 of /admin/index.php: call to upgrade_noncore()
jmalmsten-panopto commented 7 years ago

Hi,

Could you please present this info as a support ticket to Panopto? We can assist more directly from there.

Joe

jmalmsten-panopto commented 7 years ago

As a workaround I would go into mdl_block_panopto_foldermap and delete the row where the moodleid is '3112', then try re-running the upgrade.

I would still need a Panopto support ticket though before I can really dig into the code and investigate more.

Closing issue, file a ticket on https://support.panopto.com if this issue persists.

Joe

alex-rowe commented 7 years ago

Thanks Jo, I will look at creating one and link to this ticket.

There are multiple rows so it will just error out on the next one, 3113 etc.

jmalmsten-panopto commented 7 years ago

Hey,

Saw your ticket, support contact not online yet so I'm letting you know I just posted a new release that should handle this case. Give it a shot and post results in the Panopto ticket.

Thanks, Joe

alex-rowe commented 7 years ago

Thanks Joe, I saw that new release get merged.

I'll continue talking with the support staff to resolve another issue we have.

Thanks