Databases: Make Global Changes to Resource Visibility Using The Database

Databases: Make Global Changes to Resource Visibility Using The Database

by Matt Bowler -
Number of replies: 1

Hello,

We have a number of links on 'cloned' courses which have the same name and reference but are currently not visible - is there a way, using SQL make them all visible, rather than me having to enter the (140-odd)courses individually and make them visible 'by hand'.

We're using 1.9.x and I'm currently looking at a query like:

UPDATE `mdl_course_modules`,'mdl_resource'

SET `visible` = '1'

WHERE `visible` = '0'

AND `name` = 'XXXX'

I'd be grateful if anyone has any pointers!

Average of ratings: -
In reply to Matt Bowler

Re: Databases: Make Global Changes to Resource Visibility Using The Database

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That should work.

The only trick you may need to know is that after a change like that, you may need to set mdl_course.modinfo = '' (or NULL?) for the courses that are affected. That is basically a cache for performance, so clearing it is safe, and if you don't clear it, you probably won't see the changes.