Skip to content

Commit ae99ecf

Browse files
CI: Update for Moodle 4.4
1 parent 8488c55 commit ae99ecf

11 files changed

+100
-134
lines changed

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

+30-64
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
name: Moodle Plugin CI
22

3-
on: [ push, pull_request ]
3+
on: [push, pull_request]
44

55
jobs:
66
static:
77
runs-on: ubuntu-latest
88

99
strategy:
1010
matrix:
11-
php: [ '8.1' ]
12-
moodle-branch: [ 'MOODLE_402_STABLE' ]
13-
database: [ 'pgsql' ]
11+
php: ['8.2']
12+
moodle-branch: ['MOODLE_404_STABLE']
13+
database: ['pgsql']
1414

1515
steps:
1616
- name: Start PostgreSQL
1717
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@v3
20+
uses: actions/checkout@v4
2121
with:
2222
path: plugin
2323

@@ -28,29 +28,9 @@ jobs:
2828
ini-values: max_input_vars=5000
2929
coverage: none
3030

31-
- name: Get composer cache directory
32-
id: composer-cache
33-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
34-
35-
- name: Composer cache
36-
uses: actions/cache@v3
37-
with:
38-
path: ${{ steps.composer-cache.outputs.dir }}
39-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
40-
restore-keys: |
41-
${{ runner.os }}-composer-
42-
43-
- name: npm cache
44-
uses: actions/cache@v3
45-
with:
46-
path: ~/.npm
47-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
48-
restore-keys: |
49-
${{ runner.os }}-node-
50-
5131
- name: Initialise moodle-plugin-ci
5232
run: |
53-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
33+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
5434
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
5535
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
5636
sudo locale-gen en_AU.UTF-8
@@ -83,7 +63,6 @@ jobs:
8363
- name: Moodle PHPDoc Checker
8464
if: ${{ always() }}
8565
run: moodle-plugin-ci phpdoc
86-
continue-on-error: true
8766

8867
- name: Validating
8968
if: ${{ always() }}
@@ -109,28 +88,21 @@ jobs:
10988
strategy:
11089
fail-fast: false
11190
matrix:
112-
php: [ '8.0', '8.1' ]
113-
moodle-branch: [ 'MOODLE_401_STABLE', 'MOODLE_402_STABLE' ]
114-
database: [ 'mariadb', 'pgsql' ]
91+
php: ['8.0', '8.1', '8.2']
92+
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE']
93+
database: ['mariadb', 'pgsql']
94+
exclude:
95+
- php: '8.0'
96+
moodle-branch: 'main'
97+
- php: '8.2'
98+
moodle-branch: 'MOODLE_401_STABLE'
11599
include:
116100
- php: '7.4'
117-
moodle-branch: 'MOODLE_39_STABLE'
118-
database: 'mariadb'
119-
- php: '7.4'
120-
moodle-branch: 'MOODLE_39_STABLE'
101+
moodle-branch: 'MOODLE_401_STABLE'
121102
database: 'pgsql'
122-
- php: '8.0'
123-
moodle-branch: 'MOODLE_311_STABLE'
124-
database: 'mariadb'
125-
- php: '8.0'
126-
moodle-branch: 'MOODLE_311_STABLE'
127-
database: 'pgsql'
128-
- php: '8.0'
129-
moodle-branch: 'MOODLE_400_STABLE'
103+
- php: '7.4'
104+
moodle-branch: 'MOODLE_401_STABLE'
130105
database: 'mariadb'
131-
- php: '8.0'
132-
moodle-branch: 'MOODLE_400_STABLE'
133-
database: 'pgsql'
134106

135107
steps:
136108
- name: Start MariaDB
@@ -142,7 +114,7 @@ jobs:
142114
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14
143115

144116
- name: Check out repository code
145-
uses: actions/checkout@v3
117+
uses: actions/checkout@v4
146118
with:
147119
path: plugin
148120

@@ -153,24 +125,6 @@ jobs:
153125
ini-values: max_input_vars=5000
154126
coverage: none
155127

156-
- name: Get composer cache directory
157-
id: composer-cache
158-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
159-
- name: Composer cache
160-
uses: actions/cache@v3
161-
with:
162-
path: ${{ steps.composer-cache.outputs.dir }}
163-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
164-
restore-keys: |
165-
${{ runner.os }}-composer-
166-
- name: npm cache
167-
uses: actions/cache@v3
168-
with:
169-
path: ~/.npm
170-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
171-
restore-keys: |
172-
${{ runner.os }}-node-
173-
174128
- name: Initialise moodle-plugin-ci
175129
run: |
176130
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
@@ -194,3 +148,15 @@ jobs:
194148
- name: Behat features
195149
if: ${{ always() }}
196150
run: moodle-plugin-ci behat --profile chrome --auto-rerun 0
151+
152+
# This step allows to upload Behat faildump (screenshots) as workflow artifact,
153+
# so it can be downloaded and inspected. You don't need this step if you
154+
# are not running Behat test. Artifact will be retained for 7 days.
155+
- name: Upload Behat Faildump
156+
if: ${{ failure() && steps.behat.outcome == 'failure' }}
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: Behat Faildump (${{ join(matrix.*, ', ') }})
160+
path: ${{ github.workspace }}/moodledata/behat_dump
161+
retention-days: 7
162+
if-no-files-found: ignore

Diff for: approvestep.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
admin_externalpage_setup('lifecyclestep_adminapprove_manage');
3333

3434
$action = optional_param('act', null, PARAM_ALPHA);
35-
$ids = optional_param_array('c', array(), PARAM_INT);
35+
$ids = optional_param_array('c', [], PARAM_INT);
3636
$stepid = required_param('stepid', PARAM_INT);
3737

3838
$step = \tool_lifecycle\local\manager\step_manager::get_step_instance($stepid);
@@ -139,13 +139,13 @@
139139
$hasrecords = $DB->record_exists_sql('SELECT a.id FROM {lifecyclestep_adminapprove} a ' .
140140
'JOIN {tool_lifecycle_process} p ON p.id = a.processid ' .
141141
'JOIN {tool_lifecycle_step} s ON s.workflowid = p.workflowid AND s.sortindex = p.stepindex ' .
142-
'WHERE s.id = :sid AND a.status = 0', array('sid' => $stepid));
142+
'WHERE s.id = :sid AND a.status = 0', ['sid' => $stepid]);
143143

144144
if ($hasrecords) {
145145
$mform->display();
146146

147147
echo get_string('courses_waiting', 'lifecyclestep_adminapprove',
148-
array('step' => $step->instancename, 'workflow' => $workflow->title));
148+
['step' => $step->instancename, 'workflow' => $workflow->title]);
149149
echo "<br><br>";
150150
echo '<form action="" method="post"><input type="hidden" name="sesskey" value="' . sesskey() . '">';
151151

@@ -155,27 +155,27 @@
155155
echo get_string('bulkactions') . ':<br>';
156156
echo html_writer::start_div('singlebutton');
157157
echo html_writer::tag('button', get_string('proceedselected', 'lifecyclestep_adminapprove'),
158-
array('type' => 'submit', 'name' => 'act', 'value' => PROCEED, 'class' => 'btn btn-secondary'));
158+
['type' => 'submit', 'name' => 'act', 'value' => PROCEED, 'class' => 'btn btn-secondary']);
159159
echo html_writer::end_div() . html_writer::start_div('singlebutton');
160160
echo html_writer::tag('button', get_string('rollbackselected', 'lifecyclestep_adminapprove'),
161-
array('type' => 'submit', 'name' => 'act', 'value' => ROLLBACK, 'class' => 'btn btn-secondary'));
161+
['type' => 'submit', 'name' => 'act', 'value' => ROLLBACK, 'class' => 'btn btn-secondary']);
162162
echo html_writer::end_div();
163163
}
164164
echo '</form>';
165165

166166
echo '<div class="mt-2">';
167-
$button = new \single_button(new moodle_url($PAGE->url, array('act' => PROCEED_ALL)),
167+
$button = new \single_button(new moodle_url($PAGE->url, ['act' => PROCEED_ALL]),
168168
get_string(PROCEED_ALL, 'lifecyclestep_adminapprove'));
169169
echo $OUTPUT->render($button);
170170

171-
$button = new \single_button(new moodle_url($PAGE->url, array('act' => ROLLBACK_ALL)),
171+
$button = new \single_button(new moodle_url($PAGE->url, ['act' => ROLLBACK_ALL]),
172172
get_string(ROLLBACK_ALL, 'lifecyclestep_adminapprove'));
173173
echo $OUTPUT->render($button);
174174
echo '</div>';
175-
$PAGE->requires->js_call_amd('lifecyclestep_adminapprove/init', 'init', array(sesskey(), $PAGE->url->out()));
175+
$PAGE->requires->js_call_amd('lifecyclestep_adminapprove/init', 'init', [sesskey(), $PAGE->url->out()]);
176176
} else {
177177
echo get_string('no_courses_waiting', 'lifecyclestep_adminapprove',
178-
array('step' => $step->instancename, 'workflow' => $workflow->title));
178+
['step' => $step->instancename, 'workflow' => $workflow->title]);
179179
}
180180

181181
echo $OUTPUT->footer();

Diff for: classes/decision_table.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class decision_table extends \table_sql {
4040
private $category;
4141

4242
/**
43-
* @var String pattern for the coursename.
43+
* @var string pattern for the coursename.
4444
*/
4545
private $coursename;
4646

@@ -60,13 +60,13 @@ public function __construct($stepid, $courseid, $category, $coursename) {
6060
$this->define_baseurl("/admin/tool/lifecycle/step/adminapprove/approvestep.php?stepid=$stepid");
6161
$this->define_columns(['checkbox', 'courseid', 'course', 'category', 'startdate', 'tools']);
6262
$this->define_headers(
63-
array(\html_writer::checkbox('checkall', null, false),
63+
[\html_writer::checkbox('checkall', null, false),
6464
get_string('courseid', 'lifecyclestep_adminapprove'),
6565
get_string('course'),
6666
get_string('category'),
6767
get_string('startdate'),
68-
get_string('tools', 'lifecyclestep_adminapprove')));
69-
$this->column_nosort = array('checkbox', 'tools');
68+
get_string('tools', 'lifecyclestep_adminapprove')]);
69+
$this->column_nosort = ['checkbox', 'tools'];
7070
$fields = 'm.id, w.displaytitle as workflow, c.id as courseid, c.fullname as course, cc.name as category,
7171
c.startdate, m.status';
7272
$from = '{lifecyclestep_adminapprove} m ' .
@@ -76,7 +76,7 @@ public function __construct($stepid, $courseid, $category, $coursename) {
7676
'LEFT JOIN {tool_lifecycle_workflow} w ON w.id = p.workflowid ' .
7777
'LEFT JOIN {tool_lifecycle_step} s ON s.workflowid = p.workflowid AND s.sortindex = p.stepindex';
7878
$where = 'm.status = 0 AND s.id = :sid ';
79-
$params = array('sid' => $stepid);
79+
$params = ['sid' => $stepid];
8080
if ($courseid) {
8181
$where .= 'AND c.id = :cid ';
8282
$params['cid'] = $courseid;
@@ -154,13 +154,13 @@ public function col_startdate($row) {
154154
public function col_tools($row) {
155155
$output = \html_writer::start_div('singlebutton mr-1');
156156
$output .= \html_writer::tag('button', get_string('proceed', 'lifecyclestep_adminapprove'),
157-
array('class' => 'btn btn-secondary adminapprove-action', 'data-action' => 'proceed', 'data-content' => $row->id,
158-
'type' => 'button'));
157+
['class' => 'btn btn-secondary adminapprove-action', 'data-action' => 'proceed', 'data-content' => $row->id,
158+
'type' => 'button']);
159159
$output .= \html_writer::end_div();
160160
$output .= \html_writer::start_div('singlebutton mr-1 ml-0 mt-1');
161161
$output .= \html_writer::tag('button', get_string('rollback', 'lifecyclestep_adminapprove'),
162-
array('class' => 'btn btn-secondary adminapprove-action', 'data-action' => 'rollback', 'data-content' => $row->id,
163-
'type' => 'button'));
162+
['class' => 'btn btn-secondary adminapprove-action', 'data-action' => 'rollback', 'data-content' => $row->id,
163+
'type' => 'button']);
164164
$output .= \html_writer::end_div();
165165
return $output;
166166
}

Diff for: classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class provider implements null_provider {
3434
*
3535
* @return string the reason
3636
*/
37-
public static function get_reason() : string {
37+
public static function get_reason(): string {
3838
return 'privacy:metadata';
3939
}
4040
}

Diff for: classes/step_table.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public function __construct() {
4343
$this->define_baseurl("/admin/tool/lifecycle/step/adminapprove/index.php");
4444
$this->define_columns(['stepname', 'workflowname', 'courses']);
4545
$this->define_headers(
46-
array(get_string('step', 'tool_lifecycle'), get_string('workflow', 'lifecyclestep_adminapprove'),
47-
get_string('amount_courses', 'lifecyclestep_adminapprove')));
46+
[get_string('step', 'tool_lifecycle'), get_string('workflow', 'lifecyclestep_adminapprove'),
47+
get_string('amount_courses', 'lifecyclestep_adminapprove')]);
4848
$this->set_attribute('id', 'adminapprove-steptable');
4949
$this->sortable(false);
5050
$fields = 's.id as id, s.instancename as stepname, w.title as workflowname, b.courses as courses';

Diff for: db/caches.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

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

27-
$definitions = array(
28-
'mformdata' => array(
29-
'mode' => cache_store::MODE_SESSION
30-
)
31-
);
27+
$definitions = [
28+
'mformdata' => [
29+
'mode' => cache_store::MODE_SESSION,
30+
],
31+
];

Diff for: lang/de/lifecyclestep_adminapprove.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,27 @@
2323
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2424
*/
2525

26-
$string['pluginname'] = 'Adminbestätigungs-Schritt';
27-
$string['privacy:metadata'] = 'Dieses Subplugin speichert keine persönlichen Daten.';
28-
$string['emailsubject'] = 'Kurs-Lebenszyklus: Es gibt neue Kurse, die auf Bestätigung warten.';
29-
$string['emailcontent'] = 'Es gibt {$a->amount} neue Kurse, die auf Bestätigung warten. Bitte besuchen Sie {$a->url}.';
30-
$string['emailcontenthtml'] = 'Es gibt {$a->amount} neue Kurse, die auf Bestätigung warten. Bitte klicken Sie auf <a href="{$a->url}">diesen Link</a>.';
26+
$string['amount_courses'] = 'Anzahl wartender Kurse';
27+
$string['bulkactions'] = 'Massenaktionen';
3128
$string['courseid'] = 'Kurs-ID';
32-
$string['workflow'] = 'Workflow';
33-
$string['proceedselected'] = 'Ausgewählte fortführen';
34-
$string['rollbackselected'] = 'Ausgewählte zurücksetzten';
35-
$string['tools'] = 'Aktionen';
3629
$string['courses_waiting'] = 'Diese Kurse warten derzeit auf Bestätigung im "{$a->step}"-Schritt in dem "{$a->workflow}"-Workflow.';
37-
$string['no_courses_waiting'] = 'Es gibt derzeit keine Kurse, die im "{$a->step}"-Schritt in dem "{$a->workflow}"-Workflow auf Bestätigung warten.';
38-
$string['proceed'] = 'Fortführen';
39-
$string['rollback'] = 'Zurücksetzten';
40-
$string['amount_courses'] = 'Anzahl wartender Kurse';
41-
$string['only_number'] = 'Es sind nur Ziffern erlaubt!';
42-
$string['nothingtodisplay'] = 'Es gibt keine auf Bestätigung wartenden Kurse, die auf diese Filter passen.';
30+
$string['emailcontent'] = 'Es gibt {$a->amount} neue Kurse, die auf Bestätigung warten. Bitte besuchen Sie {$a->url}.';
31+
$string['emailcontenthtml'] = 'Es gibt {$a->amount} neue Kurse, die auf Bestätigung warten. Bitte klicken Sie auf <a href="{$a->url}">diesen Link</a>.';
32+
$string['emailsubject'] = 'Kurs-Lebenszyklus: Es gibt neue Kurse, die auf Bestätigung warten.';
4333
$string['manage-adminapprove'] = 'Adminbestätigungs-Schritte verwalten';
34+
$string['no_courses_waiting'] = 'Es gibt derzeit keine Kurse, die im "{$a->step}"-Schritt in dem "{$a->workflow}"-Workflow auf Bestätigung warten.';
4435
$string['nostepstodisplay'] = 'Es gibt derzeit keine Kurse in Adminbestätigungs-Schritten, die auf Bestätigung warten.';
45-
$string['bulkactions'] = 'Massenaktionen';
36+
$string['nothingtodisplay'] = 'Es gibt keine auf Bestätigung wartenden Kurse, die auf diese Filter passen.';
37+
$string['only_number'] = 'Es sind nur Ziffern erlaubt!';
38+
$string['pluginname'] = 'Adminbestätigungs-Schritt';
39+
$string['privacy:metadata'] = 'Dieses Subplugin speichert keine persönlichen Daten.';
40+
$string['proceed'] = 'Fortführen';
4641
$string['proceedall'] = 'Alle fortführen';
42+
$string['proceedselected'] = 'Ausgewählte fortführen';
43+
$string['rollback'] = 'Zurücksetzten';
4744
$string['rollbackall'] = 'Alle zurücksetzten';
45+
$string['rollbackselected'] = 'Ausgewählte zurücksetzten';
4846
$string['statusmessage'] = 'Statusnachricht';
4947
$string['statusmessage_help'] = 'Statusnachricht, welche dem Lehrer angezeigt wird, wenn ein Prozess eines Kurses den Adminbestätigungs-Schritt bearbeitet.';
48+
$string['tools'] = 'Aktionen';
49+
$string['workflow'] = 'Workflow';

Diff for: lang/en/lifecyclestep_adminapprove.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,28 @@
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
2424

25-
$string['pluginname'] = 'Admin Approve Step';
26-
$string['privacy:metadata'] = 'This subplugin does not store any personal data.';
25+
$string['amount_courses'] = 'Remaining waiting courses';
26+
$string['bulkactions'] = 'Bulk actions';
2727
$string['cachedef_mformdata'] = 'Caches the mform data';
28-
$string['emailsubject'] = 'Lifecycle: There are new courses waiting for confirmation.';
29-
$string['emailcontent'] = 'There are {$a->amount} new courses waiting for confirmation. Please visit {$a->url}.';
30-
$string['emailcontenthtml'] = 'There are {$a->amount} new courses waiting for confirmation. Please visit <a href="{$a->url}">this link</a>.';
3128
$string['courseid'] = 'Course id';
32-
$string['workflow'] = 'Workflow';
33-
$string['proceedselected'] = 'Proceed selected';
34-
$string['rollbackselected'] = 'Rollback selected';
35-
$string['tools'] = 'Tools';
3629
$string['courses_waiting'] = 'These courses are currently waiting for approval in the "{$a->step}" Step in the "{$a->workflow}" Workflow.';
37-
$string['no_courses_waiting'] = 'There are currently no courses waiting for approval in the "{$a->step}" Step in the "{$a->workflow}" Workflow.';
38-
$string['proceed'] = 'Proceed';
39-
$string['rollback'] = 'Rollback';
40-
$string['amount_courses'] = 'Remaining waiting courses';
41-
$string['only_number'] = 'Only numeric characters allowed!';
42-
$string['nothingtodisplay'] = 'There are no courses waiting for approval matching your current filters.';
30+
$string['emailcontent'] = 'There are {$a->amount} new courses waiting for confirmation. Please visit {$a->url}.';
31+
$string['emailcontenthtml'] = 'There are {$a->amount} new courses waiting for confirmation. Please visit <a href="{$a->url}">this link</a>.';
32+
$string['emailsubject'] = 'Lifecycle: There are new courses waiting for confirmation.';
4333
$string['manage-adminapprove'] = 'Manage Admin Approve Steps';
34+
$string['no_courses_waiting'] = 'There are currently no courses waiting for approval in the "{$a->step}" Step in the "{$a->workflow}" Workflow.';
4435
$string['nostepstodisplay'] = 'There are currently no courses waiting for interaction in any Admin Approve step.';
45-
$string['bulkactions'] = 'Bulk actions';
36+
$string['nothingtodisplay'] = 'There are no courses waiting for approval matching your current filters.';
37+
$string['only_number'] = 'Only numeric characters allowed!';
38+
$string['pluginname'] = 'Admin Approve Step';
39+
$string['privacy:metadata'] = 'This subplugin does not store any personal data.';
40+
$string['proceed'] = 'Proceed';
4641
$string['proceedall'] = 'Proceed all';
42+
$string['proceedselected'] = 'Proceed selected';
43+
$string['rollback'] = 'Rollback';
4744
$string['rollbackall'] = 'Rollback all';
45+
$string['rollbackselected'] = 'Rollback selected';
4846
$string['statusmessage'] = 'Status message';
4947
$string['statusmessage_help'] = 'Status message, which is displayed to a teacher, if a process of a course is at this admin approve step.';
48+
$string['tools'] = 'Tools';
49+
$string['workflow'] = 'Workflow';

0 commit comments

Comments
 (0)