Difference Report - 8/28/2008, 10:09 AM ================================================================================ File 1: "A:\htdocs\moodle\admin\health.php" Last modified on 8/28/2008, 7:20 AM File 2: "A:\htdocs\moodle\admin\health_new.php" Last modified on 8/28/2008, 10:06 AM ================================================================================ Lines added at 649 ================================================================================ + $CFG->healthquestionsnocontext = false; ================================================================================ Lines added at 655 ================================================================================ + $CFG->healthquestionsnocontext = $cat->numquestions > 0 || $CFG->healthquestionsnocontext ? true : false; ================================================================================ Lines modified at 666 ================================================================================ - return '
You can delete the empty categories by executing the following SQL:
+ if($CFG->healthquestionsnocontext)
- DELETE FROM ' . $CFG->prefix . 'question_categories
+ {
- WHERE
+ return 'You can delete the empty categories and orphaned questions by executing the following SQL in order:
- NOT EXIST (SELECT * FROM ' . $CFG->prefix . 'question q WHERE q.category = qc.id)
+ DELETE FROM ' . $CFG->prefix . 'question WHERE category IN (SELECT id FROM ' . $CFG->prefix . 'question_categories qc
- AND NOT EXIST (SELECT * FROM ' . $CFG->prefix . 'context context WHERE qc.contextid = con.id)
+ WHERE NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'context con WHERE qc.contextid = con.id))
-
Any remaining categories that contain questions will require more thought. ' .
+
- 'People in the Quiz forum may be able to help.
';
+ DELETE FROM ' . $CFG->prefix . 'question_categories qc
================================================================================
Lines added at 673
================================================================================
+ WHERE
+ qc.contextid NOT IN (SELECT con.id FROM ' . $CFG->prefix . 'context con)';
+ }
+ else
+ {
+ return 'You can delete the empty categories by executing the following SQL:
+ DELETE FROM ' . $CFG->prefix . 'question_categories qc + WHERE + qc.contextid NOT IN (SELECT con.id FROM ' . $CFG->prefix . 'context con)'; + } +