Databases: Server Name Change and HTML Block Content

Databases: Server Name Change and HTML Block Content

by Rob Hudson -
Number of replies: 1
Hello all,

Not specifically a database problem but I thought this was the most appropriate place.

We've been migrating courses from one server to another with a totally different hostname. The backup restore process takes care of a lot of the URL changing and a find replace on the database does more. A particular issue that we've come across is the content of HTML blocks. This seems to be stored base64 encoded which means the database find replace does not pick it up.

Specifcally, there is an issue when a user has written a html block with a link in that refers to another part of the moodle instance.

Has anyone come across this? What would be the best way to solve it?

Thanks in advance,

Rob


Average of ratings: -
In reply to Rob Hudson

Re: Databases: Server Name Change and HTML Block Content

by Nathan Kowald -

Hi Rob,

I came across this problem recently after we changed the URL of our Moodle. I thought I'd share my solution in case it helps anyone.

I created a script that updates URLs inside HTML blocks, here's the script: http://github.com/n8kowald/moodle-scripts/blob/master/update_block_instances.php

Usage instructions: http://github.com/n8kowald/moodle-scripts

Download the script, place it in your Moodle root, update the settings for old URL and new URL. Run the script. Done.

Nathan