Skip to content

Commit

Permalink
Merge pull request #204 from learnweb/update/m404
Browse files Browse the repository at this point in the history
Update for Moodle 4.4
  • Loading branch information
justusdieckmann authored Apr 26, 2024
2 parents ba1dc92 + 3c74651 commit 42edc87
Show file tree
Hide file tree
Showing 66 changed files with 576 additions and 651 deletions.
80 changes: 22 additions & 58 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:
strategy:
matrix:
php: ['8.2']
moodle-branch: ['MOODLE_403_STABLE']
moodle-branch: ['MOODLE_404_STABLE']
database: ['pgsql']

steps:
- name: Start PostgreSQL
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14

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

Expand All @@ -28,29 +28,9 @@ jobs:
ini-values: max_input_vars=5000
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Composer cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: npm cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- 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 Down Expand Up @@ -108,30 +88,20 @@ jobs:
fail-fast: false
matrix:
php: ['8.0', '8.1', '8.2']
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE']
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE']
database: ['mariadb', 'pgsql']
exclude:
- php: '8.0'
moodle-branch: 'MOODLE_404_STABLE'
- php: '8.2'
moodle-branch: 'MOODLE_401_STABLE'
include:
- php: '7.4'
moodle-branch: 'MOODLE_39_STABLE'
database: 'mariadb'
- php: '7.4'
moodle-branch: 'MOODLE_39_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_311_STABLE'
database: 'mariadb'
- php: '8.0'
moodle-branch: 'MOODLE_311_STABLE'
moodle-branch: 'MOODLE_401_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_400_STABLE'
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
database: 'mariadb'
- php: '8.0'
moodle-branch: 'MOODLE_400_STABLE'
database: 'pgsql'

steps:
- name: Start MariaDB
Expand All @@ -143,7 +113,7 @@ jobs:
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14

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

Expand All @@ -154,24 +124,6 @@ jobs:
ini-values: max_input_vars=5000
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Composer cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: npm cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
Expand All @@ -194,3 +146,15 @@ jobs:
- name: Behat features
if: ${{ always() }}
run: moodle-plugin-ci behat --profile chrome --auto-rerun 0

# This step allows to upload Behat faildump (screenshots) as workflow artifact,
# so it can be downloaded and inspected. You don't need this step if you
# are not running Behat test. Artifact will be retained for 7 days.
- name: Upload Behat Faildump
if: ${{ failure() && steps.behat.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: Behat Faildump (${{ join(matrix.*, ', ') }})
path: ${{ github.workspace }}/moodledata/behat_dump
retention-days: 7
if-no-files-found: ignore
1 change: 1 addition & 0 deletions activeprocesses.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @copyright 2017 Tobias Reischmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(__DIR__ . '/../../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_login();
Expand Down
3 changes: 2 additions & 1 deletion classes/local/form/form_trigger_instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ public function definition_after_data() {
}
}

/** Validate the form.
/**
* Validate the form.
* @param array $data array of ("fieldname"=>value) of submitted data
* @param array $files array of uploaded files "element_name"=>tmp_file_path
* @return array of "element_name"=>"error_description" if there are errors,
Expand Down
2 changes: 2 additions & 0 deletions classes/local/manager/workflow_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public static function insert_or_update(workflow &$workflow) {
public static function remove($workflowid, $hard = false) {
global $DB;
if ($hard || self::is_removable($workflowid)) {
$workflow = self::get_workflow($workflowid);
self::remove_from_sortindex($workflow);
trigger_manager::remove_instances_of_workflow($workflowid);
step_manager::remove_instances_of_workflow($workflowid);
$DB->delete_records('tool_lifecycle_workflow', ['id' => $workflowid]);
Expand Down
1 change: 1 addition & 0 deletions coursebackups.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @copyright 2017 Tobias Reischmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(__DIR__ . '/../../../config.php');
require_once($CFG->libdir . '/adminlib.php');

Expand Down
4 changes: 2 additions & 2 deletions db/caches.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
'application' => [
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true,
'simpledata' => true
]
'simpledata' => true,
],
];
23 changes: 23 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
* Fix any gaps in the workflows sortindex.
*/
function tool_lifecycle_fix_workflow_sortindex() {
$workflows = \tool_lifecycle\local\manager\workflow_manager::get_active_workflows();
for ($i = 1; $i <= count($workflows); $i++) {
$workflow = $workflows[$i - 1];
if ($workflow->sortindex != $i) {
$workflow->sortindex = $i;
\tool_lifecycle\local\manager\workflow_manager::insert_or_update($workflow);
}
}
}

/**
* Update script for tool_lifecycle.
* @param int $oldversion Version id of the previously installed version.
Expand Down Expand Up @@ -475,5 +489,14 @@ function xmldb_tool_lifecycle_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2021112300, 'tool', 'lifecycle');
}

if ($oldversion < 2024042300) {

tool_lifecycle_fix_workflow_sortindex();

// Lifecycle savepoint reached.
upgrade_plugin_savepoint(true, 2024042300, 'tool', 'lifecycle');

}

return true;
}
1 change: 1 addition & 0 deletions downloadbackup.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @copyright 2019 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(__DIR__ . '/../../../config.php');

require_login();
Expand Down
Loading

0 comments on commit 42edc87

Please sign in to comment.