Automated restore?

Automated restore?

by Stephen Poynter -
Number of replies: 8

Is there anyway to restore muliple courses at once in Moodle 2.x (i.e. a command line script)?  Thanks...

Average of ratings: -
In reply to Stephen Poynter

Re: Automated restore?

by Julia Küfner -

no there isn't sad

I would need that too to copy courses into an archive category

 

In reply to Stephen Poynter

Re: Automated restore?

by Chris Lewis -

I have attached a script that I used to automatically restore mbz files that are created.  This was used in Moodle 2.2 and it has NOT gone through review or cleanup (it was a quick-and-dirty program).  Most of the code came from Broom (https://github.com/moodleou/moodle-local_broom) by Sam Marshall. 

  It works like this, any mbz file in the dataroot/autoexport folder will be read in and opened up.  It will then read in the course.xml file and create a category (if one does not already exist) and then restore the course.  I made the autoexport folder myself and that is where the autoexport.php script (moodle/admin/cli) was told to dump its output.  You might have to change that or copy your stuff into it.  Hope this helps.

  Take a look here http://moodle.org/mod/forum/discuss.php?d=193187&parent=844568

Average of ratings: Useful (2)
In reply to Chris Lewis

Re: Automated restore?

by sac m -

Thanks, worked with me nicely. Thanks again for you efforts.

In reply to Chris Lewis

Re: Automated restore?

by Jenny Watt -

THANK YOU!! Just what I was looking for. Wish now I'd Googled first instead of trying to figure it out on my own -- stubborn that way, I guess! wink

Thank you again!

Jenny

In reply to Chris Lewis

Re: Automated restore?

by Cathal O'Riordan -
Picture of Core developers

Hi Chris,

You mentioned 'autoexport.php'; is this a script you put together yourself? Does it differ much from the standard Moodle cron backup? Also, I've not encountered .mbz format backups before. Are these new to Moodle 2?

Cathal.

In reply to Chris Lewis

Re: Automated restore?

by Lael ... -

Hi,

We are in the process of upgrading from 1.9. Is there a way to use this with 2.3?

Thanks!

In reply to Lael ...

Re: Automated restore?

by Thorsten Bieser -

Hello Lael,

We had the same problem. Using the script with 2.3 or higher an error occured:

Invalid database query parameter value Debug: Objects are are not allowed: SimpleXMLElement

 

The solution:

 

change this lines of the script : (about line 47)

        $shortname = (string)($xml->shortname);
        $fullname = (string)($xml->fullname);
        $categoryname = (string)($xml->category->name);

 

cheers

Thorsten

 

 

In reply to Chris Lewis

Re: Automated restore?

by Mawuli Kuivi -

Hello Chris,

If I had a backup file with logs and wanted to set it so that the restore does not include logs, how would l do this?