Skip to content

Commit 2b45097

Browse files
authored
Merge pull request #231 from KQMATH/cleanup
Code cleanup and support for 4.4
2 parents a297885 + 30879c3 commit 2b45097

File tree

98 files changed

+2039
-3032
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2039
-3032
lines changed

.github/workflows/moodle-ci.yml

Lines changed: 67 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,120 @@
1-
name: Moodle plugin CI
1+
name: Moodle Plugin CI
2+
23
on: [push, pull_request]
34

45
jobs:
56
test:
6-
runs-on: 'ubuntu-latest'
7-
strategy:
8-
fail-fast: false
9-
matrix:
10-
include:
11-
- php: '8.1'
12-
moodle-branch: 'MOODLE_402_STABLE'
13-
database: 'mariadb'
14-
- php: '8.1'
15-
moodle-branch: 'MOODLE_402_STABLE'
16-
database: 'mariadb'
17-
- php: '8.0'
18-
moodle-branch: 'MOODLE_402_STABLE'
19-
database: 'mariadb'
20-
- php: '8.0'
21-
moodle-branch: 'MOODLE_402_STABLE'
22-
database: 'mariadb'
23-
- php: '8.1'
24-
moodle-branch: 'MOODLE_401_STABLE'
25-
database: 'mariadb'
26-
- php: '8.1'
27-
moodle-branch: 'MOODLE_401_STABLE'
28-
database: 'mariadb'
29-
- php: '8.0'
30-
moodle-branch: 'MOODLE_401_STABLE'
31-
database: 'mariadb'
32-
- php: '8.0'
33-
moodle-branch: 'MOODLE_401_STABLE'
34-
database: 'mariadb'
35-
- php: '7.4'
36-
moodle-branch: 'MOODLE_401_STABLE'
37-
database: 'mariadb'
38-
- php: '7.4'
39-
moodle-branch: 'MOODLE_401_STABLE'
40-
database: 'mariadb'
41-
- php: '7.4'
42-
moodle-branch: 'MOODLE_400_STABLE'
43-
database: 'mariadb'
44-
- php: '7.4'
45-
moodle-branch: 'MOODLE_400_STABLE'
46-
database: 'mariadb'
7+
runs-on: ubuntu-22.04
478

489
services:
4910
postgres:
50-
image: postgres
11+
image: postgres:13
5112
env:
5213
POSTGRES_USER: 'postgres'
5314
POSTGRES_HOST_AUTH_METHOD: 'trust'
54-
options: >-
55-
--health-cmd pg_isready
56-
--health-interval 10s
57-
--health-timeout 5s
58-
--health-retries 3
5915
ports:
6016
- 5432:5432
17+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
6118

6219
mariadb:
63-
image: mariadb:10.5
20+
image: mariadb:10
6421
env:
6522
MYSQL_USER: 'root'
6623
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
24+
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
25+
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
6726
ports:
6827
- 3306:3306
6928
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
7029

30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
include:
34+
- php: '8.0'
35+
moodle-branch: 'MOODLE_403_STABLE'
36+
database: 'pgsql'
37+
- php: '8.1'
38+
moodle-branch: 'MOODLE_404_STABLE'
39+
database: 'pgsql'
40+
- php: '8.1'
41+
moodle-branch: 'MOODLE_404_STABLE'
42+
database: 'mariadb'
43+
7144
steps:
72-
- name: Checkout
73-
uses: actions/checkout@v3
45+
- name: Check out repository code
46+
uses: actions/checkout@v4
7447
with:
7548
path: plugin
7649

77-
- name: Setup PHP
50+
- name: Setup PHP ${{ matrix.php }}
7851
uses: shivammathur/setup-php@v2
7952
with:
8053
php-version: ${{ matrix.php }}
81-
extensions: zip, gd, mbstring, pgsql, mysqli
54+
extensions: ${{ matrix.extensions }}
55+
ini-values: max_input_vars=5000
56+
coverage: none
8257

83-
- name: Deploy moodle-plugin-ci
58+
- name: Initialise moodle-plugin-ci
8459
run: |
85-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
86-
# Add dirs to $PATH
60+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
8761
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
8862
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
89-
# PHPUnit depends on en_AU.UTF-8 locale
9063
sudo locale-gen en_AU.UTF-8
91-
- name: Install Moodle
92-
# Need explicit IP to stop mysql client fail on attempt to use unix socket.
64+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
65+
66+
- name: Install moodle-plugin-ci
9367
run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
9468
env:
9569
DB: ${{ matrix.database }}
9670
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
97-
IGNORE_NAMES: 'mobile_*.mustache'
98-
IGNORE_PATHS: 'templates/local/mobile'
9971

100-
- name: phplint
101-
if: ${{ always() }}
72+
- name: PHP Lint
73+
if: ${{ !cancelled() }}
10274
run: moodle-plugin-ci phplint
10375

104-
- name: phpcpd
105-
if: ${{ always() }}
106-
run: moodle-plugin-ci phpcpd || true
76+
- name: PHP Copy/Paste Detector
77+
continue-on-error: true # This step will show errors but will not fail
78+
if: ${{ !cancelled() }}
79+
run: moodle-plugin-ci phpcpd
10780

108-
- name: phpmd
109-
if: ${{ always() }}
81+
- name: PHP Mess Detector
82+
continue-on-error: true # This step will show errors but will not fail
83+
if: ${{ !cancelled() }}
11084
run: moodle-plugin-ci phpmd
11185

112-
- name: codechecker
113-
if: ${{ always() }}
114-
run: moodle-plugin-ci codechecker
86+
- name: Moodle Code Checker
87+
if: ${{ !cancelled() }}
88+
run: moodle-plugin-ci phpcs --max-warnings 0
11589

116-
- name: validate
117-
if: ${{ always() }}
90+
- name: Moodle PHPDoc Checker
91+
if: ${{ !cancelled() }}
92+
run: moodle-plugin-ci phpdoc --max-warnings 0
93+
94+
- name: Validating
95+
if: ${{ !cancelled() }}
11896
run: moodle-plugin-ci validate
11997

120-
- name: savepoints
121-
if: ${{ always() }}
98+
- name: Check upgrade savepoints
99+
if: ${{ !cancelled() }}
122100
run: moodle-plugin-ci savepoints
123101

124-
- name: mustache
125-
if: ${{ always() }}
102+
- name: Mustache Lint
103+
if: ${{ !cancelled() }}
126104
run: moodle-plugin-ci mustache
127105

128-
- name: grunt
129-
if: ${{ always() }}
130-
run: moodle-plugin-ci grunt
106+
- name: Grunt
107+
if: ${{ !cancelled() }}
108+
run: moodle-plugin-ci grunt --max-lint-warnings 0
131109

132-
- name: phpunit
133-
if: ${{ always() }}
134-
run: moodle-plugin-ci phpunit
110+
- name: PHPUnit tests
111+
if: ${{ !cancelled() }}
112+
run: moodle-plugin-ci phpunit --fail-on-warning
135113

136-
- name: behat
137-
if: ${{ always() }}
114+
- name: Behat features
115+
if: ${{ !cancelled() }}
138116
run: moodle-plugin-ci behat --profile chrome
117+
118+
- name: Mark cancelled jobs as failed.
119+
if: ${{ cancelled() }}
120+
run: exit 1

.travis.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org).
77

88
## [Unreleased]
99

10-
## [0.7.0] - planned 2023-04-28
10+
## [0.8.0] 2024-10-07
11+
12+
- Now compatible with new question bank API
13+
- Fixed bug with uploaded images in questions not being displayed
14+
15+
## [0.7.0] - 2023-04-28
1116

1217
+ Upgraded to work with Moodle 4.0
1318

action.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,14 @@
3333
$cmid = capquiz_urls::require_course_module_id_param();
3434
$cm = get_coursemodule_from_id('capquiz', $cmid, 0, false, MUST_EXIST);
3535
require_login($cm->course, false, $cm);
36+
3637
$context = \context_module::instance($cmid);
3738
require_capability('mod/capquiz:instructor', $context);
3839

3940
$action = required_param('action', PARAM_TEXT);
4041

41-
$cmid = capquiz_urls::require_course_module_id_param();
4242
$capquiz = new capquiz($cmid);
43-
if ($capquiz) {
44-
capquiz_urls::set_page_url($capquiz, capquiz_urls::$urlasync);
45-
capquiz_action_performer::perform($action, $capquiz);
46-
}
43+
capquiz_urls::set_page_url($capquiz, capquiz_urls::$urlasync);
44+
capquiz_action_performer::perform($action, $capquiz);
4745

4846
capquiz_urls::redirect_to_dashboard();

0 commit comments

Comments
 (0)