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:
Dan Poltawski
2010-02-17 22:15:02 +00:00
parent cdf50f82de
commit 154b2a1d7f
+4 -22
View File
@@ -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() {