Skip to content

Commit 5641e7c

Browse files
author
Laur0r
authored
Merge pull request #110 from learnweb/update/m41
Update for Moodle 4.1
2 parents 1b7621f + 7b8b0fa commit 5641e7c

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-19
lines changed

Diff for: .github/workflows/moodle-ci.yml

+24-15
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,40 @@ jobs:
88

99
strategy:
1010
matrix:
11-
php: ['7.4']
12-
moodle-branch: ['MOODLE_400_STABLE']
11+
php: ['8.0']
12+
moodle-branch: ['MOODLE_401_STABLE']
1313
database: ['pgsql']
1414

1515
steps:
1616
- name: Start PostgreSQL
17-
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:10
17+
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14
1818

1919
- name: Check out repository code
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
2121
with:
2222
path: plugin
2323

2424
- name: Setup PHP ${{ matrix.php }}
2525
uses: shivammathur/setup-php@v2
2626
with:
2727
php-version: ${{ matrix.php }}
28+
ini-values: max_input_vars=5000
2829
coverage: none
2930

3031
- name: Get composer cache directory
3132
id: composer-cache
32-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
33+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
3334

3435
- name: Composer cache
35-
uses: actions/cache@v2
36+
uses: actions/cache@v3
3637
with:
3738
path: ${{ steps.composer-cache.outputs.dir }}
3839
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
3940
restore-keys: |
4041
${{ runner.os }}-composer-
4142
4243
- name: npm cache
43-
uses: actions/cache@v2
44+
uses: actions/cache@v3
4445
with:
4546
path: ~/.npm
4647
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -108,9 +109,16 @@ jobs:
108109
strategy:
109110
fail-fast: false
110111
matrix:
111-
php: ['7.4']
112-
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE', 'MOODLE_400_STABLE']
112+
php: ['8.0']
113+
moodle-branch: ['MOODLE_311_STABLE', 'MOODLE_400_STABLE', 'MOODLE_401_STABLE']
113114
database: ['mariadb', 'pgsql']
115+
include:
116+
- php: '7.4'
117+
moodle-branch: 'MOODLE_39_STABLE'
118+
database: 'mariadb'
119+
- php: '7.4'
120+
moodle-branch: 'MOODLE_39_STABLE'
121+
database: 'pgsql'
114122

115123
steps:
116124
- name: Start MariaDB
@@ -119,31 +127,32 @@ jobs:
119127

120128
- name: Start PostgreSQL
121129
if: matrix.database == 'pgsql'
122-
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:10
130+
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14
123131

124132
- name: Check out repository code
125-
uses: actions/checkout@v2
133+
uses: actions/checkout@v3
126134
with:
127135
path: plugin
128136

129137
- name: Setup PHP ${{ matrix.php }}
130138
uses: shivammathur/setup-php@v2
131139
with:
132140
php-version: ${{ matrix.php }}
141+
ini-values: max_input_vars=5000
133142
coverage: none
134143

135144
- name: Get composer cache directory
136145
id: composer-cache
137-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
146+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
138147
- name: Composer cache
139-
uses: actions/cache@v2
148+
uses: actions/cache@v3
140149
with:
141150
path: ${{ steps.composer-cache.outputs.dir }}
142151
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
143152
restore-keys: |
144153
${{ runner.os }}-composer-
145154
- name: npm cache
146-
uses: actions/cache@v2
155+
uses: actions/cache@v3
147156
with:
148157
path: ~/.npm
149158
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -171,4 +180,4 @@ jobs:
171180

172181
- name: Behat features
173182
if: ${{ always() }}
174-
run: moodle-plugin-ci behat --auto-rerun 0
183+
run: moodle-plugin-ci behat --auto-rerun 0

Diff for: classes/review.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ public static function get_short_review_info_for_discussion(int $discussionid) {
8585
public static function get_first_review_post($moodleoverflowid, $afterpostid = null) {
8686
global $DB;
8787

88-
$params = ['moodleoverflowid' => $moodleoverflowid];
88+
$params = [
89+
'moodleoverflowid' => $moodleoverflowid,
90+
'reviewtime' => time() - get_config('moodleoverflow', 'reviewpossibleaftertime')
91+
];
8992
$orderby = '';
9093
$addwhere = '';
9194

@@ -105,7 +108,7 @@ public static function get_first_review_post($moodleoverflowid, $afterpostid = n
105108
$record = $DB->get_record_sql(
106109
'SELECT p.id as postid, p.discussion as discussionid FROM {moodleoverflow_posts} p ' .
107110
'JOIN {moodleoverflow_discussions} d ON d.id = p.discussion ' .
108-
"WHERE p.reviewed = 0 AND d.moodleoverflow = :moodleoverflowid $addwhere " .
111+
"WHERE p.reviewed = 0 AND d.moodleoverflow = :moodleoverflowid AND p.created < :reviewtime $addwhere " .
109112
"ORDER BY $orderby p.discussion, p.id " .
110113
'LIMIT 1',
111114
$params

Diff for: lang/en/moodleoverflow.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@
443443
$string['approve'] = 'Approve';
444444
$string['reject'] = 'Reject';
445445
$string['reviewpossibleaftertime'] = 'Review possible after (secs)';
446-
$string['reviewpossibleaftertime_desc'] = 'A teacher can only reject or approve a post at least this amount of time (in seconds) after the creation of the post. After a teacher has approved a post, the post cannot be edited by it\'s author anymore, even if still within the maxeditingtime duration.';
447-
$string['pending_review_but_cannot_now'] = 'Pending review, but can only be approved at least {$a} after the creation of this post to allow the author a bit of time to edit it.';
446+
$string['reviewpossibleaftertime_desc'] = 'A teacher cannot reject or approve a post until this amount of time (in seconds) after the creation of the post. After a teacher has approved a post, the post cannot be edited by it\'s author anymore, even if still within the maxeditingtime duration.';
447+
$string['pending_review_but_cannot_now'] = 'Pending review, but cannot be approved until {$a} after the creation of this post to allow the author a bit of time to edit it.';
448448

449449
$string['review_needed'] = 'Review needed!';
450450

0 commit comments

Comments
 (0)