Wish: clean-up script for database orphans

Wish: clean-up script for database orphans

by Ger Tielemans -
Number of replies: 0
Did some Moodle users develop a clean-up script that removes orphans from the database?

Lets start with an example:
  • We use the third party sidebar block, but users can very easy kill such block.
  • Then the patch came that prevented the killing of the sidebar block before the content was removed first
  • Then we no longer could kill the blocks, not even the empty ones
  • Test-tracing this process in the database, I saw that without the patch the sidebar block was killed, but the resources and activities stayed as orphans in the database. For label it is easy to trace this and kill the orphan, but other activities have more and deeper links...
That made me wonder: is there not a script "thinkable" that starts at the deepest level of the content of all tables and then identifies "missing parents in higher tables" and kills - with my permission - the orphans/the orphan-threads?
Average of ratings: -