Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moodle 4.5 compatibility #13

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

services:
postgres:
Expand All @@ -30,22 +30,37 @@ jobs:
fail-fast: false
matrix:
include:
- php: '8.3'
moodle-branch: 'MOODLE_405_STABLE'
database: 'pgsql'
- php: '8.2'
moodle-branch: 'MOODLE_405_STABLE'
database: 'mariadb'
- php: '8.1'
moodle-branch: 'MOODLE_405_STABLE'
database: 'pgsql'
- php: '8.3'
moodle-branch: 'MOODLE_404_STABLE'
database: 'mariadb'
- php: '8.2'
moodle-branch: 'MOODLE_404_STABLE'
database: 'pgsql'
- php: '8.1'
moodle-branch: 'MOODLE_404_STABLE'
database: 'mariadb'
- php: '8.2'
moodle-branch: 'MOODLE_403_STABLE'
database: 'pgsql'
- php: '8.0'
- php: '8.1'
moodle-branch: 'MOODLE_402_STABLE'
database: 'mariadb'
- php: '8.0'
moodle-branch: 'MOODLE_401_STABLE'
database: 'pgsql'
- php: '7.4'
moodle-branch: 'MOODLE_400_STABLE'
database: 'mariadb'

steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: plugin

Expand All @@ -59,7 +74,7 @@ jobs:

- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
Expand All @@ -76,16 +91,6 @@ jobs:
if: ${{ always() }}
run: moodle-plugin-ci phplint

- name: PHP Copy/Paste Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpcpd

- name: PHP Mess Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpmd

- name: Moodle Code Checker
if: ${{ always() }}
run: moodle-plugin-ci codechecker --max-warnings 0
Expand Down
2 changes: 1 addition & 1 deletion amd/build/skills.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion amd/src/skills.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ define(['jquery', 'core/modal_factory', 'core/str', 'core_form/modalform'], func
});
}


addActionListiners() {

var self = this;
Expand Down
2 changes: 1 addition & 1 deletion classes/allocation_method.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function get_data() {
*
* @return \tool_skills\logs
*/
public function get_logs() : \tool_skills\logs {
public function get_logs(): \tool_skills\logs {

if ($this->logs == null) {
$this->logs = new \tool_skills\logs();
Expand Down
6 changes: 3 additions & 3 deletions classes/courseskills.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function __construct(int $courseid) {
* @param int $courseid
* @return self
*/
public static function get(int $courseid) : self {
public static function get(int $courseid): self {
return new self($courseid);
}

Expand All @@ -79,7 +79,7 @@ public static function get(int $courseid) : self {
* @param int $skillid
* @return self
*/
public static function get_for_skill(int $skillid) : array {
public static function get_for_skill(int $skillid): array {
global $DB;

$courses = $DB->get_records('tool_skills_courses', ['skill' => $skillid]);
Expand All @@ -92,7 +92,7 @@ public static function get_for_skill(int $skillid) : array {
*
* @return stdClass Course record data.
*/
public function get_course() : stdClass {
public function get_course(): stdClass {
return get_course($this->courseid);
}

Expand Down
4 changes: 2 additions & 2 deletions classes/form/course_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function definition() {
* @return bool
*/
protected function check_access_for_dynamic_submission(): void {
// TODO: Validatation of user capability goes here.
// TODO MDL-0: Validatation of user capability goes here.
}

/**
Expand Down Expand Up @@ -190,7 +190,7 @@ protected function get_page_url_for_dynamic_submission(): moodle_url {
* @param bool $status
* @return void
*/
public static function update_status(int $skillid, int $courseid, bool $status) : void {
public static function update_status(int $skillid, int $courseid, bool $status): void {
global $DB;

$record = new stdClass;
Expand Down
8 changes: 4 additions & 4 deletions classes/level.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function __construct(int $levelid) {
*
* @return stdClass Level record.
*/
public function get_level_record() : stdClass {
public function get_level_record(): stdClass {
return $this->levelrecord;
}

Expand All @@ -103,7 +103,7 @@ public function get_level_record() : stdClass {
*
* @return stdClass
*/
public function get_data() : stdClass {
public function get_data(): stdClass {
return $this->data;
}

Expand All @@ -112,7 +112,7 @@ public function get_data() : stdClass {
*
* @return stdClass|bool
*/
protected function fetch_record() : ?stdClass {
protected function fetch_record(): ?stdClass {
global $DB;

if ($skill = $DB->get_record('tool_skills_levels', ['id' => $this->levelid])) {
Expand Down Expand Up @@ -161,7 +161,7 @@ public function get_points() {
*
* @param int $levelid
*/
public static function get(int $levelid) : \tool_skills\level {
public static function get(int $levelid): \tool_skills\level {
// Create the instance for this skill and return.
return new self($levelid);
}
Expand Down
6 changes: 3 additions & 3 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function get_metadata(collection $collection): collection {
* @param int $userid The user to search.
* @return contextlist $contextlist The list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
$contextlist = new \core_privacy\local\request\contextlist();
// User completions.
$sql = "SELECT ctx.id
Expand Down Expand Up @@ -238,7 +238,7 @@ public static function export_user_data(approved_contextlist $contextlist) {
get_string('privacy:awardlogs', 'tool_skills'),
array_filter(
$userpoints,
function(stdClass $point) use ($contextlist) : bool {
function(stdClass $point) use ($contextlist): bool {
return $point->userid == $contextlist->get_user()->id;
}
),
Expand Down Expand Up @@ -299,7 +299,7 @@ private static function export_user_points(string $path, array $userpoints, $use
private static function group_by_property(array $classes, string $property): array {
return array_reduce(
$classes,
function (array $classes, stdClass $class) use ($property) : array {
function (array $classes, stdClass $class) use ($property): array {
$classes[$class->{$property}][] = $class;
return $classes;
},
Expand Down
Loading