このフォーラム投稿は削除されました。
返信数: 10Re: All moodle courses, themes, data and plugins deleted out of the blue?
In response to:
1 - apt is package manager for the operating system. Updates operating system. Apt could be involved in moodle files only if moodle was installed by apt. How did you install moodle?
2 - Moodle consist of 3 parts ... the files in code. The moodledata directory - which is to retain files that have been uploaded to/via moodle site. And, what really drives moodle - the database. There is a direct relationship between the mdl_files table (which is really meta data) and what's in moodledata/filedir/
To the best of my knowledge (I don't use a raspberry pi 4), the only way a site could revert back to some previous state is to restore the database. That could happen if your restore included the raw files of the moodle database. Backing up or restoring a site, one should use raw file copy of mysql database files as a *last resort*. Backing up and restoring the DB should be done via mysqldump to sql file ... and restore to a database should be done using mysql client in importing an sql file.
https://docs.moodle.org/310/en/Site_backup
Note: Mr. V is a raspberry fan I believe ... maybe he will come along any time now and correct me or provide more info.
'SoS', Ken
このフォーラム投稿は削除されました。
Re: All moodle courses, themes, data and plugins deleted out of the blue?
Did you make any backups of courses while in your moodle?
IF you did and if the upgrade/update to your moodle touched only code and DB but not moodledata, backup files could be in moodledata/filedir/
But ... you won't have any DB references to the .mbz files at that location thus no real info on files. That's because all the files stored in moodledata/filedir/ are not by humanly recognizable files names, but the contenthash value in the mdl_files table.
IF you did make backups and moodledata not touched, let's find out:
ssh into server
cd /path/to/moodledata/filedir/
then issue:
file -b ./*/*/* |grep gzip
If there are backups in there you will see above command respond with this:
gzip compressed data, from Unix
A .mbz file is 'moodle backup zip' which is really a gzipped file.
'SoS', Ken
Re: All moodle courses, themes, data and plugins deleted out of the blue?
create a script called 'nifind' (non-interactive find) in moodledata/filedir/
nano nifind
In it copy/paste the following lines:
#!/bin/bash
rm -f possiblebackups.txt
for i in $(cat ./fileslist.txt)
do
# echo 'file in que:' $i;
echo $i >> possiblebackups.txt;
file -b $i |grep 'gzip' >> possiblebackups.txt;
cat possiblebackups.txt;
done
echo 'Done!';
Save the script
Make script executable: chmod u+x nifind
Execute: ./nifind [ENTER]
That will output to a possiblebackups.txt text file.
cat possiblebackups.txt |more
space bar to see more of the file.
When you see a line that says:
gzip compressed data, from Unix
The file above it ... example:
./01/8f/018f3a11a15af7e862a3c85a602580aa7e343c63
is a gzip file and possibly a backup
copy that file to a humanly recognizable named file to another location
cp ./01/8f/018f3a11a15af7e862a3c85a602580aa7e343c63 /root/backup1.mbz
To see if it really is a backup ...
cd /root/
tar tvf backup1.mbz
will show something like if it is a valid backup file:
tar tvf backup1.mbz
-rw-r--r-- 0/0 2668 2012-12-31 18:00 .ARCHIVE_INDEX
drwxr-xr-x 0/0 0 2012-12-31 18:00 activities/
drwxr-xr-x 0/0 0 2012-12-31 18:00 activities/assign_177/
-rw-r--r-- 0/0 137 2020-09-25 18:02 activities/assign_177/roles.xml
-rw-r--r-- 0/0 707 2020-09-25 18:02 activities/assign_177/module.xml
-rw-r--r-- 0/0 1298 2020-09-25 18:02 activities/assign_177/grades.xml
-rw-r--r-- 0/0 4685 2020-09-25 18:02 activities/assign_177/assign.xml
-rw-r--r-- 0/0 197 2020-09-25 18:02 activities/assign_177/grading.xml
-rw-r--r-- 0/0 106 2020-09-25 18:02 activities/assign_177/grade_history.xml
-rw-r--r-- 0/0 325 2020-09-25 18:02 activities/assign_177/inforef.xml
drwxr-xr-x 0/0 0 2012-12-31 18:00 activities/assign_178/
-rw-r--r-- 0/0 137 2020-09-25 18:02 activities/assign_178/roles.xml
-rw-r--r-- 0/0 707 2020-09-25 18:02 activities/assign_178/module.xml
-rw-r--r-- 0/0 1300 2020-09-25 18:02 activities/assign_178/grades.xml
-rw-r--r-- 0/0 4039 2020-09-25 18:02 activities/assign_178/assign.xml
-rw-r--r-- 0/0 197 2020-09-25 18:02 activities/assign_178/grading.xml
-rw-r--r-- 0/0 106 2020-09-25 18:02 activities/assign_178/grade_history.xml
-rw-r--r-- 0/0 325 2020-09-25 18:02 activities/assign_178/inforef.xml
drwxr-xr-x 0/0 0 2012-12-31 18:00 activities/page_176/
-rw-r--r-- 0/0 137 2020-09-25 18:02 activities/page_176/roles.xml
-rw-r--r-- 0/0 705 2020-09-25 18:02 activities/page_176/module.xml
-rw-r--r-- 0/0 151 2020-09-25 18:02 activities/page_176/grades.xml
-rw-r--r-- 0/0 106 2020-09-25 18:02 activities/page_176/grade_history.xml
-rw-r--r-- 0/0 887 2020-09-25 18:02 activities/page_176/page.xml
-rw-r--r-- 0/0 59 2020-09-25 18:02 activities/page_176/inforef.xml
-rw-r--r-- 0/0 79 2020-09-25 18:02 completion.xml
drwxr-xr-x 0/0 0 2012-12-31 18:00 course/
-rw-r--r-- 0/0 396 2020-09-25 18:02 course/roles.xml
-rw-r--r-- 0/0 1205 2020-09-25 18:02 course/course.xml
-rw-r--r-- 0/0 97 2020-09-25 18:02 course/completiondefaults.xml
-rw-r--r-- 0/0 4201 2020-09-25 18:02 course/enrolments.xml
-rw-r--r-- 0/0 190 2020-09-25 18:02 course/inforef.xml
drwxr-xr-x 0/0 0 2012-12-31 18:00 files/
drwxr-xr-x 0/0 0 2012-12-31 18:00 files/50/
-rw-r--r-- 0/0 25554 2020-09-25 18:02 files/50/50d3b1fc15c9cca977595d15ad1a4aa04833d736
drwxr-xr-x 0/0 0 2012-12-31 18:00 files/34/
-rw-r--r-- 0/0 10870 2020-09-25 18:02 files/34/341af9513e4e0eb9103308aa47267c8de6666930
drwxr-xr-x 0/0 0 2012-12-31 18:00 files/2d/
-rw-r--r-- 0/0 3367 2020-09-25 18:02 files/2d/2da3c6e4167a227fd2643fb96b8dfb7c17632a6d
drwxr-xr-x 0/0 0 2012-12-31 18:00 files/0e/
-rw-r--r-- 0/0 28141 2020-09-25 18:02 files/0e/0ef65e0cf83d71c70e96126c55a91bcf0441b356
-rw-r--r-- 0/0 9479 2020-09-25 18:02 files/0e/0ed1e7611f937fa16bc7ba239a07b88f7a1a7a12
drwxr-xr-x 0/0 0 2012-12-31 18:00 files/01/
-rw-r--r-- 0/0 2119 2020-09-25 18:02 files/01/013ee7039a7ec06834ecd2798d99cb210aeaa5ab
drwxr-xr-x 0/0 0 2012-12-31 18:00 files/bc/
-rw-r--r-- 0/0 5091 2020-09-25 18:02 files/bc/bc2bbcb21f03d2d8f57fbbc9f252efecbe1361e6
drwxr-xr-x 0/0 0 2012-12-31 18:00 files/19/
-rw-r--r-- 0/0 711376 2020-09-25 18:02 files/19/196319cc0e541f4a2882734dd5a6e26d027deee1
-rw-r--r-- 0/0 8896 2020-09-25 18:02 files.xml
-rw-r--r-- 0/0 106 2020-09-25 18:02 grade_history.xml
-rw-r--r-- 0/0 1965 2020-09-25 18:02 gradebook.xml
-rw-r--r-- 0/0 86 2020-09-25 18:02 groups.xml
-rw-r--r-- 0/0 6659 2020-09-25 18:02 moodle_backup.xml
-rw-r--r-- 0/0 83 2020-09-25 18:02 outcomes.xml
-rw-r--r-- 0/0 83 2020-09-25 18:02 questions.xml
-rw-r--r-- 0/0 294 2020-09-25 18:02 roles.xml
-rw-r--r-- 0/0 79 2020-09-25 18:02 scales.xml
drwxr-xr-x 0/0 0 2012-12-31 18:00 sections/
drwxr-xr-x 0/0 0 2012-12-31 18:00 sections/section_132/
-rw-r--r-- 0/0 318 2020-09-25 18:02 sections/section_132/section.xml
-rw-r--r-- 0/0 59 2020-09-25 18:02 sections/section_132/inforef.xml
drwxr-xr-x 0/0 0 2012-12-31 18:00 sections/section_131/
-rw-r--r-- 0/0 298 2020-09-25 18:02 sections/section_131/section.xml
-rw-r--r-- 0/0 59 2020-09-25 18:02 sections/section_131/inforef.xml
-rw-r--r-- 0/0 7480 2020-09-25 18:02 users.xml
-rw-r--r-- 0/0 2690 2020-09-25 18:02 moodle_backup.log
Should be able to restore that backup to a moodle version equal to that which you were running.
'SoS', Ken
Re: All moodle courses, themes, data and plugins deleted out of the blue?
OOPS! Forgot to tell how to create the 'fileslist.txt' file.
cd /path/to/moodledata/filedir/
ls ./*/*/* -1 > fileslist.txt
fileslist.txt could be fairly large and will consist of lines that look like the following clip:
./ff/a7/ffa7e2f85340f2f1066e166feb875d7d2f5e4b27
./ff/b9/ffb90a386a657bfd28fa89e4708886bb9f89978e
./ff/c3/ffc36c7dfe8356dac97efa97a13e5d5c280236f4
./ff/f8/fff87ec177e2f4639f9e18d121c6f13f4bbfae8f
Create the fileslist.txt file *before* creating and using the 'nifind' script.
'SoS', Ken
Re: All moodle courses, themes, data and plugins deleted out of the blue?
Yes, R Pi doesn't have a built-in clock. Are you sure that your Ubuntu Linux for R Pi, https://ubuntu.com/raspberry-pi (?), doesn't synchronize time? Have a look at systemd-timesyncd.
@Ken, assuming the clock time was completely off, say 1 January 1970, for some time, is it possible, for example the cron.php, to change content of a Moodle installation once the clock is corrected?
Have you looked at https://docs.moodle.org/en/Installation_quick_guide ? The prescribed method is to get the "LAMP" stack from whatever your system tools are, e.g. apt, but to get Moodle "manually" - i.e. either as a zip file or using Git. Git is preferred for easy upgrades later. I don't know anything about the Moodle package in the Ubuntu R Pi repository.
If Moodle site was reset, the only theory I can think of is a reinstallation due to repeated 'apt'. Never had, because I never do that. A hiccup in the SD card is a possibility, but unlikely in your case. It will break much more. Probably since you've lost everything any way, worth practising the whole procedure from beginning to end.
About salvaging courses: Only if you made https://docs.moodle.org/en/Course_backup or https://docs.moodle.org/en/Site_backup or taken snap-shots of the whole SD image. Well, Ken could, if your system yields to the method in his last three posts.
Or, you can take the pre-built Moodle image from https://moodlebox.net/. It is separate from moodle.org, with their own support forum.
このフォーラム投稿は削除されました。
Re: All moodle courses, themes, data and plugins deleted out of the blue?
Think if you look at Moodle's update/upgrade instructions one can see the 'roll back' was really a fresh install of a higher version of Moodle (point release or major version release).
https://docs.moodle.org/310/en/Upgrade_overview
Don't think the package manager will attempt to mimic the Moodle way to update or upgrade.
Anyway ... focus of these forums are not to support behaviors of whatever choice of poison is ... the OS ... even if it comes into play ... although there are many discussions that go beyond that focus ... sometimes necessary and is a 'gray' area.
I take it you found that moodledata was touched in the upgrade and you thus had no course backups in moodledata/filedir/ Thus my scripts of no use to you with that site (note: they might be useful still ... even with new hosting).
If that's true ... then should be a point for setting up with your hosted moodle ... make course backups to directories outside of moodledata/filedir/ for true easier for 'human' archiving.
'SoS', Ken
このフォーラム投稿は削除されました。
Re: All moodle courses, themes, data and plugins deleted out of the blue?
@Visvanath Ratnaweera
In response to:
@Ken, assuming the clock time was completely off, say 1 January 1970, for some time, is it possible, for example the cron.php, to change content of a Moodle installation once the clock is corrected?
To the best of my experience (once used Fedora and had installed Moodle via package manager) cron only controls the checking of updates to packages installed. So even if clock is set to 1970 - it does do hours. If there is a cron job to check-updates every 24 hours, would think clock (date) not really a factor. Obviously, what was used to update was not a point release the 'moodle way' but an update like that of other operating system software.
Would think, the only way to avoid, is in package manager ... CentOS, for example, one can exclude checking for software you set to exclude in repo configs. Thus admin of server would then be responsible for updating the exclusions manually.
I see the OP is now involved in setting up hosting with a provider and is having an issue with registering his site by same domain name, so this entire dicussion/thread is now moot ... for the OP.
Thread is useful, however, to advise future admins not to use OS repos or 3rd party repos other than Moodle's Official git or download site.
My 2 cents!
'SoS', Ken