Course backup on command line without user data

Course backup on command line without user data

by Jinxing Chen -
Number of replies: 7

Hi, all

I know how to run the cli script to backup the course, but is any method allow backup the course without user data on command line?

Thanks

Average of ratings: -
In reply to Jinxing Chen

Re: Course backup on command line without user data

by Ken Task -
Picture of Particularly helpful Moodlers

If I re-call correctly, that CLI script takes some parameters found in the options set for backups. 

http://yoursite/admin/settings.php?section=backupgeneralsettings

Include users check box is selected by default which means automated backups will include users.  Uncheck (deselect that item), run the cli script on one course as a test and you'll see the backup filename includes 'nu' ... no users.

php backup.php --courseid=[CID#]


where [CID#] is the course ID number.

In addition, I have a little script in /admin/cli/ that creates a text file so I can find course ID's from command line:

mysql -u root -p -e "use moodle;select id,fullname,shortname from mdl_course;" > courses.txt;cat courses.txt

courses.txt  looks like:

id    fullname    shortname
1    Moodle 27    M27
2    SA    SA
4    Moodle Sharing    MSHARE

After making your no user CLI backups, you'll have to go back to the settings and re-set whatever is desired for backups.

'spirit of sharing', Ken



Average of ratings: Useful (2)
In reply to Ken Task

Re: Course backup on command line without user data

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

Hi,

But surely it would be usefull if the CLI backup script was able to take parameters (on command line) that could be different from what is selected in Moodle!

Il would allow to include (or not) user data, logs...

Perhaps look if something for that exists in the tracker, or create it wink

Séverin

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

Re: Course backup on command line without user data

by Ken Task -
Picture of Particularly helpful Moodlers

Totally agree, it would be useful to have a couple of optons, IHMO.   Author of the script can be seen in header comments of the script itself.   Might consider contacting directly and inquiring.

'spirit of sharing', Ken


In reply to Ken Task

Re: Course backup on command line without user data

by Jinxing Chen -
100 votes for this feature.
In reply to Jinxing Chen

Re: Course backup on command line with(out) user data, or with(out) logs

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

Ok, but just posting a message like that is only intentionnal, and doesn't really help...

So, i've created MDL-52050 smile

If you find 100 people to vote for it, it will really help wink

Séverin

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

Re: Course backup on command line with(out) user data, or with(out) logs

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

Hi,

If someone is interested by this, don't hesitate to vote, comment, developp something for MDL-52050 !

Séverin

In reply to Jinxing Chen

Re: Course backup on command line without user data

by Orinic Pillar -

What version of Moodle?  Have you tried the new backup format?  That sometimes makes it easier for larger courses to backup.