Skip to content

Commit 7be2551

Browse files
authored
Hide videos not available in OC but don't delete them from Stud.IP DB (#1291)
We don't like the idea of simply deleting videos that are not available in OC from Stud.IP, because problems in the OC search index would trigger this deletion. Instead, these videos will be hidden.
1 parent fc62094 commit 7be2551

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cronjobs/opencast_discover_videos.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,13 @@ public function execute($last_result, $parameters = array())
176176
}
177177
} while (sizeof($oc_events) > 0);
178178

179-
// Check if local videos are not longer available in OC and remove them from Stud.IP
180-
// If the video should reappear in the future, Stud.IP will readd it again.
179+
// Check if local videos are no longer available in OC
181180
foreach (array_diff($local_event_ids, $event_ids) as $event_id) {
182181
$video = Videos::findOneBySql("config_id = ? AND episode = ?", [$config['id'], $event_id]);
183182
// Need null check for archived videos
184183
if ($video) {
185-
$video->delete();
184+
$video->setValue('available', false);
185+
$video->store();
186186
}
187187
}
188188

lib/Models/Videos.php

+3
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ protected static function getFilteredVideos($query, $filters)
424424
$where .= " AND trashed = " . $filters->getTrashed();
425425
$where .= " AND oc_video.token IS NOT NULL";
426426

427+
// Show only videos available in opencast to users
428+
$where .= " AND oc_video.available = 1";
429+
427430
$sql .= $where;
428431

429432
$sql .= ' GROUP BY oc_video.id';

0 commit comments

Comments
 (0)