Moodle

Registry cache bypass in add_to_log()

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8.4, 1.9
  • Fix Version/s: 1.8.5, 1.9.1
  • Component/s: General
  • Labels:
    None
  • Environment:
    moodle with registry cache activated.
  • Database:
    Any
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

Current implementation of add_to_log() updates user lastaccess field by issuing the next instruction:

$res = $db->Execute('UPDATE '. $CFG->prefix .'user
SET lastip=\''. $REMOTE_ADDR .'\', lastaccess=\''. $timenow .'\'
WHERE id = \''. $userid .'\' AND '.$timenow.' - lastaccess > 60');

This method doesn't take care of registry caché. update_record() should be used to update that fields.

One of the actual problems has to do with messaging subsystem and email notifications being sent because of inconsistency of rcache.

Thanks in advance

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

Hi Juan,

well spotted! B-)

I've added some code to reset the corresponding rcache record. Should be ok now... applied to 18_STABLE, 19_STABLE and HEAD.

Thanks for the report and ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi Juan, well spotted! B-) I've added some code to reset the corresponding rcache record. Should be ok now... applied to 18_STABLE, 19_STABLE and HEAD. Thanks for the report and ciao
Hide
Petr Škoda (skodak) added a comment -

why not reset cache for user_lastaccess too?

Show
Petr Škoda (skodak) added a comment - why not reset cache for user_lastaccess too?
Hide
Eloy Lafuente (stronk7) added a comment -

Because that table isn't ever accessed by "id", so I think it isn't ever rcached.

Show
Eloy Lafuente (stronk7) added a comment - Because that table isn't ever accessed by "id", so I think it isn't ever rcached.
Hide
Petr Škoda (skodak) added a comment -

aaah, yes - thanks! closing as fixed

Show
Petr Škoda (skodak) added a comment - aaah, yes - thanks! closing as fixed

Dates

  • Created:
    Updated:
    Resolved: