static function removePorts($DeviceID) { /* Remove all ports from a device prior to delete, etc */ global $dbh; $dev = new Device(); // make sure we have a real device first $dev->DeviceID = $DeviceID; if (!$dev->GetDevice()) { return false; } // Check the user's permissions to modify this device if ($dev->Rights != 'Write') { return false; } DevicePorts::removeConnections($DeviceID); $sql = "DELETE FROM fac_Ports WHERE DeviceID={$dev->DeviceID};"; $dbh->exec($sql); return true; }