* @copyright Catalyst IT 2023
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tool_heartbeat
*/
defined('MOODLE_INTERNAL') || die();
diff --git a/db/upgrade.php b/db/upgrade.php
index ff83916..3699717 100644
--- a/db/upgrade.php
+++ b/db/upgrade.php
@@ -13,6 +13,7 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
/**
* DB upgrade script.
*
diff --git a/errors.php b/errors.php
index 1c4de4f..2f4519c 100644
--- a/errors.php
+++ b/errors.php
@@ -34,6 +34,7 @@
echo $OUTPUT->header();
echo $OUTPUT->heading('Tests for all errors in the whole stack');
+// @codingStandardsIgnoreStart
?>
Moodle high level errors
These should all use the moodle theme
@@ -74,6 +75,7 @@
A 502 Bad Gateway, proxy cannot connect at all (how to test?)
footer();
diff --git a/errors/phpwarnings.php b/errors/phpwarnings.php
index 95fce5a..965a8eb 100644
--- a/errors/phpwarnings.php
+++ b/errors/phpwarnings.php
@@ -36,6 +36,8 @@
trigger_error("This is a notice", E_USER_NOTICE);
trigger_error("This is a warning", E_USER_WARNING);
+// @codingStandardsIgnoreStart
error_log("This is an error_log");
+// @codingStandardsIgnoreEnd
file_put_contents("php://stderr", "This writing to php://stderr");
diff --git a/index.php b/index.php
index 9cb0959..bceca24 100644
--- a/index.php
+++ b/index.php
@@ -125,7 +125,7 @@ function failed($reason) {
}
if ($fullcheck || $checksession) {
- $c = new curl(array('cache' => false, 'cookie' => true));
+ $c = new curl(['cache' => false, 'cookie' => true]);
$response = $c->get(new moodle_url('/admin/tool/heartbeat/sessionone.php'));
if ($sessioncheck = json_decode($response)) {
if ($sessioncheck->success == 'pass') {
diff --git a/lib.php b/lib.php
index 7114c3c..de4050b 100644
--- a/lib.php
+++ b/lib.php
@@ -13,6 +13,7 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
/**
* Callback point.
*
@@ -85,7 +86,7 @@ function tool_heartbeat_security_checks() {
* @param array $options More options
* @return bool Returns false if we don't find a file.
*/
-function tool_heartbeat_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
+function tool_heartbeat_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = []) {
global $CFG;
// README is just safe content we know exist. Used in the range request check.
diff --git a/loginchecker.php b/loginchecker.php
index fa0ec91..e9d3fd2 100644
--- a/loginchecker.php
+++ b/loginchecker.php
@@ -37,12 +37,12 @@
define('NO_UPGRADE_CHECK', true);
// @codingStandardsIgnoreEnd
-$options = array(
+$options = [
'help' => false,
'critthresh' => 500,
'warnthresh' => 10,
'logtime' => 5,
-);
+];
if (isset($argv)) {
// If run from the CLI.
@@ -52,9 +52,9 @@
require_once($CFG->libdir . '/clilib.php');
list($options, $unrecognized) = cli_get_params($options,
- array(
+ [
'h' => 'help',
- )
+ ]
);
if ($unrecognized) {
@@ -106,7 +106,7 @@
WHERE target = 'user_login'
AND timecreated > :checktime";
-$tablequery = $DB->get_record_sql($sqlstring, array('checktime' => $checktime));
+$tablequery = $DB->get_record_sql($sqlstring, ['checktime' => $checktime]);
$count = $tablequery->logincount;
diff --git a/sessionone.php b/sessionone.php
index 609cbbc..2e149ff 100644
--- a/sessionone.php
+++ b/sessionone.php
@@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-
/**
* Set a random integer in session and redirect to check if persists.
*
@@ -35,10 +34,10 @@
$SESSION->testnumber = $testnumber;
-$params = array(
+$params = [
'testnumber' => $testnumber,
'reqtime' => $testtimemicro,
- 'host' => $hostname);
+ 'host' => $hostname];
$url = new moodle_url('/admin/tool/heartbeat/sessiontwo.php', $params);
redirect($url);
diff --git a/settings.php b/settings.php
index 4567a27..eb884e4 100644
--- a/settings.php
+++ b/settings.php
@@ -41,11 +41,11 @@
if (!during_initial_install()) {
- $options = array(
+ $options = [
'' => new lang_string('normal', 'tool_heartbeat'),
'warn' => new lang_string('testwarning', 'tool_heartbeat'),
'error' => new lang_string('testerror', 'tool_heartbeat'),
- );
+ ];
$settings->add(new admin_setting_configselect('tool_heartbeat/testing',
new lang_string('testing', 'tool_heartbeat'),
new lang_string('testingdesc', 'tool_heartbeat'),
@@ -94,7 +94,7 @@
$opts = [
'critical' => 'CRITICAL',
'criticalbusiness' => get_string('error_critical_business', 'tool_heartbeat'),
- 'warning' => 'WARNING'
+ 'warning' => 'WARNING',
];
$time = new \DateTime('now', core_date::get_server_timezone_object());
$settings->add(new admin_setting_configselect('tool_heartbeat/errorcritical',
diff --git a/tests/check/tasklatencycheck_test.php b/tests/check/tasklatencycheck_test.php
index 8acead2..3d839f3 100644
--- a/tests/check/tasklatencycheck_test.php
+++ b/tests/check/tasklatencycheck_test.php
@@ -71,7 +71,7 @@ public function test_start_time_drift() {
// Now set a lock on the task. This should prevent critical.
$CFG->lock_factory = \tool_lockstats\proxy_lock_factory::class;
$DB->insert_record('tool_lockstats_locks', [
- 'resourcekey' => '\\logstore_standard\\task\\cleanup_task'
+ 'resourcekey' => '\\logstore_standard\\task\\cleanup_task',
]);
$result = $check->get_result();
$this->assertEquals(result::OK, $result->get_status());
@@ -120,7 +120,7 @@ public function test_task_not_run() {
// Now set a lock on the task. This should prevent critical.
$CFG->lock_factory = \tool_lockstats\proxy_lock_factory::class;
$DB->insert_record('tool_lockstats_locks', [
- 'resourcekey' => '\\logstore_standard\\task\\cleanup_task'
+ 'resourcekey' => '\\logstore_standard\\task\\cleanup_task',
]);
$result = $check->get_result();
$this->assertEquals(result::OK, $result->get_status());
diff --git a/tests/checker_test.php b/tests/checker_test.php
index 449dbe9..9368e5a 100644
--- a/tests/checker_test.php
+++ b/tests/checker_test.php
@@ -134,8 +134,8 @@ public static function create_summary_provider(): array {
],
'pipe char in output is cleaned' => [
'messages' => [$criticalwithpipemsg],
- 'expectedsummary' => str_replace('|', '|', $criticalwithpipemsg->title)
- ]
+ 'expectedsummary' => str_replace('|', '|', $criticalwithpipemsg->title),
+ ],
];
}