diff --git a/classes/task/get_meeting_recordings.php b/classes/task/get_meeting_recordings.php index 6d995770..6e8beb0f 100644 --- a/classes/task/get_meeting_recordings.php +++ b/classes/task/get_meeting_recordings.php @@ -104,28 +104,26 @@ public function execute() { $zoomrecordings = $service->get_user_recordings($hostid, $from, $to); foreach ($zoomrecordings as $recordingid => $recording) { - if (empty($meetings[$recording->meetingid])) { - // Skip meetings that are not in Moodle. - mtrace('Meeting id: ' . $recording->meetingid . ' does not exist...skipping'); - continue; - } - - $zoom = $meetings[$recording->meetingid]; - if (isset($localrecordings[$recording->meetinguuid][$recordingid])) { mtrace('Recording id: ' . $recordingid . ' exists...skipping'); $localrecording = $localrecordings[$recording->meetinguuid][$recordingid]; - if ($localrecording->recordingtype !== $zoom->recordingtype) { + if ($localrecording->recordingtype !== $recording->recordingtype) { $updatemeeting = (object) [ 'id' => $localrecording->id, - 'recordingtype' => $zoom->recordingtype, + 'recordingtype' => $recording->recordingtype, ]; $DB->update_record('zoom_meeting_recordings', $updatemeeting); } continue; } + if (empty($meetings[$recording->meetingid])) { + // Skip meetings that are not in Moodle. + mtrace('Meeting id: ' . $recording->meetingid . ' does not exist...skipping'); + continue; + } + // As of 2023-09-24, 'password' is not present in the user recordings API response. if (empty($meetingpasscodes[$recording->meetinguuid])) { try { @@ -136,6 +134,7 @@ public function execute() { } } + $zoom = $meetings[$recording->meetingid]; $recordingtype = $recording->recordingtype; $record = new stdClass();