[vhffs-dev] [441] get_used_letters takes only activated websites in account (by default ).

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 441
Author:   beuss
Date:     2007-02-04 14:01:30 +0000 (Sun, 04 Feb 2007)

Log Message:
-----------
get_used_letters takes only activated websites in account (by default). Letters are sorted.

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm


Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm	2007-02-04 13:58:37 UTC (rev 440)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm	2007-02-04 14:01:30 UTC (rev 441)
@@ -431,9 +431,11 @@
 # 0 site letters aren't stored.
 sub get_used_letters {
     my $main = shift;
-    my $sql = 'SELECT substr(servername, 1, 1) as letter, COUNT(*) as count FROM vhffs_httpd GROUP BY substr(servername, 1, 1)';
+    my $state = shift;
+    $state = Vhffs::Constants::ACTIVATED unless(defined $state);
+    my $sql = 'SELECT substr(servername, 1, 1) as letter, COUNT(*) as count FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE state = ? GROUP BY substr(servername, 1, 1) ORDER BY substr(servername, 1, 1)';
     my $dbh = $main->get_db_object;
-    return $dbh->selectall_arrayref($sql, { Slice => {} });
+    return $dbh->selectall_arrayref($sql, { Slice => {} }, $state);
 
 }
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/