Browse files

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.
  • Loading branch information...
1 parent cdf50f8 commit 154b2a1d7f49ecc78452c009df1f42a9df259272 @danpoltawski danpoltawski committed Feb 17, 2010
Showing with 4 additions and 22 deletions.
  1. +4 −22 mnet/peer.php
View
26 mnet/peer.php
@@ -107,32 +107,14 @@ function bootstrap($wwwroot, $pubkey = null, $application) {
}
function delete() {
- if ($this->deleted) return true;
-
- $users = count_records('user','mnethostid', $this->id);
- if ($users > 0) {
- $this->deleted = 1;
- $this->updateparams->deleted = 1;
- }
-
- $actions = count_records('mnet_log','hostid', $this->id);
- if ($actions > 0) {
- $this->deleted = 1;
- $this->updateparams->deleted = 1;
+ if ($this->deleted) {
+ return true;
}
- $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() {

0 comments on commit 154b2a1

Please sign in to comment.