Hello all,
wondering if anyone can shed some light on this issue I'm having?
I'm on moodle 3.1.5, using a Postgres database, and trying to import a course into a brand new course.
The course I'm importing has some missing links, but instead of just telling me that some files are missing, it gives me this error:
-------------------------------------------------------------------------------------------------------------------------------------
Default exception handler: Can not find data record in database table files_reference.
Debug: SELECT id FROM {files_reference} WHERE repositoryid = ? AND referencehash = ?
[array (
0 => '5',
1 => 'cbcbc9b686455a06e5433ecf71d75cfae67624be',
)]
Error code: invalidrecord
* line 1608 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
* line 1584 of /lib/dml/moodle_database.php: call to moodle_database->get_field_select()
* line 2684 of /lib/filestorage/file_storage.php: call to moodle_database->get_field()
* line 1304 of /lib/filestorage/file_storage.php: call to file_storage->get_referencefileid()
* line 1027 of /backup/util/dbops/restore_dbops.class.php: call to file_storage->create_file_from_storedfile()
* line 239 of /backup/util/plan/restore_structure_step.class.php: call to restore_dbops::send_files_to_pool()
* line 59 of /mod/page/backup/moodle2/restore_page_stepslib.php: call to restore_structure_step->add _related_files()
* line 410 of /backup/util/plan/restore_structure_step.class.php: call to restore_page_activity_structure_step->after_execute()
* line 113 of/backup/util/plan/restore_structure_step.class.php: call to restore_structure_step->launch_after_execute_methods()
* line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
* line 201 of /backup/moodle2/restore_activity_task.class.php: call to base_task->execute()
* line 177 of /backup/util/plan/base_plan.class.php: call to restore_activity_task->execute()
* line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
* line 335 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
* line 162 of /backup/import.php: call to restore_controller->execute_plan(), referer: http://eldev1.cit.edu.au/backup/import.php
-------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------Upon clicking 'continue', it takes me to the course I was importing from, as opposed to the course I was in when I was doing the importing.
In there, it shows me the same error message that I get if I try to edit the label that has the dodgy file reference (and it won't let me edit the dodgy link at all. It just gives me the error message without any way to fix it!):
-------------------------------------------------------------------------------------------------------------------------------------
Debug info:
Error code: filereferenceproblem
$a contents: stdClass Object
(
[repositoryid] => 5
[reference] => Tzo4OiJzdGRDbGFzcyI6Mjp7czozOiJ1cmwiO3M6MTM1OiJodHRwOi8vY2VscmRldi5jaXQuZWR1
LmF1L2NpdGRldi9pbnRlZy9nZW4vMWM5YjdmMWEtZTU0OC00Mjc3LWJlMjQtN2Q5NTEyOWNhOGYz
LzEvP2F0dGFjaG1lbnQudXVpZD1kNTIzZDZjNS03MGYzLTQwMmItODgyMy0zNTRmYzE4MDM1YjUi
O3M6ODoiZmlsZW5hbWUiO3M6MTM6IkJlY0Jsb25kZS5qcGciO30=
[referencefileid] => 14506
[fileid] =>
)
-------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------
When I tried to go into the new course that didn't complete the import properly, I get this message:
-------------------------------------------------------------------------------------------------------------------------------------
Debug info: ERROR: duplicate key value violates unique constraint "mdl_coursect_cousec_uix"
DETAIL: Key (course, section)=(155419, 1) already exists.
INSERT INTO mdl_course_sections (course,section,summary,summaryformat,sequence) VALUES($1,$2,$3,$4,$5) RETURNING id
[array (
'course' => '155419',
'section' => 1,
'summary' => '',
'summaryformat' => '1',
'sequence' => '',
)]
Error code: dmlwriteexception
-------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------
Upon doing a course backup on the troublesome course, and then a restore from the backup file, it all works beautifully. It's just the course 'import' that seems to be stuffing up.
Any clues on what to do about this?! Is this is a bug, or simply something in my system?