Books in Moodle 3 Backup -> Restore links are not updating

Books in Moodle 3 Backup -> Restore links are not updating

by Andrew Normore -
Number of replies: 6

On our old Moodle 2.6, when backup / restoring a course - the URL's would change.

In Moodle 3.3.2 this exact same process results in the links NOT changing.


So this link for example:

PROBLEM: The link doesn't update!

BACKUP COURSE A: /mod/book/view.php?id=466215&chapterid=41778

RESTORE TO COURSE B: /mod/book/view.php?id=466215&chapterid=41778 <-- the link didn't update!

SHOULD BE:

BACKUP COURSE A: /mod/book/view.php?id=466215&chapterid=41778

RESTORE TO COURSE B: /mod/book/view.php?id=100518102&chapterid=85105 <-- The link has successfully updated!


Average of ratings: -
In reply to Andrew Normore

Re: Books in Moodle 3 Backup -> Restore links are not updating

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

How are the links being added initially?  Where are they being added?  

In reply to Emma Richardson

Re: Books in Moodle 3 Backup -> Restore links are not updating

by Andrew Normore -

They are indeed being added manually. So I thought, there's no way it'll work the way that department wants.

However, it does in Moodle 2.6 work completely. Very weird. There must be a filter on the restore.php.


In reply to Andrew Normore

Re: Books in Moodle 3 Backup -> Restore links are not updating

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

So at one point I remember that if you added them through the moodle add link interface they used to work but if you added them in the html directly they would not.

I am not saying they will not work - I have labels linking to activities that do indeed update but it seems like not always...I haven't played with it for a while but you might try readding a link making sure you use the Add Link in the editor and try it again...

In reply to Andrew Normore

Re: Books in Moodle 3 Backup -> Restore links are not updating

by Andrew Normore -

SOLVED: https://docs.moodle.org/34/en/Backup_and_restore_FAQ#Why_are_certain_course_links_broken_in_a_restored_course.3F

Specifically:

Why are certain course links broken in a restored course?

Inter-activity links must be absolute (full) URLs e.g.
http://site.com/mod/resource/view.php?id=xxx
in order to be processed properly during backup and restore. Any relative URLs e.g.
/mod/resource/view.php?id=xxx
,
../resource/view.php?id=xxx
or
view.php?id=xxx
will result in broken links when the course is restored.


We recently had changed our website to https://www.... This means when Moodle does the restore, the string replacement for links does not trigger. I ran a MySQL query on the entire database to scan for the http://www.ourwebsite.com and updated it.

It works perfectly, as intended now!


Cheers,

Average of ratings: Useful (1)
In reply to Andrew Normore

Re: Books in Moodle 3 Backup -> Restore links are not updating

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi Andrew,

When you change the URL of your Moodle site, it is (more or less) a Moodle migration. And you can see in the dedicated documentation that you need to update the database. It can be done with the search and replace tool, that as the advantage to also make changes in HTML blocks.

Séverin

Average of ratings: Useful (1)
In reply to Séverin Terrier

Re: Books in Moodle 3 Backup -> Restore links are not updating

by Andrew Normore -

Correct! Ran the update script and it works now. Cheers,