Search code examples
moodle

Moodle Update 4.0 Questions - Error Reading From Database


I have recently taken over a moodle site run by our former head of department. I am taking over between us handing it over to the new head of department in a month or two. I have no experience with computers. I have attempted to update moodle to the latest update 4.0. Everything has gone okayish... The only problem I have now is that the questions in the question bank keep having an issue with reading the database. I am not sure if I have forgotten to do something with the database while updating, but I am concerned that I will not be able to access any of the questions we have built up over time.

Any help with this problem would be most appreciated. Thank you for your time.

*Update Here is the error message I receive when I am in debugging mode:

    Debug info: Unknown column 'q.category' in 'on clause'
SELECT q.*, qc.contextid FROM mdl6d_question q JOIN mdl6d_question_categories qc ON q.category = qc.id WHERE q.parent = ?
-- line 233 of /question/type/combined/combiner/base.php: call to mysqli_native_moodle_database->get_records_sql()
-- line 190 of /question/type/combined/questiontype.php: call to qtype_combined_combiner_base::get_subq_data_from_db()
-- line 961 of /lib/questionlib.php: call to qtype_combined->get_question_options()
-- line 1028 of /lib/questionlib.php: call to _tidy_question()
-- line 930 of /lib/questionlib.php: call to get_question_options()
-- line 847 of /mod/quiz/report/statistics/report.php: call to question_load_questions()
-- line 83 of /question/bank/statistics/classes/helper.php: call to quiz_statistics_report->load_and_initialise_questions_for_calculations()
-- line 105 of /question/bank/statistics/classes/helper.php: call to qbank_statistics\helper::load_question_stats()
-- line 134 of /question/bank/statistics/classes/helper.php: call to qbank_statistics\helper::load_question_stats_item()
-- line 180 of /question/bank/statistics/classes/helper.php: call to qbank_statistics\helper::calculate_average_question_stats_item()
-- line 63 of /question/bank/statistics/classes/columns/discrimination_index.php: call to qbank_statistics\helper::calculate_average_question_discrimination_index()
-- line 220 of /question/classes/local/bank/column_base.php: call to qbank_statistics\columns\discrimination_index->display_content()
-- line 1199 of /question/classes/local/bank/view.php: call to core_question\local\bank\column_base->display()
-- line 1119 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->print_table_row()
-- line 1095 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->print_table()
-- line 986 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->display_questions()
-- line 756 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->display_question_list()
-- line 60 of /question/edit.php: call to core_question\local\bank\view->display()
[array (
0 => '851',
)]
Error code: dmlreadexception×Dismiss this notification

Stack trace:
line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 291 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
line 233 of /question/type/combined/combiner/base.php: call to mysqli_native_moodle_database->get_records_sql()
line 190 of /question/type/combined/questiontype.php: call to qtype_combined_combiner_base::get_subq_data_from_db()
line 961 of /lib/questionlib.php: call to qtype_combined->get_question_options()
line 1028 of /lib/questionlib.php: call to _tidy_question()
line 930 of /lib/questionlib.php: call to get_question_options()
line 847 of /mod/quiz/report/statistics/report.php: call to question_load_questions()
line 83 of /question/bank/statistics/classes/helper.php: call to quiz_statistics_report->load_and_initialise_questions_for_calculations()
line 105 of /question/bank/statistics/classes/helper.php: call to qbank_statistics\helper::load_question_stats()
line 134 of /question/bank/statistics/classes/helper.php: call to qbank_statistics\helper::load_question_stats_item()
line 180 of /question/bank/statistics/classes/helper.php: call to qbank_statistics\helper::calculate_average_question_stats_item()
line 63 of /question/bank/statistics/classes/columns/discrimination_index.php: call to qbank_statistics\helper::calculate_average_question_discrimination_index()
line 220 of /question/classes/local/bank/column_base.php: call to qbank_statistics\columns\discrimination_index->display_content()
line 1199 of /question/classes/local/bank/view.php: call to core_question\local\bank\column_base->display()
line 1119 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->print_table_row()
line 1095 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->print_table()
line 986 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->display_questions()
line 756 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->display_question_list()
line 60 of /question/edit.php: call to core_question\local\bank\view->display()

Solution

  • Looks like this is a bug in the "Combined" question type plugin - the plugin isn't yet compatible with Moodle 4.0 - its a contributed plugin, so it isn't part of core Moodle.

    The author is aware and they are working on it :

    Hi @Dimitris, We are due to move to Moodle 4.0 in our next release, although we have been working on Moodle 4 compatibility for our plugins for the last few months (alas, we have quite a few plugins but our team is small). Additionally, our lead developer is on holiday for two weeks, so I'm afraid I can't answer this query at the moment sad However, I will try to get an answer for you by the end of the month.

    See the comment here https://moodle.org/plugins/qtype_combined

    Is this on a test site or a production site? If its a test site, then I would suggest holding off until the plugin has been upgraded. If its production, then that's going to be tricky, unless you can revert to the previous version via a backup?

    I know its hindsight, but its always a good idea to check if contributed Moodle plugins are available for major upgrades before upgrading

    There's an upgrade checklist here

    https://docs.moodle.org/400/en/Upgrading#Check_for_plugin_updates

    If you can't revert... Maybe have review how important the plugin is and see if it can be uninstalled - a warning though, uninstalling will remove the data

    Go to Site administration > Plugins > Question types > Manage question types

    Or direct to yoursite/admin/qtypes.php

    Look for the combined question and see the usage count next to it. You can click on the count to see where the plugin is being used. Then it will be a judgement call whether to uninstall or not, or wait for the plugin to be upgraded.