We're using 2.9, (last ones on the planet, I know, but we've got an upgrade scheduled soon). Our site admin installed the course archiver plugin and archived a bunch of old courses in an emergency attempt to free up some server space. Unbeknownst to me (until this week), the archive files have been stripped of all resources and activities, which renders them useless when restored to the site
Has anyone run into this issue before? Is a fix? Or is there a better way to archive courses? Our admin is reluctant to do anything with Moodle other than what is absolutely necessary at this point, and I don't know enough to be able to step in and figure this out on my own. I'm ready to manually back up and save courses if I need to....
First part ... possible recovery ... **depending upon factors** ... if site admin did a full site backup ... code, data, SQL dump prior to the installation of that plugin, that backup could be restored to another server. That would have the courses that had been deleted and you could make backups from there.
Other wise, that data/courses is toast ... blown to data bits ... never to be recovered. :\
Fix .... there is a command line utility one can install called moosh. It could be used.
OR ... one could mount a large drive and use it for an archive location ... one could mount a Windows share, a Linux share, or ever a Google Bucket ... 1OP to begin ... or an Amazon Bucket.
Once the archive drive/partition/bucket is mounted and tested, use the backup script found in moodlecode/admin/cli/ called backup.php AND loop it through a text listing of the course ID's to 'archive'.
The script will use the preferences/options seen in the Site Admin Courses Backup. So if you leave it for it's defaults, that would include users, activities, assignments, etc. ... all of it.
Here's a bash shell example script:
[root@server cli]# cat niclbackups
for i in $(cat ./cids.txt)
echo 'Course ID in que:' $i;
php backup.php --courseid=$i --destination=$mcbudir
ls -l $mcbudir;
Quick explanation: mdlvars.txt contains the $variable definitions.
note: /home/backup/ is a mounted device with tons of space.
The course id's are in cids.txt which is created by a bash shell script to query the DB and find all courses which match whatever parameter is set. The following doesn't do any of the parameter options possible, but does provide a cids.txt file that list all course ID's in the DB:
mysql -u $mddbuser -p$mddbpass -e "use $mddbname;select id from mdl_course;" > cids.txt;cat cids.txt
One would need to edit the cids.txt file to remove the first line ... which are column headings and the first course which is ID 1 ... the front page.
So cids.txt would look like:
[root@servcer cli]# cat cids.txt
Running of niclbackups (and this is a real example), will produce something like this - shows only one cid.
[root@server cli]# ./niclbackups
Course ID in que: 3
== Performing backup... ==
instantiating backup controller 03814dd5ebc3fe5f4f68b255982e09c4
setting controller status to 100
loading controller plan
setting controller status to 300
applying plan defaults
setting controller status to 400
setting file inclusion to 1
checking plan security
setting controller status to 500
setting controller status to 700
saving controller to db
calculating controller checksum 65802893cf8466578242af2961d7d437
loading controller from db
setting controller status to 800
setting controller status to 1000
saving controller to db
And the results would look like:
[root@server courses]# ll
-rw-rw-rw-. 1 root root 2768324 Aug 23 23:03 backup-moodle2-course-2-sa-20180823-1803.mbz
-rw-rw-rw-. 1 root root 2768571 Nov 8 22:16 backup-moodle2-course-2-sa-20181108-1616.mbz
-rw-rw-rw-. 1 root root 3871466 Aug 23 23:02 backup-moodle2-course-3-test-20180823-1802.mbz
-rw-rw-rw-. 1 root root 3871892 Nov 8 22:14 backup-moodle2-course-3-test-20181108-1614.mbz
-rw-rw-rw-. 1 root root 23625270 Aug 23 23:02 backup-moodle2-course-4-mshare-20180823-1802.mbz
-rw-rw-rw-. 1 root root 23624968 Oct 11 16:43 backup-moodle2-course-4-mshare-20181011-1143.mbz
-rw-rw-rw-. 1 root root 23624952 Nov 8 22:14 backup-moodle2-course-4-mshare-20181108-1614.mbz
-rw-rw-rw-. 1 root root 1214384 Aug 23 23:02 backup-moodle2-course-5-slcentos-20180823-1802.mbz
-rw-rw-rw-. 1 root root 1218056 Nov 8 22:14 backup-moodle2-course-5-slcentos-20181108-1614.mbz
-rw-rw-rw-. 1 root root 1260970934 Sep 6 22:34 backup-moodle2-course-6-gte_complete-20180906-1733.mbz
-rw-rw-rw-. 1 root root 1260971279 Nov 8 22:16 backup-moodle2-course-6-gte_complete-20181108-1614.mbz
Some cautions .... settings in backup preferences, space available on the mounted device, running the script is not advised during 'prime time', there has to be enough space in moodledata/temp/backup/ to backup the largest course at least.
'spirit of sharing', Ken
Ken, I so appreciate your prompt help! I'll pass this information along and hope for a speedy resolution.