Restore course to new install - Files not found

Restore course to new install - Files not found

by Andrew Normore -
Number of replies: 2

Hi all, big problems...

We are moving from Moodle 2.6 to Moodle 3.3.2. 

NONE of the files are working which look like this:

/draftfile.php?file=/197430/user/draft/830103596/Unit_03.pdf

I have a simple question: Did this user upload Unit_03.pdf to their personal space, and put it in a course? As such, when moved to a new server, the file will not be located.

Is this correct?


Just edited the course to use the proper file repository, exported to the new server/install and it worked... so this would seem to be the case.

Question 2:

If I moved our 700gb MoodleData folder to the new server, would this user file be restored, and start working? Saving us from rebuilding hundreds of courses?

-----

Here are some other 

Average of ratings: -
In reply to Andrew Normore

Re: Restore course to new install - Files not found

by Ken Task -
Picture of Particularly helpful Moodlers

When one migrates a server the original code, DB *and* moodledata are brought over to new server and configured to run ... same version as the old server.  If everything working, then upgrade.

Sounds like what you might have attempted ... new code, *database import from old server to new database*, new data directory.    OR, one attempted a migation *and* an upgrade at the same time ... new code on new server, same DB from old in new DB, *same* data directory.

Did old instance have file system repo or make use of some other file system (remote)?

Make a query of your DB mdl_files table for the 'humanly recognizable filename' (Unit_03.pdf) on the filename column.

If it does show a reference in that table, check out the contenthash value ...

Then see if that contenthashed file actually does exit in moodledata/filedir/

Contenthash consist of a bunch of letters and numbers ... something like qfdashweo329sdfhqwwlshf

Using the example above:

cd /pathto/moodledata/filedir/

cd qf/da/

The first two characters of the contenthash value is a subdirectory of filedir

The second two characters are a subdirectory of the above.

then ls

See a qfdashweo329sdfhqwwlshf file?

If you do, then see if it's a PDF:

file -b qfdashweo329sdfhqwwlshf

The trouble with copying the old moodledata directory now is it will replace/misplace that which was already there then the current DB has a bunch more mis-information - more broken links I predict.

If you are desparate, might try an rsync from old server moodledata/filedir/ to new server where rsync puts only new files that don't exist already on new server but that's very risky.

'spirit of sharing', Ken


In reply to Ken Task

Re: Restore course to new install - Files not found

by Andrew Normore -

Thanks Ken,

Thanks for the walk through on the file structure. I might be able to come up some sort of script with this information, to import just the data we need.

We suspect that our MoodleData has grown fat over the decade we've had it, and want to start fresh.

I did not JUST transfer from 2.6 to 2.6, as you suggest, to ensure data integrity. But I know that would have failed, as we moved NO MoodleData.

I think we're getting close. Thanks for your input, we appreciate it.