Installation help

legacyfiles and restoring courses 1.9.10 - 2.6.1

 
 
Picture of john owen-jones
legacyfiles and restoring courses 1.9.10 - 2.6.1
 

Ok I have moodle moodledata and the database from my 1.9.10  install

moodle data contains every file ever uploaded for a course in folders with names like 1 and 132 ect.

 

Moodle2.6.1 stores course files a little differently with names like fjdshgofghdfhsdhgjfbhdhsj or similar.

So my courses have moved up with moodle but all the course files have gone probably into legacy files.

so at first glance it looks like backing up the course files from my old moodle version downloading them and restoring them on my test server in appropriate places on my courses. a long and boring job.

is there a relationship between the folder number and the course the files belonging to the course. It does look like the files are clustered by course in moodledata.

maybe using find or locate with the name of a needed file might give me the location of a courses files in moodle data or perhaps there is a  line in one of the database files which will let me look up the folder

any suggestions or is it just suck it up and get on with it

regards

 

john

 

 

 

 
Average of ratings: -
Picture of Ken Task
Re: legacyfiles and restoring courses 1.9.10 - 2.6.1
Group Particularly helpful Moodlers

Welcome to the new (and improved?) file system!

The admin user really doesn't have 'full control' over file system.   In many cases, one has to combine their knowledge of the DB and queries of the DB along with other tools (not in Moodle UI) to explore etc. the new file system (good that you've experience at command line).

DB table is mdl_files.   You've already discovered the file names are no longer humanly recognizable but have been hashed and really spread all over /moodledata/filesdir/ in sub directories.

Let's say, for example, you've uploaded a file by the name of owl-binocs.jpg.   The following query could be used to see all the details about that file:

select * from `mdl_files` where `filename` like "owl-binocs.jpg"

You might see more than one reference to it if you've used that file in multiple instances/different courses/locations, etc..

Key is the contenthash field: b6bd31d7d12f5d1b1e0d26957529efa2f71a3646

You'll find that file in moodledata/filedir/b6/bd/ and it's name is now b6bd31d7d12f5d1b1e0d26957529efa2f71a3646

From the command line using the file command thusly:

file -b moodledata/filedir/b6/bd/b6bd31d7d12f5d1b1e0d26957529efa2f71a3646

Will show that it's a jpeg.

[root@sos filedir]# file -b ./b6/bd/b6bd31d7d12f5d1b1e0d26957529efa2f71a3646
JPEG image data, JFIF standard 1.01

In your case, since you've migrated your site from 1.9 through the march think you'll see all the files are in a component (db column) called legacy.

New courses created and files uploaded will not cubby hole files in legacy - only old backups.

No one has said how long 'legacy' will be supported ... I asked and no one has a response.  But, can't imagine it will be supported forever and ever!

There is an add-on for editor now called 'gopoof' ... I think ... that's supposed to deal with legacy files in courses, but one has to 1) install it and 2) edit the content containing the image/file, etc. in legacy to 'poof it'. :\

So, bottom line ... yeah, guess you're gonna have to (as you've said) 'suck it up' and move forward.

'spirit of sharing', Ken

 
Average of ratings:Useful (1)
Picture of john owen-jones
Re: legacyfiles and restoring courses 1.9.10 - 2.6.1
 

hmm

mdl_resource looks to be  interesting  there is a key relating to the folder name, and contains the document title and the document name now I just need to figure its relation to a course smile

so now I can find a filename and the folder its located in.

 

 

 
Average of ratings: -
Picture of john owen-jones
Re: legacyfiles and restoring courses 1.9.10 - 2.6.1 solved!
 

cracked it and its really rather simple

take a look at this part of a url

http://asite.com/moodle/course/view.php?id=230

that 230 is the course id and in moodledata/230 are all the resources for course 230

not only that but it also gives you a fast way to work well relatively fast you know the numbered folders you have well they will have a corresponding course so if you have a folder such as 225

then if you change id=230 to id=225 then that course will open and you can start uploading to that course the files in that folder moodle will then process them into the new format.

Of course this server i am using is my dev server on my lan so it will upload as fast as my lan speed smile

nifty isn't  it smile

cheers

john

 
Average of ratings:Useful (1)
Picture of Ken Task
Re: legacyfiles and restoring courses 1.9.10 - 2.6.1 solved!
Group Particularly helpful Moodlers

Congrats, again!   If what you say is true (don't doubt it) then there was a way as far back as 2.early.x to migrate a site *without* legacy.   Or, some code has been added to allow this to function!  Question is at which hop?  2.5 or only in 2.6.1?

I'd like to see a screen movie of that ... or some screen shots, please.   A re-write or correction to migration documentation might be in order!!!

The first hop from 1.9.x to 2.x in the march drastically restructures the moodledata directory.   In migrations past, those course ID folders were there but had mod_data only (which was related to certain 1.9 addons - like certicate, if I re-call correctly).   All the files/folders associated with that course weren't present and moved to the new ('and improved') file system and tagged as 'legacy'.

Good for you!   Let's hope others now find the same results. ;)

'spirit of sharing', Ken

 
Average of ratings: -
Picture of Justin Hunt
Re: legacyfiles and restoring courses 1.9.10 - 2.6.1 solved!
Group Particularly helpful Moodlers

 

Not sure if this helps, but I eliminated legacy files from courses in my own home grown way. But I was already on Moodle 2.x when I commenced.

It is described in this thread..

https://moodle.org/mod/forum/discuss.php?d=251415

 
Average of ratings: -
Picture of Ken Task
Re: legacyfiles and restoring courses 1.9.10 - 2.6.1 solved!
Group Particularly helpful Moodlers

Thanks, Justin.

Think this needs to be re-considered ...

The voting system for fixes/tracker items is a little flawed considering the present situation, IMHO.  1.9.x version no longer supported.  Folks who have invested what might be years of work in previous versions of Moodle *will* be migrating ... or will try.

The required number of votes in tracker for an issue to reach critical mass and the issue be addressed, to my way of thinking, shouldn't follow the normal process.   If one took all the registered 1.9 sites that are now in need of migrating, there are the votes ... automatic +1.

My 2 cents, of course.   But, what I am observing in my small corner of the world ... there are more LMS choices than ever before.   There is even a company that specializes (or claims to specialize) in assisting entities find the 'right' LMS for them - for a fee of course.   Observation: if the technical persons behind the entity Moodle finds migration to difficult, or if the teachers are required to 'gopoof' (from the video, great add-on, BTW!) what might be 1000's of resources,  they will move to another LMS (yes, I know, such is their option/choice).

'spirit of sharing', Ken

 
Average of ratings:Useful (1)
Picture of Justin Hunt
Re: legacyfiles and restoring courses 1.9.10 - 2.6.1 solved!
Group Particularly helpful Moodlers

Yes its a big problem. But without actual numbers it is really hard to say for how many people its a "big problem."

The fact that most people no longer talk about the legacy files situation leads me to wonder if 1.9ers are actually quite few these days. And as  Visvanath noted, in the thread I linked to previously, other people seem to get along just fine with legacy files. But correct me if you disagree, because I at least considered myself in a pickle.

I suspect the Moodle Partners made oodles migrating their clients to Moodle 2.x and maybe have developed better tools to automate the migration than are available publicly.  I considered a less laborious method of shifting files. One that scanned the database, moved files, and updated the DB automatically. But I needed something fast, and such a tool would take too long to write, test and refine. Though "Legacy files go poof" would be an ok start point for the development of such a tool.

 

Justin

 

 
Average of ratings: -