From 026927286c33229c88301b5506183d920a4695e8 Mon Sep 17 00:00:00 2001 From: Markus Heck Date: Fri, 12 Jan 2024 17:11:59 +0100 Subject: [PATCH] add php 8.2 test environment and add support note in readme on php8.2 and moodle 4.3 --- dev_utils/load_test.py | 40 ++++++++++++++++++++++++++++ test.plantuml | 60 ++++++++++++++++++++++++++++++++++++++++++ test2.plantuml | 1 + 3 files changed, 101 insertions(+) create mode 100644 dev_utils/load_test.py create mode 100644 test.plantuml create mode 100644 test2.plantuml diff --git a/dev_utils/load_test.py b/dev_utils/load_test.py new file mode 100644 index 0000000..c806e30 --- /dev/null +++ b/dev_utils/load_test.py @@ -0,0 +1,40 @@ + +import time +import argparse +import requests +from multiprocessing import Process + + +argParser = argparse.ArgumentParser() +argParser.add_argument("-b", "--backupFile", help="", required=True) +argParser.add_argument("-a", "--atfFile", help="", required=True) +argParser.add_argument("-t", "--token", help="auth token", required=True) +argParser.add_argument("-u", "--url", help="moodle url (default: http://localhost)", default="http://localhost") +argParser.add_argument("-c", "--count", help="how often the file will be uploaded", default=10) +argParser.add_argument("-d", "--delay", help="delay between starting uploads", default=5) + +args = argParser.parse_args() + +def upload_file(): + print("Uploading backup file") + backupFile = open(args.backupFile, 'rb') + atfFile = open(args.atfFile, 'rb') + + response = requests.post( + args.url + '/api/Worlds', + files={'backupFile': backupFile.read(), 'atfFile': atfFile.read()}, + headers={'token': args.token}, + ) + + print(response.status_code) + print(response.text) + +if __name__ == "__main__": + processes = [] + for i in range(int(args.count)): + p = Process(target=upload_file) + p.start() + processes.append(p) + time.sleep(int(args.delay)) + for p in processes: + p.join() diff --git a/test.plantuml b/test.plantuml new file mode 100644 index 0000000..87c3372 --- /dev/null +++ b/test.plantuml @@ -0,0 +1,60 @@ +@startuml + +!define classdiagram +skinparam classAttributeIconSize 0 + +namespace local_adler { + class adler_score { + -course_module: object + -user_id: int + #score_item: stdClass + #helpers: string + #completion_info: string + #adler_score_helpers: string + + +__construct(course_module: object, user_id: int = null) + +get_cmid(): int + +get_score(): float + -get_h5p_score(): float + -get_primitive_score(): float + -calculate_score(max_score: float, percentage_achieved: float): float + -calculate_percentage_achieved(value: float, max: float, min: float = 0): float + } + + class helpers { + +get_course_from_course_id(course_id: int) + +delete_adler_course_record(course_id: int) + +course_is_adler_course(course_id: int): bool + +is_primitive_learning_element(course_module: object): bool + } +} + +class completion_info { +} + +class context_course { +} + +class dml_exception { +} + +class user_not_enrolled_exception { +} + +class moodle_exception { +} + +class stdClass { +} + +adler_score ..> helpers: <> +adler_score ..> completion_info: <> +adler_score ..> adler_score_helpers: <> + +adler_score .. context_course: <> +adler_score ..> dml_exception: <> +adler_score ..> user_not_enrolled_exception: <> +adler_score ..> moodle_exception: <> +adler_score -- stdClass: <> + +@enduml diff --git a/test2.plantuml b/test2.plantuml new file mode 100644 index 0000000..38466d9 --- /dev/null +++ b/test2.plantuml @@ -0,0 +1 @@ +@startuml