[vhffs-dev] [1613] Added stats about Mercurial repositories

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


Revision: 1613
Author:   xavier
Date:     2010-08-06 23:14:15 +0200 (Fri, 06 Aug 2010)
Log Message:
-----------
Added stats about Mercurial repositories

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-06-06 21:47:27 UTC (rev 1612)
+++ trunk/vhffs-api/src/Vhffs/Stats.pm	2010-08-06 21:14:15 UTC (rev 1613)
@@ -374,6 +374,29 @@
 }
 
 
+sub get_mercurial_in_moderation
+{
+    my $self = shift;
+    unless(defined $self->{mercurial}{awaiting_validation}) {
+        my $sql = 'SELECT COUNT(*) FROM vhffs_mercurial w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+        ($self->{mercurial}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+
+    }
+    return $self->{mercurial}{awaiting_validation};
+}
+
+
+sub get_mercurial_activated
+{
+    my $self = shift;
+    unless(defined $self->{mercurial}{activated}) {
+        my $sql = 'SELECT COUNT(*) FROM vhffs_mercurial w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state='.Vhffs::Constants::ACTIVATED;
+        ($self->{'mercurial'}{activated}) = @{$self->{db}->selectrow_arrayref( $sql )};
+    }
+    return $self->{mercurial}{activated};
+}
+
+
 sub get_mysql_in_moderation
 {
     my $self = shift;

Modified: trunk/vhffs-panel/admin/stats.pl
===================================================================
--- trunk/vhffs-panel/admin/stats.pl	2010-06-06 21:47:27 UTC (rev 1612)
+++ trunk/vhffs-panel/admin/stats.pl	2010-08-06 21:14:15 UTC (rev 1613)
@@ -135,6 +135,12 @@
 	$template->param( TEXT_TOTAL_GIT_ACTIVATED => gettext("Total activated GIT") );
 	$template->param( VALUE_TOTAL_GIT_ACTIVATED => $stats->get_git_activated );
 
+	$template->param( TEXT_MERCURIAL => gettext("MERCURIAL stats") );
+	$template->param( TEXT_TOTAL_MERCURIAL_IN_MODERATION => gettext("Total MERCURIAL in moderation") );
+	$template->param( VALUE_TOTAL_MERCURIAL_IN_MODERATION => $stats->get_mercurial_in_moderation );
+	$template->param( TEXT_TOTAL_MERCURIAL_ACTIVATED => gettext("Total activated MERCURIAL") );
+	$template->param( VALUE_TOTAL_MERCURIAL_ACTIVATED => $stats->get_mercurial_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-06-06 21:47:27 UTC (rev 1612)
+++ trunk/vhffs-panel/templates/admin/misc/stats.tmpl	2010-08-06 21:14:15 UTC (rev 1613)
@@ -63,6 +63,14 @@
 </ul>
 
 <h2>
+	<TMPL_VAR ESCAPE=1 NAME="TEXT_MERCURIAL">: 
+</h2>
+<ul>
+	<li><TMPL_VAR ESCAPE=1 NAME="TEXT_TOTAL_MERCURIAL_IN_MODERATION">: <TMPL_VAR ESCAPE=1 NAME="VALUE_TOTAL_MERCURIAL_IN_MODERATION"></li>
+	<li><TMPL_VAR ESCAPE=1 NAME="TEXT_TOTAL_MERCURIAL_ACTIVATED">: <TMPL_VAR ESCAPE=1 NAME="VALUE_TOTAL_MERCURIAL_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-06-06 21:47:27 UTC (rev 1612)
+++ trunk/vhffs-public/extern/stats.pl	2010-08-06 21:14:15 UTC (rev 1613)
@@ -93,6 +93,11 @@
 $output .= '  <activated>'.$stats->get_git_activated.'</activated>'."\n";
 $output .= '</service>'."\n";
 
+$output .= '<service name="mercurial">'."\n";
+$output .= '  <awaitingmoderation>'.$stats->get_mercurial_in_moderation.'</awaitingmoderation>'."\n";
+$output .= '  <activated>'.$stats->get_mercurial_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/