Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6815

Re: Course Backup Files

$
0
0
by Ken Task.  

There is a plugin:
https://moodle.org/plugins/report_allbackups

You might install that.

"...in the directory we specify?"   Yes.

File names of .mbz backup files ... if left for defaults, they look like this:

backup-moodle2-course-3-jecli-20231210-1536-nu.mbz

in the example above, 3 is the course ID number on the server it was backed up from.
jecli - is the shortname of the course.
20231210-1536 - is date/time stamp
nu means no users contained in it.

You could run a command line bash shell script in admin/cli/ that produces a courses.txt file listing:

mysql -u root -p'password' -e "use moodle;select id,category,fullname,shortname,visible,format from mdl_course;"> courses.txt;cat courses.txt;wc -l courses.txt

Looks like:
head courses.txt
id      category        fullname        shortname       visible format
4       86      Government - Marshall   Government      1       topics
5       153     AP Computer Science - All Teachers      APCS    0       topics
9       66      Pre-Calculus - All Teachers     Pre-Calculus    1       topics
10      93      SA      SA      0       topics
13      144     Art II: Graphic Design & Illustration I - Letterman     FA-GD&I 1       topics
27      63      AP Calculus AB  AP Calculus AB  1       topics
28      63      AP Calculus BC  CalcBC  1       onetopic
29      45      English II Pre-AP - Sanchez     ENG II PAP      1       topics

and use courses.txt to cross reference the backups - id number - shortname.
BTW, course ID 1 is your front page but you cannot restore that backup to the front page.

As far as restoring those backups outside moodledata ...
you could setup a file system repository that points to where they have been saved.
Then use that repository to restore courses.
If doing that, probably best to allow only sys admins to do that as teachers would see all the backups of all the courses.

I also use the following 'getcids': script
mysql -u root -p'pass' -e "use moodle;select id from mdl_course;"> cids.txt;cat cids.txt;wc -l cids.txt

to get a id number listing of all the courses, then use that cids.txt file in a looping script that uses cli backup script

#!/bin/bash
#
# echo $1;
cd /var/www/html/admin/cli/;
for i in `cat /var/www/html/admin/cli/cids.txt`
do
    echo "Course ID in que:" $i;
    php backup.php --courseid=$i --destination=/home/cbackups/20230805/
done
ls -l /home/cbackups/20230805/;
echo 'Done!';

As you can see by above I have multiple directories - the one above from Aug. 8 of 2023.

I find the above method to be more flexible than using autobackups.

'SoS', Ken


Viewing all articles
Browse latest Browse all 6815

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>