Skip to content

Commit ea17c16

Browse files
committed
Make codechecker happy again
1 parent 6fdbb06 commit ea17c16

File tree

6 files changed

+32
-21
lines changed

6 files changed

+32
-21
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changes
66

77
### Unreleased
88

9+
* 2025-10-15 - Make codechecker happy again
910
* 2025-10-15 - Tests: Switch Github actions workflows to reusable workflows by Moodle an Hochschulen e.V.
1011

1112
### v5.0-r1

classes/privacy/provider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3333
*/
3434
class provider implements \core_privacy\local\metadata\null_provider {
35-
3635
/**
3736
* Get the language string identifier with the component's language
3837
* file to explain why this plugin stores no data.

cli/check_opcache.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,23 @@
2525

2626
define('CLI_SCRIPT', true);
2727

28-
require(__DIR__.'/../../../../config.php');
29-
require_once($CFG->libdir.'/clilib.php');
28+
require(__DIR__ . '/../../../../config.php');
29+
require_once($CFG->libdir . '/clilib.php');
3030
require_once($CFG->libdir . '/filelib.php');
3131

3232

3333
// Get cli options.
34-
list($options, $unrecognized) = cli_get_params(['help' => false,
34+
[$options, $unrecognized] = cli_get_params(
35+
['help' => false,
3536
'url' => null,
3637
'warning' => 80,
3738
'critical' => 90, ],
38-
['h' => 'help',
39+
['h' => 'help',
3940
'u' => 'url',
4041
'w' => 'warning',
41-
'c' => 'critical', ]);
42+
'c' => 'critical',
43+
]
44+
);
4245
if ($unrecognized) {
4346
$unrecognized = implode("\n ", $unrecognized);
4447
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
@@ -60,7 +63,7 @@
6063
-h, --help Print out this help
6164
6265
Example:
63-
\$ sudo -u www-data /usr/bin/php admin/tool/cli/check_opcache.php ".
66+
\$ sudo -u www-data /usr/bin/php admin/tool/cli/check_opcache.php " .
6467
"--url=\"https://example.com/admin/tool/opcache/cli/check_opcache_web.php\" --warning=75 --critical=85
6568
";
6669
cli_writeln($help);
@@ -117,16 +120,17 @@
117120
}
118121

119122
// Concatenate return string including performance data.
120-
$out = $usedpct."% cache used | ".
121-
"used_pct=".$usedpct."%;".$options['warning'].";".$options['critical']." hit_pct=".$hitspct."%; miss_pct=".$misspct."%;";
123+
$out = $usedpct . "% cache used | " .
124+
"used_pct=" . $usedpct . "%;" . $options['warning'] . ";" . $options['critical'] . " hit_pct=" . $hitspct .
125+
"%; miss_pct=" . $misspct . "%;";
122126

123127
// Echo return string.
124128
if ($returnstatus == 0) {
125-
cli_writeln('OK - '.$out);
129+
cli_writeln('OK - ' . $out);
126130
} else if ($returnstatus == 1) {
127-
cli_writeln('WARNING - '.$out);
131+
cli_writeln('WARNING - ' . $out);
128132
} else {
129-
cli_writeln('CRITICAL - '.$out);
133+
cli_writeln('CRITICAL - ' . $out);
130134
}
131135

132136
// Exit with calculated return status.

cli/reset_opcache.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,23 @@
2424

2525
define('CLI_SCRIPT', true);
2626

27-
require(__DIR__.'/../../../../config.php');
28-
require_once($CFG->libdir.'/clilib.php');
27+
require(__DIR__ . '/../../../../config.php');
28+
require_once($CFG->libdir . '/clilib.php');
2929
require_once($CFG->libdir . '/filelib.php');
3030

3131
global $CFG;
3232

3333

3434
// Get cli options.
35-
list($options, $unrecognized) = cli_get_params(['help' => false,
35+
[$options, $unrecognized] = cli_get_params(
36+
['help' => false,
3637
'url' => null,
3738
'reset' => false, ],
38-
['h' => 'help',
39+
['h' => 'help',
3940
'u' => 'url',
40-
'r' => 'reset', ]);
41+
'r' => 'reset',
42+
]
43+
);
4144
if ($unrecognized) {
4245
$unrecognized = implode("\n ", $unrecognized);
4346
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));

index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424

2525
require(__DIR__ . '/../../../config.php');
26-
require_once($CFG->libdir.'/adminlib.php');
26+
require_once($CFG->libdir . '/adminlib.php');
2727

2828
// Set up the plugin's main page as external admin page.
2929
admin_externalpage_setup('tool_opcache');
@@ -39,7 +39,7 @@
3939
} else {
4040
// Page setup.
4141
$title = get_string('pluginname', 'tool_opcache');
42-
$PAGE->set_url('/'.$CFG->admin.'/tool/opcache/index.php');
42+
$PAGE->set_url('/' . $CFG->admin . '/tool/opcache/index.php');
4343
$PAGE->set_title($title);
4444
$PAGE->set_heading($title);
4545

settings.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626

2727
if ($hassiteconfig) {
2828
// Add the plugin's main page to the server settings category.
29-
$settingspage = new admin_externalpage('tool_opcache', new \core\lang_string('pluginname', 'tool_opcache'),
30-
new \core\url('/'.$CFG->admin.'/tool/opcache/index.php'), 'moodle/site:config');
29+
$settingspage = new admin_externalpage(
30+
'tool_opcache',
31+
new \core\lang_string('pluginname', 'tool_opcache'),
32+
new \core\url('/' . $CFG->admin . '/tool/opcache/index.php'),
33+
'moodle/site:config'
34+
);
3135
$ADMIN->add('server', $settingspage);
3236
}

0 commit comments

Comments
 (0)