mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-81991 core: Reload accessdata for dirty users in CLI mode
This commit is contained in:
parent
ad7fc69c25
commit
ca7286c14c
@ -979,6 +979,15 @@ function get_user_accessdata($userid, $preloadonly=false) {
|
||||
$ACCESSLIB_PRIVATE->accessdatabyuser[$USER->id] = $USER->access;
|
||||
}
|
||||
|
||||
// Unfortunately, we can't use the $ACCESSLIB_PRIVATE->dirtyusers array because it is not available in CLI.
|
||||
// So we need to check if the user has been marked as dirty or not in the cache directly.
|
||||
// This will add additional queries to the database, but it is the best we can do.
|
||||
if (CLI_SCRIPT && !empty($ACCESSLIB_PRIVATE->accessdatabyuser[$userid])) {
|
||||
if (get_cache_flag('accesslib/dirtyusers', $userid, $ACCESSLIB_PRIVATE->accessdatabyuser[$userid]['time'])) {
|
||||
unset($ACCESSLIB_PRIVATE->accessdatabyuser[$userid]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($ACCESSLIB_PRIVATE->accessdatabyuser[$userid])) {
|
||||
if (empty($userid)) {
|
||||
if (!empty($CFG->notloggedinroleid)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user