Immediate refresh of display after deleting course from code

Immediate refresh of display after deleting course from code

by Peter Eliyahu Kornfeld -
Number of replies: 4

Hi,

I do delete a course using delete_course($course, false).

When looking - immediately after it - at the course list I have some error:

error

It is about cache, and it goes away after some minutes, but I want to refresh the cache immediately after deleting the course...


Thank you,

Peter



Average of ratings: Useful (1)
In reply to Peter Eliyahu Kornfeld

Re: Immediate refresh of display after deleting course from code

by Ranil Peiris -

I also have the same issue. Please help if someone know how to prevent this issue.

Thank you

Ranil

In reply to Ranil Peiris

Re: Immediate refresh of display after deleting course from code

by Sam Chaffee -
Picture of Core developers

Are you using this after delete_course()?

fix_course_sortorder();

See the example in course/delete.php. It handles purging course-related caches as necessary.

In reply to Sam Chaffee

Re: Immediate refresh of display after deleting course from code

by Peter Eliyahu Kornfeld -

Thank you...


I will test it. Only wondering, if it is so important, why it's not part of the 'course_delete' API?


In reply to Peter Eliyahu Kornfeld

Re: Immediate refresh of display after deleting course from code

by Sam Chaffee -
Picture of Core developers

Without looking at the code again my guess is that so one could potentially do multiple course deletes without going through all the work of fixing the sort orders and purging the caches each time.