MDL-29029 move health center to admin tools

AMOS BEGIN
 MOV [healthcenter,moodle],[pluginname,tool_health]
 MOV [healthnoproblemsfound,moodle],[healthnoproblemsfound,tool_health]
 MOV [healthproblemsdetected,moodle],[healthproblemsdetected,tool_health]
 MOV [healthproblemsolution,moodle],[healthproblemsolution,tool_health]
 MOV [healthreturntomain,moodle],[healthreturntomain,tool_health]
 MOV [healthsolution,moodle],[healthsolution,tool_health]
AMOS END
This commit is contained in:
Petr Skoda 2011-09-17 15:21:05 +02:00
parent 8e4c1a80b4
commit 7f1d34f0eb
8 changed files with 196 additions and 85 deletions

View File

@ -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));

View File

@ -1,7 +1,30 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* 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 <<<STYLES
<style type="text/css">
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;
}
</style>
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 '<div id="healthnoproblemsfound">';
echo get_string('healthnoproblemsfound');
echo get_string('healthnoproblemsfound', 'tool_health');
echo '</div>';
}
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 '<dt id="'.$classname.'">'.$data['title'].'</dt>';
echo '<dd>'.$data['description'];
echo '<form action="health.php#solution" method="get">';
echo '<form action="index.php#solution" method="get">';
echo '<input type="hidden" name="solution" value="'.$classname.'" /><input type="submit" value="'.get_string('viewsolution').'" />';
echo '</form></dd>';
}
@ -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 '<dl class="healthissues '.$data['severity'].'">';
echo '<dt>'.$data['title'].'</dt>';
echo '<dd>'.$data['description'].'</dd>';
echo '<dt id="solution" class="solution">'.get_string('healthsolution').'</dt>';
echo '<dt id="solution" class="solution">'.get_string('healthsolution', 'tool_health').'</dt>';
echo '<dd class="solution">'.$data['solution'].'</dd></dl>';
echo '<form id="healthformreturn" action="health.php#'.$classname.'" method="get">';
echo '<input type="submit" value="'.get_string('healthreturntomain').'" />';
echo '<form id="healthformreturn" action="index.php#'.$classname.'" method="get">';
echo '<input type="submit" value="'.get_string('healthreturntomain', 'tool_health').'" />';
echo '</form>';
}
@ -786,5 +748,3 @@ TODO:
detect unsupported characters in $CFG->wwwroot - see bug Bug #6091 - relative vs absolute path during backup/restore process
*/

View File

@ -0,0 +1,31 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* 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';

View File

@ -0,0 +1,30 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* 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));
}

View File

@ -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;
}

View File

@ -0,0 +1,32 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* 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

View File

@ -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';

View File

@ -367,7 +367,8 @@ class plugin_manager {
),
'tool' => array(
'bloglevelupgrade', 'capability', 'generator', 'profiling', 'unittest', 'unsuproles'
'bloglevelupgrade', 'capability', 'generator', 'health',
'profiling', 'unittest', 'unsuproles'
),
'webservice' => array(