]> git.mjollnir.org Git - moodle.git/commitdiff
Remove unneeded mnet_host2service records
authordonal <donal>
Fri, 15 Feb 2008 08:04:20 +0000 (08:04 +0000)
committerdonal <donal>
Fri, 15 Feb 2008 08:04:20 +0000 (08:04 +0000)
admin/mnet/mnet_services.php

index 2af3e99876549d1df59f6e4dd5287be9ff5d51e9..dddff86b3396f786dedf29f5d1ff1d16c8188585 100644 (file)
             $publish        = (isset($_POST['publish'][$key]) && $_POST['publish'][$key] == 'on')? 1 : 0;
             $subscribe      = (isset($_POST['subscribe'][$key]) && $_POST['subscribe'][$key] == 'on')? 1 : 0;
 
-            if (false == $host2service && ($publish == 1 || $subscribe == 1)) {
+            if ($publish != 1 && $subscribe != 1) {
+                if (false == $host2service) {
+                    // We don't have or need a record - do nothing!
+                } else {
+                    // We don't need the record - delete it
+                    delete_records('mnet_host2service', 'hostid', $_POST['hostid'], 'serviceid', $key);
+                }
+            } elseif (false == $host2service && ($publish == 1 || $subscribe == 1)) {
                 $host2service = new stdClass();
                 $host2service->hostid = $_POST['hostid'];
                 $host2service->serviceid = $key;