how to get the exact version of moodle from moodledata or a db dump?

how to get the exact version of moodle from moodledata or a db dump?

by Malik Koné -
Number of replies: 3

I kept a db dump and the moodledata folder from an old moodle website.

I think it was a moodle 3.2 but I'm not sure.

grepping the db dump for 'version' give me those 2 interesting line

(9,'backup_version','2016052300'),
(24,'version','2018051701'),

I'm not sure wich one is pointing to the moodle code base version.

Could some moodle wizard give me a clue how to find the exact version of my moodle without codebase hence no version.php file?

Average of ratings: -
In reply to Malik Koné

Re: how to get the exact version of moodle from moodledata or a db dump?

by Ken Task -
Picture of Particularly helpful Moodlers

You have a backup of the moodledata for the old site.  And you have that downloaded ... correct?

Uncompress/zip whatever the moodledata.

A directory in there held all files uploaded ... filesdir.

IF ... IF ... you made course backups and didn't save those to a designated directory, you could have .mbz files by another name in the un-compressed moodledata/filedir/

Got a Mac or a Linux server where you have terminal?

You could extract only the filedir directory.

Then from terminal in that directory

[root@sos filedir]# file -b ./*/*/* |grep gzip

If there are backup files in there ... you will see a listing like:

gzip compressed data, from Unix
gzip compressed data, from Unix
gzip compressed data, from Unix
gzip compressed data, from Unix
gzip compressed data, from Unix

Dunno the file location nor it's name ... but those are .mbz files.

How large is your moodledata/filedir directory?   If not too large I have an offer you can't refuse!   (you could and do it yourself, I guess!)   PM me here on moodle forums with info and we'll 'talk'!

Or ... you could restore the .sql file -> oldmoodle.  Then query the mdl_files  table for contenthash,filename where filename like '%.mbz'.

That would show the contenthash which is the path and filename of the .mbz file in moodledata/filedir/

Use that info to copy out the contenthash named .mbz file by the matching filename seen in the query to a directory where you can upload to new 3.9 when ya get it running.

Above might be less work than doing what you are doing! smile

'SoS', Ken

'SoS', Ken


In reply to Ken Task

Re: how to get the exact version of moodle from moodledata or a db dump?

by Malik Koné -
That some great info you gave me here Ken.
I was able to find so mbz files and their file path with
```
find . -type f -exec file -b {} \; -ls | grep -A 1 gzip
```

I only have linux on my machine, so that probably made it easier. smile

I'm left with checking what courses those .mbz file are exactly and if the includes my questions.
In reply to Malik Koné

Re: how to get the exact version of moodle from moodledata or a db dump?

by Malik Koné -
And they do have the questions inside. Youpi!

Gosh that was easy to do, but so hard to guess or know in advance what to do.

Thank you very much Ken