FLV resource problem moving from 1.9 to 2.1 popup related

FLV resource problem moving from 1.9 to 2.1 popup related

by Chris Meyer -
Number of replies: 4

TO DEVELOPERS, see my final note at the bottom...

I had a problem with our many FLV files (flash video) resources after upgrading from 1.9 to 2.0+.  The problem seems to have been that most of our flv resources were setup as popups, which seems to be no longer supported.  Automatic is supported.

Finding which files are a problem involved tying together several tables (mdl_resource, mdl_context, mdl_files, mdl_course_resource) to find out which resources were tied to files with .flv extensions.  At this point, I ran the following script to fix the tables supporting the resource: (PS: this code is included just to show how stuff ties together.  Do not use at another site without review, testing, backups, etc)

UPDATE mdl_resource r
JOIN mdl_course_modules c
ON r.id = c.instance
JOIN mdl_context x
ON x.instanceid = c.id
AND x.contextlevel = 70
JOIN mdl_files f
ON x.id = f.contextid
AND f.mimetype = 'video/x-flv'
SET r.intro = CONCAT('<p>',r.name,'</p>'),    # intro required
r.display = 0,                                             # change popup to automatic
r.displayoptions = 'a:2:{s:12:"printheading";i:0;s:10:"printintro";i:1;}',
f.sortorder = 1
WHERE f.mimetype = 'video/x-flv';

This was not a total fix, however, since the mdl_course table has a field (modinfo) that contains a pseudo table made up of all the resources used on the page.  The modinfo field is rewritten when someone edits a resource in a course, so even though the underlying tables can be fixed behind the scenes with SQL, the course owner still has to edit/save any flv resources that had been popups to get the modinfo right.  (This is an argument for holding more closely to a true data-driven model in software design, i.e. a cleaner, more discrete set of tables is easer to maintain/repair)

I was able, with great effort, to fix the modinfo field, but I don't particularly recommend this unless you have a lot of programming experience and some time.

I suggest the moodle developers catch the popup resources and fix them during the upgrade if the popup method is no longer supported.

Otherwise, the flv resource works great smile  Version 2.1 seems to be running well at our sites and the upgrade process ran quite smoothly.

Average of ratings: -
In reply to Chris Meyer

Re: FLV resource problem moving from 1.9 to 2.1 popup related

by Roberto Daniele -

Hi all,

After moving from 1.9 to 2.1, seems that FLV in popup does not work.
It looks as generated HTML uses draftfile.php insted of pluginfile.php.
My question: is a bug or is by design?

If second, how can play FLV in pop-up window?

Thanks a lot for the reply


 

In reply to Roberto Daniele

Re: FLV resource problem moving from 1.9 to 2.1 popup related

by Neil Burgess -

Further for Developers: I'm working in both 1.9 and 2.1. As with the note from Roberto, some moves from 1.9 to 2.1 don't work properly. I can live with that. What I find really, really annoying in 2.1 are the new resources. It seems the option of having resources appear either in the parent or as a pop-up is now a course global function toggled under the plugin menu. OK, there are advantages to sometimes making the global switch, but I'd like to decide on a resource by resource basis most of the time. I can resize the window once I've decided to use pop-ups, but that's it. So, how about a third option under pugins - the ability under advanced to choose display method on a resource by resource basis.

Cheers, Neil

In reply to Chris Meyer

Re: FLV resource problem moving from 1.9 to 2.1 popup related

by Chris Gibson -

If anyone, like me, found this via google there's also a ticket in the tracker if anyone wants to vote for it :

http://tracker.moodle.org/browse/MDL-32348

Regarding the modinfo column in mdl_course : I think you can simply clear whatever is in there and it will be repopulated the next time the course is viewed. This is probably a very bad thing to do and I'm expecting someone from the dev team to slap my wrist for suggesting it.

In reply to Chris Gibson

Re: FLV resource problem moving from 1.9 to 2.1 popup related

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

About modinfo - I think I'm the developer who most recently made significant changes in that area of code a few versions back (modinfolib), and I say, feel free to just set it to null. smile

I did so today in fact for a stack of courses on our live system regarding problems with other data that I had to fix with sql queries.

However:

1) If you're doing this from within code, you should use the rebuild_course_cache($courseid, true) function rather than doing the raw SQL to null the field.

2) If you're doing this manually and only need it for a single course, you do not need to hack the database. Just edit one activity on the course - any activity - and, without making any changes to its form, do 'Save and return to course' - this will regenerate modinfo.

--sam