3 ob_start(); //for whitespace test
4 require_once('../config.php');
5 $extraws = ob_get_clean();
7 require_once($CFG->libdir
.'/adminlib.php');
9 admin_externalpage_setup('healthcenter');
11 define('SEVERITY_NOTICE', 'notice');
12 define('SEVERITY_ANNOYANCE', 'annoyance');
13 define('SEVERITY_SIGNIFICANT', 'significant');
14 define('SEVERITY_CRITICAL', 'critical');
16 $solution = optional_param('solution', 0, PARAM_SAFEDIR
); //in fact it is class name alhanumeric and _
19 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM
));
23 echo $OUTPUT->header();
26 <style type="text/css">
27 div#healthnoproblemsfound {
31 border: 1px black solid;
32 -moz-border-radius: 6px;
38 dl.critical dt, dl.critical dd {
39 background-color: #a71501;
41 dl.significant dt, dl.significant dd {
42 background-color: #d36707;
44 dl.annoyance dt, dl.annoyance dd {
45 background-color: #dba707;
47 dl.notice dt, dl.notice dd {
48 background-color: #e5db36;
50 dt.solution, dd.solution, div#healthnoproblemsfound {
51 background-color: #5BB83E !important;
53 dl.healthissues dt, dl.healthissues dd {
56 border: 1px black solid;
61 padding-bottom: 0.5em;
68 dl.healthissues dd form {
72 form#healthformreturn {
87 if(strpos($solution, 'problem_') === 0 && class_exists($solution)) {
88 health_print_solution($solution);
91 health_find_problems();
95 echo $OUTPUT->footer();
98 function health_find_problems() {
101 echo $OUTPUT->heading(get_string('healthcenter'));
104 SEVERITY_CRITICAL
=> array(),
105 SEVERITY_SIGNIFICANT
=> array(),
106 SEVERITY_ANNOYANCE
=> array(),
107 SEVERITY_NOTICE
=> array(),
111 for($i = 1; $i < 1000000; ++
$i) {
112 $classname = sprintf('problem_%06d', $i);
113 if(!class_exists($classname)) {
116 $problem = new $classname;
117 if($problem->exists()) {
118 $severity = $problem->severity();
119 $issues[$severity][$classname] = array(
120 'severity' => $severity,
121 'description' => $problem->description(),
122 'title' => $problem->title()
130 echo '<div id="healthnoproblemsfound">';
131 echo get_string('healthnoproblemsfound');
135 echo $OUTPUT->heading(get_string('healthproblemsdetected'));
136 $severities = array(SEVERITY_CRITICAL
, SEVERITY_SIGNIFICANT
, SEVERITY_ANNOYANCE
, SEVERITY_NOTICE
);
137 foreach($severities as $severity) {
138 if(!empty($issues[$severity])) {
139 echo '<dl class="healthissues '.$severity.'">';
140 foreach($issues[$severity] as $classname => $data) {
141 echo '<dt id="'.$classname.'">'.$data['title'].'</dt>';
142 echo '<dd>'.$data['description'];
143 echo '<form action="health.php#solution" method="get">';
144 echo '<input type="hidden" name="solution" value="'.$classname.'" /><input type="submit" value="'.get_string('viewsolution').'" />';
153 function health_print_solution($classname) {
155 $problem = new $classname;
157 'title' => $problem->title(),
158 'severity' => $problem->severity(),
159 'description' => $problem->description(),
160 'solution' => $problem->solution()
163 echo $OUTPUT->heading(get_string('healthcenter'));
164 echo $OUTPUT->heading(get_string('healthproblemsolution'));
165 echo '<dl class="healthissues '.$data['severity'].'">';
166 echo '<dt>'.$data['title'].'</dt>';
167 echo '<dd>'.$data['description'].'</dd>';
168 echo '<dt id="solution" class="solution">'.get_string('healthsolution').'</dt>';
169 echo '<dd class="solution">'.$data['solution'].'</dd></dl>';
170 echo '<form id="healthformreturn" action="health.php#'.$classname.'" method="get">';
171 echo '<input type="submit" value="'.get_string('healthreturntomain').'" />';
182 function severity() {
183 return SEVERITY_NOTICE
;
185 function description() {
188 function solution() {
193 class problem_000002
extends problem_base
{
195 return 'Extra characters at the end of config.php or other library function';
200 if($extraws === '') {
205 function severity() {
206 return SEVERITY_SIGNIFICANT
;
208 function description() {
209 return 'Your Moodle configuration file config.php or another library file, contains some characters after the closing PHP tag (?>). This causes Moodle to exhibit several kinds of problems (such as broken downloaded files) and must be fixed.';
211 function solution() {
213 return 'You need to edit <strong>'.$CFG->dirroot
.'/config.php</strong> and remove all characters (including spaces and returns) after the ending ?> tag. These two characters should be the very last in that file. The extra trailing whitespace may be also present in other PHP files that are included from lib/setup.php.';
217 class problem_000003
extends problem_base
{
219 return '$CFG->dataroot does not exist or does not have write permissions';
223 if(!is_dir($CFG->dataroot
) ||
!is_writable($CFG->dataroot
)) {
228 function severity() {
229 return SEVERITY_SIGNIFICANT
;
231 function description() {
233 return 'Your <strong>config.php</strong> says that your "data root" directory is <strong>'.$CFG->dataroot
.'</strong>. However, this directory either does not exist or cannot be written to by Moodle. This means that a variety of problems will be present, such as users not being able to log in and not being able to upload any files. It is imperative that you address this problem for Moodle to work correctly.';
235 function solution() {
237 return 'First of all, make sure that the directory <strong>'.$CFG->dataroot
.'</strong> exists. If the directory does exist, then you must make sure that Moodle is able to write to it. Contact your web server administrator and request that he gives write permissions for that directory to the user that the web server process is running as.';
241 class problem_000004
extends problem_base
{
243 return 'cron.php is not set up to run automatically';
247 $lastcron = $DB->get_field_sql('SELECT max(lastcron) FROM {modules}');
248 return (time() - $lastcron > 3600 * 24);
250 function severity() {
251 return SEVERITY_SIGNIFICANT
;
253 function description() {
254 return 'The cron.php mainenance script has not been run in the past 24 hours. This probably means that your server is not configured to automatically run this script in regular time intervals. If this is the case, then Moodle will mostly work as it should but some operations (notably sending email to users) will not be carried out at all.';
256 function solution() {
258 return 'For detailed instructions on how to enable cron, see <a href="'.$CFG->wwwroot
.'/doc/?file=install.html#cron">this section</a> of the installation manual.';
262 class problem_000005
extends problem_base
{
264 return 'PHP: session.auto_start is enabled';
267 return ini_get_bool('session.auto_start');
269 function severity() {
270 return SEVERITY_CRITICAL
;
272 function description() {
273 return 'Your PHP configuration includes an enabled setting, session.auto_start, that <strong>must be disabled</strong> in order for Moodle to work correctly. Notable symptoms arising from this misconfiguration include fatal errors and/or blank pages when trying to log in.';
275 function solution() {
277 return '<p>There are two ways you can solve this problem:</p><ol><li>If you have access to your main <strong>php.ini</strong> file, then find the line that looks like this: <pre>session.auto_start = 1</pre> and change it to <pre>session.auto_start = 0</pre> and then restart your web server. Be warned that this, as any other PHP setting change, might affect other web applications running on the server.</li><li>Finally, you may be able to change this setting just for your site by creating or editing the file <strong>'.$CFG->dirroot
.'/.htaccess</strong> to contain this line: <pre>php_value session.auto_start "0"</pre></li></ol>';
281 class problem_000006
extends problem_base
{
283 return 'PHP: magic_quotes_runtime is enabled';
286 return (ini_get_bool('magic_quotes_runtime'));
288 function severity() {
289 return SEVERITY_SIGNIFICANT
;
291 function description() {
292 return 'Your PHP configuration includes an enabled setting, magic_quotes_runtime, that <strong>must be disabled</strong> in order for Moodle to work correctly. Notable symptoms arising from this misconfiguration include strange display errors whenever a text field that includes single or double quotes is processed.';
294 function solution() {
296 return '<p>There are two ways you can solve this problem:</p><ol><li>If you have access to your main <strong>php.ini</strong> file, then find the line that looks like this: <pre>magic_quotes_runtime = On</pre> and change it to <pre>magic_quotes_runtime = Off</pre> and then restart your web server. Be warned that this, as any other PHP setting change, might affect other web applications running on the server.</li><li>Finally, you may be able to change this setting just for your site by creating or editing the file <strong>'.$CFG->dirroot
.'/.htaccess</strong> to contain this line: <pre>php_value magic_quotes_runtime "Off"</pre></li></ol>';
300 class problem_000007
extends problem_base
{
302 return 'PHP: file_uploads is disabled';
305 return !ini_get_bool('file_uploads');
307 function severity() {
308 return SEVERITY_SIGNIFICANT
;
310 function description() {
311 return 'Your PHP configuration includes a disabled setting, file_uploads, that <strong>must be enabled</strong> to let Moodle offer its full functionality. Until this setting is enabled, it will not be possible to upload any files into Moodle. This includes, for example, course content and user pictures.';
313 function solution() {
315 return '<p>There are two ways you can solve this problem:</p><ol><li>If you have access to your main <strong>php.ini</strong> file, then find the line that looks like this: <pre>file_uploads = Off</pre> and change it to <pre>file_uploads = On</pre> and then restart your web server. Be warned that this, as any other PHP setting change, might affect other web applications running on the server.</li><li>Finally, you may be able to change this setting just for your site by creating or editing the file <strong>'.$CFG->dirroot
.'/.htaccess</strong> to contain this line: <pre>php_value file_uploads "On"</pre></li></ol>';
319 class problem_000008
extends problem_base
{
321 return 'PHP: memory_limit cannot be controlled by Moodle';
326 $oldmemlimit = @ini_get
('memory_limit');
327 if (empty($oldmemlimit)) {
328 // PHP not compiled with memory limits, this means that it's
329 // probably limited to 8M or in case of Windows not at all.
330 // We can ignore it for now - there is not much to test anyway
331 // TODO: add manual test that fills memory??
334 $oldmemlimit = get_real_size($oldmemlimit);
335 //now lets change the memory limit to something higher
336 $newmemlimit = ($oldmemlimit +
1024*1024*5);
337 raise_memory_limit($newmemlimit);
338 $testmemlimit = get_real_size(@ini_get
('memory_limit'));
339 //verify the change had any effect at all
340 if ($oldmemlimit == $testmemlimit) {
341 //memory limit can not be changed - is it big enough then?
342 if ($oldmemlimit < get_real_size('128M')) {
348 reduce_memory_limit($oldmemlimit);
351 function severity() {
352 return SEVERITY_NOTICE
;
354 function description() {
355 return 'The settings for PHP on your server do not allow a script to request more memory during its execution. '.
356 'This means that there is a hard limit of '.@ini_get
('memory_limit').' for each script. '.
357 'It is possible that certain operations within Moodle will require more than this amount in order '.
358 'to complete successfully, especially if there are lots of data to be processed.';
360 function solution() {
361 return 'It is recommended that you contact your web server administrator to address this issue.';
365 class problem_000009
extends problem_base
{
367 return 'SQL: using account without password';
371 return empty($CFG->dbpass
);
373 function severity() {
374 return SEVERITY_CRITICAL
;
376 function description() {
378 return 'The user account your are connecting to the database server with is set up without a password. This is a very big security risk and is only somewhat lessened if your database is configured to not accept connections from any hosts other than the server Moodle is running on. Unless you use a strong password to connect to the database, you risk unauthorized access to and manipulation of your data.'.($CFG->dbuser
!= 'root'?
'':' <strong>This is especially alarming because such access to the database would be as the superuser (root)!</strong>');
380 function solution() {
382 return 'You should change the password of the user <strong>'.$CFG->dbuser
.'</strong> both in your database and in your Moodle <strong>config.php</strong> immediately!'.($CFG->dbuser
!= 'root'?
'':' It would also be a good idea to change the user account from root to something else, because this would lessen the impact in the event that your database is compromised anyway.');
385 /* // not implemented in 2.0 yet
386 class problem_000010 extends problem_base {
388 return 'Uploaded files: slasharguments disabled or not working';
391 if (!$this->is_enabled()) {
394 if ($this->status() < 1) {
399 function severity() {
400 if ($this->is_enabled() and $this->status() == 0) {
401 return SEVERITY_SIGNIFICANT;
403 return SEVERITY_ANNOYANCE;
406 function description() {
408 $desc = 'Slasharguments are needed for relative linking in uploaded resources:<ul>';
409 if (!$this->is_enabled()) {
410 $desc .= '<li>slasharguments are <strong>disabled</strong> in Moodle configuration</li>';
412 $desc .= '<li>slasharguments are enabled in Moodle configuration</li>';
414 if ($this->status() == -1) {
415 $desc .= '<li>can not run automatic test, you can verify it <a href="'.$CFG->wwwroot.'/file.php/testslasharguments" target="_blank">here</a> manually</li>';
416 } else if ($this->status() == 0) {
417 $desc .= '<li>slashargument test <strong>failed</strong>, please check server configuration</li>';
419 $desc .= '<li>slashargument test passed</li>';
424 function solution() {
426 $enabled = $this->is_enabled();
427 $status = $this->status();
429 if ($enabled and ($status == 0)) {
430 $solution .= 'Slasharguments are enabled, but the test failed. Please disable slasharguments in Moodle configuration or fix the server configuration.<hr />';
431 } else if ((!$enabled) and ($status == 0)) {
432 $solution .= 'Slasharguments are disabled and the test failed. You may try to fix the server configuration.<hr />';
433 } else if ($enabled and ($status == -1)) {
434 $solution .= 'Slasharguments are enabled, <a href="'.$CFG->wwwroot.'/file.php/testslasharguments">automatic testing</a> not possible.<hr />';
435 } else if ((!$enabled) and ($status == -1)) {
436 $solution .= 'Slasharguments are disabled, <a href="'.$CFG->wwwroot.'/file.php/testslasharguments">automatic testing</a> not possible.<hr />';
437 } else if ((!$enabled) and ($status > 0)) {
438 $solution .= 'Slasharguments are disabled though the iternal test is OK. You should enable slasharguments in Moodle configuration.';
439 } else if ($enabled and ($status > 0)) {
440 $solution .= 'Congratulations - everything seems OK now :-D';
443 $solution .= '<p>IIS:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li><li>do NOT enable AllowPathInfoForScriptMappings !!!</li><li>slasharguments may not work when using ISAPI and PHP 4.3.10 and older</li></ul></p>';
444 $solution .= '<p>Apache 1:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
445 $solution .= '<p>Apache 2:<ul><li>you must add <code>AcceptPathInfo on</code> to php.ini or .htaccess</li><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
449 function is_enabled() {
451 return !empty($CFG->slasharguments);
455 $handle = @fopen($CFG->wwwroot.'/file.php?file=/testslasharguments', "r");
456 $contents = @trim(fread($handle, 10));
458 if ($contents != 'test -1') {
461 $handle = @fopen($CFG->wwwroot.'/file.php/testslasharguments', "r");
462 $contents = trim(@fread($handle, 10));
465 case 'test 1': return 1;
466 case 'test 2': return 2;
472 class problem_000012
extends problem_base
{
474 return 'Random questions data consistency';
478 return $DB->record_exists_select('question', "qtype = 'random' AND parent <> id", array());
480 function severity() {
481 return SEVERITY_ANNOYANCE
;
483 function description() {
484 return '<p>For random questions, question.parent should equal question.id. ' .
485 'There are some questions in your database for which this is not true. ' .
486 'One way that this could have happened is for random questions restored from backup before ' .
487 '<a href="http://tracker.moodle.org/browse/MDL-5482">MDL-5482</a> was fixed.</p>';
489 function solution() {
491 return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the SQL</p>' .
492 '<pre>UPDATE ' . $CFG->prefix
. 'question SET parent = id WHERE qtype = \'random\' and parent <> id;</pre>';
496 class problem_000013
extends problem_base
{
498 return 'Multi-answer questions data consistency';
502 $positionexpr = $DB->sql_position($DB->sql_concat("','", "q.id", "','"),
503 $DB->sql_concat("','", "qma.sequence", "','"));
504 return $DB->record_exists_sql("
505 SELECT * FROM {question} q
506 JOIN {question_multianswer} qma ON $positionexpr > 0
507 WHERE qma.question <> q.parent") ||
508 $DB->record_exists_sql("
509 SELECT * FROM {question} q
510 JOIN {question} parent_q ON parent_q.id = q.parent
511 WHERE q.category <> parent_q.category");
513 function severity() {
514 return SEVERITY_ANNOYANCE
;
516 function description() {
517 return '<p>For each sub-question whose id is listed in ' .
518 'question_multianswer.sequence, its question.parent field should equal ' .
519 'question_multianswer.question; and each sub-question should be in the same ' .
520 'category as its parent. There are questions in your database for ' .
521 'which this is not the case. One way that this could have happened is ' .
522 'for multi-answer questions restored from backup before ' .
523 '<a href="http://tracker.moodle.org/browse/MDL-14750">MDL-14750</a> was fixed.</p>';
525 function solution() {
526 return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the ' .
527 'code in question_multianswer_fix_subquestion_parents_and_categories in ' .
528 '<a href="http://cvs.moodle.org/moodle/question/type/multianswer/db/upgrade.php?revision=1.1.10.2&view=markup">/question/type/multianswer/db/upgrade.php' .
529 'from the 1.9 stable branch</a>.</p>';
533 class problem_000014
extends problem_base
{
535 return 'Only multianswer and random questions should be the parent of another question';
539 return $DB->record_exists_sql("
540 SELECT * FROM {question} q
541 JOIN {question} parent_q ON parent_q.id = q.parent
542 WHERE parent_q.qtype NOT IN ('random', 'multianswer')");
544 function severity() {
545 return SEVERITY_ANNOYANCE
;
547 function description() {
548 return '<p>You have questions that violate this in your databse. ' .
549 'You will need to investigate to determine how this happened.</p>';
551 function solution() {
552 return '<p>It is impossible to give a solution without knowing more about ' .
553 ' how the problem was caused. You may be able to get help from the ' .
554 '<a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a>.</p>';
558 class problem_000015
extends problem_base
{
560 return 'Question categories should belong to a valid context';
564 return $DB->record_exists_sql("
565 SELECT qc.*, (SELECT COUNT(1) FROM {question} q WHERE q.category = qc.id) AS numquestions
566 FROM {question_categories} qc
567 LEFT JOIN {context} con ON qc.contextid = con.id
568 WHERE con.id IS NULL");
570 function severity() {
571 return SEVERITY_ANNOYANCE
;
573 function description() {
575 $problemcategories = $DB->get_records_sql("
576 SELECT qc.id, qc.name, qc.contextid, (SELECT COUNT(1) FROM {question} q WHERE q.category = qc.id) AS numquestions
577 FROM {question_categories} qc
578 LEFT JOIN {context} con ON qc.contextid = con.id
580 ORDER BY numquestions DESC, qc.name");
581 $table = '<table><thead><tr><th>Cat id</th><th>Category name</th>' .
582 "<th>Context id</th><th>Num Questions</th></tr></thead><tbody>\n";
583 foreach ($problemcategories as $cat) {
584 $table .= "<tr><td>$cat->id</td><td>" . s($cat->name
) . "</td><td>" .
585 $cat->contextid
."</td><td>$cat->numquestions</td></tr>\n";
587 $table .= '</tbody></table>';
588 return '<p>All question categories are linked to a context id, and, ' .
589 'the context they are linked to must exist. The following categories ' .
590 'belong to a non-existant category:</p>' . $table . '<p>Any of these ' .
591 'categories that contain no questions can just be deleted form the database. ' .
592 'Other categories will require more thought.</p>';
594 function solution() {
596 return '<p>You can delete the empty categories by executing the following SQL:</p><pre>
597 DELETE FROM ' . $CFG->prefix
. 'question_categories
599 NOT EXISTS (SELECT * FROM ' . $CFG->prefix
. 'question q WHERE q.category = ' . $CFG->prefix
. 'question_categories.id)
600 AND NOT EXISTS (SELECT * FROM ' . $CFG->prefix
. 'context con WHERE contextid = con.id)
601 </pre><p>Any remaining categories that contain questions will require more thought. ' .
602 'People in the <a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a> may be able to help.</p>';
606 class problem_000016
extends problem_base
{
608 return 'Question categories should belong to the same context as their parent';
612 return $DB->record_exists_sql("
613 SELECT parent_qc.id AS parent, child_qc.id AS child, child_qc.contextid
614 FROM {question_categories} child_qc
615 JOIN {question_categories} parent_qc ON child_qc.parent = parent_qc.id
616 WHERE child_qc.contextid <> parent_qc.contextid");
618 function severity() {
619 return SEVERITY_ANNOYANCE
;
621 function description() {
623 $problemcategories = $DB->get_records_sql("
625 parent_qc.id AS parentid, parent_qc.name AS parentname, parent_qc.contextid AS parentcon,
626 child_qc.id AS childid, child_qc.name AS childname, child_qc.contextid AS childcon
627 FROM {question_categories} child_qc
628 JOIN {question_categories} parent_qc ON child_qc.parent = parent_qc.id
629 WHERE child_qc.contextid <> parent_qc.contextid");
630 $table = '<table><thead><tr><th colspan="3">Child category</th><th colspan="3">Parent category</th></tr><tr>' .
631 '<th>Id</th><th>Name</th><th>Context id</th>' .
632 '<th>Id</th><th>Name</th><th>Context id</th>' .
633 "</tr></thead><tbody>\n";
634 foreach ($problemcategories as $cat) {
635 $table .= "<tr><td>$cat->childid</td><td>" . s($cat->childname
) .
636 "</td><td>$cat->childcon</td><td>$cat->parentid</td><td>" . s($cat->parentname
) .
637 "</td><td>$cat->parentcon</td></tr>\n";
639 $table .= '</tbody></table>';
640 return '<p>When one question category is the parent of another, then they ' .
641 'should both belong to the same context. This is not true for the following categories:</p>' .
644 function solution() {
645 return '<p>An automated solution is difficult. It depends whether the ' .
646 'parent or child category is in the wrong pace.' .
647 'People in the <a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a> may be able to help.</p>';
651 class problem_000017
extends problem_base
{
653 return 'Question categories tree structure';
655 function find_problems() {
657 static $answer = null;
659 if (is_null($answer)) {
660 $categories = $DB->get_records('question_categories', array(), 'id');
662 // Look for missing parents.
663 $missingparent = array();
664 foreach ($categories as $category) {
665 if ($category->parent
!= 0 && !array_key_exists($category->parent
, $categories)) {
666 $missingparent[$category->id
] = $category;
672 while (!empty($categories)) {
673 $current = array_pop($categories);
674 $thisloop = array($current->id
=> $current);
676 if (isset($thisloop[$current->parent
])) {
678 $loops[$current->id
] = $thisloop;
680 } else if (!isset($categories[$current->parent
])) {
681 // Got to the top level, or a category we already know is OK.
684 // Continue following the path.
685 $current = $categories[$current->parent
];
686 $thisloop[$current->id
] = $current;
687 unset($categories[$current->id
]);
692 $answer = array($missingparent, $loops);
698 list($missingparent, $loops) = $this->find_problems();
699 return !empty($missingparent) ||
!empty($loops);
701 function severity() {
702 return SEVERITY_ANNOYANCE
;
704 function description() {
705 list($missingparent, $loops) = $this->find_problems();
707 $description = '<p>The question categories should be arranged into tree ' .
708 ' structures by the question_categories.parent field. Sometimes ' .
709 ' this tree structure gets messed up.</p>';
711 if (!empty($missingparent)) {
712 $description .= '<p>The following categories are missing their parents:</p><ul>';
713 foreach ($missingparent as $cat) {
714 $description .= "<li>Category $cat->id: " . s($cat->name
) . "</li>\n";
716 $description .= "</ul>\n";
719 if (!empty($loops)) {
720 $description .= '<p>The following categories form a loop of parents:</p><ul>';
721 foreach ($loops as $loop) {
722 $description .= "<li><ul>\n";
723 foreach ($loop as $cat) {
724 $description .= "<li>Category $cat->id: " . s($cat->name
) . " has parent $cat->parent</li>\n";
726 $description .= "</ul></li>\n";
728 $description .= "</ul>\n";
733 function solution() {
735 list($missingparent, $loops) = $this->find_problems();
737 $solution = '<p>Consider executing the following SQL queries. These fix ' .
738 'the problem by moving some categories to the top level.</p>';
740 if (!empty($missingparent)) {
741 $solution .= "<pre>UPDATE " . $CFG->prefix
. "question_categories\n" .
742 " SET parent = 0\n" .
743 " WHERE id IN (" . implode(',', array_keys($missingparent)) . ");</pre>\n";
746 if (!empty($loops)) {
747 $solution .= "<pre>UPDATE " . $CFG->prefix
. "question_categories\n" .
748 " SET parent = 0\n" .
749 " WHERE id IN (" . implode(',', array_keys($loops)) . ");</pre>\n";
756 class problem_00000x
extends problem_base
{
763 function severity() {
764 return SEVERITY_SIGNIFICANT
;
766 function description() {
769 function solution() {
779 session.save_path -- it doesn't really matter because we are already IN a session, right?
780 detect unsupported characters in $CFG->wwwroot - see bug Bug #6091 - relative vs absolute path during backup/restore process