how call purge_cache ?

how call purge_cache ?

by stephane ngov -
Number of replies: 3

I all,

I request this query


UPDATE `mdl_test`.`course_modules` SET `availability` = '{"op":"&","c":[{"type":"profile","sf":"adresse","op":"isequalto","v":"toto"}],"showc":[true]}' WHERE `clr_course_modules`.`id` =2


I don't want use frontend for automatiquely restrict module course, the test restriction is ok ,

but the view information is not refresh


for exemple i have this page



I throw this query

UPDATE `mdl_test`.`course_modules` SET `availability` = '{"op":"&","c":[{"type":"profile","sf":"department","op":"isequalto","v":"newtoto"}],"showc":[true]}' WHERE `clr_course_modules`.`id` =2

if I test newtoto is available forum, and toto is no access it, but in " Address is toto" is not refresh,

I must purge_all cache for have in frontend newtoto

how i cant resolve it, thanks for help.



Average of ratings: -
In reply to stephane ngov

Re: how call purge_cache ?

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

You need to call the Moodle function: 'rebuild_course_cache($courseid)' to clear the cache for the course.

There is no way to do this directly in the database (as the cache can be stored in a file, or in memcache, etc., depending on your caching configuration).

What you are trying to do looks like a bad idea anyway - I'm sure there must be a much better way to add availability in the code, rather than trying to push data directly into the database like that.

In reply to Davo Smith

Re: how call purge_cache ?

by stephane ngov -

thank a lot ,

I know  it's the bad way but i try automaticaly form restricted, beacause the teacher would'not

apply cohorte , and he said he submit with a false "departement"

exemple

restricted how have departement Classe : A,

he said classe:A ? Classe A ? classe : a .... , if i automatiquely insert in base, it's a true submit form

and he said this form is not friendly