bug 1136: Use optimised SQL query from bug #922
authorMichael Tänzer <neo@nhng.de>
Tue, 6 Aug 2013 21:37:06 +0000 (23:37 +0200)
committerMichael Tänzer <neo@nhng.de>
Tue, 6 Aug 2013 21:58:06 +0000 (23:58 +0200)
Signed-off-by: Michael Tänzer <neo@nhng.de>
includes/notary.inc.php

index 1ca6ba1..5fd64f1 100644 (file)
        function revoke_all_server_cert($domainid){
                //revokes all server certs for an domain
                $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` = '$domainid'
+                       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))
                {