Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

by Martin Greenaway -
Number of replies: 9

Hi,

We are attempting to upgrade a Moodle site from 3.8.5 to 3.9.4 and have hit some issues with the process.  The most obvious problem is that all of the course configurations seem to be corrupted.

Courses were topics format, with ~ 5 or 6 topics/sections each with a couple of activities, in the 3.8.5 version. Sections had availability conditions, e.g. reveal when a quiz in the previous section is complete or a scorm pack etc.

After the upgrade to 3.9.4, now all courses are set as "single activity" format with an activity type of "forum". Because this activity doesn't exist, you are taken to the "Add a forum activity" page (as an admin).  If I go into the course settings and restore it to "topics" format, then the activities all reappear, along with the topics themselves, but the activities are now all in the first topic, the topic availability conditions have gone and all of the topics are hidden from students. We do not seem to have lost activity/course completion data.

I *could* recreate all of the course setups, but this is not without significant effort.

I am aware of this in the release notes: https://docs.moodle.org/dev/Moodle_3.9.4_release_notes#Warning_-_courses_with_many_sections however this is not a custom course format and it's not more than 52 sections. Topics does not define the max sections, the default in /course/format/lib.php should apply, which is 52. moodlecourse:maxsections is also 52 in the prefix_config_plugins database table.  This should not be the cause.

We are re-running the update using 3.9.3 instead and will update this thread if the same issue happens there, but has anyone else experienced this and does anyone have any ideas what we might do to enable us to use the current LTS version?

Average of ratings: -
In reply to Martin Greenaway

Re: Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

by Martin Greenaway -
For what it is worth, we have retried this with 3.9.3 as the target version and have had the same result of corrupted courses.

We'll try again with 3.9.2 but, again, any thoughts anyone has on this problem would be greatly appreciated - things to check in Moodle or dependencies etc..
In reply to Martin Greenaway

Re: Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

by Martin Greenaway -
Subsequent to this, we have tried upgrading from the current version to 3.9.2, to 3.9.0, we have tried removing a custom activity plugin before we do the upgrade in case that was the issue, but we are basically at a loss. I don't think Moodle would have released a new version where upgrading from the previous version is broken, let alone allowed that to remain the case for four subsequent minor iterations, so I have to believe that this is something unique to this installation, but I have honestly got no idea where to start looking. Any and all suggestions on this are welcome.
In reply to Martin Greenaway

Re: Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
Martin, I am far from the expert that you need to help. I just want to mention that a few years ago I think I got the same thing that you are experiencing right now... a course was corrupted. But I don't know what I did to fix this. Somehow, I think the update might not have completely finish? Or maybe it was a forgotten plugin? I can't remember. Maybe it was a php timeout setting?

Sorry that I can't help much more.
Average of ratings: Useful (1)
In reply to Rick Jerz

Re: Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

by Martin Greenaway -
Thanks for these suggestions Rick - we will definitely take a look at PHP timeouts - I am skeptical of it being plugin related but again we can try to remove anything that is not core moodle and try that (although in this site, that's going to break the courses, we can at least try to narrow down where the issues are).
In reply to Martin Greenaway

Re: Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

by Martin Greenaway -
This has now been solved. The culprit was, indeed, a missing plugin - the Edwiser Course Formats plugin (which I did not realise we were using). It does not come up as a missing plugin when you go through the update process, and therefore I did not copy it back across.

However, unlike other plugins, it seems that the Edwiser Course Formats plugin also needs to be present when the Moodle version upgrade is carried out, and cannot be left until afterwards, otherwise we get the courses defaulting to the standard "single topic" course format and, furthermore, to the default "forum" activity. Once you have hit that situation, even restoring the plugin only results in the course format itself being restored - all of the course activities are left bunched up in the default topic, and any topic visibility dependencies are lost.

Thank you for your suggestions, which helped me to figure this out - I know you were both flying blind - but I appreciate the suggestions as they helped me work my way to the solution.
In reply to Martin Greenaway

Re: Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

by Ken Task -
Picture of Particularly helpful Moodlers

What is your default theme?

Might consider adding to config.php a force to a default theme that comes with 3.9.x ... boot or classic.

Dunno if this will fix, but in 3.9.x there was a change to the code in the chooser for an activity or resource ... rather than a separate drop down for activity or resource it was combined into one or in a 3.8 there was a single link that popupd a single chooser window with divisions for Activity and Resources.

You can set default behavior in config.php

// act chooser 0=new 1=old
// $CFG->modchooserdefault=1;

Set that in config.php prior to attempting upgrade.  Just tested the setting via config.php on a 3.8 and no ill affects to viewing/editing an existing course.

An upgrade to site core code shouldn't change the defaults for a course format ...

DB query of mdl_course for format should show topics

mysql> select id,shortname,format from mdl_course where format='topics';

Like I said, dunno if the above will help or not, but since it's a small edits to config.php (which can later be commented out), doesn't hurt to try! smile

And, what happens/what do you see, if debugging is turned on via config.php file?

Plus ... do the courses have custom topics turned on with 'blank' text in custom topic titles?

'SoS', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

by Martin Greenaway -
Hi Ken, many thanks for these suggestions - some very good ones there which I will try out tomorrow. Sometimes it's hard to see the wood for the trees, so turning debugging on via config file is probably the first step!
In reply to Martin Greenaway

Re: Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

by Ken Task -
Picture of Particularly helpful Moodlers

Yep ... debug first should provide more info.

Observation ... in 3.9.x ... the very last process an update or upgrade does is to run through all the settings of a site.  It's a 'heavy' process and takes time to complete.   Dunno the order of those but course settings could be involved.

Do you have access to command line?  If so, executing the 'upgrade.php' script in /code/admin/cli/ takes web service (config/timeouts/etc) out of the loop/process and it's only php scripting talking to the DB that's involved.

cd code/admin/cli/

php upgrade.php [ENTER]

should work IF php-cli is found on your server.

Always do a full site backup prior to update or upgrade.

'SoS', Ken



Average of ratings: Useful (1)
In reply to Ken Task

Re: Upgrading 3.8 to 3.9 - topics format courses corrupted into single activity format

by Martin Greenaway -
This has now been solved. As posted above, the culprit was a missing Edwiser Course Formats plugin (which I did not realise we were using). It does not come up as a missing plugin when you go through the update process, and therefore I did not copy it back across.

Unlike other plugins, it seems that the Edwiser Course Formats plugin also needs to be present when the Moodle version upgrade is carried out, and cannot be left until afterwards, otherwise we get the courses defaulting to the standard "single topic" course format and, furthermore, to the default "forum" activity. Once you have hit that situation, even restoring the plugin only results in the course format itself being restored - all of the course activities are left bunched up in the default topic, and any topic visibility dependencies are lost.

Thank you for your suggestions, which helped me to figure this out - I know you were both flying blind - but I appreciate the suggestions as they helped me work my way to the solution.
Average of ratings: Useful (1)