bug 893: Use optimised SQL query from bug #922
authorMichael Tänzer <neo@nhng.de>
Wed, 31 Jul 2013 17:26:51 +0000 (19:26 +0200)
committerMichael Tänzer <neo@nhng.de>
Wed, 31 Jul 2013 17:26:51 +0000 (19:26 +0200)
Signed-off-by: Michael Tänzer <neo@nhng.de>
includes/notary.inc.php

index 929158e..3de0b09 100644 (file)
        //called from www/diputes.php if($type == "reallydomain") / if($action == "accept")
        //called from account_delete
                $domainid = intval($domainid);
-               $query = "select distinct `domaincerts`.`id`
-                       from `domaincerts`, `domlink`
-                       where `domaincerts`.`domid` = '$domainid'
-                       or (
-                       `domaincerts`.`id` = `domlink`.`certid`
-                       and `domlink`.`domid` = '$domainid')";
+               $query =
+                       "select `domaincerts`.`id`
+                               from `domaincerts`
+                               where `domaincerts`.`domid` = '$id'
+                       union distinct
+                       select `domaincerts`.`id`
+                               from `domaincerts`, `domlink`
+                               where `domaincerts`.`id` = `domlink`.`certid`
+                               and `domlink`.`domid` = '$domainid'";
                $dres = mysql_query($query);
                while($drow = mysql_fetch_assoc($dres))
                {