mnet: MDL-21632 - remove reference to non-existant table
Backport Jermoes patch to only mark mnet hosts as deleted rather than delete from db. Unfortunately the previous behaviour in <2.0 to mark hosts as delted wasn't at all correct due to horrible behaviour of the commit() function. This addresses tha tproblem.
This commit is contained in:
+4
-22
@@ -107,32 +107,14 @@ class mnet_peer {
|
||||
}
|
||||
|
||||
function delete() {
|
||||
if ($this->deleted) return true;
|
||||
|
||||
$users = count_records('user','mnethostid', $this->id);
|
||||
if ($users > 0) {
|
||||
$this->deleted = 1;
|
||||
$this->updateparams->deleted = 1;
|
||||
if ($this->deleted) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$actions = count_records('mnet_log','hostid', $this->id);
|
||||
if ($actions > 0) {
|
||||
$this->deleted = 1;
|
||||
$this->updateparams->deleted = 1;
|
||||
}
|
||||
|
||||
$obj = delete_records('mnet_rpc2host', 'host_id', $this->id);
|
||||
|
||||
$this->delete_all_sessions();
|
||||
|
||||
// If we don't have any activity records for which the mnet_host table
|
||||
// provides a foreign key, then we can delete the record. Otherwise, we
|
||||
// just mark it as deleted.
|
||||
if (0 == $this->deleted) {
|
||||
delete_records('mnet_host', "id", $this->id);
|
||||
} else {
|
||||
$this->commit();
|
||||
}
|
||||
$this->updateparams->deleted = 1;
|
||||
$this->commit();
|
||||
}
|
||||
|
||||
function count_live_sessions() {
|
||||
|
||||
Reference in New Issue
Block a user