');
+ return $string;
+ }
+
+ /**
+ * Renders a Check API result
+ *
+ * @param result $result
+ * @return string fragment
+ */
+ public function check_result(core\check\result $result) {
+ return $this->render_check_result($result);
+ }
+
/**
* Returns a template fragment representing a Heading.
*
diff --git a/report/security/index.php b/report/security/index.php
index 6a8feae99c4..74d5e59c32a 100644
--- a/report/security/index.php
+++ b/report/security/index.php
@@ -27,87 +27,23 @@ define('NO_OUTPUT_BUFFERING', true);
require('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
-use core\check\check;
-use core\check\result;
-
-// Print the header.
admin_externalpage_setup('reportsecurity', '', null, '', ['pagelayout' => 'report']);
-// We may need a bit more memory and this may take a long time to process.
-raise_memory_limit(MEMORY_EXTRA);
-core_php_time_limit::raise();
-
-$checks = \core\check\manager::get_security_checks();
-
$detail = optional_param('detail', '', PARAM_TEXT); // Show detailed info about one check only.
-if ($detail) {
- $checks = array_filter($checks, function($check) use ($detail) {
- return $detail == $check->get_ref();
- });
- $checks = array_values($checks);
- if (!empty($checks)) {
- $PAGE->set_docs_path('report/security/index.php?detail=' . $detail);
- $PAGE->navbar->add($checks[0]->get_name());
- }
+
+$url = '/report/security/index.php';
+$table = new core\check\table('security', $url, $detail);
+
+if (!empty($table->detail)) {
+ $PAGE->set_docs_path($url . '?detail=' . $detail);
+ $PAGE->navbar->add($table->detail->get_name());
}
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('pluginname', 'report_security'));
-
-echo '' . get_string('timewarning', 'report_security') . '
';
-
-$url = "$CFG->wwwroot/report/security/index.php";
-
-$PAGE->requires->js_init_code("Y.one('#timewarning').addClass('timewarninghidden')");
-$table = new html_table();
-$table->data = [];
-$table->head = [
- get_string('status'),
- get_string('check'),
- get_string('summary'),
- get_string('action'),
-];
-$table->colclasses = [
- 'rightalign status',
- 'leftalign check',
- 'leftalign summary',
- 'leftalign action',
-];
-$table->id = 'securityreporttable';
-$table->attributes = ['class' => 'admintable securityreport generaltable'];
-
-$manager = core_plugin_manager::instance();
-
-foreach ($checks as $check) {
- $ref = $check->get_ref();
- $result = $check->get_result();
- $component = $check->get_component();
- $actionlink = $check->get_action_link();
-
- $link = new \moodle_url('/report/security/index.php', ['detail' => $ref]);
-
- $row = [];
- $row[] = $OUTPUT->check_result($result);
- $row[] = $OUTPUT->action_link($link, $check->get_name());
-
- $row[] = $result->get_summary();
- if ($actionlink) {
- $row[] = $OUTPUT->render($actionlink);
- } else {
- $row[] = '';
- }
-
- $table->data[] = $row;
-}
-echo html_writer::table($table);
-
-if ($detail && $result) {
- echo $OUTPUT->heading(get_string('description'), 3);
- echo $OUTPUT->box($result->get_details(), 'generalbox boxwidthnormal boxaligncenter');
- echo $OUTPUT->continue_button($url);
-}
-
+echo $table->render($OUTPUT);
echo $OUTPUT->footer();
+
$event = \report_security\event\report_viewed::create(['context' => context_system::instance()]);
$event->trigger();
diff --git a/report/status/classes/privacy/provider.php b/report/status/classes/privacy/provider.php
new file mode 100644
index 00000000000..a686b907c28
--- /dev/null
+++ b/report/status/classes/privacy/provider.php
@@ -0,0 +1,48 @@
+.
+
+/**
+ * Privacy provider.
+ *
+ * @package report_status
+ * @copyright 2020 Brendan Heywood (brendan@catalyst-au.net)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace report_status\privacy;
+
+defined('MOODLE_INTERNAL') || die;
+
+/**
+ * Privacy provider.
+ *
+ * @package report_status
+ * @copyright 2020 Brendan Heywood (brendan@catalyst-au.net)
+ * @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';
+ }
+}
+
diff --git a/report/status/db/access.php b/report/status/db/access.php
new file mode 100644
index 00000000000..5e969358478
--- /dev/null
+++ b/report/status/db/access.php
@@ -0,0 +1,37 @@
+.
+
+/**
+ * System status capabilities
+ *
+ * @package report_status
+ * @copyright 2020 Brendan Heywood (brendan@catalyst-au.net)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$capabilities = [
+
+ 'report/status:view' => [
+ 'riskbitmask' => RISK_CONFIG,
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_SYSTEM,
+ 'archetypes' => [
+ 'manager' => CAP_ALLOW
+ ],
+ ]
+];
diff --git a/report/status/index.php b/report/status/index.php
new file mode 100644
index 00000000000..2d4605ddfdb
--- /dev/null
+++ b/report/status/index.php
@@ -0,0 +1,46 @@
+.
+
+/**
+ * System Status report
+ *
+ * @package report_status
+ * @copyright 2020 Brendan Heywood (brendan@catalyst-au.net)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define('NO_OUTPUT_BUFFERING', true);
+
+require('../../config.php');
+require_once($CFG->libdir.'/adminlib.php');
+
+admin_externalpage_setup('reportstatus', '', null, '', ['pagelayout' => 'report']);
+
+$detail = optional_param('detail', '', PARAM_TEXT); // Show detailed info about one check only.
+
+$url = '/report/status/index.php';
+$table = new core\check\table('status', $url, $detail);
+
+if (!empty($table->detail)) {
+ $PAGE->set_docs_path($url . '?detail=' . $detail);
+ $PAGE->navbar->add($table->detail->get_name());
+}
+
+echo $OUTPUT->header();
+echo $OUTPUT->heading(get_string('pluginname', 'report_status'));
+echo $table->render($OUTPUT);
+echo $OUTPUT->footer();
+
diff --git a/report/status/lang/en/report_status.php b/report/status/lang/en/report_status.php
new file mode 100644
index 00000000000..5251062c224
--- /dev/null
+++ b/report/status/lang/en/report_status.php
@@ -0,0 +1,27 @@
+.
+
+/**
+ * Strings for component 'tool_task', language 'en'
+ *
+ * @package report_status
+ * @copyright 2020 Brendan Heywood (brendan@catalyst-au.net)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'System status';
+$string['status:view'] = 'View system status';
+$string['privacy:metadata'] = 'This plugin does not store any personal data.';
diff --git a/report/status/settings.php b/report/status/settings.php
new file mode 100644
index 00000000000..0575fe5c967
--- /dev/null
+++ b/report/status/settings.php
@@ -0,0 +1,30 @@
+.
+
+/**
+ * Plugin version info
+ *
+ * @package report_status
+ * @copyright 2020 Brendan Heywood (brendan@catalyst-au.net)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$ADMIN->add('reports', new admin_externalpage('reportstatus', get_string('pluginname', 'report_status'),
+ "$CFG->wwwroot/report/status/index.php", 'report/status:view'));
+
+$settings = null;
diff --git a/report/status/version.php b/report/status/version.php
new file mode 100644
index 00000000000..df6ae86aa02
--- /dev/null
+++ b/report/status/version.php
@@ -0,0 +1,30 @@
+.
+
+/**
+ * Plugin version info
+ *
+ * @package report_status
+ * @copyright 2020 Brendan Heywood (brendan@catalyst-au.net)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version = 2019111800; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2019111200; // Requires this Moodle version.
+$plugin->component = 'report_status'; // Full name of the plugin (used for diagnostics).
+