Skip to content

Introducing audit logging table for playlist videos and its cleanup cronjob #1381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 11, 2025

Conversation

ferishili
Copy link
Contributor

@ferishili ferishili commented May 28, 2025

This PR fixes #1257,

  • Implemented PlaylistVideosAuditLog for tracking add, delete, and restore actions.
  • Enhanced PlaylistVideos model to log actions during delete and store operations.
  • It specifically checks the audit log in the discovery worker to make sure that if the playlist video was removed previously! this avoids force re-adding to playlist!
  • Created a cronjob (OpencastPlaylistVideosAuditCleanup) to periodically clean up old audit log entries. (every 28 days)
  • Added migration to create the oc_playlist_videos_audit_log table and schedule the cleanup task.

P.S. Feedback, suggestions, and arguments are very much appreciated!

[UPDATE]: the above mentioned description no longer applied, please see #1381 (comment)

- Implemented PlaylistVideosAuditLog for tracking add, delete, and restore actions.
- Enhanced PlaylistVideos model to log actions during delete and store operations.
- Created a cronjob (OpencastPlaylistVideosAuditCleanup) to periodically clean up old audit log entries. (every 28 days)
- Added migration to create the oc_playlist_videos_audit_log table and schedule the cleanup task.
@ferishili ferishili requested a review from tgloeggl May 28, 2025 13:18
@ferishili ferishili self-assigned this May 28, 2025
@ferishili ferishili added type:enhancement type:bug v:3 Everything related to the Stud.IP Opencast Plugin Version 3.x labels May 28, 2025
@ferishili ferishili requested a review from dennis531 May 28, 2025 13:20
@ferishili ferishili marked this pull request as ready for review May 28, 2025 13:24
Copy link
Collaborator

@dennis531 dennis531 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good and this patch solves the problem of the linked issue except the case above. However, I wonder if there is an easier way to solve this problem without a cronjob and a new database table.

For example, wouldn't it be sufficient to check whether the video has been added to the Stud.IP database for the first time, i.e. seen by Stud.IP?
If this is the case, the video would be added to the series playlist. Otherwise, the series would be ignored.

@ferishili
Copy link
Contributor Author

However, I wonder if there is an easier way to solve this problem without a cronjob and a new database table.
For example, wouldn't it be sufficient to check whether the video has been added to the Stud.IP database for the first time, i.e. seen by Stud.IP?
If this is the case, the video would be added to the series playlist. Otherwise, the series would be ignored.

I would prefer to keep this logic within the plugin itself, especially when it comes to logging and event tracking, instead of relying on a higher-level recording mechanism (if I understood your suggestion correctly).
This is because we would also need to implement additional mechanisms for cleanup, such as removing related logs when a video or playlist is deleted.

Additionally, please note that the cronjob here is only used as a periodic cleanup task. So no need to be intimidated by it!

@ferishili
Copy link
Contributor Author

Discussion:

  • A simpler way has been discussed. and agreed upon:
    • We have to only do the addToCoursePlaylist in the discovery where the video is new! line 133!
    • So the observer needs to be removed as well!

ferishili added 2 commits June 5, 2025 15:04
- reverting audit log mechanism
- taking addToCoursePlaylist out of OpencastVideoSync observer
- only call addToCoursePlaylist when the video is fresh, this should happen only when scheduling occurs!
@ferishili
Copy link
Contributor Author

[UPDATE]: the change have been applied according to the discussion!

  • No more Audit Log in favor of simplicity
  • addToCoursePlaylist is no longer in an OpencastVideoSync event observer
  • addToCoursePlaylist is called only when the video is newly discovered, which means that it only should cover the scheduling scenario!

@ferishili ferishili requested a review from dennis531 June 6, 2025 06:19
Copy link
Collaborator

@dennis531 dennis531 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Farbod. I like this solution! It works and the code looks great!

@tgloeggl tgloeggl added this to the 3.30 milestone Jun 11, 2025
@tgloeggl tgloeggl merged commit c3b0467 into elan-ev:main Jun 11, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug type:enhancement v:3 Everything related to the Stud.IP Opencast Plugin Version 3.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Videos werden immer in die Veranstaltung ihrer Serie hinzugefügt
3 participants