Author: jfthomps
Date: Tue Apr 20 19:17:59 2010
New Revision: 936034

URL: http://svn.apache.org/viewvc?rev=936034&view=rev
Log:
VCL-206

vm.php: modified getVMHostData - the vmprofile table was being pulled in to the 
query for no reason; removed it

utils.php:
-modified sortKeepIndex: added ending of .edu, .com, .net, .org and checking $b 
for same as $a when checking to see if compareDashedNumbers should be called 
instead of strcasecmp
-modified compareDashedNumbers to compare full domain instead of just first part

Modified:
    incubator/vcl/trunk/web/.ht-inc/utils.php
    incubator/vcl/trunk/web/.ht-inc/vm.php

Modified: incubator/vcl/trunk/web/.ht-inc/utils.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/utils.php?rev=936034&r1=936033&r2=936034&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/utils.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/utils.php Tue Apr 20 19:17:59 2010
@@ -7151,12 +7151,18 @@ function getNodeInfo($nodeid) {
 function sortKeepIndex($a, $b) {
        if(is_array($a)) {
                if(array_key_exists("prettyname", $a)) {
-                       if(preg_match('/[0-9]-[0-9]/', $a['prettyname']))
+                       if(preg_match('/[0-9]-[0-9]/', $a['prettyname']) ||
+                          preg_match('/\.edu$|\.com$|\.net$|\.org$/', 
$a['prettyname']) ||
+                          preg_match('/[0-9]-[0-9]/', $b['prettyname']) ||
+                          preg_match('/\.edu$|\.com$|\.net$|\.org$/', 
$b['prettyname']))
                                return compareDashedNumbers($a["prettyname"], 
$b["prettyname"]);
                        return strcasecmp($a["prettyname"], $b["prettyname"]);
                }
                elseif(array_key_exists("name", $a)) {
-                       if(preg_match('/[0-9]-[0-9]/', $a['name']))
+                       if(preg_match('/[0-9]-[0-9]/', $a['name']) ||
+                          preg_match('/\.edu$|\.com$|\.net$|\.org$/', 
$a['name']) ||
+                          preg_match('/[0-9]-[0-9]/', $b['name']) ||
+                          preg_match('/\.edu$|\.com$|\.net$|\.org$/', 
$b['name']))
                                return compareDashedNumbers($a["name"], 
$b["name"]);
                        return strcasecmp($a["name"], $b["name"]);
                }
@@ -7183,12 +7189,12 @@ function compareDashedNumbers($a, $b) {
        # get hostname and first part of domain name
        $tmp = explode('.', $a);
        $h1 = array_shift($tmp);
-       $domain1 = array_shift($tmp);
+       $domain1 = implode('.', $tmp);
        $letters1 = preg_replace('([^a-zA-Z])', '', $h1);
 
        $tmp = explode('.', $b);
        $h2 = array_shift($tmp);
-       $domain2 = array_shift($tmp);
+       $domain2 = implode('.', $tmp);
        $letters2 = preg_replace('([^a-zA-Z])', '', $h2);
 
        // if different domain names, return based on that

Modified: incubator/vcl/trunk/web/.ht-inc/vm.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/vm.php?rev=936034&r1=936033&r2=936034&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/vm.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/vm.php Tue Apr 20 19:17:59 2010
@@ -397,13 +397,10 @@ function getVMHostData($id='') {
               .        "c.hostname, "
               .        "vh.vmlimit, "
               .        "vh.vmprofileid, "
-              #.        "vp.profilename, "
               .        "vh.vmkernalnic "
               . "FROM vmhost vh, " 
-              .      "vmprofile vp, "
               .      "computer c "
-              . "WHERE vh.vmprofileid = vp.id AND "
-              .       "vh.computerid = c.id";
+              . "WHERE vh.computerid = c.id";
        if(! empty($id))
                $query .= " AND vh.id = $id";
        $qh = doQuery($query, 101);


Reply via email to