[3.5]Multiple top categories in questionbank

[3.5]Multiple top categories in questionbank

by Richard van Iwaarden -
Number of replies: 3
Picture of Particularly helpful Moodlers

I'm having problems with backup restoring and duplicating quizzes and it all seems to boil down to this problem:


Many courses have question banks with multiple top categories. These top categories have the same name. They seem to be unmanageable, as they are not listed in the 'edit categories' tab.

There's a fix in Moodle 3.5.2, see here: MDL-62897

Of course very nice that this bug is fixed, but it renders my course backups useless as they can not be restored due to this problem.

Is there a SQL statement that I can run which eliminates this problem in my current Moodle version (3.5+ (Build: 20180628))?


Average of ratings: -
In reply to Richard van Iwaarden

Re: [3.5]Multiple top categories in questionbank

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I think if you upgrade to 3.5.2, the upgrade process will sort out the problem, and that is probably the most reliable way to do it.

In reply to Tim Hunt

Re: [3.5]Multiple top categories in questionbank

by Richard van Iwaarden -
Picture of Particularly helpful Moodlers

I understand Tim, but it still renders my early backups useless (they can not be restored, also not in Moodle 3.5.2)


Is there a way to strip the questionbank out of a course backup file (mbz file)? 


If so, then I can at least restore a course without the questionbank. Right now I can't restore anything because inside the backup file there are multiple top categories in the questionbank.



In reply to Richard van Iwaarden

Re: [3.5]Multiple top categories in questionbank

by Gerald Grow -

I wonder if this error message is reliable. 

Today, I installed three Moodles, the same way, side by side in the same web root, in Moodle 3.6.2 on a LiquidWeb Linux cPanel VPS server that runs ModSecurity -- something I have used for several years now. 

I could restore backups into two of the Moodles, but the third gave the "more than one top" error message.

The fact that two of the Moodles worked made me suspicious of the error message. In addition, when I first encountered this error message last year, I searched my downloaded question bank without being able to find the problem the error message pointed to. 

I compared the three Moodles and changed what was different about the one that did not work. It was:

1. I had started using it before assigning a unique name for its cookies (in Server/Session Handling). I fixed this.

2. I had created several course categories in that Moodle, but not in the others. I deleted all but Miscellaneous.

After these changes, the recalcitrant Moodle began to restore the identical backup file it had rejected earlier, and continued to restore successfully, both from a web restore and from a command-line restore. 

This experience makes me wonder if the error message might be triggered by things other than the error it reports. 

Or if there IS a real top-category problem, and it will come back to haunt me.