delete_instance not called on deleting a resource

This forum post has been removed

Number of replies: 7
The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: delete_instance not called on deleting a resource

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Have you tried using Xdebug and putting a breakpoint in your function to see if it is being hit?

If that doesn't help, try searching for the place an error is thrown if you don't define the required function and see if you can trace up from there to work out why it isn't being called.

It would also be helpful if you have created a tracker ticket for this to post the ticket link in the forum, so anyone interested can find it without searching.

As an aside, I've written several activity plugins and the instance_delete functions for them were all working the last time I checked - but I don't regularly investigate, so it's always possible (although unlikely?) that this has been broken in recent versions of Moodle.


In reply to Davo Smith

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: delete_instance not called on deleting a resource

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you've created a ticket, please copy + paste the ticket URL here, so other users can see it and comment on it.

In reply to Davo Smith

Re: delete_instance not called on deleting a resource

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

OK - this is a new one for me. It looks like course module deletion is now handed off to an ad-hoc background task if the recycle bin is enabled (as it will need to do a backup of the activity, before it completes the deletion process).

That means that if you want to see the deletion complete, you need to run the Moodle cron script (or disable the recycle bin feature).



Average of ratings: Useful (1)
In reply to Davo Smith

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: delete_instance not called on deleting a resource

by Darko Miletić -

You have two options:

  1. Disable Recycle bin for courses.
  2. Live with it.

The way async deletion is implemented does not give you any notification that your activity is queued for deletion. You will need to manually check course_modules.deletioninprogress field for any of your activities to actually know.



Average of ratings: Useful (1)
In reply to Darko Miletić

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.