Skip to content

Commit e0739f8

Browse files
Alex Priestleycwarwicker
authored andcommitted
WR490974: Recommended amendments
1 parent ad91874 commit e0739f8

6 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎callback.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
}
150150

151151
$divicon = html_writer::tag('div', $icon, ['id' => 'icon' . $cat->catid]);
152-
$title = html_writer::tag('strong', $cat->catname);
152+
$title = html_writer::tag('strong', format_string($cat->catname));
153153
$rawsize = $excludebackups ? $cat->filesize - $cat->backupsize : $cat->filesize;
154154
$filesize = report_coursesize_displaysize($rawsize, $displaysize);
155155
$size = html_writer::tag('strong', $filesize);
@@ -246,7 +246,7 @@
246246

247247
$title = html_writer::link(
248248
$CFG->wwwroot . '/course/view.php?id=' . $course->courseid,
249-
$course->coursename
249+
format_string($course->coursename)
250250
);
251251

252252
$backupinfo = 'Backup size: ' . format_float($course->backupsize ?? 0, 0) . ' bytes';

‎classes/local/helper.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public static function get_options(): array {
4343
$displaysizedefault = 'auto';
4444
$excludebackupsdefault = 0;
4545

46-
$sortorder = optional_param('sorder', $sortorderdefault, PARAM_TEXT);
47-
$sortdir = optional_param('sdir', $sortdirdefault, PARAM_TEXT);
48-
$displaysize = optional_param('display', $displaysizedefault, PARAM_TEXT);
46+
$sortorder = optional_param('sorder', $sortorderdefault, PARAM_ALPHA);
47+
$sortdir = optional_param('sdir', $sortdirdefault, PARAM_ALPHA);
48+
$displaysize = optional_param('display', $displaysizedefault, PARAM_ALPHA);
4949
$excludebackups = optional_param('excludebackups', $excludebackupsdefault, PARAM_INT);
5050

5151
// Display options.

‎db/access.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
/* allows the user to view the site's data usage summary */
3030
'report/coursesize:view' => [
31-
'riskbitmask' => RISK_CONFIG,
31+
'riskbitmask' => RISK_PERSONAL | RISK_CONFIG,
3232
'captype' => 'read',
3333
'contextlevel' => CONTEXT_SYSTEM,
3434
'archetypes' => [

‎granular.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
$table->data = [];
6565

6666
foreach ($filelist as $fileinfo) {
67-
$filename = $fileinfo->filename;
67+
$filename = s($fileinfo->filename);
6868

6969
if ($dohtml) {
7070
// Soft-break long lines on underscores with a zero-width space.
@@ -76,6 +76,7 @@
7676
if (str_contains($fileinfo->filename, '.')) {
7777
$parts = explode('.', $fileinfo->filename);
7878
$ext = end($parts);
79+
$ext = s($ext);
7980
}
8081

8182
$username = $DB->get_field('user', 'username', ['id' => $fileinfo->userid]);

‎locallib.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ function report_coursesize_export($displaysize, $sortorder, $sortdir) {
853853
$sql .= ' ORDER BY ' . $orderby;
854854

855855
if ($cats = $DB->get_records_sql($sql, $params)) {
856-
if ($config->calcmethod == 'live') {
856+
if (isset($config->calcmethod) && $config->calcmethod == 'live') {
857857
// Recalculate.
858858
$dosort = false;
859859
foreach ($cats as $cat) {
@@ -934,7 +934,7 @@ function report_coursesize_export($displaysize, $sortorder, $sortdir) {
934934
$categories[0] = '/';
935935

936936
if ($courses = $DB->get_records_sql($sql, $params)) {
937-
if ($config->calcmethod == 'live') {
937+
if (isset($config->calcmethod) && $config->calcmethod == 'live') {
938938
// Recalculate.
939939
$dosort = false;
940940
foreach ($courses as $course) {

‎version.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
defined('MOODLE_INTERNAL') || die();
2626

27-
$plugin->version = 2025121001;
27+
$plugin->version = 2025121002;
2828
$plugin->requires = 2022112800; // Requires 4.1.
2929
$plugin->component = 'report_coursesize';
30-
$plugin->release = 2024112602;
30+
$plugin->release = 2025121001;
3131
$plugin->maturity = MATURITY_STABLE;
3232
$plugin->supported = [401, 405];

0 commit comments

Comments
 (0)