1
0
mirror of https://github.com/PlagiarismCheck/moodle-plagiarism_pchkorg.git synced 2024-12-22 12:10:08 +00:00

Handle situation when we can not receive file.

This commit is contained in:
Jane Adelmann 2019-04-26 15:01:08 +03:00
parent 9caf4af4b8
commit 7951fd129c
No known key found for this signature in database
GPG Key ID: 4CCF39DF30B8AF72

15
lib.php
View File

@ -560,6 +560,21 @@ display: inline-block;"
$moodlesubmission = $DB->get_record('assign_submission', array('assignment' => $cm->instance, $moodlesubmission = $DB->get_record('assign_submission', array('assignment' => $cm->instance,
'userid' => $filedb->userid, 'id' => $filedb->itemid), 'id'); 'userid' => $filedb->userid, 'id' => $filedb->itemid), 'id');
$file = $fs->get_file_by_id($filedb->fileid); $file = $fs->get_file_by_id($filedb->fileid);
// We can not receive file by id.
// Maybe file does not exist anymore.
// So we mark it as error and continue.
if (!$file || !is_object($file)) {
$filedbnew = new stdClass();
$filedbnew->id = $filedb->id;
$filedbnew->attempt = $filedb->attempt + 1;
$filedbnew->state = 11; // Sending error.
$DB->update_record('plagiarism_pchkorg_files', $filedbnew);
continue;
}
if ($apiprovider->is_group_token()) { if ($apiprovider->is_group_token()) {
$textid = $apiprovider->send_group_text( $textid = $apiprovider->send_group_text(
$apiprovider->user_email_to_hash($user->email), $apiprovider->user_email_to_hash($user->email),