Possible to 'backwards' restore from Moodle 2.7 to 1.9?

Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Alex Vanden Bosch -
Number of replies: 19

As the title says, really - is it possible? :/ 

Average of ratings: -
In reply to Alex Vanden Bosch

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

I don't think it is, no, I'm afraid. I am not an expert though, so let's see what others think too.

In reply to Alex Vanden Bosch

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

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

No.  No backwards compatibility.

In reply to Alex Vanden Bosch

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Ken Task -
Picture of Particularly helpful Moodlers

Both Mary and Emma are correct ...  using the Moodle UI's, no.  

From command line and a text editor with a great deal of re-editing the xml flies of an un-archived backup of the 2.7 on could acquire some parts but not all.     Example: in a 2.x backup, the 'roadmap' for restoring the course contained in a moodle_backup.xml file.   A valid 1.9 backup had a similar file called moodle.xml.  Now changing the name won't do the trick by itself.   One also has to edit the xml file to make it compatible with the 1.9 restore process.   For the files contained in the 2.7 course - files.xml and the related 'files' directory for the actual files themselves (by contenthash name - not humanly re-cognizable by filename.ext).

One could NOT get users for sure ... too much has changed in the area of passwords.

It might, however, be possible to get the files that were uploaded to a 2.7 extracted from the backup in 2.7 format, out into an 'extracted' directory by their humanly recognizable file names/types with some work (command line only).

The real question is ... just how important is it to do this ... 2.7 course backwards to a 1.9 ... and how much time one really wants to spend on it.

'spirit of sharing', Ken

In reply to Ken Task

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Alex Vanden Bosch -

Thanks for getting back to me, guys! 

It sounds like something that I wont be tackling any time soon. 

The reason for doing it was I remember in the course back ups in 1.9, the moodle.xml file held all the course information in a, more or less, 'human readable' format. 

My current predicament is that I have to find and replace all the British English words in our courses into US English words over many hundreds of pages of content. In Moodle 1.9, I could pull out the xml file and just 'find and replace' and it would change the words throughout the whole course. Now I don't know where to begin with it all!

In reply to Alex Vanden Bosch

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

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

Why not just change the language in the language settings?

In reply to Emma Richardson

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Alex Vanden Bosch -

That just changes the language of Moodle, no? I need to change the language within our content which is made up of various things like lessons and pages. 

In reply to Alex Vanden Bosch

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Derek Chirnside -

Alex, Part of this will depend on what you mean by 'pages'

Are they files?  word/pdf maybe.  Or Moodle pages?  Or inside Lesson etc?  Or are they section details and labels?

Have you pulled apart a backup from 2.x to see how it is constructed?

-Derek

In reply to Derek Chirnside

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Alex Vanden Bosch -

Its mainly Moodle pages, but some lessons. It was originally Word docs, but it has been split up and put into various Moodle pages. For example; a subject on Genetics has been split into 7 Moodle topics, each of which has around 5-7 Moodle pages and then a quiz. So one subject may have 50+ pages and there are around 30 subjects. 

I have unzipped a backup, but I can't see anything related to the actual content text?

In reply to Alex Vanden Bosch

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

i'd be very tempted to just write a Moodle filter that converted the words on the fly - and install/configure that filter on your US site - that way you don't have to modify any of the content at all.... Probably wouldn't be very hard to create either...

Average of ratings: Useful (1)
In reply to Dan Marsden

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Alex Vanden Bosch -

That just sounds like magic and witchcraft to me, I'm afraid!


Edit: Just looking at the Moodledocs page on filters and it looks like you could be right! Just going to give it a go now (with my very limited coding abilities, this could all go horribly wrong)

In reply to Dan Marsden

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Alex Vanden Bosch -

It looks like you're onto a winner there; I followed the 'hello world' tutorial and it works perfectly! I think I owe you about a month of my life!

One small question though. This is the hello word code:

<?php

class filter_helloworld extends moodle_text_filter {

    public function filter($text, array $options = array()) {

        return str_replace('world', 'hello world!', $text);

    }

}

?>

So it replaces the string 'world' with 'hello world!', but I have a list of about 400 words to change. How would that go in the coding? Like this?

return str_replace('colour', 'color', $text);

return str_replace('centre', 'center', $text);

return str_replace('metre', 'meter', $text);



In reply to Alex Vanden Bosch

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Why are you deliberately entering misspellings into your text? mixed   No wonder kids can't read any more!

Look at the Oxford Dictionary, please!  


P.S Webster got it wrong!   sad   Ask Stephen Fry, Melvin Bragg et. al.!!!!

In reply to Colin Fraser

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

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

As a Brit that is now also an American, I can confirm that he is translating not misspelling.  I too am bilingual - English and American!!

In reply to Emma Richardson

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Sadly Emma, our local Murdoch rag ran a front page headline that used the word "jail" instead of the correct "gaol". Unbelievable!!!! Having said that, Webster's dictionary predates OED by more than 60 years, a fact the purists have long lamented. Although Johnson's work predates them all, there were many other English, mostly unreliable and more concerned with the etymology of words, dictionaries before him. 

And btw, I was really being sarcastic, or caustic or something there... Every now and again, some serious topic needs a bit of lightening up blush  

In reply to Colin Fraser

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
My comment was meant to be humorous too or humourous perhaps!!
In reply to Alex Vanden Bosch

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
few different options - one would be putting them in an array like this:


$strings = array();
$strings['colour'] = 'color';
$strings['centre'] = 'center';

foreach ($strings as $string1 => $string2) {
     $text = str_replace($string1, $string2, $text);
}

Or you could be "clever" and read the lang/en_us/moodle.php file to load in all your US strings and the lang/en/moodle.php to load in the "proper" strings and then replace all of them.

Of course - because all your text is being parsed by filters this may affect the performance of your server so it's probably worth doing some testing to see how well it performs.

In reply to Dan Marsden

Re: Possible to 'backwards' restore from Moodle 2.7 to 1.9?

by Alex Vanden Bosch -
Sorry for being a pain, but I'm having a little bit of trouble actually writing the code correctly. 

Where would I put the code you put in your example above? 

I tried this, but it didn't work:

<?php

class filter_helloworld extends moodle_text_filter {

    public function filter($strings = array();

    $strings['colour'] = 'color';

    $strings['centre'] = 'center';) {

      foreach ($strings as $string1 => $string2) {

           $text = str_replace($string1, $string2, $text);

    }

}

?>