From fb7906f8e8327afbbf7f4a3ced418e70605b0c37 Mon Sep 17 00:00:00 2001 From: Daniil Fajnberg Date: Tue, 9 Apr 2024 13:14:10 +0200 Subject: [PATCH] Require Moodle 4.1; remove use of deprecated function (fixes #5) --- .github/workflows/moodle-ci.yml | 10 +--------- classes/course_files.php | 11 +++-------- version.php | 2 +- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index 75e5a44..459497e 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -31,7 +31,7 @@ jobs: fail-fast: false matrix: php: ['7.4', '8.0', '8.1', '8.2'] - moodle-branch: [MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE] + moodle-branch: [MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE] database: [pgsql, mariadb] # See: https://moodledev.io/general/development/policies/php exclude: @@ -41,14 +41,6 @@ jobs: moodle-branch: MOODLE_403_STABLE - php: '8.0' moodle-branch: MOODLE_403_STABLE - - php: '8.1' - moodle-branch: MOODLE_311_STABLE - - php: '8.1' - moodle-branch: MOODLE_400_STABLE - - php: '8.2' - moodle-branch: MOODLE_311_STABLE - - php: '8.2' - moodle-branch: MOODLE_400_STABLE - php: '8.2' moodle-branch: MOODLE_401_STABLE diff --git a/classes/course_files.php b/classes/course_files.php index 7f38109..7c50a29 100644 --- a/classes/course_files.php +++ b/classes/course_files.php @@ -146,14 +146,9 @@ public function get_file_list($offset, $limit) { $sqlwhere .= ' AND ' . $this->get_sql_mimetype($this->filterfiletype, true); } - if (class_exists('\core_user\fields')) { - $usernameselect = implode(', ', array_map(function($field) { - return 'u.' . $field; - }, \core_user\fields::get_name_fields())); - } else { - // For compatibility with Moodle 3.9. - $usernameselect = get_all_user_name_fields(true, 'u'); - } + $usernameselect = implode(', ', array_map(function($field) { + return 'u.' . $field; + }, \core_user\fields::get_name_fields())); $sql = "FROM {files} f LEFT JOIN {context} c ON (c.id = f.contextid) diff --git a/version.php b/version.php index f68f876..f9cda0c 100644 --- a/version.php +++ b/version.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die; $plugin->version = 2022060800; -$plugin->requires = 2016051900; +$plugin->requires = 2022112800; // Require at least Moodle 4.1.0. $plugin->cron = 0; $plugin->component = "local_listcoursefiles"; $plugin->maturity = MATURITY_STABLE;