Skip to content

Commit

Permalink
Update wwu branch (#219)
Browse files Browse the repository at this point in the history
* Removed ,

* CI: Update for Moodle 4.2

* Workflow backup: Do not save attributes when they are null

* Bump version

* MBS-7377: Fix workflowoverview for big instances

* Fix wrong calculation of courses counts in template context

* fix upload workflow (#185)

* fix upload workflow

* inserting feedback

* finally

* Add check if process exists. (#191)

This prevents courses to be processed which had been rescued by the teacher.

* Update README.md

Make Subplugin List (and link to wiki) more apparent

* Improve help text for integration of icons (manual trigger) (#193)

* Improved help text for the integration of icons

* Improved help text for the integration of icons

* Update for Moodle 4.3 (#190)

* CI: Update for Moodle 4.3

* Prevent dynamic property access on classes for PHP 8.2

* phpcbf for styles etc.

---------

Co-authored-by: Justus Dieckmann <[email protected]>
Co-authored-by: NinaHerrmann <[email protected]>

* Hide menu when there is no manual workflow (#195)

Co-authored-by: Justus Dieckmann <[email protected]>

* Fix step and trigger reordering: only change the relevant workflow (#200)

* Reorder the remaining active workflows when disabling a workflow (#201)

This fixes #128.

* Show menu entry when a manual or automatic workflow is active (#199)

* Show menu point when a manual or automatic workflow is active

* Rename reset cache function

* Show menu entry if there are workflows other than the default two

---------

Co-authored-by: Justus Dieckmann <[email protected]>

* Check backup consistency before importing workflow (#196)

* Check backup consistency before importing workflow

* Fix PHPDocs

* Use existing category in backup_and_restore test

* lifecycletrigger_categories: A bit of general refactoring

* lifecycletrigger_categories: Don't fail if category doesn't exist

* Add possibility to force import of errorneous backup

* Use $force = false as default in restore_workflow:execute

* Display only unique errors when Workflows causes multiple errors

---------

Co-authored-by: Justus Dieckmann <[email protected]>
Co-authored-by: NinaHerrmann <[email protected]>

* CI: Update for Moodle 4.4

* Codestyle PHPCBF

* Sort strings in lang files alphabetically

* Fix sortindex gaps in upgrade step

* Bump version

* The columns in active_manual_workflows_table shouldn't be sortable

* Shell escape the release notes in the release workflow (#207)

Co-authored-by: Justus Dieckmann <[email protected]>

* Fix mustache

* added mtrace statement for logging failed mails (#214)

* Shell escape release workflow for realsies this time (#208)

---------

Co-authored-by: Justus Dieckmann <[email protected]>
Co-authored-by: Philipp Memmel <[email protected]>
Co-authored-by: Justus Dieckmann <[email protected]>
Co-authored-by: Melanie Treitinger <[email protected]>
Co-authored-by: KerstinSc <[email protected]>
Co-authored-by: Kata <[email protected]>
  • Loading branch information
7 people authored Jun 19, 2024
1 parent b96e107 commit 306cf73
Show file tree
Hide file tree
Showing 133 changed files with 1,206 additions and 1,032 deletions.
77 changes: 28 additions & 49 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ jobs:

strategy:
matrix:
php: ['8.0']
moodle-branch: ['MOODLE_401_STABLE']
php: ['8.2']
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 @@ -107,16 +87,21 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.0']
moodle-branch: ['MOODLE_311_STABLE', 'MOODLE_400_STABLE', 'MOODLE_401_STABLE']
php: ['8.0', '8.1', '8.2']
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'
moodle-branch: 'MOODLE_401_STABLE'
database: 'pgsql'
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
database: 'mariadb'

steps:
- name: Start MariaDB
Expand All @@ -128,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 @@ -139,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 @@ -179,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
11 changes: 6 additions & 5 deletions .github/workflows/moodle-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ jobs:
steps:
- name: Call the service function
id: add-version
env:
TAGNAME: ${{ github.event.release.tag_name }}
BODY: ${{ github.event.release.body }}
ZIPURL: ${{ github.event.release.zipball_url }}
run: |
TAGNAME="${{ github.event.release.tag_name }}"
BODY="${{ github.event.release.body }}"
ZIPURL="${{ github.event.release.zipball_url }}"
RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \
--data-urlencode "wsfunction=${FUNCTION}" \
--data-urlencode "moodlewsrestformat=json" \
Expand All @@ -42,9 +43,9 @@ jobs:
--data-urlencode "vcstag=${TAGNAME}" \
--data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
--data-urlencode "altdownloadurl=${ZIPURL}" \
--data-urlencode "releasenotes=${BODY}" \
--data-urlencode "releasenotes=${BODY@Q}" \
--data-urlencode "releasenotesformat=4")
echo "::set-output name=response::${RESPONSE}"
echo "response=${RESPONSE}" >> $GITHUB_OUTPUT
- name: Evaluate the response
id: evaluate-response
env:
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ Possible use cases are (not limited to):

To be adaptable to the needs of different institutions the plugin provides two subplugin types:

**Trigger**: These subplugins control the conditions a course have to meet so that a specific process is started for it.
**Trigger**: These subplugins control the conditions a course must meet so that a specific process is started.

**Step**: These subplugins represent atomic, reusable tasks that should be executed for a specific course.

## Subplugins
Requirements that are specific to your institution can be added through additional subplugins.
For more information please have a look at the [wiki](https://github.com/learnweb/moodle-tool_lifecycle/wiki).
It provides instructions for administrators as well as for developers to implement own requirements into subplugins.
A list of all subplugins and more information can be found in the [Wiki](https://github.com/learnweb/moodle-tool_lifecycle/wiki/List-of-Additional-Subplugins) ([subpluginslist](https://github.com/learnweb/moodle-tool_lifecycle/wiki/List-of-Additional-Subplugins)).
It provides instructions for administrators as well as for developers to implement their own requirements into subplugins.

Installation
============
Expand All @@ -31,7 +32,7 @@ Moodle version
==============
The plugin is continously tested with all moodle versions, which are security supported by the moodle headquarter.
Therefore, Travis uses the most current release to build a test instance and run the behat and unit tests on them.
In addition to all stable branches the version is also tested against the master branch to support early adopters.
In addition to all stable branches the version is tested against the master branch to support early adopters.

Changelog
=========
Expand Down
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
2 changes: 1 addition & 1 deletion activeworkflows.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
'inputname' => 'search',
'extraclasses' => 'mb-3',
'inform' => false,
'searchstring' => 'Search for courses'
'searchstring' => 'Search for courses',
]);

echo $OUTPUT->heading(get_string('active_automatic_workflows_heading', 'tool_lifecycle'));
Expand Down
10 changes: 5 additions & 5 deletions classes/event/process_proceeded.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ class process_proceeded extends \core\event\base {
* @throws \dml_exception
*/
public static function event_from_process($process) {
$data = array(
$data = [
'context' => \context_system::instance(),
'other' => array(
'other' => [
'processid' => $process->id,
'workflowid' => $process->workflowid,
'stepindex' => $process->stepindex,
'courseid' => $process->courseid
)
);
'courseid' => $process->courseid,
],
];
return self::create($data);
}

Expand Down
10 changes: 5 additions & 5 deletions classes/event/process_rollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ class process_rollback extends \core\event\base {
* @throws \dml_exception
*/
public static function event_from_process($process) {
$data = array(
$data = [
'context' => \context_system::instance(),
'other' => array(
'other' => [
'processid' => $process->id,
'workflowid' => $process->workflowid,
'stepindex' => $process->stepindex,
'courseid' => $process->courseid
)
);
'courseid' => $process->courseid,
],
];
return self::create($data);
}

Expand Down
10 changes: 5 additions & 5 deletions classes/event/process_triggered.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ class process_triggered extends \core\event\base {
* @throws \dml_exception
*/
public static function event_from_process($process) {
$data = array(
$data = [
'context' => \context_system::instance(),
'other' => array(
'other' => [
'processid' => $process->id,
'workflowid' => $process->workflowid,
'courseid' => $process->courseid
)
);
'courseid' => $process->courseid,
],
];
return self::create($data);
}

Expand Down
20 changes: 15 additions & 5 deletions classes/local/backup/backup_lifecycle_workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public function send_temp_file() {
*/
private function write_workflow() {
foreach (get_object_vars($this->workflow) as $prop => $value) {
$this->writer->writeAttribute($prop, $value);
if (!is_null($value)) {
$this->writer->writeAttribute($prop, $value);
}
}
}

Expand All @@ -118,13 +120,17 @@ private function write_triggers() {
foreach ($this->trigger as $trigger) {
$this->writer->startElement("trigger");
foreach (get_object_vars($trigger) as $prop => $value) {
$this->writer->writeAttribute($prop, $value);
if (!is_null($value)) {
$this->writer->writeAttribute($prop, $value);
}
}
$settings = settings_manager::get_settings($trigger->id, settings_type::TRIGGER);
foreach ($settings as $name => $value) {
$this->writer->startElement("setting");
$this->writer->writeAttribute('name', $name);
$this->writer->writeAttribute('value', $value);
if (!is_null($value)) {
$this->writer->writeAttribute('value', $value);
}
$this->writer->endElement();
}
$this->writer->endElement();
Expand All @@ -139,13 +145,17 @@ private function write_steps() {
foreach ($this->steps as $step) {
$this->writer->startElement("step");
foreach (get_object_vars($step) as $prop => $value) {
$this->writer->writeAttribute($prop, $value);
if (!is_null($value)) {
$this->writer->writeAttribute($prop, $value);
}
}
$settings = settings_manager::get_settings($step->id, settings_type::STEP);
foreach ($settings as $name => $value) {
$this->writer->startElement("setting");
$this->writer->writeAttribute('name', $name);
$this->writer->writeAttribute('value', $value);
if (!is_null($value)) {
$this->writer->writeAttribute('value', $value);
}
$this->writer->endElement();
}
$this->writer->endElement();
Expand Down
Loading

0 comments on commit 306cf73

Please sign in to comment.