Moodle

Delete not fully setup users - separate admin setting

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.8, 1.9
  • Fix Version/s: 1.8.6, 1.9.2
  • Component/s: General
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

if (!empty($CFG->deleteunconfirmed)) {
$cuttime = $timenow - ($CFG->deleteunconfirmed * 3600);
$rs = get_recordset_sql ("SELECT id, username
FROM {$CFG->prefix}user
WHERE confirmed = ********1**********//this seems wrong
AND lastaccess > 0
AND lastaccess < $cuttime
AND deleted = 0
AND (lastname = '' OR firstname = '' OR email = '')");
while ($user = rs_fetch_next_record($rs)) {
if (delete_records('user', 'id', $user->id)) { mtrace("Deleted not fully setup user $user->username ($user->id)"); }
}
rs_close($rs);
}

Activity

Hide
Petr Škoda (skodak) added a comment -

We need to evaluate this more, but this definitely seems wrong and may result in major data loss.

Show
Petr Škoda (skodak) added a comment - We need to evaluate this more, but this definitely seems wrong and may result in major data loss.
Hide
Petr Škoda (skodak) added a comment -

imo it should do normal delete, because data might already exist in system
also it should not abuse the $CFG->deleteunconfirmed and have own setting

Show
Petr Škoda (skodak) added a comment - imo it should do normal delete, because data might already exist in system also it should not abuse the $CFG->deleteunconfirmed and have own setting
Hide
Martin Dougiamas added a comment - - edited

Yes it needs a new setting (deleteincompleteusers default 0) and yes I agree it should do a normal delete.

confirmed is probably correct as 1

Show
Martin Dougiamas added a comment - - edited Yes it needs a new setting (deleteincompleteusers default 0) and yes I agree it should do a normal delete. confirmed is probably correct as 1
Hide
Petr Škoda (skodak) added a comment -

working on this...

Show
Petr Škoda (skodak) added a comment - working on this...
Hide
Petr Škoda (skodak) added a comment -

fixed in cvs

Show
Petr Škoda (skodak) added a comment - fixed in cvs

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: