2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Strings for component 'tool_health', language 'en', branch 'MOODLE_22_STABLE'
22 * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 ob_start(); //for whitespace test
27 require('../../../config.php');
28 $extraws = ob_get_clean();
30 require_once($CFG->libdir.'/adminlib.php');
32 admin_externalpage_setup('toolhealth');
34 define('SEVERITY_NOTICE', 'notice');
35 define('SEVERITY_ANNOYANCE', 'annoyance');
36 define('SEVERITY_SIGNIFICANT', 'significant');
37 define('SEVERITY_CRITICAL', 'critical');
39 $solution = optional_param('solution', 0, PARAM_PLUGIN);
42 require_capability('moodle/site:config', context_system::instance());
46 echo $OUTPUT->header();
48 if(strpos($solution, 'problem_') === 0 && class_exists($solution)) {
49 health_print_solution($solution);
52 health_find_problems();
56 echo $OUTPUT->footer();
59 function health_find_problems() {
62 echo $OUTPUT->heading(get_string('pluginname', 'tool_health'));
65 SEVERITY_CRITICAL => array(),
66 SEVERITY_SIGNIFICANT => array(),
67 SEVERITY_ANNOYANCE => array(),
68 SEVERITY_NOTICE => array(),
72 for($i = 1; $i < 1000000; ++$i) {
73 $classname = sprintf('problem_%06d', $i);
74 if(!class_exists($classname)) {
77 $problem = new $classname;
79 if($problem->exists()) {
80 $severity = $problem->severity();
81 $issues[$severity][$classname] = array(
82 'severity' => $severity,
83 'description' => $problem->description(),
84 'title' => $problem->title()
92 echo '<div id="healthnoproblemsfound">';
93 echo get_string('healthnoproblemsfound', 'tool_health');
97 echo $OUTPUT->heading(get_string('healthproblemsdetected', 'tool_health'));
98 $severities = array(SEVERITY_CRITICAL, SEVERITY_SIGNIFICANT, SEVERITY_ANNOYANCE, SEVERITY_NOTICE);
99 foreach($severities as $severity) {
100 if(!empty($issues[$severity])) {
101 echo '<dl class="healthissues '.$severity.'">';
102 foreach($issues[$severity] as $classname => $data) {
103 echo '<dt id="'.$classname.'">'.$data['title'].'</dt>';
104 echo '<dd>'.$data['description'];
105 echo '<form action="index.php#solution" method="get">';
106 echo '<input type="hidden" name="solution" value="'.$classname.'" /><input type="submit" value="'.get_string('viewsolution').'" />';
115 function health_print_solution($classname) {
117 $problem = new $classname;
119 'title' => $problem->title(),
120 'severity' => $problem->severity(),
121 'description' => $problem->description(),
122 'solution' => $problem->solution()
125 echo $OUTPUT->heading(get_string('pluginname', 'tool_health'));
126 echo $OUTPUT->heading(get_string('healthproblemsolution', 'tool_health'));
127 echo '<dl class="healthissues '.$data['severity'].'">';
128 echo '<dt>'.$data['title'].'</dt>';
129 echo '<dd>'.$data['description'].'</dd>';
130 echo '<dt id="solution" class="solution">'.get_string('healthsolution', 'tool_health').'</dt>';
131 echo '<dd class="solution">'.$data['solution'].'</dd></dl>';
132 echo '<form id="healthformreturn" action="index.php#'.$classname.'" method="get">';
133 echo '<input type="submit" value="'.get_string('healthreturntomain', 'tool_health').'" />';
144 function severity() {
145 return SEVERITY_NOTICE;
147 function description() {
150 function solution() {
155 class problem_000002 extends problem_base {
157 return 'Extra characters at the end of config.php or other library function';
162 if($extraws === '') {
167 function severity() {
168 return SEVERITY_SIGNIFICANT;
170 function description() {
171 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.';
173 function solution() {
175 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.';
179 class problem_000003 extends problem_base {
181 return '$CFG->dataroot does not exist or does not have write permissions';
185 if(!is_dir($CFG->dataroot) || !is_writable($CFG->dataroot)) {
190 function severity() {
191 return SEVERITY_SIGNIFICANT;
193 function description() {
195 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.';
197 function solution() {
199 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.';
203 class problem_000004 extends problem_base {
205 return 'cron.php is not set up to run automatically';
209 $lastcron = $DB->get_field_sql('SELECT max(lastcron) FROM {modules}');
210 return (time() - $lastcron > 3600 * 24);
212 function severity() {
213 return SEVERITY_SIGNIFICANT;
215 function description() {
216 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.';
218 function solution() {
220 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.';
224 class problem_000005 extends problem_base {
226 return 'PHP: session.auto_start is enabled';
229 return ini_get_bool('session.auto_start');
231 function severity() {
232 return SEVERITY_CRITICAL;
234 function description() {
235 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.';
237 function solution() {
239 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>';
243 class problem_000006 extends problem_base {
245 return 'PHP: magic_quotes_runtime is enabled';
248 return (ini_get_bool('magic_quotes_runtime'));
250 function severity() {
251 return SEVERITY_SIGNIFICANT;
253 function description() {
254 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.';
256 function solution() {
258 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>';
262 class problem_000007 extends problem_base {
264 return 'PHP: file_uploads is disabled';
267 return !ini_get_bool('file_uploads');
269 function severity() {
270 return SEVERITY_SIGNIFICANT;
272 function description() {
273 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.';
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>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>';
281 class problem_000008 extends problem_base {
283 return 'PHP: memory_limit cannot be controlled by Moodle';
288 $oldmemlimit = @ini_get('memory_limit');
289 if (empty($oldmemlimit)) {
290 // PHP not compiled with memory limits, this means that it's
291 // probably limited to 8M or in case of Windows not at all.
292 // We can ignore it for now - there is not much to test anyway
293 // TODO: add manual test that fills memory??
296 $oldmemlimit = get_real_size($oldmemlimit);
297 //now lets change the memory limit to something higher
298 $newmemlimit = ($oldmemlimit + 1024*1024*5);
299 raise_memory_limit($newmemlimit);
300 $testmemlimit = get_real_size(@ini_get('memory_limit'));
301 //verify the change had any effect at all
302 if ($oldmemlimit == $testmemlimit) {
303 //memory limit can not be changed - is it big enough then?
304 if ($oldmemlimit < get_real_size('128M')) {
310 reduce_memory_limit($oldmemlimit);
313 function severity() {
314 return SEVERITY_NOTICE;
316 function description() {
317 return 'The settings for PHP on your server do not allow a script to request more memory during its execution. '.
318 'This means that there is a hard limit of '.@ini_get('memory_limit').' for each script. '.
319 'It is possible that certain operations within Moodle will require more than this amount in order '.
320 'to complete successfully, especially if there are lots of data to be processed.';
322 function solution() {
323 return 'It is recommended that you contact your web server administrator to address this issue.';
327 class problem_000009 extends problem_base {
329 return 'SQL: using account without password';
333 return empty($CFG->dbpass);
335 function severity() {
336 return SEVERITY_CRITICAL;
338 function description() {
340 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>');
342 function solution() {
344 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.');
347 /* // not implemented in 2.0 yet
348 class problem_000010 extends problem_base {
350 return 'Uploaded files: slasharguments disabled or not working';
353 if (!$this->is_enabled()) {
356 if ($this->status() < 1) {
361 function severity() {
362 if ($this->is_enabled() and $this->status() == 0) {
363 return SEVERITY_SIGNIFICANT;
365 return SEVERITY_ANNOYANCE;
368 function description() {
370 $desc = 'Slasharguments are needed for relative linking in uploaded resources:<ul>';
371 if (!$this->is_enabled()) {
372 $desc .= '<li>slasharguments are <strong>disabled</strong> in Moodle configuration</li>';
374 $desc .= '<li>slasharguments are enabled in Moodle configuration</li>';
376 if ($this->status() == -1) {
377 $desc .= '<li>can not run automatic test, you can verify it <a href="'.$CFG->wwwroot.'/file.php/testslasharguments" target="_blank">here</a> manually</li>';
378 } else if ($this->status() == 0) {
379 $desc .= '<li>slashargument test <strong>failed</strong>, please check server configuration</li>';
381 $desc .= '<li>slashargument test passed</li>';
386 function solution() {
388 $enabled = $this->is_enabled();
389 $status = $this->status();
391 if ($enabled and ($status == 0)) {
392 $solution .= 'Slasharguments are enabled, but the test failed. Please disable slasharguments in Moodle configuration or fix the server configuration.<hr />';
393 } else if ((!$enabled) and ($status == 0)) {
394 $solution .= 'Slasharguments are disabled and the test failed. You may try to fix the server configuration.<hr />';
395 } else if ($enabled and ($status == -1)) {
396 $solution .= 'Slasharguments are enabled, <a href="'.$CFG->wwwroot.'/file.php/testslasharguments">automatic testing</a> not possible.<hr />';
397 } else if ((!$enabled) and ($status == -1)) {
398 $solution .= 'Slasharguments are disabled, <a href="'.$CFG->wwwroot.'/file.php/testslasharguments">automatic testing</a> not possible.<hr />';
399 } else if ((!$enabled) and ($status > 0)) {
400 $solution .= 'Slasharguments are disabled though the iternal test is OK. You should enable slasharguments in Moodle configuration.';
401 } else if ($enabled and ($status > 0)) {
402 $solution .= 'Congratulations - everything seems OK now :-D';
405 $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>';
406 $solution .= '<p>Apache 1:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
407 $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>';
411 function is_enabled() {
413 return !empty($CFG->slasharguments);
417 $handle = @fopen($CFG->wwwroot.'/file.php?file=/testslasharguments', "r");
418 $contents = @trim(fread($handle, 10));
420 if ($contents != 'test -1') {
423 $handle = @fopen($CFG->wwwroot.'/file.php/testslasharguments', "r");
424 $contents = trim(@fread($handle, 10));
427 case 'test 1': return 1;
428 case 'test 2': return 2;
434 class problem_000012 extends problem_base {
436 return 'Random questions data consistency';
440 return $DB->record_exists_select('question', "qtype = 'random' AND parent <> id", array());
442 function severity() {
443 return SEVERITY_ANNOYANCE;
445 function description() {
446 return '<p>For random questions, question.parent should equal question.id. ' .
447 'There are some questions in your database for which this is not true. ' .
448 'One way that this could have happened is for random questions restored from backup before ' .
449 '<a href="http://tracker.moodle.org/browse/MDL-5482">MDL-5482</a> was fixed.</p>';
451 function solution() {
453 return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the SQL</p>' .
454 '<pre>UPDATE ' . $CFG->prefix . 'question SET parent = id WHERE qtype = \'random\' and parent <> id;</pre>';
458 class problem_000013 extends problem_base {
460 return 'Multi-answer questions data consistency';
464 $positionexpr = $DB->sql_position($DB->sql_concat("','", "q.id", "','"),
465 $DB->sql_concat("','", "qma.sequence", "','"));
466 return $DB->record_exists_sql("
467 SELECT * FROM {question} q
468 JOIN {question_multianswer} qma ON $positionexpr > 0
469 WHERE qma.question <> q.parent") ||
470 $DB->record_exists_sql("
471 SELECT * FROM {question} q
472 JOIN {question} parent_q ON parent_q.id = q.parent
473 WHERE q.category <> parent_q.category");
475 function severity() {
476 return SEVERITY_ANNOYANCE;
478 function description() {
479 return '<p>For each sub-question whose id is listed in ' .
480 'question_multianswer.sequence, its question.parent field should equal ' .
481 'question_multianswer.question; and each sub-question should be in the same ' .
482 'category as its parent. There are questions in your database for ' .
483 'which this is not the case. One way that this could have happened is ' .
484 'for multi-answer questions restored from backup before ' .
485 '<a href="http://tracker.moodle.org/browse/MDL-14750">MDL-14750</a> was fixed.</p>';
487 function solution() {
488 return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the ' .
489 'code in question_multianswer_fix_subquestion_parents_and_categories in ' .
490 '<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' .
491 'from the 1.9 stable branch</a>.</p>';
495 class problem_000014 extends problem_base {
497 return 'Only multianswer and random questions should be the parent of another question';
501 return $DB->record_exists_sql("
502 SELECT * FROM {question} q
503 JOIN {question} parent_q ON parent_q.id = q.parent
504 WHERE parent_q.qtype NOT IN ('random', 'multianswer')");
506 function severity() {
507 return SEVERITY_ANNOYANCE;
509 function description() {
510 return '<p>You have questions that violate this in your databse. ' .
511 'You will need to investigate to determine how this happened.</p>';
513 function solution() {
514 return '<p>It is impossible to give a solution without knowing more about ' .
515 ' how the problem was caused. You may be able to get help from the ' .
516 '<a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a>.</p>';
520 class problem_000015 extends problem_base {
522 return 'Question categories should belong to a valid context';
526 return $DB->record_exists_sql("
527 SELECT qc.*, (SELECT COUNT(1) FROM {question} q WHERE q.category = qc.id) AS numquestions
528 FROM {question_categories} qc
529 LEFT JOIN {context} con ON qc.contextid = con.id
530 WHERE con.id IS NULL");
532 function severity() {
533 return SEVERITY_ANNOYANCE;
535 function description() {
537 $problemcategories = $DB->get_records_sql("
538 SELECT qc.id, qc.name, qc.contextid, (SELECT COUNT(1) FROM {question} q WHERE q.category = qc.id) AS numquestions
539 FROM {question_categories} qc
540 LEFT JOIN {context} con ON qc.contextid = con.id
542 ORDER BY numquestions DESC, qc.name");
543 $table = '<table><thead><tr><th>Cat id</th><th>Category name</th>' .
544 "<th>Context id</th><th>Num Questions</th></tr></thead><tbody>\n";
545 foreach ($problemcategories as $cat) {
546 $table .= "<tr><td>$cat->id</td><td>" . s($cat->name) . "</td><td>" .
547 $cat->contextid ."</td><td>$cat->numquestions</td></tr>\n";
549 $table .= '</tbody></table>';
550 return '<p>All question categories are linked to a context id, and, ' .
551 'the context they are linked to must exist. The following categories ' .
552 'belong to a non-existant category:</p>' . $table . '<p>Any of these ' .
553 'categories that contain no questions can just be deleted form the database. ' .
554 'Other categories will require more thought.</p>';
556 function solution() {
558 return '<p>You can delete the empty categories by executing the following SQL:</p><pre>
559 DELETE FROM ' . $CFG->prefix . 'question_categories
561 NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'question q WHERE q.category = ' . $CFG->prefix . 'question_categories.id)
562 AND NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'context con WHERE contextid = con.id)
563 </pre><p>Any remaining categories that contain questions will require more thought. ' .
564 'People in the <a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a> may be able to help.</p>';
568 class problem_000016 extends problem_base {
570 return 'Question categories should belong to the same context as their parent';
574 return $DB->record_exists_sql("
575 SELECT parent_qc.id AS parent, child_qc.id AS child, child_qc.contextid
576 FROM {question_categories} child_qc
577 JOIN {question_categories} parent_qc ON child_qc.parent = parent_qc.id
578 WHERE child_qc.contextid <> parent_qc.contextid");
580 function severity() {
581 return SEVERITY_ANNOYANCE;
583 function description() {
585 $problemcategories = $DB->get_records_sql("
587 parent_qc.id AS parentid, parent_qc.name AS parentname, parent_qc.contextid AS parentcon,
588 child_qc.id AS childid, child_qc.name AS childname, child_qc.contextid AS childcon
589 FROM {question_categories} child_qc
590 JOIN {question_categories} parent_qc ON child_qc.parent = parent_qc.id
591 WHERE child_qc.contextid <> parent_qc.contextid");
592 $table = '<table><thead><tr><th colspan="3">Child category</th><th colspan="3">Parent category</th></tr><tr>' .
593 '<th>Id</th><th>Name</th><th>Context id</th>' .
594 '<th>Id</th><th>Name</th><th>Context id</th>' .
595 "</tr></thead><tbody>\n";
596 foreach ($problemcategories as $cat) {
597 $table .= "<tr><td>$cat->childid</td><td>" . s($cat->childname) .
598 "</td><td>$cat->childcon</td><td>$cat->parentid</td><td>" . s($cat->parentname) .
599 "</td><td>$cat->parentcon</td></tr>\n";
601 $table .= '</tbody></table>';
602 return '<p>When one question category is the parent of another, then they ' .
603 'should both belong to the same context. This is not true for the following categories:</p>' .
606 function solution() {
607 return '<p>An automated solution is difficult. It depends whether the ' .
608 'parent or child category is in the wrong pace.' .
609 'People in the <a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a> may be able to help.</p>';
613 class problem_000017 extends problem_base {
615 return 'Question categories tree structure';
617 function find_problems() {
619 static $answer = null;
621 if (is_null($answer)) {
622 $categories = $DB->get_records('question_categories', array(), 'id');
624 // Look for missing parents.
625 $missingparent = array();
626 foreach ($categories as $category) {
627 if ($category->parent != 0 && !array_key_exists($category->parent, $categories)) {
628 $missingparent[$category->id] = $category;
634 while (!empty($categories)) {
635 $current = array_pop($categories);
636 $thisloop = array($current->id => $current);
638 if (isset($thisloop[$current->parent])) {
640 $loops[$current->id] = $thisloop;
642 } else if (!isset($categories[$current->parent])) {
643 // Got to the top level, or a category we already know is OK.
646 // Continue following the path.
647 $current = $categories[$current->parent];
648 $thisloop[$current->id] = $current;
649 unset($categories[$current->id]);
654 $answer = array($missingparent, $loops);
660 list($missingparent, $loops) = $this->find_problems();
661 return !empty($missingparent) || !empty($loops);
663 function severity() {
664 return SEVERITY_ANNOYANCE;
666 function description() {
667 list($missingparent, $loops) = $this->find_problems();
669 $description = '<p>The question categories should be arranged into tree ' .
670 ' structures by the question_categories.parent field. Sometimes ' .
671 ' this tree structure gets messed up.</p>';
673 if (!empty($missingparent)) {
674 $description .= '<p>The following categories are missing their parents:</p><ul>';
675 foreach ($missingparent as $cat) {
676 $description .= "<li>Category $cat->id: " . s($cat->name) . "</li>\n";
678 $description .= "</ul>\n";
681 if (!empty($loops)) {
682 $description .= '<p>The following categories form a loop of parents:</p><ul>';
683 foreach ($loops as $loop) {
684 $description .= "<li><ul>\n";
685 foreach ($loop as $cat) {
686 $description .= "<li>Category $cat->id: " . s($cat->name) . " has parent $cat->parent</li>\n";
688 $description .= "</ul></li>\n";
690 $description .= "</ul>\n";
695 function solution() {
697 list($missingparent, $loops) = $this->find_problems();
699 $solution = '<p>Consider executing the following SQL queries. These fix ' .
700 'the problem by moving some categories to the top level.</p>';
702 if (!empty($missingparent)) {
703 $solution .= "<pre>UPDATE " . $CFG->prefix . "question_categories\n" .
704 " SET parent = 0\n" .
705 " WHERE id IN (" . implode(',', array_keys($missingparent)) . ");</pre>\n";
708 if (!empty($loops)) {
709 $solution .= "<pre>UPDATE " . $CFG->prefix . "question_categories\n" .
710 " SET parent = 0\n" .
711 " WHERE id IN (" . implode(',', array_keys($loops)) . ");</pre>\n";
718 class problem_00000x extends problem_base {
725 function severity() {
726 return SEVERITY_SIGNIFICANT;
728 function description() {
731 function solution() {
741 session.save_path -- it doesn't really matter because we are already IN a session, right?
742 detect unsupported characters in $CFG->wwwroot - see bug Bug #6091 - relative vs absolute path during backup/restore process