Commit bad5b1d8 authored by cescobedo's avatar cescobedo
Browse files

MDL-72335 tool_health: Remove tool_health from core

parent 214adb79
<?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/>.
/**
* Privacy Subsystem implementation for tool_health.
*
* @package tool_health
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_health\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for tool_health implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}
\ No newline at end of file
This diff is collapsed.
<?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'] = 'No health problems were found!';
$string['healthproblemsdetected'] = 'Health problems detected!';
$string['healthproblemsolution'] = 'Health problem solution';
$string['healthreturntomain'] = 'Continue';
$string['healthsolution'] = 'Solution';
$string['pluginname'] = 'Health center';
$string['privacy:metadata'] = 'The Health center plugin does not store any personal data.';
<?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/>.
/**
* Functions used by the health tool.
*
* @package tool_health
* @copyright 2013 Marko Vidberg
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Given a list of categories, this function searches for ones
* that have a missing parent category.
*
* @param array $categories List of categories.
* @return array List of categories with missing parents.
*/
function tool_health_category_find_missing_parents($categories) {
$missingparent = array();
foreach ($categories as $category) {
if ($category->parent != 0 && !array_key_exists($category->parent, $categories)) {
$missingparent[$category->id] = $category;
}
}
return $missingparent;
}
/**
* Generates a list of categories with missing parents.
*
* @param array $missingparent List of categories with missing parents.
* @return string Bullet point list of categories with missing parents.
*/
function tool_health_category_list_missing_parents($missingparent) {
$description = '';
if (!empty($missingparent)) {
$description .= '<p>The following categories are missing their parents:</p><ul>';
foreach ($missingparent as $cat) {
$description .= "<li>Category $cat->id: " . s($cat->name) . "</li>\n";
}
$description .= "</ul>\n";
}
return $description;
}
/**
* Given a list of categories, this function searches for ones
* that have loops to previous parent categories.
*
* @param array $categories List of categories.
* @return array List of categories with loops.
*/
function tool_health_category_find_loops($categories) {
$loops = array();
while (!empty($categories)) {
$current = array_pop($categories);
$thisloop = array($current->id => $current);
while (true) {
if (isset($thisloop[$current->parent])) {
// Loop detected.
$loops = $loops + $thisloop;
break;
} else if ($current->parent === 0) {
// Top level.
break;
} else if (isset($loops[$current->parent])) {
// If the parent is in a loop we should also update this category.
$loops = $loops + $thisloop;
break;
} else if (!isset($categories[$current->parent])) {
// We already checked this category and is correct.
break;
} else {
// Continue following the path.
$current = $categories[$current->parent];
$thisloop[$current->id] = $current;
unset($categories[$current->id]);
}
}
}
return $loops;
}
/**
* Generates a list of categories with loops.
*
* @param array $loops List of categories with loops.
* @return string Bullet point list of categories with loops.
*/
function tool_health_category_list_loops($loops) {
$description = '';
if (!empty($loops)) {
$description .= '<p>The following categories form a loop of parents:</p><ul>';
foreach ($loops as $loop) {
$description .= "<li>\n";
$description .= "Category $loop->id: " . s($loop->name) . " has parent $loop->parent\n";
$description .= "</li>\n";
}
$description .= "</ul>\n";
}
return $description;
}
<?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 health
* @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));
}
.path-admin-tool-health div#healthnoproblemsfound {
width: 60%;
margin: auto;
padding: 1em;
border: 1px solid black;
-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 dl dt.solution,
.path-admin-tool-health dl dd.solution,
.path-admin-tool-health div#healthnoproblemsfound {
background-color: #5bb83e;
}
.path-admin-tool-health dl.healthissues dt,
.path-admin-tool-health dl.healthissues dd {
margin: 0;
padding: 1em;
border: 1px solid black;
}
.path-admin-tool-health dl.healthissues dt {
font-weight: bold;
border-bottom: 0;
padding-bottom: 0.5em;
}
.path-admin-tool-health dl.healthissues dd {
border-top: 0;
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: 0;
margin: 1em 0;
}
.path-admin-tool-health dd.solution li {
margin-top: 1em;
}
<?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/>.
/**
* Unit tests for tool_health.
*
* @package tool_health
* @copyright 2013 Marko Vidberg
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/health/locallib.php');
/**
* Health lib testcase.
*
* @package tool_health
* @copyright 2013 Marko Vidberg
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class healthlib_testcase extends advanced_testcase {
/**
* Data provider for test_tool_health_category_find_loops.
*/
public static function provider_loop_categories() {
return array(
// One item loop including root.
0 => array(
array(
'1' => (object) array('id' => 1, 'parent' => 1)
),
array(
'1' => (object) array('id' => 1, 'parent' => 1)
),
),
// One item loop not including root.
1 => array(
array(
'1' => (object) array('id' => 1, 'parent' => 0),
'2' => (object) array('id' => 2, 'parent' => 2)
),
array(
'2' => (object) array('id' => 2, 'parent' => 2)
),
),
// Two item loop including root.
2 => array(
array(
'1' => (object) array('id' => 1, 'parent' => 2),
'2' => (object) array('id' => 2, 'parent' => 1)
),
array(
'2' => (object) array('id' => 2, 'parent' => 1),
'1' => (object) array('id' => 1, 'parent' => 2),
)
),
// Two item loop not including root.
3 => array(
array(
'1' => (object) array('id' => 1, 'parent' => 0),
'2' => (object) array('id' => 2, 'parent' => 3),
'3' => (object) array('id' => 3, 'parent' => 2),
),
array(
'3' => (object) array('id' => 3, 'parent' => 2),
'2' => (object) array('id' => 2, 'parent' => 3),
)
),
// Three item loop including root.
4 => array(
array(
'1' => (object) array('id' => 1, 'parent' => 2),
'2' => (object) array('id' => 2, 'parent' => 3),
'3' => (object) array('id' => 3, 'parent' => 1),
),
array(
'3' => (object) array('id' => 3, 'parent' => 1),
'1' => (object) array('id' => 1, 'parent' => 2),
'2' => (object) array('id' => 2, 'parent' => 3),
)
),
// Three item loop not including root.
5 => array(
array(
'1' => (object) array('id' => 1, 'parent' => 0),
'2' => (object) array('id' => 2, 'parent' => 3),
'3' => (object) array('id' => 3, 'parent' => 4),
'4' => (object) array('id' => 4, 'parent' => 2)
),
array(
'4' => (object) array('id' => 4, 'parent' => 2),
'2' => (object) array('id' => 2, 'parent' => 3),
'3' => (object) array('id' => 3, 'parent' => 4),
)
),
// Multi-loop.
6 => array(
array(
'1' => (object) array('id' => 1, 'parent' => 2),
'2' => (object) array('id' => 2, 'parent' => 1),
'3' => (object) array('id' => 3, 'parent' => 4),
'4' => (object) array('id' => 4, 'parent' => 5),
'5' => (object) array('id' => 5, 'parent' => 3),
'6' => (object) array('id' => 6, 'parent' => 6),
'7' => (object) array('id' => 7, 'parent' => 1),
'8' => (object) array('id' => 8, 'parent' => 7),
),
array(
'1' => (object) array('id' => 1, 'parent' => 2),
'2' => (object) array('id' => 2, 'parent' => 1),
'8' => (object) array('id' => 8, 'parent' => 7),
'7' => (object) array('id' => 7, 'parent' => 1),
'6' => (object) array('id' => 6, 'parent' => 6),
'5' => (object) array('id' => 5, 'parent' => 3),
'3' => (object) array('id' => 3, 'parent' => 4),
'4' => (object) array('id' => 4, 'parent' => 5),
)
),
// Double-loop
7 => array(
array(
'1' => (object) array('id' => 1, 'parent' => 2),
'2' => (object) array('id' => 2, 'parent' => 1),
'3' => (object) array('id' => 3, 'parent' => 2),
'4' => (object) array('id' => 4, 'parent' => 2),
),
array(
'4' => (object) array('id' => 4, 'parent' => 2),
'3' => (object) array('id' => 3, 'parent' => 2),
'2' => (object) array('id' => 2, 'parent' => 1),
'1' => (object) array('id' => 1, 'parent' => 2),
)
)
);
}
/**
* Data provider for test_tool_health_category_find_missing_parents.
*/
public static function provider_missing_parent_categories() {
return array(
// Test for two items, both with direct ancestor (parent) missing.
0 => array(
array(
'1' => (object) array('id' => 1, 'parent' => 0),
'2' => (object) array('id' => 2, 'parent' => 3),
'4' => (object) array('id' => 4, 'parent' => 5),
'6' => (object) array('id' => 6, 'parent' => 2)
),
array(
'4' => (object) array('id' => 4, 'parent' => 5),
'2' => (object) array('id' => 2, 'parent' => 3)
),
)
);
}
/**
* Test finding loops between two items referring to each other.
*
* @param array $categories
* @param array $expected
* @dataProvider provider_loop_categories
*/
public function test_tool_health_category_find_loops($categories, $expected) {
$loops = tool_health_category_find_loops($categories);
$this->assertEquals($expected, $loops);
}
/**
* Test finding missing parent categories.
*
* @param array $categories
* @param array $expected
* @dataProvider provider_missing_parent_categories
*/
public function test_tool_health_category_find_missing_parents($categories, $expected) {
$missingparent = tool_health_category_find_missing_parents($categories);
$this->assertEquals($expected, $missingparent);
}
/**
* Test listing missing parent categories.
*/
public function test_tool_health_category_list_missing_parents() {
$missingparent = array((object) array('id' => 2, 'parent' => 3, 'name' => 'test'),
(object) array('id' => 4, 'parent' => 5, 'name' => 'test2'));
$result = tool_health_category_list_missing_parents($missingparent);
$this->assertMatchesRegularExpression('/Category 2: test/', $result);
$this->assertMatchesRegularExpression('/Category 4: test2/', $result);
}
/**
* Test listing loop categories.
*/
public function test_tool_health_category_list_loops() {
$loops = array((object) array('id' => 2, 'parent' => 3, 'name' => 'test'));
$result = tool_health_category_list_loops($loops);
$this->assertMatchesRegularExpression('/Category 2: test/', $result);
}
}
<?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 = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
This files describes API changes in /admin/tool/* - plugins, This files describes API changes in /admin/tool/* - plugins,
information provided here is intended especially for developers. information provided here is intended especially for developers.
=== 4.0 ===
* The Health center tool has been completely removed.
=== 3.6 === === 3.6 ===
The assignment upgrade tool has been removed. If you need to upgrade assignments from before Moodle 2.3, you will have to upgrade to any Moodle version from 2.3 to 3.5, upgrade the assignments and then upgrade to a later version. The assignment upgrade tool has been removed. If you need to upgrade assignments from before Moodle 2.3, you will have to upgrade to any Moodle version from 2.3 to 3.5, upgrade the assignments and then upgrade to a later version.
......
...@@ -1733,7 +1733,7 @@ class core_plugin_manager { ...@@ -1733,7 +1733,7 @@ class core_plugin_manager {
'report' => array('search'), 'report' => array('search'),
'repository' => array('alfresco', 'picasa'), 'repository' => array('alfresco', 'picasa'),
'tinymce' => array('dragmath'), 'tinymce' => array('dragmath'),
'tool' => array('bloglevelupgrade', 'qeupgradehelper', 'timezoneimport', 'assignmentupgrade'), 'tool' => array('bloglevelupgrade', 'qeupgradehelper', 'timezoneimport', 'assignmentupgrade', 'health'),
'theme' => array('bootstrapbase', 'clean', 'more', 'afterburner', 'anomaly', 'arialist', 'base', 'theme' => array('bootstrapbase', 'clean', 'more', 'afterburner', 'anomaly', 'arialist', 'base',
'binarius', 'boxxie', 'brick', 'canvas', 'formal_white', 'formfactor', 'fusion', 'leatherbound', 'binarius', 'boxxie', 'brick', 'canvas', 'formal_white', 'formfactor', 'fusion', 'leatherbound',
'magazine', 'mymobile', 'nimble', 'nonzero', 'overlay', 'serenity', 'sky_high', 'splash', 'magazine', 'mymobile', 'nimble', 'nonzero', 'overlay', 'serenity', 'sky_high', 'splash',
...@@ -2022,7 +2022,7 @@ class core_plugin_manager { ...@@ -2022,7 +2022,7 @@ class core_plugin_manager {
'tool' => array( 'tool' => array(
'analytics', 'availabilityconditions', 'behat', 'brickfield', 'capability', 'cohortroles', 'componentlibrary', 'analytics', 'availabilityconditions', 'behat', 'brickfield', 'capability', 'cohortroles', 'componentlibrary',
'customlang', 'dataprivacy', 'dbtransfer', 'filetypes', 'generator', 'health', 'httpsreplace', 'innodb', 'customlang', 'dataprivacy', 'dbtransfer', 'filetypes', 'generator', 'httpsreplace', 'innodb',
'installaddon', 'langimport', 'licensemanager', 'log', 'lp', 'lpimportcsv', 'lpmigrate', 'messageinbound', 'installaddon', 'langimport', 'licensemanager', 'log', 'lp', 'lpimportcsv', 'lpmigrate', 'messageinbound',
'mobile', 'moodlenet', 'multilangupgrade', 'monitor', 'oauth2', 'phpunit', 'policy', 'profiling', 'recyclebin', 'mobile', 'moodlenet', 'multilangupgrade', 'monitor', 'oauth2', 'phpunit', 'policy', 'profiling', 'recyclebin',
'replace', 'spamcleaner', 'task', 'templatelibrary', 'uploadcourse', 'uploaduser', 'unsuproles',