Skip to content

Commit 639e9a3

Browse files
committed
Merge branch 'update/M4.4' of github.com:learnweb/moodle-mod_moodleoverflow into enhancement/postform
2 parents 9eeeb29 + 9bb30d1 commit 639e9a3

28 files changed

+191
-141
lines changed

.github/workflows/moodle-ci.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88

99
strategy:
1010
matrix:
11-
php: ['8.2']
12-
moodle-branch: ['MOODLE_403_STABLE']
11+
php: ['8.3']
12+
moodle-branch: ['MOODLE_404_STABLE']
1313
database: ['pgsql']
1414

1515
steps:
@@ -110,22 +110,27 @@ jobs:
110110
strategy:
111111
fail-fast: false
112112
matrix:
113-
php: [8.1']
114-
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE']
113+
php: ['8.0', '8.1', '8.2', '8.3']
114+
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE']
115115
database: ['mariadb', 'pgsql']
116-
include:
117-
- php: '8.2'
118-
moodle-branch: 'MOODLE_402_STABLE'
119-
database: 'mariadb'
116+
exclude:
117+
- php: '8.0'
118+
moodle-branch: 'MOODLE_404_STABLE'
120119
- php: '8.2'
120+
moodle-branch: 'MOODLE_401_STABLE'
121+
- php: '8.3'
122+
moodle-branch: 'MOODLE_401_STABLE'
123+
- php: '8.3'
121124
moodle-branch: 'MOODLE_402_STABLE'
122-
database: 'pgsql'
123-
- php: '8.2'
124-
moodle-branch: 'MOODLE_403_STABLE'
125-
database: 'mariadb'
126-
- php: '8.2'
125+
- php: '8.3'
127126
moodle-branch: 'MOODLE_403_STABLE'
127+
include:
128+
- php: '7.4'
129+
moodle-branch: 'MOODLE_401_STABLE'
128130
database: 'pgsql'
131+
- php: '7.4'
132+
moodle-branch: 'MOODLE_401_STABLE'
133+
database: 'mariadb'
129134

130135
steps:
131136
- name: Start MariaDB

.github/workflows/moodle-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
--data-urlencode "vcstag=${TAGNAME}" \
4343
--data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
4444
--data-urlencode "altdownloadurl=${ZIPURL}" \
45-
--data-urlencode "releasenotes=${BODY}" \
45+
--data-urlencode "releasenotes=${BODY@Q}" \
4646
--data-urlencode "releasenotesformat=4")
4747
echo "response=${RESPONSE}" >> $GITHUB_OUTPUT
4848
- name: Evaluate the response

backup/moodle2/backup_moodleoverflow_stepslib.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ protected function define_structure() {
4747
$moodleoverflow = new backup_nested_element('moodleoverflow', ['id'], [
4848
'name', 'intro', 'introformat', 'maxbytes', 'maxattachments',
4949
'forcesubscribe', 'trackingtype', 'timecreated', 'timemodified',
50-
'ratingpreference', 'coursewidereputation', 'allownegativereputation']);
50+
'ratingpreference', 'coursewidereputation', 'allownegativereputation', ]);
5151

5252
// Define each element separated.
5353
$discussions = new backup_nested_element('discussions');
5454
$discussion = new backup_nested_element('discussion', ['id'], [
55-
'name', 'firstpost', 'userid', 'timemodified', 'usermodified', 'timestart']);
55+
'name', 'firstpost', 'userid', 'timemodified', 'usermodified', 'timestart', ]);
5656

5757
$posts = new backup_nested_element('posts');
5858

5959
$post = new backup_nested_element('post', ['id'], [
6060
'parent', 'userid', 'created', 'modified',
61-
'mailed', 'message', 'messageformat', 'attachment']);
61+
'mailed', 'message', 'messageformat', 'attachment', ]);
6262

6363
$ratings = new backup_nested_element('ratings');
6464

6565
$rating = new backup_nested_element('rating', ['id'], [
66-
'userid', 'rating', 'firstrated', 'lastchanged']);
66+
'userid', 'rating', 'firstrated', 'lastchanged', ]);
6767

6868
$discussionsubs = new backup_nested_element('discuss_subs');
6969

@@ -75,18 +75,18 @@ protected function define_structure() {
7575
$subscriptions = new backup_nested_element('subscriptions');
7676

7777
$subscription = new backup_nested_element('subscription', ['id'], [
78-
'userid']);
78+
'userid', ]);
7979

8080
$readposts = new backup_nested_element('readposts');
8181

8282
$read = new backup_nested_element('read', ['id'], [
8383
'userid', 'discussionid', 'postid', 'firstread',
84-
'lastread']);
84+
'lastread', ]);
8585

8686
$tracking = new backup_nested_element('tracking');
8787

8888
$track = new backup_nested_element('track', ['id'], [
89-
'userid']);
89+
'userid', ]);
9090

9191
// Build the tree.
9292
$moodleoverflow->add_child($discussions);

classes/manager/mail_manager.php

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

2727
use context_course;
2828
use context_module;
29+
use core\context\course;
2930
use core_php_time_limit;
3031
use mod_moodleoverflow\anonymous;
3132
use mod_moodleoverflow\output\moodleoverflow_email;
@@ -406,7 +407,7 @@ private static function send_post($userto, $post, array &$coursemodules, array &
406407
['userid' => $dataobject->userid,
407408
'courseid' => $dataobject->courseid,
408409
'forumid' => $dataobject->forumid,
409-
'forumdiscussionid' => $dataobject->forumdiscussionid],
410+
'forumdiscussionid' => $dataobject->forumdiscussionid, ],
410411
'numberofposts, id');
411412
if (is_object($record)) {
412413
$dataset = $record;
@@ -496,8 +497,7 @@ private static function send_post($userto, $post, array &$coursemodules, array &
496497

497498
// Preapare to actually send the post now. Build up the content.
498499
$cleanname = str_replace('"', "'", strip_tags(format_string($moodleoverflow->name)));
499-
$coursecontext = context_course::instance($course->id);
500-
$shortname = format_string($course->shortname, true, ['context' => $coursecontext]);
500+
$shortname = format_string($course->shortname, true, ['context' => context_course::instance($course->id)]);
501501

502502
// Define a header to make mails easier to track.
503503
$emailmessageid = generate_email_messageid('moodlemoodleoverflow' . $moodleoverflow->id);

classes/observer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static function role_assigned(\core\event\role_assigned $event) {
9595
WHERE m.course = :courseid AND m.forcesubscribe = :initial AND mo.name = 'moodleoverflow' AND ms.id IS NULL";
9696
$params = ['courseid' => $context->instanceid,
9797
'userid' => $userid,
98-
'initial' => MOODLEOVERFLOW_INITIALSUBSCRIBE];
98+
'initial' => MOODLEOVERFLOW_INITIALSUBSCRIBE, ];
9999
$moodleoverflows = $DB->get_records_sql($sql, $params);
100100

101101
// Loop through all moodleoverflows.

classes/privacy/data_export_helper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function export_discussion_data($userid, array $mappings) {
5151
FROM {moodleoverflow} mof
5252
INNER JOIN {moodleoverflow_discussions} d ON d.moodleoverflow = mof.id
5353
LEFT JOIN {moodleoverflow_discuss_subs} dsub ON dsub.discussion = d.id
54-
WHERE mof.id ${foruminsql}
54+
WHERE mof.id {$foruminsql}
5555
AND (
5656
d.userid = :discussionuserid OR
5757
d.usermodified = :dmuserid OR
@@ -113,7 +113,7 @@ public static function export_all_posts($userid, array $mappings) {
113113
INNER JOIN {moodleoverflow_posts} p ON p.discussion = d.id
114114
LEFT JOIN {moodleoverflow_read} fr ON fr.postid = p.id
115115
LEFT JOIN {moodleoverflow_ratings} rat ON rat.postid = p.id
116-
WHERE mof.id ${foruminsql} AND
116+
WHERE mof.id {$foruminsql} AND
117117
(
118118
p.userid = :postuserid OR
119119
fr.userid = :readuserid OR

classes/privacy/provider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,22 +324,22 @@ public static function delete_data_for_user(approved_contextlist $contextlist) {
324324

325325
$DB->delete_records('moodleoverflow_read', [
326326
'moodleoverflowid' => $forum->id,
327-
'userid' => $userid]);
327+
'userid' => $userid, ]);
328328

329329
$DB->delete_records('moodleoverflow_subscriptions', [
330330
'moodleoverflow' => $forum->id,
331-
'userid' => $userid]);
331+
'userid' => $userid, ]);
332332

333333
$DB->delete_records('moodleoverflow_discuss_subs', [
334334
'moodleoverflow' => $forum->id,
335-
'userid' => $userid]);
335+
'userid' => $userid, ]);
336336

337337
$DB->delete_records('moodleoverflow_tracking', [
338338
'moodleoverflowid' => $forum->id,
339-
'userid' => $userid]);
339+
'userid' => $userid, ]);
340340
$DB->delete_records('moodleoverflow_grades', [
341341
'moodleoverflowid' => $forum->id,
342-
'userid' => $userid]);
342+
'userid' => $userid, ]);
343343

344344
// Do not delete ratings but reset userid.
345345
$ratingsql = "userid = :userid AND discussionid IN

classes/ratings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static function moodleoverflow_add_rating($moodleoverflow, $postid, $rati
5757
// Is the submitted rating valid?
5858
$possibleratings = [RATING_NEUTRAL, RATING_DOWNVOTE, RATING_UPVOTE, RATING_SOLVED,
5959
RATING_HELPFUL, RATING_REMOVE_DOWNVOTE, RATING_REMOVE_UPVOTE,
60-
RATING_REMOVE_SOLVED, RATING_REMOVE_HELPFUL];
60+
RATING_REMOVE_SOLVED, RATING_REMOVE_HELPFUL, ];
6161
if (!in_array($rating, $possibleratings)) {
6262
throw new moodle_exception('invalidratingid', 'moodleoverflow');
6363
}

classes/subscriptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public static function get_unsubscribable_moodleoverflows() {
438438
WHERE m.forcesubscribe <> :forcesubscribe AND ms.id IS NOT NULL AND cm.course $coursesql";
439439
$params = ['modulename' => 'moodleoverflow',
440440
'userid' => $USER->id,
441-
'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE];
441+
'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE, ];
442442
$mergedparams = array_merge($courseparams, $params);
443443
$moodleoverflows = $DB->get_recordset_sql($sql, $mergedparams);
444444

@@ -670,7 +670,7 @@ public static function subscribe_user($userid, $moodleoverflow, $context, $userr
670670
$params = [
671671
'userid' => $userid,
672672
'moodleoverflowid' => $moodleoverflow->id,
673-
'preference' => self::MOODLEOVERFLOW_DISCUSSION_UNSUBSCRIBED];
673+
'preference' => self::MOODLEOVERFLOW_DISCUSSION_UNSUBSCRIBED, ];
674674
$where = 'userid = :userid AND moodleoverflow = :moodleoverflowid AND preference <> :preference';
675675
$DB->delete_records_select('moodleoverflow_discuss_subs', $where, $params);
676676

classes/tables/userstats_table.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ public function __construct($uniqueid, $courseid, $moodleoverflow, $url) {
7575
'forumactivity',
7676
'courseactivity',
7777
'forumreputation',
78-
'coursereputation']);
78+
'coursereputation', ]);
7979
$this->define_baseurl($url);
8080
$this->define_headers([get_string('fullnameuser'),
8181
get_string('userstatsupvotes', 'moodleoverflow'),
8282
get_string('userstatsdownvotes', 'moodleoverflow'),
8383
(get_string('userstatsforumactivity', 'moodleoverflow') . $this->helpactivity->object),
8484
(get_string('userstatscourseactivity', 'moodleoverflow') . $this->helpactivity->object),
8585
get_string('userstatsforumreputation', 'moodleoverflow'),
86-
get_string('userstatscoursereputation', 'moodleoverflow')]);
86+
get_string('userstatscoursereputation', 'moodleoverflow'), ]);
8787
$this->get_table_data();
8888
$this->sortable(true, 'coursereputation', SORT_DESC);
8989
$this->no_sorting('username');
@@ -277,7 +277,7 @@ public function set_helpactivity() {
277277
'tabindex' => '0',
278278
'data-content' => '<div class=&quot;no-overflow&quot;><p>' .
279279
get_string('helpamountofactivity', 'moodleoverflow') .
280-
'</p> </div>'];
280+
'</p> </div>', ];
281281

282282
$this->helpactivity->object = \html_writer::span($this->helpactivity->icon,
283283
$this->helpactivity->class,
@@ -356,10 +356,10 @@ public function col_coursereputation($row) {
356356
*/
357357
private function badge_render($number) {
358358
if ($number > 0) {
359-
return \html_writer::tag('h5', \html_writer::start_span('badge badge-success') .
359+
return \html_writer::tag('h5', \html_writer::start_span('badge bg-success') .
360360
$number . \html_writer::end_span());
361361
} else {
362-
return \html_writer::tag('h5', \html_writer::start_span('badge badge-warning') .
362+
return \html_writer::tag('h5', \html_writer::start_span('badge bg-warning') .
363363
$number . \html_writer::end_span());
364364
}
365365
}

0 commit comments

Comments
 (0)