public static function update_token_lastaccess($token, int $time = 0) {
        global $DB;

        if (!$time) {
            $time = time();
        }

        // Only update the field if it is a different time from previous request,
        // so as not to waste database effort.
        if ($time >= $token->lastaccess + self::TOKEN_LASTACCESS_UPDATE_SECS) {
            $DB->set_field('external_tokens', 'lastaccess', $time, array('id' => $token->id));
        }
    }
public static function update_token_lastaccess($token, int $time = 0) {
        global $DB;

        if (!$time) {
            $time = time();
        }

        // Only update the field if it is a different time from previous request,
        // so as not to waste database effort.
        if ($time >= $token->lastaccess + self::TOKEN_LASTACCESS_UPDATE_SECS) {
            $DB->set_field('external_tokens', 'lastaccess', $time, array('id' => $token->id));
        }
    }
public static function update_token_lastaccess ( $ token , int $ time = 0 ) { global $ DB ; if ( ! $ time ) { $ time = time ( ) ; } // Only update the field if it is a different time from previous request, // so as not to waste database effort. if ( $ time >= $ token -> lastaccess + self :: TOKEN_LASTACCESS_UPDATE_SECS ) { $ DB -> set_field ( 'external_tokens' , 'lastaccess' , $ time , array ( 'id' => $ token -> id ) ) ; } }
Updates the last access time for a token.

@param \stdClass $token Token object (must include id, lastaccess fields)
@param int $time Time of access (0 = use current time)
@throws dml_exception If database error
Updates the last access time for a token .