[vhffs-dev] [1615] Added stats about Bazaar repositories (copied from commit 1613, thanks xavier)

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


Revision: 1615
Author:   guillaumito
Date:     2010-08-09 13:42:57 +0200 (Mon, 09 Aug 2010)
Log Message:
-----------
Added stats about Bazaar repositories (copied from commit 1613, thanks xavier)

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Stats.pm
    trunk/vhffs-panel/admin/stats.pl
    trunk/vhffs-panel/templates/admin/misc/stats.tmpl
    trunk/vhffs-public/extern/stats.pl

Modified: trunk/vhffs-api/src/Vhffs/Stats.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Stats.pm	2010-08-09 07:58:57 UTC (rev 1614)
+++ trunk/vhffs-api/src/Vhffs/Stats.pm	2010-08-09 11:42:57 UTC (rev 1615)
@@ -397,6 +397,29 @@
 }
 
 
+sub get_bazaar_in_moderation
+{
+    my $self = shift;
+    unless(defined $self->{bazaar}{awaiting_validation}) {
+        my $sql = 'SELECT COUNT(*) FROM vhffs_bazaar w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+        ($self->{bazaar}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+
+    }
+    return $self->{bazaar}{awaiting_validation};
+}
+
+
+sub get_bazaar_activated
+{
+    my $self = shift;
+    unless(defined $self->{bazaar}{activated}) {
+        my $sql = 'SELECT COUNT(*) FROM vhffs_bazaar w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state='.Vhffs::Constants::ACTIVATED;
+        ($self->{'bazaar'}{activated}) = @{$self->{db}->selectrow_arrayref( $sql )};
+    }
+    return $self->{bazaar}{activated};
+}
+
+
 sub get_mysql_in_moderation
 {
     my $self = shift;

Modified: trunk/vhffs-panel/admin/stats.pl
===================================================================
--- trunk/vhffs-panel/admin/stats.pl	2010-08-09 07:58:57 UTC (rev 1614)
+++ trunk/vhffs-panel/admin/stats.pl	2010-08-09 11:42:57 UTC (rev 1615)
@@ -141,6 +141,12 @@
 	$template->param( TEXT_TOTAL_MERCURIAL_ACTIVATED => gettext("Total activated MERCURIAL") );
 	$template->param( VALUE_TOTAL_MERCURIAL_ACTIVATED => $stats->get_mercurial_activated );
 
+	$template->param( TEXT_BAZAAR => gettext("BAZAAR stats") );
+	$template->param( TEXT_TOTAL_BAZAAR_IN_MODERATION => gettext("Total BAZAAR in moderation") );
+	$template->param( VALUE_TOTAL_BAZAAR_IN_MODERATION => $stats->get_bazaar_in_moderation );
+	$template->param( TEXT_TOTAL_BAZAAR_ACTIVATED => gettext("Total activated BAZAAR") );
+	$template->param( VALUE_TOTAL_BAZAAR_ACTIVATED => $stats->get_bazaar_activated );
+
 	$template->param( TEXT_MAIL => gettext("Mail stats") );
 	$template->param( TEXT_TOTAL_MAIL_IN_MODERATION => gettext("Total Mail domains in moderation") );
 	$template->param( VALUE_TOTAL_MAIL_IN_MODERATION => $stats->get_mail_in_moderation );

Modified: trunk/vhffs-panel/templates/admin/misc/stats.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/misc/stats.tmpl	2010-08-09 07:58:57 UTC (rev 1614)
+++ trunk/vhffs-panel/templates/admin/misc/stats.tmpl	2010-08-09 11:42:57 UTC (rev 1615)
@@ -71,6 +71,14 @@
 </ul>
 
 <h2>
+	<TMPL_VAR ESCAPE=1 NAME="TEXT_BAZAAR">: 
+</h2>
+<ul>
+	<li><TMPL_VAR ESCAPE=1 NAME="TEXT_TOTAL_BAZAAR_IN_MODERATION">: <TMPL_VAR ESCAPE=1 NAME="VALUE_TOTAL_BAZAAR_IN_MODERATION"></li>
+	<li><TMPL_VAR ESCAPE=1 NAME="TEXT_TOTAL_BAZAAR_ACTIVATED">: <TMPL_VAR ESCAPE=1 NAME="VALUE_TOTAL_BAZAAR_ACTIVATED"></li>
+</ul>
+
+<h2>
 	<TMPL_VAR ESCAPE=1 NAME="TEXT_MAIL">: 
 </h2>
 <ul>

Modified: trunk/vhffs-public/extern/stats.pl
===================================================================
--- trunk/vhffs-public/extern/stats.pl	2010-08-09 07:58:57 UTC (rev 1614)
+++ trunk/vhffs-public/extern/stats.pl	2010-08-09 11:42:57 UTC (rev 1615)
@@ -98,6 +98,11 @@
 $output .= '  <activated>'.$stats->get_mercurial_activated.'</activated>'."\n";
 $output .= '</service>'."\n";
 
+$output .= '<service name="bazaar">'."\n";
+$output .= '  <awaitingmoderation>'.$stats->get_bazaar_in_moderation.'</awaitingmoderation>'."\n";
+$output .= '  <activated>'.$stats->get_bazaar_activated.'</activated>'."\n";
+$output .= '</service>'."\n";
+
 $output .= '<service name="mail">'."\n";
 $output .= '  <awaitingmoderation>'.$stats->get_mail_in_moderation.'</awaitingmoderation>'."\n";
 $output .= '  <activated>'.$stats->get_mail_activated.'</activated>'."\n";


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