-
Bug
-
Resolution: Fixed
-
Blocker
-
4.2
-
MOODLE_402_STABLE
-
MOODLE_402_STABLE
-
MDL-77958-master -
I'm just taking a look at the Moodlenet API, and I have to say I think we need to make some improvements before release. Nothing major, but stuff that should not have even passed PR.
moodlenet_client
create_resource_from_file
- missing type hints for description
- missing return type decs
- This should 100% NOT take an array of $filedata. Why do we think it needs to?
This should just take a single stored_file param:public function create_resource_from_stored_file(
stored_file $file,
string $resourcename,
string $resourcedescription,
): ResponseInterface;
- The prepare_file_share_request_data has the same problem.
- As do all of the API calls leading up to this. The whole file preparation is wrong.
We should try really hard not to store file content in memory. So:- activity_packager::package should just return a stored_file.
- etc.
- We should then make prepare_file_share_request_data take a a filename, mimetype, and important a psr7 StreamInterface
- This means that we can stream the file straight from the filesystem without ever loading it into memory at all.
This is mega important for performance!!
To do so we need to introduce a new method to:- stored_file
- file_system
I'd consider this a must fix because this is a part of the public API which will be hard to change.
- is a regression caused by
-
MDL-75316 (PARENT) Implement LMS foundation for sharing content to MoodleNet (share activities)
-
- Closed
-