Skip to content

Commit

Permalink
minor improvements/cleanups/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Glutamat42 committed Jul 9, 2024
1 parent c48b66d commit 6b8a5f0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 71 deletions.
16 changes: 10 additions & 6 deletions classes/external/upload_course.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
use backup;
use context_coursecat;
use core_course_category;
use Exception;
use dml_exception;
use external_api;
use external_function_parameters;
use external_single_structure;
use external_value;
use invalid_parameter_exception;
use local_adler\local\exceptions\not_an_adler_course_exception;
use moodle_exception;
use required_capability_exception;
use restore_controller;
use restore_controller_exception;
use restore_dbops;
Expand All @@ -27,7 +28,7 @@ class upload_course extends external_api {
public static function execute_parameters(): external_function_parameters {
return new external_function_parameters(
array(
'category_id' => new external_value(PARAM_INT, 'ID of the category in which the course should be created. If null, the course will be created in the category with the lowest available ID. Please note that even if a user has restore permissions for a category other than the one with the lowest ID, the course restoration process will not be successful.', VALUE_DEFAULT, null),
'category_id' => new external_value(PARAM_INT, 'ID of the category in which the course should be created. If null, the course will be created in the first category the user is allowed to create a course in.', VALUE_DEFAULT, null),
'only_check_permissions' => new external_value(PARAM_BOOL, 'Check only if user has the permissions for restore. No mbz needed. Will return generic data for course name and id.', VALUE_DEFAULT, false),
'mbz' => new external_value(PARAM_FILE, 'Required (moodle tag "optional" is due to moodle limitations), except if only_check_permissions is true. MBZ as file upload. Upload the file in this field. Moodle external_api wont recognize it / this field will be empty but it can be loaded from this field via plain PHP code.', VALUE_DEFAULT, null),
)
Expand All @@ -46,14 +47,17 @@ public static function execute_returns(): external_function_parameters {
}

/**
* @param int $category_id ID of the category the course should be restored in
* @param int|null $category_id ID of the category the course should be restored in
* @param bool $only_check_permissions
* @return array
* @throws dml_exception
* @throws required_capability_exception
* @throws invalid_parameter_exception
* @throws moodle_exception
* @throws not_an_adler_course_exception
* @throws restore_controller_exception
* @throws moodle_exception
* @throws Exception
*/
public static function execute(int $category_id=null, $only_check_permissions=false): array {
public static function execute(int $category_id=null, bool $only_check_permissions=false): array {
global $USER;

// param validation except mbz
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "projekt-adler/local_adler",
"description": "Main plugin for the Adler project",
"require": {},
"require-dev": {
"mockery/mockery": "^1.5.1"
}
}
}
1 change: 1 addition & 0 deletions dev_utils/backup_test_course.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$file = reset($file);
$filepath = $file->get_contenthash();
$filepath = $CFG->dataroot . '/filedir/' . substr($filepath, 0, 2) . '/' . substr($filepath, 2, 2) . '/' . $filepath;
// $this->bc->get_results()['backup_destination']->copy_content_to_temp()
echo "Backup file path:\n";
echo $filepath . "\n";

Expand Down
60 changes: 0 additions & 60 deletions test.plantuml

This file was deleted.

1 change: 0 additions & 1 deletion test2.plantuml

This file was deleted.

4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
$plugin->version = 2024060300;
$plugin->requires = 2022112800; // Moodle version
$plugin->component = 'local_adler';
$plugin->release = '3.2.0';
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '3.2.0-dev';
$plugin->maturity = MATURITY_ALPHA;
$plugin->dependencies = array(
'local_logging' => ANY_VERSION,
);

0 comments on commit 6b8a5f0

Please sign in to comment.