mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-62560 tool_dataprivacy: Fetch user purpose once
This commit is contained in:
parent
a1d51ad8c6
commit
b519dab3bd
@ -269,6 +269,8 @@ class expired_contexts_manager {
|
||||
$datalist = [];
|
||||
$expiredcontents = [];
|
||||
$pathstoskip = [];
|
||||
|
||||
$userpurpose = data_registry::get_effective_contextlevel_value(CONTEXT_USER, 'purpose');
|
||||
foreach ($fulllist as $record) {
|
||||
\context_helper::preload_from_record($record);
|
||||
$context = \context::instance_by_id($record->id, false);
|
||||
@ -291,8 +293,12 @@ class expired_contexts_manager {
|
||||
continue;
|
||||
}
|
||||
|
||||
$purposevalue = $record->purposeid !== null ? $record->purposeid : context_instance::NOTSET;
|
||||
$purpose = api::get_effective_context_purpose($context, $purposevalue);
|
||||
if ($context instanceof \context_user) {
|
||||
$purpose = $userpurpose;
|
||||
} else {
|
||||
$purposevalue = $record->purposeid !== null ? $record->purposeid : context_instance::NOTSET;
|
||||
$purpose = api::get_effective_context_purpose($context, $purposevalue);
|
||||
}
|
||||
|
||||
if ($context instanceof \context_user && !empty($record->userdeleted)) {
|
||||
$expiryinfo = static::get_expiry_info($purpose, $record->userdeleted);
|
||||
|
Loading…
x
Reference in New Issue
Block a user