Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

File Size: 267 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: autosave_manager  - X-Ref

Autosave Manager.

__construct(int $contextid,string $pagehash,string $pageinstance,string $elementid,?stdClass $user = null)   X-Ref
Constructor for the autosave manager.

param: int $contextid The contextid of the session
param: string $pagehash The page hash
param: string $pageinstance The page instance
param: string $elementid The element id
param: null|stdClass $user The user object for the owner of the autosave

get_autosave_record()   X-Ref
Get the autosave record for this session.

return: stdClass|null

create_autosave_record(string $drafttext, ?int $draftid = null)   X-Ref
Create an autosave record for the session.

param: string $drafttext The draft text to save
param: null|int $draftid The draft file area if one is used
return: stdClass The autosave record

update_autosave_record(string $drafttext)   X-Ref
Update the text of the autosave session.

param: string $drafttext The text to save
return: stdClass The updated record

resume_autosave_session(?int $draftid = null)   X-Ref
Resume an autosave session, updating the draft file area if relevant.

param: null|int $draftid The draft file area to update
return: stdClass The updated autosave record

is_autosave_stale(stdClass $record)   X-Ref
Check whether the autosave data is stale.

Records are considered stale if either of the following conditions are true:
- The record is older than the stale period
- Any of the files in the draft area are newer than the autosave data itself

param: stdClass $record The autosave record
return: bool Whether the record is stale

update_draftid_for_record(stdClass $record, int $newdraftid)   X-Ref
Move the files relating to the autosave session to a new draft file area.

param: stdClass $record The autosave record
param: int $newdraftid The new draftid to move files to
return: stdClass The updated autosave record

remove_autosave_record()   X-Ref
Remove the autosave record.