Fix resources in Moodle 1.6 -> 1.8 upgrade

Since we upgraded Moodle to 1.8, I have been bothered by how the web and file resources displayed after the conversion. A new, intermediate screen appeared asking the user to click to open the requested resource, a bother if you were used to clicking on the link and seeing the page immediately open.


I discovered today that Moodle 1.8 (or was it 1.7?) eliminated the “display in a frame” option for resources, which had been the default option in 1.6. We were getting this new screen for any resource that had the frame option selected. I’m not sure whether this was an intentional omission from the Moodle upgrade scripts or not. It’s worth mentioning that all other aspects of the Moodle upgrade went extremely smoothly!

How could we update all of the resources with this problem at once? I looked into the database and developed the following query to do the trick.

update `resource` set `options`='' where `options`='frame';

This changes all resources that used to open within a frame so that they will open in the same window.

Please note that tinkering directly with the database of any application is only recommended if you have first thoroughly tested the change and have a solid backup of your data! One way to test is to run the query on individual records within a test course before applying it to real courses. I certainly feel a lot better about making global changes in this manner during the summer when the site is inactive.

One comment

  1. Martin says:

    Note that this frame change was a direct result of compliance with XHTML Strict 1.0 … frames aren’t allowed for accessibility. Blame W3C (and screen-reader manufacturers)! 🙂