@@ -525,9 +525,9 @@ private static function createEventMetadata($course_id, $resource_id, $config_id
525525 }
526526
527527 if (\StudipVersion::newerThan ('4.4 ' )) {
528- $ room = new \Resource ($ resource_id );
528+ $ room = new \Resource ($ resource_id );
529529 } else {
530- $ room = \ResourceObject::Factory ($ resource_id );
530+ $ room = \ResourceObject::Factory ($ resource_id );
531531 }
532532 $ ca = Resources::findByResource_id ($ resource_id );
533533
@@ -619,18 +619,21 @@ public static function deleteEventForSeminar($course_id, $termin_id, $external_c
619619 /**
620620 * Updates an scheduled event
621621 * NOTE: it performs updating of scheduled record on both sides (SOP & OC)
622- * this function will be used upon time range cahnges with Slider
622+ * this function will be used upon time range change with Slider
623623 *
624624 * @param string $course_id - course identifier
625625 * @param string $termin_id - termin identifier
626626 * @param int $start - the start timestamp
627627 * @param int $end - the end timestamp
628628 * @param bool $update_resource - whether to update the resources info of scheduled recording object
629+ * @param bool $force_oc_update - a flag to force update recordings on opencast.
629630 *
630631 * @return bool success or not
631632 */
632- public static function updateEventForSeminar ($ course_id , $ termin_id , $ start = null , $ end = null , $ update_resource = false )
633+ public static function updateEventForSeminar ($ course_id , $ termin_id , $ start = null , $ end = null , $ update_resource = false ,
634+ $ force_oc_update = false )
633635 {
636+ $ has_changes = false ;
634637 $ date = new \SingleDate ($ termin_id );
635638 $ resource_id = $ date ->getResourceID ();
636639 if (!$ resource_id ) {
@@ -674,6 +677,7 @@ public static function updateEventForSeminar($course_id, $termin_id, $start = nu
674677 if (!empty ($ new_start )) {
675678 $ scheduled_recording_obj ->start = $ new_start ;
676679 $ scheduled_recording_obj ->store ();
680+ $ has_changes = true ;
677681 }
678682
679683 $ new_end = 0 ;
@@ -692,6 +696,7 @@ public static function updateEventForSeminar($course_id, $termin_id, $start = nu
692696 if (!empty ($ new_end )) {
693697 $ scheduled_recording_obj ->end = $ new_end ;
694698 $ scheduled_recording_obj ->store ();
699+ $ has_changes = true ;
695700 }
696701
697702 $ is_livestream = (bool ) $ scheduled_recording_obj ->is_livestream ;
@@ -703,6 +708,11 @@ public static function updateEventForSeminar($course_id, $termin_id, $start = nu
703708 $ workflow_id = $ is_livestream ? $ resource_obj ['livestream_workflow_id ' ] : $ resource_obj ['workflow_id ' ];
704709 $ scheduled_recording_obj ->workflow_id = $ workflow_id ;
705710 $ scheduled_recording_obj ->store ();
711+ $ has_changes = true ;
712+ }
713+
714+ if (!$ force_oc_update && !$ has_changes ) {
715+ return true ;
706716 }
707717
708718 $ metadata = self ::createEventMetadata ($ course_id , $ resource_id , $ resource_obj ['config_id ' ], $ termin_id , $ event_id , $ is_livestream );
0 commit comments