Table "course_modules_availability" does not exist

Table "course_modules_availability" does not exist

by Cédric Mallet -
Number of replies: 6

Hello

I have enabled conditional access on my moodle site, but since then, I cannot duplicate any activity. I have some SCORM activities which I usually duplicate to create a new one, but it does not work any longer.

I have checked in the database and the table is indeed not present, neither is "course_modules_avail_fields".

I have tried to disable conditionnal access, and re-activate it, but no success. I no longer need conditionnal access so this is very painful.

Any help much appreciated ! I guess creating an empty table could fix the issue, but I'm struggle to find the exact structure and I'm not sure the table is actually needed.

Cedric

Moodle version : 2.8


Average of ratings: -
In reply to Cédric Mallet

Re: Table "course_modules_availability" does not exist

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I find it somewhat hard to believe that this was caused by enabling conditional access (I am presuming you enabled completion settings and restricted access..).  

I also do not have that table so don't believe that is the issue.  What happens when you attempt to duplicate the activity?  Have you turned debugging on and if so, what was the error message?  If not, please turn it on and post the error message.

In reply to Emma Richardson

Re: Table "course_modules_availability" does not exist

by Cédric Mallet -

With debugging ON that is the error message I get (Table "course_modules_availability" does not exist), stack trace below.

Apart from using conditional access, the only thing I also changed is installed feedback plugin. Apart from those I have absolutely nothing in mind regarding any change in the configuration.

I have checked an old database backup and the table was actually never there. From what I understand by reading the code this table has been replace by a column in the course_module table. Looks like a bug somewhere trying to access an old feature..


* line 585 of /lib/dml/moodle_database.php: dml_exception thrown
* line 1146 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
* line 51 of /backup/util/dbops/backup_structure_dbops.class.php: call to moodle_database->get_recordset()
* line 359 of /backup/util/structure/backup_nested_element.class.php: call to backup_structure_dbops::get_iterator()
* line 77 of /backup/util/structure/backup_nested_element.class.php: call to backup_nested_element->get_iterator()
* line 107 of /backup/util/structure/backup_nested_element.class.php: call to backup_nested_element->process()
* line 107 of /backup/util/structure/backup_nested_element.class.php: call to backup_nested_element->process()
* line 97 of /backup/util/plan/backup_structure_step.class.php: call to backup_nested_element->process()
* line 181 of /backup/util/plan/base_task.class.php: call to backup_structure_step->execute()
* line 211 of /backup/moodle2/backup_activity_task.class.php: call to base_task->execute()
* line 177 of /backup/util/plan/base_plan.class.php: call to backup_activity_task->execute()
* line 120 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
* line 320 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
* line 3454 of /course/lib.php: call to backup_controller->execute_plan()
* line 118 of /course/rest.php: call to mod_duplicate_activity()


In reply to Cédric Mallet

Re: Table "course_modules_availability" does not exist

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You say you installed feedback plugin but feedback is built in?  Have you tried uninstalling that plugin?

In reply to Emma Richardson

Re: Table "course_modules_availability" does not exist

by Cédric Mallet -

You are right, I just enabled the plugin.

I cannot uninstall it for the time being because we have feedbacks currently in use. Yet the availability settings of feedbacks are actually stored in the feedback table itself, not in a generic availability table.

I have also searched for "modules_availability" in the whole source code of our moodle server and could not find any relevant instance.

The problem occurs when duplicating activities of any kind : I have disabled conditional access, and after creating any activity, I get the same error message when trying to duplicate it (same stack when duplicating a URL resource...)

In reply to Cédric Mallet

Re: Table "course_modules_availability" does not exist

by Cédric Mallet -

Problem solved: I have restored the /backup folder from a fresh installation and the issue is fixed. Seems like someone might have tampered with our files..

Thank you for your help anyway !

In reply to Cédric Mallet

Re: Table "course_modules_availability" does not exist

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Good deal - I really didn't think it was to do with the conditional access stuff.  Glad you figured it out.