Expired contexts manager.
More...
|
const | DELETE_LIMIT = 200 |
| Number of deleted contexts for each scheduled task run.
|
|
Expired contexts manager.
- Copyright
- 2018 David Monllao
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
tool_dataprivacy\expired_contexts_manager::__construct |
( |
\progress_trace | $trace = null | ) |
|
Constructor for the expired_contexts_manager.
- Parameters
-
◆ are_user_context_dependencies_expired()
static tool_dataprivacy\expired_contexts_manager::are_user_context_dependencies_expired |
( |
\context_user | $context | ) |
|
|
staticprotected |
Determine whether the supplied user context's dependencies have expired.
This checks whether courses have expired, and some other check, but does not check whether the user themself has expired.
Although this seems unusual at first, each location calling this actually checks whether the user is elgible for deletion, irrespective if they have actually expired.
For example, a request to delete the user only cares about course dependencies and the user's lack of expiry should not block their own request to be deleted; whilst the expiry eligibility check has already tested for the user being expired.
- Parameters
-
- Return values
-
◆ check_requirements()
tool_dataprivacy\expired_contexts_manager::check_requirements |
( |
| ) |
|
|
protected |
Check that the requirements to start deleting contexts are satisified.
- Return values
-
◆ delete_expired_context()
tool_dataprivacy\expired_contexts_manager::delete_expired_context |
( |
expired_context | $expiredctx | ) |
|
|
protected |
Deletes user data from the provided context.
- Parameters
-
expired_context | $expiredctx | |
- Return values
-
◆ delete_expired_user_context()
tool_dataprivacy\expired_contexts_manager::delete_expired_user_context |
( |
expired_context | $expiredctx | ) |
|
|
protected |
Deletes user data from the provided user context.
- Parameters
-
expired_context | $expiredctx | |
◆ flag_expired_contexts()
tool_dataprivacy\expired_contexts_manager::flag_expired_contexts |
( |
| ) |
|
Flag expired contexts as expired.
- Return values
-
int[] | The number of contexts flagged as expired for courses, and users. |
◆ get_delete_limit()
tool_dataprivacy\expired_contexts_manager::get_delete_limit |
( |
| ) |
|
|
protected |
Fetch the limit for the maximum number of contexts to delete in one session.
- Return values
-
◆ get_expiry_info()
static tool_dataprivacy\expired_contexts_manager::get_expiry_info |
( |
purpose | $purpose, |
|
|
int | $comparisondate = 0 ) |
|
staticprotected |
Get the expiry info object for the specified purpose and comparison date.
- Parameters
-
purpose | $purpose | The purpose of this context |
int | $comparisondate | The date for comparison |
- Return values
-
◆ get_nested_expiry_info()
static tool_dataprivacy\expired_contexts_manager::get_nested_expiry_info |
( |
| $contextpath = '' | ) |
|
|
staticprotected |
Get the full nested set of expiry data relating to all contexts.
- Parameters
-
string | $contextpath | A contexpath to restrict results to |
- Return values
-
◆ get_nested_expiry_info_for_courses()
static tool_dataprivacy\expired_contexts_manager::get_nested_expiry_info_for_courses |
( |
| $contextpath = '' | ) |
|
|
staticprotected |
Get the full nested set of expiry data relating to course-related contexts.
- Parameters
-
string | $contextpath | A contexpath to restrict results to |
- Return values
-
◆ get_nested_expiry_info_for_user()
static tool_dataprivacy\expired_contexts_manager::get_nested_expiry_info_for_user |
( |
| $contextpath = '' | ) |
|
|
staticprotected |
Get the full nested set of expiry data.
- Parameters
-
string | $contextpath | A contexpath to restrict results to |
- Return values
-
◆ get_nested_expiry_info_from_sql()
static tool_dataprivacy\expired_contexts_manager::get_nested_expiry_info_from_sql |
( |
string | $sql, |
|
|
array | $params ) |
|
staticprotected |
Get the full nested set of expiry data given appropriate SQL.
Only contexts which have expired will be included.
- Parameters
-
string | $sql | The SQL used to select the nested information. |
array | $params | The params required by the SQL. |
- Return values
-
◆ get_privacy_manager()
tool_dataprivacy\expired_contexts_manager::get_privacy_manager |
( |
| ) |
|
|
protected |
Create a new instance of the privacy manager.
- Return values
-
◆ get_progress()
tool_dataprivacy\expired_contexts_manager::get_progress |
( |
| ) |
|
|
protected |
Get the progress tracer.
- Return values
-
◆ get_role_users_for_expired_context()
tool_dataprivacy\expired_contexts_manager::get_role_users_for_expired_context |
( |
expired_context | $expiredctx, |
|
|
context | $context ) |
|
protected |
Get the list of actual users for the combination of expired, and unexpired roles.
- Parameters
-
expired_context | $expiredctx | |
context | $context | |
- Return values
-
◆ has_expired()
static tool_dataprivacy\expired_contexts_manager::has_expired |
( |
string | $period, |
|
|
int | $comparisondate ) |
|
staticprotected |
Check whether a date is beyond the specified period.
- Parameters
-
string | $period | The Expiry Period |
int | $comparisondate | The date for comparison |
- Return values
-
◆ is_context_expired()
static tool_dataprivacy\expired_contexts_manager::is_context_expired |
( |
\context | $context | ) |
|
|
static |
Determine whether the supplied context has expired.
- Parameters
-
- Return values
-
◆ is_context_expired_or_unprotected_for_user()
static tool_dataprivacy\expired_contexts_manager::is_context_expired_or_unprotected_for_user |
( |
\context | $context, |
|
|
stdClass | $user ) |
|
static |
Determine whether the supplied context has expired or unprotected for the specified user.
- Parameters
-
context | $context | |
stdClass | $user | |
- Return values
-
◆ is_course_context_expired()
static tool_dataprivacy\expired_contexts_manager::is_course_context_expired |
( |
\context | $context | ) |
|
|
staticprotected |
Determine whether the supplied course-related context has expired.
Note: This is not necessarily a course context, but a context which is within a course.
- Parameters
-
- Return values
-
◆ is_course_context_expired_or_unprotected_for_user()
static tool_dataprivacy\expired_contexts_manager::is_course_context_expired_or_unprotected_for_user |
( |
\context | $context, |
|
|
stdClass | $user ) |
|
staticprotected |
Determine whether the supplied course-related context has expired, or is unprotected.
Note: This is not necessarily a course context, but a context which is within a course.
- Parameters
-
context | $context | |
stdClass | $user | |
- Return values
-
◆ is_course_expired()
static tool_dataprivacy\expired_contexts_manager::is_course_expired |
( |
\stdClass | $course | ) |
|
|
staticprotected |
Check whether the course has expired.
- Parameters
-
- Return values
-
◆ is_eligible_for_deletion()
static tool_dataprivacy\expired_contexts_manager::is_eligible_for_deletion |
( |
array & | $pathstoskip, |
|
|
context | $context ) |
|
staticprotected |
Check whether the supplied context would be elible for deletion.
- Parameters
-
array | $pathstoskip | A set of paths which should be skipped |
context | $context | |
- Return values
-
◆ process_approved_deletions()
tool_dataprivacy\expired_contexts_manager::process_approved_deletions |
( |
| ) |
|
Deletes the expired contexts.
- Return values
-
int[] | The number of deleted contexts. |
◆ require_all_end_dates_for_user_deletion()
static tool_dataprivacy\expired_contexts_manager::require_all_end_dates_for_user_deletion |
( |
| ) |
|
|
staticprotected |
Whether end dates are required on all courses in order for a user to be expired from them.
- Return values
-
◆ set_progress()
tool_dataprivacy\expired_contexts_manager::set_progress |
( |
\progress_trace | $trace | ) |
|
Set a specific tracer for the task.
- Parameters
-
- Return values
-
◆ update_expired_context()
tool_dataprivacy\expired_contexts_manager::update_expired_context |
( |
expired_context | $expiredctx | ) |
|
|
protected |
Update the expired context record.
Note: You should use the return value as the provided value will be used to fetch data only.
- Parameters
-
expired_context | $expiredctx | The record to update |
- Return values
-
◆ update_from_expiry_info()
tool_dataprivacy\expired_contexts_manager::update_from_expiry_info |
( |
\stdClass | $expiryrecord | ) |
|
|
protected |
Update or delete the expired_context from the expiry_info object.
This function depends upon the data structure returned from get_nested_expiry_info.
If the context is expired in any way, then an expired_context will be returned, otherwise null will be returned.
- Parameters
-
- Return values
-
The documentation for this class was generated from the following file:
- admin/tool/dataprivacy/classes/expired_contexts_manager.php