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

Backup by Category ID Instead of by Course ID

$
0
0
von Ken Task.  

Tis Massive Moodle Month (MMM)!

The month (a week or a few days) right before the 1st semester of a new academic year (2025).

Plugins:
You can look:
https://moodle.org/plugins/?q=backup

But I didn't find any ... soooooooo ...

If you have command line access there is a way to do exactly what you want with a little bash shell scripting ... a loop or repeat method (below is repeat method).


DB query:
select id,category,fullname from mdl_course where category=43;
The id is the course id.
Real Example:
mysql> select id,category,fullname from mdl_course where category=43;
+-----+----------+---------------------------------------------------------+
| id  | category | fullname                                                |
+-----+----------+---------------------------------------------------------+
|  42 |       43 | Science TAKS Resource                                   |
|  43 |       43 | New Employee Mentor Program                             |
|  44 |       43 | New Employee Orientation Paraprofessional Tech Training |
|  45 |       43 | New Employee Orientation Curriculum and Instruction     |
|  46 |       43 | New Employee Orientation: Technology                    |
| 387 |       43 | New Employee Moodle Practice                            |

to backup all courses with one-liners
From code/admin/cli/

php ./backup.php --courseid=42 --destination=/home/neweployee2025/
php ./backup.php --courseid=43 --destination=/home/newemployee2025/
php ./backup.php --courseid=44 --destination=/home/newemployee2025/
php ./backup.php --courseid=45 --destination=/home/newemployee2025/
php ./backup.php --courseid=387 --destination=/home/newemployee2025/

/home/newemplyee2025 must exist - can make manually.

To do them all in one script
nano donewemplyeebu
put all the above lines in donewemployee
and add to the bottom of that file

ls -l /home/newemployee2025/
echo 'Done'

To execute:
from admin/cli/ where donewemplyeebu file exist
source ./donewemployeebu

You should see something like:

== Performing backup... ==
Writing /home/newemployee2025/backup-moodle2-course-42-science_taks_resource-20250909-0047.mbz
Backup completed.
== Performing backup... ==
Writing /home/newemployee2025/backup-moodle2-course-43-neo_mentor-20250909-0047.mbz
Backup completed.
== Performing backup... ==
Writing /home/newemployee2025/backup-moodle2-course-44-neo_admin-20250909-0047.mbz
Backup completed.
== Performing backup... ==
Writing /home/newemployee2025/backup-moodle2-course-45-neo_c_and_i-20250909-0047.mbz
Backup completed.
== Performing backup... ==
Writing /home/newemployee2025/backup-moodle2-course-387-nemp-20250909-0047.mbz
Backup completed.
total 85336
-rw-rw-rw-. 1 root root  6504138 Sep  9 00:47 backup-moodle2-course-387-nemp-20250909-0047.mbz
-rw-rw-rw-. 1 root root  1051730 Sep  9 00:47 backup-moodle2-course-42-science_taks_resource-20250909-0047.mbz
-rw-rw-rw-. 1 root root   634260 Sep  9 00:47 backup-moodle2-course-43-neo_mentor-20250909-0047.mbz
-rw-rw-rw-. 1 root root   821931 Sep  9 00:47 backup-moodle2-course-44-neo_admin-20250909-0047.mbz
-rw-rw-rw-. 1 root root 78365432 Sep  9 00:47 backup-moodle2-course-45-neo_c_and_i-20250909-0047.mbz
Done

'Spirit of Sharing' (SoS) and here's hoping your MMM goes well! lächelnd

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>