Ongoing problems moving courses between servers

Ongoing problems moving courses between servers

by Andy Diament -
Number of replies: 13
I could do with some help on this: i'm moving a course from laptop to server (moodle 1.3.1 on windows to 1.3.1 on redhat)

I've made sure that all links in resources are in slash arguments format  and the restore has updated the location of the file to the correct new course...

however each instance of file.php as it appears in the editor of the restored file is

http://localhost/moodle/file.php/......

i.e. it is pointing to the php code on localhost, which is fine for me on my laptop but not for anyone else; my understanding from our earlier discussions on this is that the wwwroot is updated in the restore

Any ideas, short of doing a find and replace for localhost on the moodle.xml file in the backup?

Much appreciated in advance...Andy D
Average of ratings: -
In reply to Andy Diament

Re: Ongoing problems moving courses between servers

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Andy,

sorry by he delay, I forgot this message!!

As you said in your previous post, all the file.php calls are "translated" on the fly from their old location to the new one.

This included the translation of:

- Your old wwwroot to the new one
- Your old course->id to the new one

If the course->id modification is working fine (as you said in your previous message), I only can imagine one reason to your issue:

In your destination server, the wwwrooot variable is pointing to "http://localhost/moodle" too.

Can you confirm this? If it is false, then your course->id shouldn't be translated!!

Ciao smile
In reply to Eloy Lafuente (stronk7)

Re: Ongoing problems moving courses between servers

by Ger Tielemans -
And what about the relativ links in the html-editor that were changed by that same editor in absolut (So wrong) paths on the new server? 
In reply to Ger Tielemans

Re: Ongoing problems moving courses between servers

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Ger,

relative links (ie. "images/mylogo.jpg") needn't to be transformed in the backup/restore process at all. They will work in the new (destination) server without modifications.

If relative links are modified by the HTML editor to absolute links (ie. "http://URL/file.php/COURSEID/PATH_to_mylogo.jpg"), then the backup/restore will transform the URL and COURSEID to their new destination automatically. Obviously the "file.php" and "PATH_to_mylogo.jpg" will remain unchanged.

So, every absolute link generated by the editor, using the file.php script will be transformed without problems at all (I think).

Ciao smile

PS: All this is with "slasharguments" on, of course! wink
In reply to Eloy Lafuente (stronk7)

Re: Ongoing problems moving courses between servers

by Ger Tielemans -

Strange, which version of the HTML-editor?

How can I look at the paths in the backup.zip?

In reply to Ger Tielemans

Re: Ongoing problems moving courses between servers

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Ger,

sorry but I don't understand you blush. What is strange? In my previous post I only explained how relative and absolute links are being transformed in the backup/restore.

I think that it hasn't anything to do with HTML-editor. I only named it because in your post you did it! That transformations are absolute independent from the editor used.

Any comment? mixed

Ciao smile

PS: To see what is being transformed, you can unzip your backup file, then take a look to the moodle.xml file. Every occurrence of "$@FILEPHP@$" is an absolute path link and it will be transformed to fit in the new server/course perfectly.
In reply to Eloy Lafuente (stronk7)

Re: Ongoing problems moving courses between servers

by Ger Tielemans -

thanks. Is there in CVS or so a description of this XML structure?

I think backup is fine, (I only wonder about the userlogs, are they in yet?)

This link error is inside HTML-editor, after you reopen the window for re-editing 

In reply to Eloy Lafuente (stronk7)

Re: Ongoing problems moving courses between servers

by Andy Diament -

Thanks for the reply

The wwwroot is not pointing to localhost, it is pointing to an ip address rather than a URL, but I don't think this is the problem.

As a further test,  I have hust restored another course form a completely different source (Ray Lawrence's Getting started course from the moodle exchange), and it does everything that it is supposed to do (thanks Ray,if you are reading this) - so I know it's my course, not the restore process as such

Historically, the course was created in moodle 1.2, without slasharguments but I have tried my best to ensure that all references to file.php in the editor are done with slash arguments, which is now supported on our production server and my laptop.

It's been moved around between 3 servers - is there any information in the moodle.xml which could make the program that the code is old, so the updating wwwroot doesn't work

Andy D

In reply to Andy Diament

Re: Ongoing problems moving courses between servers

by Andy Diament -
Hi again =ignore last post

I think I've got is sussed

I took a lazy guess - I asssumed that if I changed the ? format to / format in moodle.xml in the backup all would be well, but I've found the way that you replace file.php... with FILEPHP to update the course and I think I can cure this on my own - if I need further help I will be in touch

Pays to look at things carefully

In fact cured it - it weas to do with ? instead of /, I just needed to thoroughly remove these at the html source level. Now very happy, as the course is to be distributed to other UK colleges as part of something called the Qprojects and  confident my colleagues elsewhere will now be able to use it

Andy D
In reply to Andy Diament

Re: Ongoing problems moving courses between servers

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Andy,

you are correct. If your original course backup was created in a site without the slash arguments activated then the $@FILEPHP@$ conversion won't work.

You've to edit the moodle.xml file and replace every occurrence of:

http://your_wwwroot/file.php?file=/your_original_courseid

to

$@FILEPHP@$

Then, with slash arguments activated in your destination site, all the transformations should work. cool

Ciao smile

PS: Anyway, I'm thinking that I can modify the backup (and restore) process to take care of the slash-arguments setting and make the $@FILEPHP@$ conversion to work always!. Please, if you can create a bug in http://moodle.org/bugs approve TIA!
In reply to Eloy Lafuente (stronk7)

Re: Ongoing problems moving courses between servers

by Andy Diament -
Problem sorted, reported as a bug smile Andy D
In reply to Andy Diament

Re: Ongoing problems moving courses between servers

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Cool, thanks. Working on it just now!!

It's Bug 1634 (for future reference)

Ciao smile
In reply to Eloy Lafuente (stronk7)

Re: Ongoing problems moving courses between servers:

by Andy Diament -
Hi Eloy
Tested the files that you sent me.
A course with a mixture of slash args and file.php?= for image urls
Backed up and restored successfully to 2 servers:
  • localhost (ie where it came from) moodle 1.3.2
  • production server (using ip address for wwwroot) moodle 1.3.1
wwwroot and course id successfully updated to correct values in slash argument form big grin

so should please a lot of people moving courses between servers - make sure that you make the files available CVS and draw attention to them; comment on bug report

Thanks very much indeed - I am very grateful

Cheers Andy D
In reply to Andy Diament

Re: Ongoing problems moving courses between servers:

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Andy,

thanks for your feedback. I'll close Bug 1634 in some hours.

Modified files are now in CVS and I highly recommend you (everybody) to wait some days because Moodle 1.3.3 is coming and it'll include such modifications...

Ciao smile