Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Expiry Data.

Copyright: 2018 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 207 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: expiry_info  - X-Ref

Expiry Data.

__construct(bool $default, bool $defaultprotected, array $expired, array $unexpired, array $protectedroles)   X-Ref
Constructor for the expiry_info class.

param: bool    $default Whether the default expiry period for this context has been reached.
param: bool    $defaultprotected Whether the default expiry is protected.
param: int[]   $expired A list of roles in this context which have explicitly expired.
param: int[]   $unexpired A list of roles in this context which have not yet expired.
param: int[]   $protectedroles A list of unexpired roles in this context which are protected.

is_fully_expired()   X-Ref
Whether this context has 'fully' expired.
That is to say that the default retention period has been reached, and that there are no unexpired roles.

return: bool

is_any_expired()   X-Ref
Whether any part of this context has expired.

return: bool

get_expired_roles()   X-Ref
Get the list of explicitly expired role IDs.
Note: This does not list roles which have been expired via the default retention policy being reached.

return: int[]

is_role_expired(int $roleid)   X-Ref
Check whether the specified role is explicitly expired.
Note: This does not list roles which have been expired via the default retention policy being reached.

param: int $roleid
return: bool

is_default_expired()   X-Ref
Whether the default retention policy has been reached.

return: bool

is_default_protected()   X-Ref
Whether the default purpose is protected.

return: bool

get_unexpired_roles()   X-Ref
Get the list of unexpired role IDs.

return: int[]

get_unexpired_protected_roles()   X-Ref
Get the list of unexpired protected roles.

return: int[]

get_unprotected_overridden_roles()   X-Ref
Get a list of all overridden roles which are unprotected.

return: int[]

merge_with_child(expiry_info $child)   X-Ref
Merge this expiry_info object with another belonging to a child context in order to set the 'safest' heritage.

It is not possible to delete any part of a context that is not deleted by a parent.
So if a course's retention policy has been reached, then only parts where the children have also expired can be
deleted.

param: expiry_info $child The child record to merge with.
return: $this