mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
add proper rs_close() into cleanup_contexts() - we have to close even when now records returned
This commit is contained in:
parent
77be46fdee
commit
3f7d592598
@ -2442,20 +2442,22 @@ function cleanup_contexts() {
|
||||
ON c.instanceid = t.id
|
||||
WHERE t.id IS NULL AND c.contextlevel = " . CONTEXT_GROUP . "
|
||||
";
|
||||
$rs = get_recordset_sql($sql);
|
||||
if ($rs->RecordCount()) {
|
||||
begin_sql();
|
||||
$tx = true;
|
||||
while ($tx && $ctx = rs_fetch_next_record($rs)) {
|
||||
$tx = $tx && delete_context($ctx->level, $ctx->instanceid);
|
||||
if ($rs = get_recordset_sql($sql)) {
|
||||
if ($rs->RecordCount()) {
|
||||
begin_sql();
|
||||
$tx = true;
|
||||
while ($tx && $ctx = rs_fetch_next_record($rs)) {
|
||||
$tx = $tx && delete_context($ctx->level, $ctx->instanceid);
|
||||
}
|
||||
rs_close($rs);
|
||||
if ($tx) {
|
||||
commit_sql();
|
||||
return true;
|
||||
}
|
||||
rollback_sql();
|
||||
return false;
|
||||
}
|
||||
rs_close($rs);
|
||||
if ($tx) {
|
||||
commit_sql();
|
||||
return true;
|
||||
}
|
||||
rollback_sql();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user