diff --git a/admin/settings/unsupported.php b/admin/settings/unsupported.php index b5cd7e55a7a..c800de1eb42 100644 --- a/admin/settings/unsupported.php +++ b/admin/settings/unsupported.php @@ -5,7 +5,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page $ADMIN->add('unsupported', new admin_externalpage('purgemoodledata', 'Purge moodledata', $CFG->wwwroot.'/'.$CFG->admin.'/delete.php', 'moodle/site:config', true)); - $ADMIN->add('unsupported', new admin_externalpage('healthcenter', get_string('healthcenter'), $CFG->wwwroot.'/'.$CFG->admin.'/health.php', 'moodle/site:config', true)); $ADMIN->add('unsupported', new admin_externalpage('toinodb', 'Convert to InnoDB', $CFG->wwwroot.'/'.$CFG->admin.'/innodb.php', 'moodle/site:config', true)); $ADMIN->add('unsupported', new admin_externalpage('replace', 'Search and replace', $CFG->wwwroot.'/'.$CFG->admin.'/replace.php', 'moodle/site:config', true)); diff --git a/admin/health.php b/admin/tool/health/index.php similarity index 94% rename from admin/health.php rename to admin/tool/health/index.php index e18a052c059..d7596ae80c8 100644 --- a/admin/health.php +++ b/admin/tool/health/index.php @@ -1,7 +1,30 @@ . + +/** + * Strings for component 'tool_health', language 'en', branch 'MOODLE_22_STABLE' + * + * @package tool + * @subpackage health + * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ ob_start(); //for whitespace test - require_once('../config.php'); + require('../../../config.php'); // extra whitespace test - intentionally breaks cookieless mode $extraws = ''; @@ -12,7 +35,7 @@ require_once($CFG->libdir.'/adminlib.php'); - admin_externalpage_setup('healthcenter'); + admin_externalpage_setup('toolhealth'); define('SEVERITY_NOTICE', 'notice'); define('SEVERITY_ANNOYANCE', 'annoyance'); @@ -28,68 +51,6 @@ echo $OUTPUT->header(); -echo << -div#healthnoproblemsfound { - width: 60%; - margin: auto; - padding: 1em; - border: 1px black solid; - -moz-border-radius: 6px; -} -dl.healthissues { - width: 60%; - margin: auto; -} -dl.critical dt, dl.critical dd { - background-color: #a71501; -} -dl.significant dt, dl.significant dd { - background-color: #d36707; -} -dl.annoyance dt, dl.annoyance dd { - background-color: #dba707; -} -dl.notice dt, dl.notice dd { - background-color: #e5db36; -} -dt.solution, dd.solution, div#healthnoproblemsfound { - background-color: #5BB83E !important; -} -dl.healthissues dt, dl.healthissues dd { - margin: 0px; - padding: 1em; - border: 1px black solid; -} -dl.healthissues dt { - font-weight: bold; - border-bottom: none; - padding-bottom: 0.5em; -} -dl.healthissues dd { - border-top: none; - padding-top: 0.5em; - margin-bottom: 10px; -} -dl.healthissues dd form { - margin-top: 0.5em; - text-align: right; -} -form#healthformreturn { - text-align: center; - margin: 2em; -} -dd.solution p { - padding: 0px; - margin: 1em 0px; -} -dd.solution li { - margin-top: 1em; -} - - -STYLES; - if(strpos($solution, 'problem_') === 0 && class_exists($solution)) { health_print_solution($solution); } @@ -104,7 +65,7 @@ STYLES; function health_find_problems() { global $OUTPUT; - echo $OUTPUT->heading(get_string('healthcenter')); + echo $OUTPUT->heading(get_string('pluginname', 'tool_health')); $issues = array( SEVERITY_CRITICAL => array(), @@ -117,9 +78,10 @@ function health_find_problems() { for($i = 1; $i < 1000000; ++$i) { $classname = sprintf('problem_%06d', $i); if(!class_exists($classname)) { - break; + continue; } $problem = new $classname; + if($problem->exists()) { $severity = $problem->severity(); $issues[$severity][$classname] = array( @@ -134,11 +96,11 @@ function health_find_problems() { if($problems == 0) { echo '
'; - echo get_string('healthnoproblemsfound'); + echo get_string('healthnoproblemsfound', 'tool_health'); echo '
'; } else { - echo $OUTPUT->heading(get_string('healthproblemsdetected')); + echo $OUTPUT->heading(get_string('healthproblemsdetected', 'tool_health')); $severities = array(SEVERITY_CRITICAL, SEVERITY_SIGNIFICANT, SEVERITY_ANNOYANCE, SEVERITY_NOTICE); foreach($severities as $severity) { if(!empty($issues[$severity])) { @@ -146,7 +108,7 @@ function health_find_problems() { foreach($issues[$severity] as $classname => $data) { echo '
'.$data['title'].'
'; echo '
'.$data['description']; - echo '
'; + echo ''; echo ''; echo '
'; } @@ -166,15 +128,15 @@ function health_print_solution($classname) { 'solution' => $problem->solution() ); - echo $OUTPUT->heading(get_string('healthcenter')); - echo $OUTPUT->heading(get_string('healthproblemsolution')); + echo $OUTPUT->heading(get_string('pluginname', 'tool_health')); + echo $OUTPUT->heading(get_string('healthproblemsolution', 'tool_health')); echo '
'; echo '
'.$data['title'].'
'; echo '
'.$data['description'].'
'; - echo '
'.get_string('healthsolution').'
'; + echo '
'.get_string('healthsolution', 'tool_health').'
'; echo '
'.$data['solution'].'
'; - echo '
'; - echo ''; + echo ''; + echo ''; echo '
'; } @@ -786,5 +748,3 @@ TODO: detect unsupported characters in $CFG->wwwroot - see bug Bug #6091 - relative vs absolute path during backup/restore process */ - - diff --git a/admin/tool/health/lang/en/tool_health.php b/admin/tool/health/lang/en/tool_health.php new file mode 100644 index 00000000000..009a147ff76 --- /dev/null +++ b/admin/tool/health/lang/en/tool_health.php @@ -0,0 +1,31 @@ +. + +/** + * Strings for component 'tool_health', language 'en', branch 'MOODLE_22_STABLE' + * + * @package tool + * @subpackage health + * @copyright 2011 petr Skoda + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +$string['healthnoproblemsfound'] = 'There is no health problem found!'; +$string['healthproblemsdetected'] = 'Health problems detected!'; +$string['healthproblemsolution'] = 'Health problem solution'; +$string['healthreturntomain'] = 'Continue'; +$string['healthsolution'] = 'Solution'; +$string['pluginname'] = 'Health center'; diff --git a/admin/tool/health/settings.php b/admin/tool/health/settings.php new file mode 100644 index 00000000000..07b58b38a9e --- /dev/null +++ b/admin/tool/health/settings.php @@ -0,0 +1,30 @@ +. + +/** + * Capability overview settings + * + * @package tool + * @subpackage bloglevelupgrade + * @copyright 2011 Petr Skoda + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die; + +if ($hassiteconfig) { + $ADMIN->add('unsupported', new admin_externalpage('toolhealth', get_string('pluginname', 'tool_health'), $CFG->wwwroot.'/'.$CFG->admin.'/tool/health/index.php', 'moodle/site:config', true)); +} diff --git a/admin/tool/health/styles.css b/admin/tool/health/styles.css new file mode 100644 index 00000000000..556b443e95e --- /dev/null +++ b/admin/tool/health/styles.css @@ -0,0 +1,65 @@ + +.path-admin-tool-health div#healthnoproblemsfound { + width: 60%; + margin: auto; + padding: 1em; + border: 1px black solid; + -moz-border-radius: 6px; +} +.path-admin-tool-health dl.healthissues { + width: 60%; + margin: auto; +} +.path-admin-tool-health dl.critical dt, +.path-admin-tool-health dl.critical dd { + background-color: #a71501; +} +.path-admin-tool-health dl.significant dt, +.path-admin-tool-health dl.significant dd { + background-color: #d36707; +} +.path-admin-tool-health dl.annoyance dt, +.path-admin-tool-health dl.annoyance dd { + background-color: #dba707; +} +.path-admin-tool-health dl.notice dt, +.path-admin-tool-health dl.notice dd { + background-color: #e5db36; +} +.path-admin-tool-health dt.solution, +.path-admin-tool-health dd.solution, +.path-admin-tool-health div#healthnoproblemsfound { + background-color: #5BB83E !important; +} +.path-admin-tool-health dl.healthissues dt, +.path-admin-tool-health dl.healthissues dd { + margin: 0px; + padding: 1em; + border: 1px black solid; +} +.path-admin-tool-health dl.healthissues dt { + font-weight: bold; + border-bottom: none; + padding-bottom: 0.5em; +} +.path-admin-tool-health dl.healthissues dd { + border-top: none; + padding-top: 0.5em; + margin-bottom: 10px; +} +.path-admin-tool-health dl.healthissues dd form { + margin-top: 0.5em; + text-align: right; +} +.path-admin-tool-health form#healthformreturn { + text-align: center; + margin: 2em; +} +.path-admin-tool-health dd.solution p { + padding: 0px; + margin: 1em 0px; +} +.path-admin-tool-health dd.solution li { + margin-top: 1em; +} + diff --git a/admin/tool/health/version.php b/admin/tool/health/version.php new file mode 100644 index 00000000000..9cc559b30a7 --- /dev/null +++ b/admin/tool/health/version.php @@ -0,0 +1,32 @@ +. + +/** + * Version details. + * + * @package tool + * @subpackage health + * @copyright 2011 petr Skoda + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die; + +$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX) +$plugin->requires = 2011091600; // Requires this Moodle version +$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics) + +$maturity = MATURITY_ALPHA; // this version's maturity level diff --git a/lang/en/moodle.php b/lang/en/moodle.php index ecd7141719d..fd9c8d6437b 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -81,7 +81,6 @@ $string['adminhelpeditorsettings'] = 'Define basic settings for HTML editor'; $string['adminhelpedituser'] = 'Browse the list of user accounts and edit any of them'; $string['adminhelpenvironment'] = 'Check how your server suits current and future installation requirements'; $string['adminhelpfailurelogs'] = 'Browse logs of failed logins'; -$string['adminhelphealthcenter'] = 'Automatic detection of site problems'; $string['adminhelplanguage'] = 'For checking and editing the current language pack'; $string['adminhelplogs'] = 'Browse logs of all activity on this site'; $string['adminhelpmanageblocks'] = 'Manage installed blocks and their settings'; @@ -782,12 +781,6 @@ $string['guestsnotallowed'] = 'Sorry, \'{$a}\' does not allow guests to enter.'; $string['guestsyes'] = 'Allow guests without the key'; $string['guestuser'] = 'Guest user'; $string['guestuserinfo'] = 'This user is a special user that allows read-only access to some courses.'; -$string['healthcenter'] = 'Health center'; -$string['healthnoproblemsfound'] = 'There is no health problem found!'; -$string['healthproblemsdetected'] = 'Health problems detected!'; -$string['healthproblemsolution'] = 'Health problem solution'; -$string['healthreturntomain'] = 'Continue'; -$string['healthsolution'] = 'Solution'; $string['help'] = 'Help'; $string['helpprefix2'] = 'Help with {$a}'; $string['helpwiththis'] = 'Help with this'; diff --git a/lib/pluginlib.php b/lib/pluginlib.php index d09d629e0f0..0c754726c1c 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -367,7 +367,8 @@ class plugin_manager { ), 'tool' => array( - 'bloglevelupgrade', 'capability', 'generator', 'profiling', 'unittest', 'unsuproles' + 'bloglevelupgrade', 'capability', 'generator', 'health', + 'profiling', 'unittest', 'unsuproles' ), 'webservice' => array(