Skip to content

Commit

Permalink
remove plugins.json from project, add sample plugins.json, improve er…
Browse files Browse the repository at this point in the history
…ror handling if file does not exist and update README.md
  • Loading branch information
Glutamat42 committed Dec 16, 2024
1 parent 681457b commit 9133b7d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 24 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ The following roles are available:

The following environment variables are used:
- DECLARATIVE_SETUP_MANAGER_PASSWORD: Password for the manager user
- DECLARATIVE_SETUP_STUDENT_PASSWORD: Password for the student user
- DECLARATIVE_SETUP_STUDENT_PASSWORD: Password for the student user

## files/plugins.json
This file is required if `moodle_dev_env` role is not used. Get the current version from
[ProjektAdLer/MoodleAdlerLMS/files/plugin.json](https://github.com/ProjektAdLer/MoodleAdlerLMS/blob/main/plugins.json).
See plugins.json.sample for an example.

If this plugin is used in the [AdLer LMS Moodle image](https://github.com/ProjektAdLer/MoodleAdlerLMS), the plugin.json
file is automatically copied to the `files` directory.
5 changes: 4 additions & 1 deletion classes/playbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,15 @@ protected function playbook_implementation(): void {
}

/**
* @throws invalid_parameter_exception
* @throws moodle_exception
* @returns install_plugins_model[]
*/
private function load_plugins_to_install(): array {
$filePath = __DIR__ . '/../files/plugins.json';
$jsonContent = file_get_contents($filePath);
if ($jsonContent === false) {
throw new moodle_exception('Failed to read files/plugins.json. Does it exist?');
}
$pluginsArray = json_decode($jsonContent, true);

return array_map(function ($plugin) {
Expand Down
22 changes: 0 additions & 22 deletions files/plugins.json

This file was deleted.

32 changes: 32 additions & 0 deletions files/plugins.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"package_repo": "https://packages.projekt-adler.eu/packages/moodle/",
"version": "0.1.0",
"name": "local_declarativesetup"
},
{
"package_repo": "https://packages.projekt-adler.eu/packages/moodle/",
"version": "0.1.0",
"name": "playbook_adler"
},
{
"package_repo": "https://packages.projekt-adler.eu/packages/moodle/",
"version": "5.0.0",
"name": "local_adler"
},
{
"package_repo": "https://packages.projekt-adler.eu/packages/moodle/",
"version": "4.0.1",
"name": "availability_adler"
},
{
"package_repo": "https://packages.projekt-adler.eu/packages/moodle/",
"version": "3.0.0",
"name": "mod_adleradaptivity"
},
{
"package_repo": "https://packages.projekt-adler.eu/packages/moodle/",
"version": "1.0.0",
"name": "local_logging"
}
]

0 comments on commit 9133b7d

Please sign in to comment.