[feladat @ 218]
authorpeter
Sun, 30 Mar 2008 13:50:39 +0000
changeset 115 b1d7998a903e
parent 114 7c8af2b598eb
child 116 cc09385a62aa
[feladat @ 218] Little modification to speed up the zone listing in pgSQL.
inc/record.inc.php
--- a/inc/record.inc.php	Sun Mar 30 12:45:05 2008 +0000
+++ b/inc/record.inc.php	Sun Mar 30 13:50:39 2008 +0000
@@ -732,6 +732,9 @@
 function zone_count_ng($perm, $letterstart=all) {
 	global $db;
 	global $sql_regexp;
+
+	$fromTable = 'domains';
+
 	if ($perm != "own" && $perm != "all") {
 		$zone_count = "0";
 	} 
@@ -740,6 +743,7 @@
 		if ($perm == "own") {
 			$sql_add = " AND zones.domain_id = domains.id
 					AND zones.owner = ".$db->quote($_SESSION['userid']);
+			$fromTable .= ',zones';
 		}
 		if ($letterstart!=all && $letterstart!=1) {
 			$sql_add .=" AND domains.name LIKE ".$db->quote($letterstart."%")." ";
@@ -748,8 +752,7 @@
 		}
 
 		$sqlq = "SELECT COUNT(distinct domains.id) AS count_zones 
-			FROM domains,zones 
-			WHERE 1=1
+			FROM ".$fromTable."	WHERE 1=1
 			".$sql_add.";";
 
 		$zone_count = $db->queryOne($sqlq);