[vhffs-dev] [2011] Remorked Vhffs::Stats, Vhffs::ObjectFactory, Vhffs::Functions, Vhffs ::Constants, Vhffs::Services.

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


Revision: 2011
Author:   gradator
Date:     2012-02-16 23:15:09 +0100 (Thu, 16 Feb 2012)
Log Message:
-----------
Remorked Vhffs::Stats, Vhffs::ObjectFactory, Vhffs::Functions, Vhffs::Constants, Vhffs::Services.

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Constants.pm
    trunk/vhffs-api/src/Vhffs/Functions.pm
    trunk/vhffs-api/src/Vhffs/Listengine.pm
    trunk/vhffs-api/src/Vhffs/Main.pm
    trunk/vhffs-api/src/Vhffs/ObjectFactory.pm
    trunk/vhffs-api/src/Vhffs/Panel/Auth.pm
    trunk/vhffs-api/src/Vhffs/Panel/Public.pm
    trunk/vhffs-api/src/Vhffs/Panel/Stats.pm
    trunk/vhffs-api/src/Vhffs/Services.pm
    trunk/vhffs-api/src/Vhffs/Stats.pm

Modified: trunk/vhffs-api/src/Vhffs/Constants.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Constants.pm	2012-02-16 00:06:27 UTC (rev 2010)
+++ trunk/vhffs-api/src/Vhffs/Constants.pm	2012-02-16 22:15:09 UTC (rev 2011)
@@ -104,42 +104,84 @@
 		Vhffs::Constants::MODIFICATION_APPLIED => 'Modification applied',
 		Vhffs::Constants::TO_DELETE => 'Will be deleted',
 	},
-	# Types strings that are going to be read by humans
-	TYPES_STRINGS => {
-		Vhffs::Constants::TYPE_USER => 'User',
-		Vhffs::Constants::TYPE_GROUP => 'Group',
-		Vhffs::Constants::TYPE_WEB => 'Webarea',
-		Vhffs::Constants::TYPE_REPOSITORY => 'Download Repository',
-		Vhffs::Constants::TYPE_MYSQL => 'MySQL DB',
-		Vhffs::Constants::TYPE_PGSQL => 'PgSQL DB',
-		Vhffs::Constants::TYPE_CVS => 'CVS Repository',
-		Vhffs::Constants::TYPE_SVN => 'SVN Repository',
-		Vhffs::Constants::TYPE_GIT => 'GIT Repository',
-		Vhffs::Constants::TYPE_MERCURIAL => 'Mercurial Repository',
-		Vhffs::Constants::TYPE_BAZAAR => 'Bazaar Repository',
-		Vhffs::Constants::TYPE_DNS => 'Domain Name',
-		Vhffs::Constants::TYPE_MAIL => 'Mail Domain',
-		Vhffs::Constants::TYPE_ML => 'Mailing List',
-		Vhffs::Constants::TYPE_CRON => 'Cron job',
+	# Types strings
+	TYPES => {
+		Vhffs::Constants::TYPE_USER => {
+			name => 'User',
+			fs => 'user',
+			class => 'Vhffs::User',
+		},
+		Vhffs::Constants::TYPE_GROUP => {
+			name => 'Group',
+			fs => 'group',
+			class => 'Vhffs::Group',
+		},
+		Vhffs::Constants::TYPE_WEB => {
+			name => 'Webarea',
+			fs => 'web',
+			class => 'Vhffs::Services::Web',
+		},
+		Vhffs::Constants::TYPE_REPOSITORY => {
+			name => 'Download Repository',
+			fs => 'repository',
+			class => 'Vhffs::Services::Repository',
+		},
+		Vhffs::Constants::TYPE_MYSQL => {
+			name => 'MySQL DB',
+			fs => 'mysql',
+			class => 'Vhffs::Services::Mysql',
+		},
+		Vhffs::Constants::TYPE_PGSQL => {
+			name => 'PgSQL DB',
+			fs => 'postgresql',
+			class => 'Vhffs::Services::Pgsql',
+		},
+		Vhffs::Constants::TYPE_CVS => {
+			name => 'CVS Repository',
+			fs => 'cvs',
+			class => 'Vhffs::Services::Cvs',
+		},
+		Vhffs::Constants::TYPE_SVN => {
+			name => 'SVN Repository',
+			fs => 'svn',
+			class => 'Vhffs::Services::Svn',
+		},
+		Vhffs::Constants::TYPE_GIT => {
+			name => 'GIT Repository',
+			fs => 'git',
+			class => 'Vhffs::Services::Git',
+		},
+		Vhffs::Constants::TYPE_MERCURIAL => {
+			name => 'Mercurial Repository',
+			fs => 'mercurial',
+			class => 'Vhffs::Services::Mercurial',
+		},
+		Vhffs::Constants::TYPE_BAZAAR => {
+			name => 'Bazaar Repository',
+			fs => 'bazaar',
+			class => 'Vhffs::Services::Bazaar',
+		},
+		Vhffs::Constants::TYPE_DNS => {
+			name => 'Domain Name',
+			fs => 'dns',
+			class => 'Vhffs::Services::DNS',
+		},
+		Vhffs::Constants::TYPE_MAIL => {
+			name => 'Mail Domain',
+			fs => 'mail',
+			class => 'Vhffs::Services::Mail',
+		},
+		Vhffs::Constants::TYPE_ML => {
+			name => 'Mailing List',
+			fs => 'mailinglist',
+			class => 'Vhffs::Services::MailingList',
+		},
+		Vhffs::Constants::TYPE_CRON => {
+			name => 'Cron job',
+			fs => 'cron',
+			class => 'Vhffs::Services::Cron',
+		},
 	},
-	# Types strings that are convenient for file systems (no space, lowercase)
-	TYPES_STRINGS_FS => {
-		Vhffs::Constants::TYPE_USER => 'user',
-		Vhffs::Constants::TYPE_GROUP => 'group',
-		Vhffs::Constants::TYPE_WEB => 'web',
-		Vhffs::Constants::TYPE_REPOSITORY => 'repository',
-		Vhffs::Constants::TYPE_MYSQL => 'mysql',
-		Vhffs::Constants::TYPE_PGSQL => 'postgresql',
-		Vhffs::Constants::TYPE_CVS => 'cvs',
-		Vhffs::Constants::TYPE_SVN => 'svn',
-		Vhffs::Constants::TYPE_GIT => 'git',
-		Vhffs::Constants::TYPE_MERCURIAL => 'mercurial',
-		Vhffs::Constants::TYPE_BAZAAR => 'bazaar',
-		Vhffs::Constants::TYPE_DNS => 'dns',
-		Vhffs::Constants::TYPE_MAIL => 'mail',
-		Vhffs::Constants::TYPE_ML => 'mailinglist',
-		Vhffs::Constants::TYPE_CRON => 'cron',
-	},
 };
 
 1;
@@ -223,8 +265,8 @@
 
 =head1 TYPES STRINGS
 
-my $typesstr = Vhffs::Constants::TYPES_STRINGS->{ OBJECT TYPE };
+Constants for objects: human name, name for filesystem (lowercase, without spaces), and name of VHFFS API Class
 
-=head1 TYPES STRINGS FOR FILESYSTEM
-
-my $typesstrfs = Vhffs::Constants::TYPES_STRINGS_FS->{ OBJECT TYPE };
+my $typesstr = Vhffs::Constants::TYPES->{ OBJECT TYPE }->{name};
+my $typesstrfs = Vhffs::Constants::TYPES->{ OBJECT TYPE }->{fs};
+my $class = Vhffs::Constants::TYPES->{ OBJECT TYPE }->{class};

Modified: trunk/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Functions.pm	2012-02-16 00:06:27 UTC (rev 2010)
+++ trunk/vhffs-api/src/Vhffs/Functions.pm	2012-02-16 22:15:09 UTC (rev 2011)
@@ -320,7 +320,7 @@
 =cut
 sub type_string_from_type_id($) {
 	my $type = shift;
-	return gettext( Vhffs::Constants::TYPES_STRINGS->{$type} or 'Unknown' );
+	return gettext( Vhffs::Constants::TYPES->{$type}->{'name'} or 'Unknown' );
 }
 
 =pod
@@ -334,11 +334,25 @@
 =cut
 sub type_string_fs_from_type_id($) {
 	my $type = shift;
-	return gettext( Vhffs::Constants::TYPES_STRINGS_FS->{$type} or 'unknown' );
+	return ( Vhffs::Constants::TYPES->{$type}->{'fs'} or 'unknown' );
 }
 
 =pod
 
+=head2 type_class_from_type_id
+
+	my $class = Vhffs::Functions::type_class_from_type_id( $id );
+
+Returns class from type id.
+
+=cut
+sub type_class_from_type_id($) {
+	my $type = shift;
+	return ( Vhffs::Constants::TYPES->{$type}->{'class'} or 'unknown' );
+}
+
+=pod
+
 =head2 check_domain_name
 
 	die "Domain name is invalid (you can't use FQDN)\n" unless Vhffs::Functions::check_domain_name($name);

Modified: trunk/vhffs-api/src/Vhffs/Listengine.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Listengine.pm	2012-02-16 00:06:27 UTC (rev 2010)
+++ trunk/vhffs-api/src/Vhffs/Listengine.pm	2012-02-16 22:15:09 UTC (rev 2011)
@@ -37,463 +37,410 @@
 use locale;
 use Locale::gettext;
 
+sub mail_generate_help {
+	 my $list = shift;
 
-sub mail_generate_help
-{
-    my $list = shift;
+	 my @result;
+	 push( @result , gettext("Hello and welcome on listengine help\n" ));
+	 push( @result , "\n" );
+	 push( @result , gettext( "All commands can be sent as mail subject.\n" ) );
+	 push( @result , gettext( "You can also send a command list in the mail body.\n" )  );
+	 push( @result , gettext( "All mails with commands must be sent on YOURLIST-request\@domain.tld list.\n" ) );
+	 push( @result , "\n" );
+	 push( @result , gettext("Here are the basic listengine commands:\n") );
+	 push( @result , gettext("help\t\t - show this help\n") );
+	 push( @result , gettext("subscribe\t - subscribe the shipper to the list\n") );
+	 push( @result , gettext("unsubscribe\t - unsubscribe from this list\n") );
+	 push( @result , gettext("lang [fr|us|es]\t - set listengine language\n") );
+	 push( @result , "\n" );
+	 push( @result , gettext("Only this list administrators can use the following commands.\n" )  );
+	 push( @result , gettext("subscription accept XXXXX\t\t - accept the subscription with key XXXXX\n" ) );
+	 push( @result , gettext("subscription refuse XXXXX\t\t - refuse the subscription with key XXXXX\n" ) );
+	 push( @result , gettext("moderate XXXXX\t\t\t - accept the message with message-id XXXXX\n" )  );
+	 push( @result , gettext("moderate accept XXXXX\t\t\t - accept the message with message-id XXXXX\n" ) );
+	 push( @result , gettext("moderate refused XXXXX\t\t\t - refuse the message with message-id XXXXX\n" ) );
+	 push( @result , gettext("moderate list\t\t\t - give the message list for moderation\n" ) );
+	 push( @result , gettext("user unsubscribe user\@domain.tld\t - delete user user\@domain.tld from list\n") );
+	 push( @result , gettext("user subscribe user\@domain.tld\t\t - register the user user\@domain.tld on the list\n") );
+	 push( @result , gettext("user right RIGHT user\@domain.tld\t - change right for this user\n") );
+	 push( @result , gettext("\t\t\t\t   RIGHT can be subscriber or admin\n") );
+	 push( @result , gettext("user info user\@domain.tld\t\t - show user information\n") );
 
-    my @result;
-    push( @result , gettext("Hello and welcome on listengine help\n" ));
-    push( @result , "\n" );
-    push( @result , gettext( "All commands can be sent as mail subject.\n" ) );
-    push( @result , gettext( "You can also send a command list in the mail body.\n" )  );
-    push( @result , gettext( "All mails with commands must be sent on YOURLIST-request\@domain.tld list.\n" ) );
-    push( @result , "\n" );
-    push( @result , gettext("Here are the basic listengine commands:\n") );
-    push( @result , gettext("help\t\t - show this help\n") );
-    push( @result , gettext("subscribe\t - subscribe the shipper to the list\n") );
-    push( @result , gettext("unsubscribe\t - unsubscribe from this list\n") );
-    push( @result , gettext("lang [fr|us|es]\t - set listengine language\n") );
-    push( @result , "\n" );
-    push( @result , gettext("Only this list administrators can use the following commands.\n" )  );
-    push( @result , gettext("subscription accept XXXXX\t\t - accept the subscription with key XXXXX\n" ) );
-    push( @result , gettext("subscription refuse XXXXX\t\t - refuse the subscription with key XXXXX\n" ) );
-    push( @result , gettext("moderate XXXXX\t\t\t - accept the message with message-id XXXXX\n" )  );
-    push( @result , gettext("moderate accept XXXXX\t\t\t - accept the message with message-id XXXXX\n" ) );
-    push( @result , gettext("moderate refused XXXXX\t\t\t - refuse the message with message-id XXXXX\n" ) );
-    push( @result , gettext("moderate list\t\t\t - give the message list for moderation\n" ) );
-    push( @result , gettext("user unsubscribe user\@domain.tld\t - delete user user\@domain.tld from list\n") );
-    push( @result , gettext("user subscribe user\@domain.tld\t\t - register the user user\@domain.tld on the list\n") );
-    push( @result , gettext("user right RIGHT user\@domain.tld\t - change right for this user\n") );
-    push( @result , gettext("\t\t\t\t   RIGHT can be subscriber or admin\n") );
-    push( @result , gettext("user info user\@domain.tld\t\t - show user information\n") );
-
-    push( @result , "\n" );
-    
-    return( \@result );
+	 push( @result , "\n" );
+	 
+	 return( \@result );
 }
 
-
-sub mail_new_sub
-{
-    my $list = shift;
-    my $from = shift;
-    my $pass = shift;
-    my @result;
+sub mail_new_sub {
+	 my $list = shift;
+	 my $from = shift;
+	 my $pass = shift;
+	 my @result;
  
-    push( @result , sprintf( "You sent a request to be subscribed to the following mailing list:\n  %s\n\nWith the following email:\n  %s\n\n" , $list->get_listname , $from ) );
-    push( @result , gettext( "You must confirm your request by sending a confirmation email\n")  );
-    push( @result , sprintf( gettext( "This mail must have the following subject : \"confirm subscribe %s\"\nOn most clients it should work by just replying this email\n")  , $pass ) );
-    push( @result , "\n" );
-    push( @result , gettext( "If you don't asked to be subscribed to this mailing list,\njust forget this email\n" ) );
-    push( @result , "\n" );
-    
-    return( \@result );
+	 push( @result , sprintf( "You sent a request to be subscribed to the following mailing list:\n  %s\n\nWith the following email:\n  %s\n\n" , $list->get_listname , $from ) );
+	 push( @result , gettext( "You must confirm your request by sending a confirmation email\n")  );
+	 push( @result , sprintf( gettext( "This mail must have the following subject : \"confirm subscribe %s\"\nOn most clients it should work by just replying this email\n")  , $pass ) );
+	 push( @result , "\n" );
+	 push( @result , gettext( "If you don't asked to be subscribed to this mailing list,\njust forget this email\n" ) );
+	 push( @result , "\n" );
+	 
+	 return( \@result );
 }
 
-
-sub mail_new_unsub
-{
-    my $list = shift;
-    my $from = shift;
-    my $hash = shift;
-    my @result;
+sub mail_new_unsub {
+	 my $list = shift;
+	 my $from = shift;
+	 my $hash = shift;
+	 my @result;
  
-    push( @result , sprintf( "You asked to be removed from the following list:\n\n%s\n\n" , $list->get_listname) );
-    push( @result , gettext( "You must confirm your request by sending a confirmation email\n")  );
-    push( @result , sprintf( gettext( "This mail must contains the following subject : \"confirm unsubscribe %s\"\n")  , $hash ) );
-    push( @result , "\n" );
-    push( @result , gettext( "If you haven't asked to be unsubscribed from this list,\nplease don't answer to this mail\n" ) );
-    push( @result , "\n" );
+	 push( @result , sprintf( "You asked to be removed from the following list:\n\n%s\n\n" , $list->get_listname) );
+	 push( @result , gettext( "You must confirm your request by sending a confirmation email\n")  );
+	 push( @result , sprintf( gettext( "This mail must contains the following subject : \"confirm unsubscribe %s\"\n")  , $hash ) );
+	 push( @result , "\n" );
+	 push( @result , gettext( "If you haven't asked to be unsubscribed from this list,\nplease don't answer to this mail\n" ) );
+	 push( @result , "\n" );
 
-    return( \@result );
+	 return( \@result );
 }
 
-
-sub mail_sub_already_exist
-{
-    my $list = shift;
-    my $from = shift;
-    my @result;
+sub mail_sub_already_exist {
+	 my $list = shift;
+	 my $from = shift;
+	 my @result;
  
-    push( @result , sprintf( gettext( "You asked to be subscribed to the following list:\n\n%s\n\n" ) , $list->get_listname) );
-    push( @result , sprintf( gettext( "However you are (%s) already subscribed to this list.\n")  , $from ) );
-    push( @result , "\n" );
-    push( @result , gettext( "The state of you subscription was not changed, you are still subscribed\n") );
-    push( @result , "\n" );
+	 push( @result , sprintf( gettext( "You asked to be subscribed to the following list:\n\n%s\n\n" ) , $list->get_listname) );
+	 push( @result , sprintf( gettext( "However you are (%s) already subscribed to this list.\n")  , $from ) );
+	 push( @result , "\n" );
+	 push( @result , gettext( "The state of you subscription was not changed, you are still subscribed\n") );
+	 push( @result , "\n" );
 
-    return( \@result );
+	 return( \@result );
 }
 
+sub mail_sub_deny {
+	 my $list = shift;
+	 my $from = shift;
+	 my @result;
 
-sub mail_sub_deny
-{
-    my $list = shift;
-    my $from = shift;
-    my @result;
-
-    push( @result , sprintf( gettext( "Subscription to the following list is forbidden:\n  %s\n\nHave a nice day.\n" ) , $list->get_listname) );
-    
-    return( \@result );
+	 push( @result , sprintf( gettext( "Subscription to the following list is forbidden:\n  %s\n\nHave a nice day.\n" ) , $list->get_listname) );
+	 
+	 return( \@result );
 }
 
+sub mail_confirm_sub {
+	 my $list = shift;
+	 my $from = shift;
+	 my @result;
 
-sub mail_confirm_sub
-{
-    my $list = shift;
-    my $from = shift;
-    my @result;
-
-    push( @result , sprintf( gettext( "You have been successfully subscribed to the following mailing list:\n  %s\n" ) , $list->get_listname) );
-    push( @result , gettext( "\n")  );
-    push( @result , gettext( "You may get some help on listengine by sending an email to\n") );
-    push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n")  , $list->get_localpart , $list->get_domain ) );
-    push( @result , "\n" );
-    
-    return( \@result );
+	 push( @result , sprintf( gettext( "You have been successfully subscribed to the following mailing list:\n  %s\n" ) , $list->get_listname) );
+	 push( @result , gettext( "\n")  );
+	 push( @result , gettext( "You may get some help on listengine by sending an email to\n") );
+	 push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n")  , $list->get_localpart , $list->get_domain ) );
+	 push( @result , "\n" );
+	 
+	 return( \@result );
 }
 
+sub mail_confirm_sub_approvalneeded {
+	 my $list = shift;
+	 my $from = shift;
+	 my @result;
 
-sub mail_confirm_sub_approvalneeded
-{
-    my $list = shift;
-    my $from = shift;
-    my @result;
-
-    push( @result , sprintf( gettext( "You have been successfully subscribed to the following mailing list:\n  %s\n" ) , $list->get_listname) );
-    push( @result , gettext( "\n")  );
-    push( @result , gettext( "However this list require approval for new subscribers.\n") );
-    push( @result , gettext( "You will receive an email with the decision of administrators.\n") );
-    push( @result , gettext( "\n") );
-    push( @result , gettext( "You may get some help on listengine by sending an email to\n") );
-    push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n")  , $list->get_localpart , $list->get_domain ) );
-    push( @result , "\n" );
-    
-    return( \@result );
+	 push( @result , sprintf( gettext( "You have been successfully subscribed to the following mailing list:\n  %s\n" ) , $list->get_listname) );
+	 push( @result , gettext( "\n")  );
+	 push( @result , gettext( "However this list require approval for new subscribers.\n") );
+	 push( @result , gettext( "You will receive an email with the decision of administrators.\n") );
+	 push( @result , gettext( "\n") );
+	 push( @result , gettext( "You may get some help on listengine by sending an email to\n") );
+	 push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n")  , $list->get_localpart , $list->get_domain ) );
+	 push( @result , "\n" );
+	 
+	 return( \@result );
 }
 
+sub mail_confirm_unsub {
+	 my $list = shift;
+	 my $from = shift;
+	 my @result;
 
-sub mail_confirm_unsub
-{
-    my $list = shift;
-    my $from = shift;
-    my @result;
-
-    push( @result , sprintf( gettext( "You have been successfully removed from the following list:\n  %s\n" ) , $list->get_listname) );
-    
-    return( \@result );
+	 push( @result , sprintf( gettext( "You have been successfully removed from the following list:\n  %s\n" ) , $list->get_listname) );
+	 
+	 return( \@result );
 }
 
+sub mail_error_sub {
+	 my $list = shift;
+	 my $from = shift;
+	 my @result;
 
-sub mail_error_sub
-{
-    my $list = shift;
-    my $from = shift;
-    my @result;
-
-    push( @result , sprintf( gettext( "An error occured during your subscription to the following list:\n  %s\n\n" ) , $list->get_listname) );
-    push( @result , gettext("The confirmation code was wrong\n" ));
-    push( @result , gettext("Please try again !\n" ));
-    push( @result , "\n" );
-    
-    return( \@result );
+	 push( @result , sprintf( gettext( "An error occured during your subscription to the following list:\n  %s\n\n" ) , $list->get_listname) );
+	 push( @result , gettext("The confirmation code was wrong\n" ));
+	 push( @result , gettext("Please try again !\n" ));
+	 push( @result , "\n" );
+	 
+	 return( \@result );
 }
 
+sub mail_sub_not_exist {
+	 my $list = shift;
+	 my $from = shift;
+	 
+	 my @result;
+	 
+	 push( @result , sprintf( gettext( "The following address %s is not on the following mailing list:\n  %s\n" ) , $from , $list->get_listname) );
+	 push( @result , gettext("You demand was refused\n" ));
 
-sub mail_sub_not_exist
-{
-    my $list = shift;
-    my $from = shift;
-    
-    my @result;
-    
-    push( @result , sprintf( gettext( "The following address %s is not on the following mailing list:\n  %s\n" ) , $from , $list->get_listname) );
-    push( @result , gettext("You demand was refused\n" ));
-
-    push( @result , "\n" );
-    
-    return( \@result );  
+	 push( @result , "\n" );
+	 
+	 return( \@result );  
 }
 
+sub mail_error_unsub {
+	 my $list = shift;
+	 my $from = shift;
+	 
+	 my @result;
+	 
+	 push( @result , sprintf( gettext( "You cannot unsubscribe from the list %s\n" ) , $list->get_listname) );
+	 push( @result , gettext("You are not a subscriber on this list.\n" ));
 
-sub mail_error_unsub
-{
-    my $list = shift;
-    my $from = shift;
-    
-    my @result;
-    
-    push( @result , sprintf( gettext( "You cannot unsubscribe from the list %s\n" ) , $list->get_listname) );
-    push( @result , gettext("You are not a subscriber on this list.\n" ));
-
-    push( @result , "\n" );
-    
-    return( \@result );  
+	 push( @result , "\n" );
+	 
+	 return( \@result );  
 }
 
 
-sub mail_error_unsub_hash
-{
-    my $list = shift;
-    my @result;
-    
-    push( @result , sprintf( gettext( "Unsubscribe for the list %s was not complete.\n" ) , $list->get_listname) );
-    push( @result , gettext("Confirmation code was wrong.\n" ));
-    push( @result , gettext("Please try again.\n" ));
+sub mail_error_unsub_hash {
+	 my $list = shift;
+	 my @result;
+	 
+	 push( @result , sprintf( gettext( "Unsubscribe for the list %s was not complete.\n" ) , $list->get_listname) );
+	 push( @result , gettext("Confirmation code was wrong.\n" ));
+	 push( @result , gettext("Please try again.\n" ));
 
-    push( @result , "\n" );
-    
-    return( \@result );  
+	 push( @result , "\n" );
+	 
+	 return( \@result );  
 }
 
 
-sub mail_unsub_success
-{
-    my $list = shift;
-    my @result;
-    
-    push( @result , sprintf( gettext( "You have been successfully removed from the list %s.\n" ) , $list->get_listname) );
+sub mail_unsub_success {
+	 my $list = shift;
+	 my @result;
+	 
+	 push( @result , sprintf( gettext( "You have been successfully removed from the list %s.\n" ) , $list->get_listname) );
 
-    push( @result , "\n" );
-    
-    return( \@result );  
+	 push( @result , "\n" );
+	 
+	 return( \@result );  
 }
 
 
-sub mail_lang_change_success
-{
-    my $list = shift;
-    my $from = shift;
-    my $lang = shift;
-    my @result;
-    
-    push( @result , sprintf( gettext( "The listengine language preference was changed for the following address %s.\n" ) , $from) );
-    push( @result , sprintf( gettext( "New language is: %s\n" ) , $lang) );
-    push( @result , "\n" );
-    
-    return( \@result );  
+sub mail_lang_change_success {
+	 my $list = shift;
+	 my $from = shift;
+	 my $lang = shift;
+	 my @result;
+	 
+	 push( @result , sprintf( gettext( "The listengine language preference was changed for the following address %s.\n" ) , $from) );
+	 push( @result , sprintf( gettext( "New language is: %s\n" ) , $lang) );
+	 push( @result , "\n" );
+	 
+	 return( \@result );  
 }
 
 
-sub mail_lang_change_error
-{
-    my $list = shift;
-    my $from = shift;
-    my $lang = shift;
-    my @result;
-    
-    push( @result , sprintf( gettext( "An error occured while updating language for the following address: %s.\n" ) , $from) );
-    push( @result , "\n" );
-    
-    return( \@result );  
+sub mail_lang_change_error {
+	 my $list = shift;
+	 my $from = shift;
+	 my $lang = shift;
+	 my @result;
+	 
+	 push( @result , sprintf( gettext( "An error occured while updating language for the following address: %s.\n" ) , $from) );
+	 push( @result , "\n" );
+	 
+	 return( \@result );  
 }
 
+sub mail_unknown_command {
+	 my $list = shift;
 
-sub mail_unknown_command
-{
-    my $list = shift;
-
-    my @result;
-    
-    push( @result , gettext( "Unknow command\n\n" ) );
-    push( @result , gettext( "Please read help of listengine\n" )  );
-    push( @result , gettext( "Send an email with the subject \"help\" to the following address: \n" )  );
-    push( @result , sprintf( "%s-request\@%s" , $list->get_localpart , $list->get_domain) );
-    push( @result , "\n" );
-    push( @result , "---\n" );
-    push( @result , "Listengine 4.0\n" );
-    
-    return( \@result );  
+	 my @result;
+	 
+	 push( @result , gettext( "Unknow command\n\n" ) );
+	 push( @result , gettext( "Please read help of listengine\n" )  );
+	 push( @result , gettext( "Send an email with the subject \"help\" to the following address: \n" )  );
+	 push( @result , sprintf( "%s-request\@%s" , $list->get_localpart , $list->get_domain) );
+	 push( @result , "\n" );
+	 push( @result , "---\n" );
+	 push( @result , "Listengine 4.0\n" );
+	 
+	 return( \@result );  
 }
 
+sub mail_refuse_error {
+	 my $list = shift;
+	 my $hash = shift;
 
-sub mail_refuse_error
-{
-    my $list = shift;
-    my $hash = shift;
+	 my @result;
 
-    my @result;
+	 push( @result , sprintf( gettext( "The message with the following id %s") , $hash ) );
+	 push( @result , sprintf( gettext( "present in the moderation queue for the list %s") , $list->get_listname ) );
+	 push( @result , gettext( "cannot be removed.\n" ) );
+	 push( @result , gettext( "The message does not exists or was moderated before you.\n" ) );
+	 push( @result , "\n" );
+	 push( @result , "---\n" );
+	 push( @result , "Listengine 4.0\n" );
 
-    push( @result , sprintf( gettext( "The message with the following id %s") , $hash ) );
-    push( @result , sprintf( gettext( "present in the moderation queue for the list %s") , $list->get_listname ) );
-    push( @result , gettext( "cannot be removed.\n" ) );
-    push( @result , gettext( "The message does not exists or was moderated before you.\n" ) );
-    push( @result , "\n" );
-    push( @result , "---\n" );
-    push( @result , "Listengine 4.0\n" );
-
-    return( \@result );
+	 return( \@result );
 }
 
+sub mail_refuse_success {
+	 my $list = shift;
+	 my $hash = shift;
 
-sub mail_refuse_success
-{
-    my $list = shift;
-    my $hash = shift;
+	 my @result;
 
-    my @result;
-
-    push( @result , sprintf( gettext( "Message with id: %s") , $hash ) );
-    push( @result , sprintf( gettext( "was removed from the moderation queue from the list %s") , $list->get_listname ) );
-    push( @result , "\n" );
-    push( @result , "---\n" );
-    push( @result , "Listengine 4.0\n" );
-    
-    return( \@result );
+	 push( @result , sprintf( gettext( "Message with id: %s") , $hash ) );
+	 push( @result , sprintf( gettext( "was removed from the moderation queue from the list %s") , $list->get_listname ) );
+	 push( @result , "\n" );
+	 push( @result , "---\n" );
+	 push( @result , "Listengine 4.0\n" );
+	 
+	 return( \@result );
 }
 
+sub mail_moderate_error {
+	 my $list = shift;
+	 my $hash = shift;
 
-sub mail_moderate_error
-{
-    my $list = shift;
-    my $hash = shift;
+	 my @result;
 
-    my @result;
+	 push( @result , sprintf( gettext( "Message with id: %s") , $hash ) );
+	 push( @result , sprintf( gettext( "present in the moderation queue for the list %s") , $list->get_listname ) );
+	 push( @result , gettext( "cannot be removed from the list\n" ) );
+	 push( @result , "\n" );
+	 push( @result , "---\n" );
+	 push( @result , "Listengine 4.0\n" );
 
-    push( @result , sprintf( gettext( "Message with id: %s") , $hash ) );
-    push( @result , sprintf( gettext( "present in the moderation queue for the list %s") , $list->get_listname ) );
-    push( @result , gettext( "cannot be removed from the list\n" ) );
-    push( @result , "\n" );
-    push( @result , "---\n" );
-    push( @result , "Listengine 4.0\n" );
-
-    return( \@result );
+	 return( \@result );
 }
 
+sub mail_moderate_success {
+	 my $list = shift;
+	 my $hash = shift;
 
-sub mail_moderate_success
-{
-    my $list = shift;
-    my $hash = shift;
+	 my @result;
 
-    my @result;
+	 push( @result , sprintf( gettext( "Mail with id %s") , $hash ) );
+	 push( @result , sprintf( gettext( "in the moderation queue of the list %s") , $list->get_listname ) );
+	 push( @result , gettext( "was sent on the list.\n" ) );
+	 push( @result , "\n" );
+	 push( @result , "---\n" );
+	 push( @result , "Listengine 4.0\n" );
 
-    push( @result , sprintf( gettext( "Mail with id %s") , $hash ) );
-    push( @result , sprintf( gettext( "in the moderation queue of the list %s") , $list->get_listname ) );
-    push( @result , gettext( "was sent on the list.\n" ) );
-    push( @result , "\n" );
-    push( @result , "---\n" );
-    push( @result , "Listengine 4.0\n" );
-
-    return( \@result );    
+	 return( \@result );    
 }
 
+sub mail_not_allowed {
+	 my $list = shift;
+	 my $from = shift;
 
-sub mail_not_allowed
-{
-    my $list = shift;
-    my $from = shift;
-
-    my @result;
-    
-    push( @result , sprintf( gettext( "The following address %s is not allowed to execute commands on the list %s\n") , $from , $list->get_listname ) );
-    push( @result , "\n" );
-    
-    return( \@result );  
+	 my @result;
+	 
+	 push( @result , sprintf( gettext( "The following address %s is not allowed to execute commands on the list %s\n") , $from , $list->get_listname ) );
+	 push( @result , "\n" );
+	 
+	 return( \@result );  
 }
 
-
-sub mail_moderate_message
-{
-    my $list = shift;
-    my $hash = shift;
-    my $from = shift;
-    my $subject = shift;
-    my @result;
-    
-    push( @result , sprintf( gettext( "A mail to moderate is on the following mailing list:\n  %s\n\n" ) , $list->get_listname) );
-    push( @result , sprintf( gettext( "This mail was sent by %s with the following subject:\n  %s\n\n" ) , $from, $subject) );
-    push( @result , sprintf( gettext( "To put this post on the list, send a message to:\n  %s-request\@%s\n" ) , $list->get_localpart , $list->get_domain) );
-    push( @result , sprintf( gettext( "with the following subject :\n  \"moderate %s\" \n" ) , $hash) );
-    push( @result , "\n" );
-    
-    return( \@result );  
+sub mail_moderate_message {
+	 my $list = shift;
+	 my $hash = shift;
+	 my $from = shift;
+	 my $subject = shift;
+	 my @result;
+	 
+	 push( @result , sprintf( gettext( "A mail to moderate is on the following mailing list:\n  %s\n\n" ) , $list->get_listname) );
+	 push( @result , sprintf( gettext( "This mail was sent by %s with the following subject:\n  %s\n\n" ) , $from, $subject) );
+	 push( @result , sprintf( gettext( "To put this post on the list, send a message to:\n  %s-request\@%s\n" ) , $list->get_localpart , $list->get_domain) );
+	 push( @result , sprintf( gettext( "with the following subject :\n  \"moderate %s\" \n" ) , $hash) );
+	 push( @result , "\n" );
+	 
+	 return( \@result );  
 }
 
-
-sub mail_moderate_subscriber
-{
-    my $list = shift;
-    my $from = shift;
-    my $pass = shift;
-    my @result;
-    
-    push( @result , sprintf( gettext( "A new person wants to subscribe to the following mailing list:\n  %s\n\n" ) , $list->get_listname) );
-    push( @result , sprintf( gettext( "His email address is:\n  %s\n" ) , $from) );
-    push( @result , "\n" );
-    push( @result , gettext( "To accept this subscriber, send a message to\n" ) );
-    push( @result , sprintf( gettext( "  %s-request\@%s\nwith the following subject :\n  \"subscription accept %s %s\" \n" ) , $list->get_localpart , $list->get_domain , $from, $pass) );
-    push( @result , "\n" );
-    push( @result , gettext( "To refuse this subscriber, send a message to\n" ) );
-    push( @result , sprintf( gettext( "  %s-request\@%s\nwith the following subject :\n  \"subscription refuse %s %s\" \n" ) , $list->get_localpart , $list->get_domain , $from, $pass) );
-    push( @result , "\n" );
-    
-    return( \@result );  
+sub mail_moderate_subscriber {
+	 my $list = shift;
+	 my $from = shift;
+	 my $pass = shift;
+	 my @result;
+	 
+	 push( @result , sprintf( gettext( "A new person wants to subscribe to the following mailing list:\n  %s\n\n" ) , $list->get_listname) );
+	 push( @result , sprintf( gettext( "His email address is:\n  %s\n" ) , $from) );
+	 push( @result , "\n" );
+	 push( @result , gettext( "To accept this subscriber, send a message to\n" ) );
+	 push( @result , sprintf( gettext( "  %s-request\@%s\nwith the following subject :\n  \"subscription accept %s %s\" \n" ) , $list->get_localpart , $list->get_domain , $from, $pass) );
+	 push( @result , "\n" );
+	 push( @result , gettext( "To refuse this subscriber, send a message to\n" ) );
+	 push( @result , sprintf( gettext( "  %s-request\@%s\nwith the following subject :\n  \"subscription refuse %s %s\" \n" ) , $list->get_localpart , $list->get_domain , $from, $pass) );
+	 push( @result , "\n" );
+	 
+	 return( \@result );  
 }
 
+sub mail_moderate_subscription_accepted {
+	 my $list = shift;
+	 my $from = shift;
+	 my @result;
 
-sub mail_moderate_subscription_accepted
-{
-    my $list = shift;
-    my $from = shift;
-    my @result;
-
-    push( @result , sprintf( gettext( "Your subscription was accepted to the following mailing list:\n  %s\n" ) , $list->get_listname) );
-    push( @result , gettext( "\n")  );
-    push( @result , gettext( "You may get some help on listengine by sending an email to\n") );
-    push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n")  , $list->get_localpart , $list->get_domain ) );
-    push( @result , "\n" );
-    
-    return( \@result );
+	 push( @result , sprintf( gettext( "Your subscription was accepted to the following mailing list:\n  %s\n" ) , $list->get_listname) );
+	 push( @result , gettext( "\n")  );
+	 push( @result , gettext( "You may get some help on listengine by sending an email to\n") );
+	 push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n")  , $list->get_localpart , $list->get_domain ) );
+	 push( @result , "\n" );
+	 
+	 return( \@result );
 }
 
+sub mail_moderate_subscription_accept_ack {
+	 my $list = shift;
+	 my $subscriber = shift;
+	 my @result;
 
-sub mail_moderate_subscription_accept_ack
-{
-    my $list = shift;
-    my $subscriber = shift;
-    my @result;
+	 push( @result , sprintf( gettext( "We confirm that you accepted the subscription of:\n  %s\n\nto the following mailing list:\n  %s\n\n") , $subscriber, $list->get_listname ) );
 
-    push( @result , sprintf( gettext( "We confirm that you accepted the subscription of:\n  %s\n\nto the following mailing list:\n  %s\n\n") , $subscriber, $list->get_listname ) );
-
-    return( \@result );    
+	 return( \@result );    
 }
 
+sub mail_moderate_subscription_refused {
+	 my $list = shift;
+	 my $from = shift;
+	 my @result;
 
-sub mail_moderate_subscription_refused
-{
-    my $list = shift;
-    my $from = shift;
-    my @result;
-
-    push( @result , sprintf( gettext( "Your subscription was refused to the following mailing list:\n  %s\n\nHave a nice day.\n" ) , $list->get_listname) );
-    
-    return( \@result );
+	 push( @result , sprintf( gettext( "Your subscription was refused to the following mailing list:\n  %s\n\nHave a nice day.\n" ) , $list->get_listname) );
+	 
+	 return( \@result );
 }
 
+sub mail_moderate_subscription_refuse_ack {
+	 my $list = shift;
+	 my $subscriber = shift;
+	 my @result;
 
-sub mail_moderate_subscription_refuse_ack
-{
-    my $list = shift;
-    my $subscriber = shift;
-    my @result;
-
-    push( @result , sprintf( gettext( "We confirm that you REFUSED the subscription of:\n  %s\n\nto the following mailing list:\n  %s\n\n") , $subscriber, $list->get_listname ) );
-    
-    return( \@result );
+	 push( @result , sprintf( gettext( "We confirm that you REFUSED the subscription of:\n  %s\n\nto the following mailing list:\n  %s\n\n") , $subscriber, $list->get_listname ) );
+	 
+	 return( \@result );
 }
 
+sub mail_moderate_subscription_error {
+	 my $list = shift;
+	 my $subscriber = shift;
+	 my @result;
 
-sub mail_moderate_subscription_error
-{
-    my $list = shift;
-    my $subscriber = shift;
-    my @result;
-
-    push( @result , sprintf( gettext( "An error occured during your approval of subscription of:\n  %s\ninto the following mailing list:\n  %s\n\n" ) , $subscriber, $list->get_listname) );
-    
-    return( \@result );
+	 push( @result , sprintf( gettext( "An error occured during your approval of subscription of:\n  %s\ninto the following mailing list:\n  %s\n\n" ) , $subscriber, $list->get_listname) );
+	 
+	 return( \@result );
 }
 
-
 1;

Modified: trunk/vhffs-api/src/Vhffs/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Main.pm	2012-02-16 00:06:27 UTC (rev 2010)
+++ trunk/vhffs-api/src/Vhffs/Main.pm	2012-02-16 22:15:09 UTC (rev 2011)
@@ -227,6 +227,26 @@
 	delete $self->{current_user};
 }
 
+=pod
+
+=head1 get_stats
+
+my $stats = $vhffs->get_stats;
+
+Returns and caches a C<Vhffs::Stats> object.
+
+$time is an optional parameter, default to 3600, the cache is not going to be flushed if data were not flushed $time seconds ago.
+
+=cut
+sub get_stats {
+	my $self = shift;
+	my $time = shift;
+	require Vhffs::Stats;
+	$self->{stats} = new Vhffs::Stats( $self ) unless defined $self->{stats};
+	$self->{stats}->flush( defined $time ? $time : 3600 );
+	return $self->{stats};
+}
+
 1;
 
 __END__

Modified: trunk/vhffs-api/src/Vhffs/ObjectFactory.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/ObjectFactory.pm	2012-02-16 00:06:27 UTC (rev 2010)
+++ trunk/vhffs-api/src/Vhffs/ObjectFactory.pm	2012-02-16 22:15:09 UTC (rev 2011)
@@ -47,29 +47,11 @@
 use strict;
 use utf8;
 use Vhffs::Constants;
+use Vhffs::Functions;
 use Vhffs::User;
 use Vhffs::Group;
 use Vhffs::Services;
 
-# Matches an object class based on its type
-my @OBJECTS_BY_TYPE;
-
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_USER] = 'Vhffs::User';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_GROUP] = 'Vhffs::Group';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_WEB] = 'Vhffs::Services::Web';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_REPOSITORY] = 'Vhffs::Services::Repository';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_MYSQL] = 'Vhffs::Services::Mysql';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_PGSQL] = 'Vhffs::Services::Pgsql';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_CVS] = 'Vhffs::Services::Cvs';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_SVN] = 'Vhffs::Services::Svn';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_GIT] = 'Vhffs::Services::Git';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_MERCURIAL] = 'Vhffs::Services::Mercurial';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_BAZAAR] = 'Vhffs::Services::Bazaar';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_DNS] = 'Vhffs::Services::DNS';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_MAIL] = 'Vhffs::Services::Mail';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_ML] = 'Vhffs::Services::MailingList';
-$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_CRON] = 'Vhffs::Services::Cron';
-
 =head2 fetch_object
 
     my $obj = Vhffs::ObjectFactory::fetch_object($vhffs, $oid);
@@ -79,16 +61,13 @@
 will call the subcall get_label method).
 
 =cut
-
 sub fetch_object {
-    my ($vhffs, $oid) = @_;
-    my $obj = Vhffs::Object::get_by_oid($vhffs, $oid);
-    return undef unless(defined $obj);
-    my $class = $OBJECTS_BY_TYPE[$obj->get_type];
-    if(defined $class) {
-        $obj = $class->fill_object($obj);
-    }
-    return $obj;
+	my ($vhffs, $oid) = @_;
+	my $obj = Vhffs::Object::get_by_oid($vhffs, $oid);
+	return undef unless defined $obj;
+	my $class = Vhffs::Functions::type_class_from_type_id($obj->get_type);
+        $obj = $class->fill_object($obj) if defined $class;
+	return $obj;
 }
 
 return 1;

Modified: trunk/vhffs-api/src/Vhffs/Panel/Auth.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Auth.pm	2012-02-16 00:06:27 UTC (rev 2010)
+++ trunk/vhffs-api/src/Vhffs/Panel/Auth.pm	2012-02-16 22:15:09 UTC (rev 2011)
@@ -54,8 +54,7 @@
 	$vars->{website} = $website;
 	$vars->{hostname} = $hostname;
 	if( $vhffs->get_config->get_panel->{'stats_on_home'} ) {
-		require Vhffs::Stats;
-		my $stats = new Vhffs::Stats( $vhffs );
+		my $stats = $vhffs->get_stats;
 		$vars->{stats} = {
 			users => $stats->get_user_total,
 			groups => $stats->get_groups_activated

Modified: trunk/vhffs-api/src/Vhffs/Panel/Public.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Public.pm	2012-02-16 00:06:27 UTC (rev 2010)
+++ trunk/vhffs-api/src/Vhffs/Panel/Public.pm	2012-02-16 22:15:09 UTC (rev 2011)
@@ -405,8 +405,7 @@
 	my $panel = shift;
 	my $vhffs = $panel->{vhffs};
 	
-	require Vhffs::Stats;
-	my $stats = new Vhffs::Stats( $vhffs );
+	my $stats = $vhffs->get_stats;
 	return unless defined $stats;
 	
 	my $output = '';

Modified: trunk/vhffs-api/src/Vhffs/Panel/Stats.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Stats.pm	2012-02-16 00:06:27 UTC (rev 2010)
+++ trunk/vhffs-api/src/Vhffs/Panel/Stats.pm	2012-02-16 22:15:09 UTC (rev 2011)
@@ -41,7 +41,6 @@
 
 use Vhffs::Constants;
 use Vhffs::Functions;
-use Vhffs::Stats;
 
 
 sub stats {
@@ -53,63 +52,63 @@
 	my $session = $panel->{'session'};
 	my $user = $panel->{'user'};
 
-	my $stats = new Vhffs::Stats( $vhffs );
+	my $stats = $vhffs->get_stats( 0 );
 	unless( defined $stats ) {
-		$panel->render('misc/message.tt', { message => gettext( "Cannot get statistics") } );
+		$panel->render('misc/message.tt', { message => gettext('Cannot get statistics') } );
 		return;
 	}
 
 	my $vars = {
-	  users_count => $stats->get_user_total,
-	  administrators_count => $stats->get_user_total_admin,
-	  moderators_count => $stats->get_user_total_moderator,
+		users_count => $stats->get_user_total,
+		administrators_count => $stats->get_user_total_admin,
+		moderators_count => $stats->get_user_total_moderator,
 
-	  groups_count => $stats->get_groups_total,
-	  activated_groups_count => $stats->get_groups_activated,
+		groups_count => $stats->get_groups_total,
+		activated_groups_count => $stats->get_groups_activated,
 
-	  waiting_web_count => $stats->get_web_in_moderation,
-	  activated_web_count => $stats->get_web_activated,
+		waiting_web_count => $stats->get_web_in_moderation,
+		activated_web_count => $stats->get_web_activated,
 
-	  waiting_dns_count => $stats->get_dns_in_moderation,
-	  activated_dns_count => $stats->get_dns_activated,
+		waiting_dns_count => $stats->get_dns_in_moderation,
+		activated_dns_count => $stats->get_dns_activated,
 
-	  waiting_cvs_count => $stats->get_cvs_in_moderation,
-	  activated_cvs_count => $stats->get_cvs_activated,
+		waiting_cvs_count => $stats->get_cvs_in_moderation,
+		activated_cvs_count => $stats->get_cvs_activated,
 
-	  waiting_svn_count => $stats->get_svn_in_moderation,
-	  activated_svn_count => $stats->get_svn_activated,
+		waiting_svn_count => $stats->get_svn_in_moderation,
+		activated_svn_count => $stats->get_svn_activated,
 
-	  waiting_git_count => $stats->get_git_in_moderation,
-	  activated_git_count => $stats->get_git_activated,
+		waiting_git_count => $stats->get_git_in_moderation,
+		activated_git_count => $stats->get_git_activated,
 
-	  waiting_mercurial_count => $stats->get_mercurial_in_moderation,
-	  activated_mercurial_count => $stats->get_mercurial_activated,
+		waiting_mercurial_count => $stats->get_mercurial_in_moderation,
+		activated_mercurial_count => $stats->get_mercurial_activated,
 
-	  waiting_bazaar_count => $stats->get_bazaar_in_moderation,
-	  activated_bazaar_count => $stats->get_bazaar_activated,
+		waiting_bazaar_count => $stats->get_bazaar_in_moderation,
+		activated_bazaar_count => $stats->get_bazaar_activated,
 
-	  waiting_mail_domains_count => $stats->get_mail_in_moderation,
-	  activated_mail_domains_count => $stats->get_mail_activated,
-	  mail_boxes_count => $stats->get_mail_total_boxes,
-	  mail_forwards_count => $stats->get_mail_total_forwards,
+		waiting_mail_domains_count => $stats->get_mail_in_moderation,
+		activated_mail_domains_count => $stats->get_mail_activated,
+		mail_boxes_count => $stats->get_mail_total_boxes,
+		mail_forwards_count => $stats->get_mail_total_forwards,
 
-	  waiting_mysql_count => $stats->get_mysql_in_moderation,
-	  activated_mysql_count => $stats->get_mysql_activated,
+		waiting_mysql_count => $stats->get_mysql_in_moderation,
+		activated_mysql_count => $stats->get_mysql_activated,
 
-	  waiting_pgsql_count => $stats->get_pgsql_in_moderation,
-	  activated_pgsql_count => $stats->get_pgsql_activated,
+		waiting_pgsql_count => $stats->get_pgsql_in_moderation,
+		activated_pgsql_count => $stats->get_pgsql_activated,
 
-	  waiting_ml_count => $stats->get_lists_in_moderation,
-	  activated_ml_count => $stats->get_lists_activated,
-	  ml_subscribers_count => $stats->get_lists_totalsubs,
+		waiting_ml_count => $stats->get_lists_in_moderation,
+		activated_ml_count => $stats->get_lists_activated,
+		ml_subscribers_count => $stats->get_lists_totalsubs,
 
-	  tag_categories_count => $stats->get_tags_categories_total,
-	  used_tags_count => $stats->get_tags_used_total,
-	  total_tags_count => $stats->get_tags_total,
-	  tagged_groups_count => $stats->get_tags_groups_total,
-	  max_tags_count => $stats->get_tags_groups_max,
-	  top10_tags => $stats->get_most_popular_tags
-	  };
+		tag_categories_count => $stats->get_tags_categories_total,
+		used_tags_count => $stats->get_tags_used_total,
+		total_tags_count => $stats->get_tags_total,
+		tagged_groups_count => $stats->get_tags_groups_total,
+		max_tags_count => $stats->get_tags_groups_max,
+		top10_tags => $stats->get_most_popular_tags
+	};
 
 	$panel->render('admin/misc/stats.tt', $vars);
 }

Modified: trunk/vhffs-api/src/Vhffs/Services.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services.pm	2012-02-16 00:06:27 UTC (rev 2010)
+++ trunk/vhffs-api/src/Vhffs/Services.pm	2012-02-16 22:15:09 UTC (rev 2011)
@@ -34,6 +34,7 @@
 
 package Vhffs::Services;
 
+# TODO: find a way to remove that
 use Vhffs::Services::Cvs;
 use Vhffs::Services::DNS;
 use Vhffs::Services::Web;

Modified: trunk/vhffs-api/src/Vhffs/Stats.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Stats.pm	2012-02-16 00:06:27 UTC (rev 2010)
+++ trunk/vhffs-api/src/Vhffs/Stats.pm	2012-02-16 22:15:09 UTC (rev 2011)
@@ -37,18 +37,16 @@
 
 =head1 SYNOPSIS
 
-    my $main = init Vhffs::Main(...);
+	my $main = init Vhffs::Main(...);
 
-    my $stats = new Vhffs::Stats($main);
-    my $lstcount = $stats->get_lists_in_moderation;
+	my $stats = new Vhffs::Stats($main);
+	my $lstcount = $stats->get_lists_in_moderation;
+	my $count = $stats->get_...
 
-    # Add some lists here...
-    # ...
+	$stats->flush();  # Flush cache
+	my $newlstcount = $stats->get_lists_in_moderation;
 
-    $stats->refresh();  # Flush cache
-    my $newlstcount = $stats->get_lists_in_moderation;
 
-
 =head1 METHODS
 
 =cut
@@ -59,509 +57,745 @@
 use strict;
 use utf8;
 
-use base qw(Vhffs::Object);
 use Vhffs::Constants;
 
 =pod
 
 =head2 new
 
-    my $stats = new Vhffs::Stats($main);
+	my $stats = new Vhffs::Stats($main);
 
-Creates a new Vhffs::Stats instance. C<$main> is
-the C<Vhffs::Main> instance used to get database
-connection.
+Creates a new Vhffs::Stats instance. C<$main> is the C<Vhffs::Main> instance used to get database connection.
 
 =cut
-sub new
-{
-    my ( $class , $main ) = @_;
-    
-    my $this = {};
-
-    
-    $this->{'main'} = $main;
-    $this->{'db'} = $main->get_db_object;
-    bless( $this , $class );
+sub new {
+	my ( $class, $main ) = @_;
+	
+	my $this = {};
+	$this->{main} = $main;
+	$this->{flushed} = time();
+	bless( $this, $class );
 }
 
 =pod
 
-=head2 refresh
+=head2 flush
 
-    $stats->refresh();
+	$stats->flush( $time );
 
-When you call a C<get_xxxx> method, data
-are fetched from database and cached. If you
-want to flush the cache, call C<refresh>.
+When you call a C<get_xxxx> method, data are fetched from database and cached. If you want to flush the cache, call C<flush>.
 
-There are very few cases where this method should
-be used.
+$time is an optional parameter, if set the cache is not going to be flushed if data were not flushed $time seconds ago.
 
 =cut
+sub flush {
+	my $self = shift;
+	my $time = shift;
 
-sub refresh {
-    my $self = shift;
-    foreach(keys(%{$self})) {
-        next if($_ eq 'main' || $_ eq 'db');
-        delete $self->{$_}
-    }
+	my $curtime = time();
+	return if defined $time and ($curtime - $self->{flushed} < $time or $self->{flushed} > $curtime);
+	delete $self->{stats};
+	$self->{flushed} = $curtime;
 }
 
 =pod
 
 =head2 get_lists_totalsubs
 
-    my $count = $stats->get_lists_totalsubs();
+	my $count = $stats->get_lists_totalsubs();
 
 Returns the count of mailing list subscribers on
 the platform.
 
 =cut
-
-sub get_lists_totalsubs
-{
-    my $self = shift;
-    unless(defined $self->{lists}{totalsubs}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_ml_subscribers';
-        ($self->{lists}{totalsubs}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{lists}{totalsubs};
+sub get_lists_totalsubs {
+	my $self = shift;
+	unless(defined $self->{stats}->{lists}->{totalsubs}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_ml_subscribers';
+		($self->{stats}->{lists}->{totalsubs}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{lists}->{totalsubs};
 }
 
 =pod
 
 =head2 get_lists_in_moderation
 
-    my $count = $stats->get_lists_in_moderation();
+	my $count = $stats->get_lists_in_moderation();
 
-Returns the count of mailing lists waiting for
-moderation.
+Returns the count of mailing lists waiting for moderation.
 
 =cut
-
-sub get_lists_in_moderation
-{
-    my $self = shift;
-    unless(defined $self->{lists}{awaiting_validation}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id AND o.state='.Vhffs::Constants::WAITING_FOR_VALIDATION;
-        ($self->{lists}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{lists}{awaiting_validation};
+sub get_lists_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{lists}->{awaiting_validation}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id AND o.state='.Vhffs::Constants::WAITING_FOR_VALIDATION;
+		($self->{stats}->{lists}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{lists}->{awaiting_validation};
 }
 
 =pod
 
-=head2 get_lists_in_activated
+=head2 get_lists_activated
 
-    my $count = $stats->get_lists_activated();
+	my $count = $stats->get_lists_activated();
 
 Returns the count of mailing lists currently activated.
 
 =cut
-
-sub get_lists_activated
-{
-    my $self = shift;
-    unless(defined $self->{lists}{activated}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id AND o.state = ?';
-        ($self->{lists}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
-    }
-    return $self->{lists}{activated};
+sub get_lists_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{lists}->{activated}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id AND o.state = ?';
+		($self->{stats}->{lists}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
+	}
+	return $self->{stats}->{lists}->{activated};
 }
 
 =pod
 
 =head2 get_lists_total
 
-    my $count = $stats->get_lists_total();
+	my $count = $stats->get_lists_total();
 
 Returns the total count of mailing lists (activated or not).
 
 =cut
-
-sub get_lists_total
-{
-    my $self = shift;
-    unless(defined $self->{lists}{total}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_ml';
-        ($self->{lists}{total}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{lists}{total};
+sub get_lists_total {
+	my $self = shift;
+	unless(defined $self->{stats}->{lists}->{total}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_ml';
+		($self->{stats}->{lists}->{total}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{lists}->{total};
 }
 
+=pod
 
+=head2 get_web_in_moderation
 
-sub get_web_in_moderation
-{
-    my $self = shift;
-    unless(defined $self->{web}{awaiting_validation}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
-        ($self->{web}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
-    }
-    return $self->{web}{awaiting_validation};
+	my $count = $stats->get_web_in_moderation();
+
+Returns the count of web areas waiting for moderation.
+
+=cut
+sub get_web_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{web}->{awaiting_validation}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+		($self->{stats}->{web}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+	}
+	return $self->{stats}->{web}->{awaiting_validation};
 }
 
-sub get_web_activated
-{
-    my $self = shift;
-    unless(defined $self->{web}{activated}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
-        ($self->{web}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )}; 
-    }
-    return $self->{web}{activated};
+=pod
+
+=head2 get_web_activated
+
+	my $count = $stats->get_web_activated();
+
+Returns the count of web areas currently activated.
+
+=cut
+sub get_web_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{web}->{activated}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+		($self->{stats}->{web}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
+	}
+	return $self->{stats}->{web}->{activated};
 }
 
+=pod
 
-sub get_user_total
-{
-    my $self = shift;
-    unless(defined $self->{users}{total}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_users';
-        ($self->{users}{total}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{users}{total};
+=head2 get_user_total
+
+	my $count = $stats->get_user_total();
+
+Returns the total count of users (activated or not).
+
+=cut
+sub get_user_total {
+	my $self = shift;
+	unless(defined $self->{stats}->{users}->{total}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_users';
+		($self->{stats}->{users}->{total}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{users}->{total};
 }
 
+=pod
 
-sub get_user_total_admin
-{
-    my $self = shift;
-    unless(defined $self->{users}{total_admin}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_users WHERE admin=?';
-        ($self->{users}{total_admin}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::USER_ADMIN )};
-    }
-    return $self->{'users'}{'total_admin'};
+=head2 get_user_total_admin
+
+	my $count = $stats->get_user_total_admin();
+
+Returns the total count of administrators.
+
+=cut
+sub get_user_total_admin {
+	my $self = shift;
+	unless(defined $self->{stats}->{users}->{total_admin}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_users WHERE admin=?';
+		($self->{stats}->{users}->{total_admin}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::USER_ADMIN )};
+	}
+	return $self->{stats}->{users}->{total_admin};
 }
 
+=pod
 
-sub get_user_total_moderator
-{
-    my $self = shift;
-    unless(defined $self->{users}{total_moderator}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_users WHERE admin=?';
-        ($self->{users}{total_moderator}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::USER_MODERATOR )};
-    }
-    return $self->{users}{total_moderator};
+=head2 get_user_total_moderator
+
+	my $count = $stats->get_user_total_moderator();
+
+Returns the total count of moderators.
+
+=cut
+sub get_user_total_moderator {
+	my $self = shift;
+	unless(defined $self->{stats}->{users}->{total_moderator}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_users WHERE admin=?';
+		($self->{stats}->{users}->{total_moderator}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::USER_MODERATOR )};
+	}
+	return $self->{stats}->{users}->{total_moderator};
 }
 
 
-sub get_dns_in_moderation
-{
-    my $self = shift;
-    unless(defined $self->{dns}{awaiting_validation}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_dns w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?';
-        ($self->{dns}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
-    }
-    return $self->{dns}{awaiting_validation};
+=pod
+
+=head2 get_dns_in_moderation
+
+	my $count = $stats->get_dns_in_moderation();
+
+Returns the count of domain name (DNS) waiting for moderation.
+
+=cut
+sub get_dns_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{dns}->{awaiting_validation}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_dns w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?';
+		($self->{stats}->{dns}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+	}
+	return $self->{stats}->{dns}->{awaiting_validation};
 }
 
-sub get_dns_activated
-{
-    my $self = shift;
-    unless(defined $self->{dns}{activated}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_dns w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?';
-        ($self->{dns}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
-    }
-    return $self->{dns}{activated};
+=pod
+
+=head2 get_dns_activated
+
+	my $count = $stats->get_dns_activated();
+
+Returns the count of domaine name (DNS) currently activated.
+
+=cut
+sub get_dns_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{dns}->{activated}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_dns w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?';
+		($self->{stats}->{dns}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
+	}
+	return $self->{stats}->{dns}->{activated};
 }
 
+=pod
 
-sub get_mail_in_moderation
-{
-    my $self = shift;
-    unless(defined $self->{mail}{awaiting_validation}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_mxdomain w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
-        ($self->{mail}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
-    }
-    return $self->{mail}{awaiting_validation};
+=head2 get_mail_in_moderation
+
+	my $count = $stats->get_mail_in_moderation();
+
+Returns the count of mail domains waiting for moderation.
+
+=cut
+sub get_mail_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{mail}->{awaiting_validation}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_mxdomain w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+		($self->{stats}->{mail}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+	}
+	return $self->{stats}->{mail}->{awaiting_validation};
 }
 
-sub get_mail_activated
-{
-    my $self = shift;
-    unless(defined $self->{mail}{activated}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_mxdomain w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
-        ($self->{mail}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
-    }
-    return $self->{mail}{activated};
+=pod
+
+=head2 get_mail_activated
+
+	my $count = $stats->get_mail_activated();
+
+Returns the count of mail domains currently activated.
+
+=cut
+sub get_mail_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{mail}->{activated}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_mxdomain w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+		($self->{stats}->{mail}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
+	}
+	return $self->{stats}->{mail}->{activated};
 }
 
-sub get_mail_total_boxes
-{
-    my $self = shift;
-    unless(defined $self->{mail}{total_boxes}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_boxes';
-        ($self->{mail}{total_boxes}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{mail}{total_boxes};
+=pod
+
+=head2 get_mail_total_boxes
+
+	my $count = $stats->get_mail_total_boxes();
+
+Returns the total count of mail boxes.
+
+=cut
+sub get_mail_total_boxes {
+	my $self = shift;
+	unless(defined $self->{stats}->{mail}->{total_boxes}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_boxes';
+		($self->{stats}->{mail}->{total_boxes}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{mail}->{total_boxes};
 }
 
-sub get_mail_total_forwards
-{
-    my $self = shift;
-    unless(defined $self->{mail}{total_forwards}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_forward';
-        ($self->{'mail'}{'total_forwards'}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{mail}{total_forwards};
+=pod
+
+=head2 get_mail_total_forwards
+
+	my $count = $stats->get_mail_total_forwards();
+
+Returns the total count of mail forwards.
+
+=cut
+sub get_mail_total_forwards {
+	my $self = shift;
+	unless(defined $self->{stats}->{mail}->{total_forwards}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_forward';
+		($self->{stats}->{mail}->{total_forwards}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{mail}->{total_forwards};
 }
 
-sub get_cvs_in_moderation
-{
-    my $self = shift;
-    unless(defined $self->{cvs}{awaiting_validation}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_cvs w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?';
-        ($self->{cvs}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
-    }
-    return $self->{cvs}{awaiting_validation};
+=pod
+
+=head2 get_cvs_in_moderation
+
+	my $count = $stats->get_cvs_in_moderation();
+
+Returns the count of CVS repositories waiting for moderation.
+
+=cut
+sub get_cvs_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{cvs}->{awaiting_validation}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_cvs w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?';
+		($self->{stats}->{cvs}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+	}
+	return $self->{stats}->{cvs}->{awaiting_validation};
 }
 
-sub get_cvs_activated
-{
-    my $self = shift;
-    unless(defined $self->{cvs}{activated}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_cvs w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?';
-        ($self->{cvs}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
-    }
-    return $self->{cvs}{activated};
+=pod
+
+=head2 get_cvs_activated
+
+	my $count = $stats->get_cvs_activated();
+
+Returns the count of CVS repositories currently activated.
+
+=cut
+sub get_cvs_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{cvs}->{activated}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_cvs w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?';
+		($self->{stats}->{cvs}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
+	}
+	return $self->{stats}->{cvs}->{activated};
 }
 
+=pod
 
-sub get_svn_in_moderation
-{
-    my $self = shift;
-    unless(defined $self->{svn}{awaiting_validation}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_svn w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
-        ($self->{svn}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+=head2 get_svn_in_moderation
 
-    }
-    return $self->{svn}{awaiting_validation};
+	my $count = $stats->get_svn_in_moderation();
+
+Returns the count of SVN repositories waiting for moderation.
+
+=cut
+sub get_svn_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{svn}->{awaiting_validation}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_svn w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+		($self->{stats}->{svn}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+
+	}
+	return $self->{stats}->{svn}->{awaiting_validation};
 }
 
+=pod
 
-sub get_svn_activated
-{
-    my $self = shift;
-    unless(defined $self->{svn}{activated}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_svn w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state='.Vhffs::Constants::ACTIVATED;
-        ($self->{'svn'}{activated}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{svn}{activated};
+=head2 get_svn_activated
+
+	my $count = $stats->get_svn_activated();
+
+Returns the count of SVN repositories currently activated.
+
+=cut
+sub get_svn_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{svn}->{activated}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_svn w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state='.Vhffs::Constants::ACTIVATED;
+		($self->{stats}->{svn}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{svn}->{activated};
 }
 
+=pod
 
-sub get_git_in_moderation
-{
-    my $self = shift;
-    unless(defined $self->{git}{awaiting_validation}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_git w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
-        ($self->{git}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+=head2 get_git_in_moderation
 
-    }
-    return $self->{git}{awaiting_validation};
+	my $count = $stats->get_git_in_moderation();
+
+Returns the count of Git repositories waiting for moderation.
+
+=cut
+sub get_git_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{git}->{awaiting_validation}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_git w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+		($self->{stats}->{git}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+
+	}
+	return $self->{stats}->{git}->{awaiting_validation};
 }
 
+=pod
 
-sub get_git_activated
-{
-    my $self = shift;
-    unless(defined $self->{git}{activated}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_git w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state='.Vhffs::Constants::ACTIVATED;
-        ($self->{'git'}{activated}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{git}{activated};
+=head2 get_git_activated
+
+	my $count = $stats->get_git_activated();
+
+Returns the count of Git repositories currently activated.
+
+=cut
+sub get_git_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{git}->{activated}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_git w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state='.Vhffs::Constants::ACTIVATED;
+		($self->{stats}->{git}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{git}->{activated};
 }
 
+=pod
 
-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 )};
+=head2 get_mercurial_in_moderation
 
-    }
-    return $self->{mercurial}{awaiting_validation};
+	my $count = $stats->get_mercurial_in_moderation();
+
+Returns the count of Mercurial repositories waiting for moderation.
+
+=cut
+sub get_mercurial_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{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->{stats}->{mercurial}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+
+	}
+	return $self->{stats}->{mercurial}->{awaiting_validation};
 }
 
+=pod
 
-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};
+=head2 get_mercurial_activated
+
+	my $count = $stats->get_mercurial_activated();
+
+Returns the count of Mercurial repositories currently activated.
+
+=cut
+sub get_mercurial_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{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->{stats}->{mercurial}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{mercurial}->{activated};
 }
 
+=pod
 
-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 )};
+=head2 get_bazaar_in_moderation
 
-    }
-    return $self->{bazaar}{awaiting_validation};
+	my $count = $stats->get_bazaar_in_moderation();
+
+Returns the count of Bazaar repositories waiting for moderation.
+
+=cut
+sub get_bazaar_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{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->{stats}->{bazaar}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+
+	}
+	return $self->{stats}->{bazaar}->{awaiting_validation};
 }
 
+=pod
 
-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};
+=head2 get_bazaar_activated
+
+	my $count = $stats->get_bazaar_activated();
+
+Returns the count of Bazaar repositories currently activated.
+
+=cut
+sub get_bazaar_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{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->{stats}->{bazaar}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{bazaar}->{activated};
 }
 
+=pod
 
-sub get_mysql_in_moderation
-{
-    my $self = shift;
-    unless(defined $self->{mysql}{awaiting_validation}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_mysql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
-        ($self->{mysql}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
-    }
-    return $self->{mysql}{awaiting_validation};
+=head2 get_mysql_in_moderation
+
+	my $count = $stats->get_mysql_in_moderation();
+
+Returns the count of Mysql databases waiting for moderation.
+
+=cut
+sub get_mysql_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{mysql}->{awaiting_validation}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_mysql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+		($self->{stats}->{mysql}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+	}
+	return $self->{stats}->{mysql}->{awaiting_validation};
 }
 
-sub get_mysql_activated
-{
-    my $self = shift;
-    unless(defined $self->{mysql}{activated}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_mysql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
-        ($self->{'mysql'}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
-    }
-    return $self->{mysql}{activated};
+=pod
+
+=head2 get_mysql_activated
+
+	my $count = $stats->get_mysql_activated();
+
+Returns the count of Mysql databaes currently activated.
+
+=cut
+sub get_mysql_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{mysql}->{activated}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_mysql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+		($self->{stats}->{mysql}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
+	}
+	return $self->{stats}->{mysql}->{activated};
 }
 
+=pod
 
-sub get_pgsql_in_moderation
-{
-    my $self = shift;
-    unless(defined $self->{pgsql}{awaiting_validation}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_pgsql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
-        ($self->{pgsql}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+=head2 get_pgsql_in_moderation
 
-    }
-    return $self->{pgsql}{awaiting_validation};
+	my $count = $stats->get_pgsql_in_moderation();
+
+Returns the count of Pgsql databases waiting for moderation.
+
+=cut
+sub get_pgsql_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{pgsql}->{awaiting_validation}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_pgsql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+		($self->{stats}->{pgsql}->{awaiting_validation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+
+	}
+	return $self->{stats}->{pgsql}->{awaiting_validation};
 }
 
-sub get_pgsql_activated
-{
-    my $self = shift;
-    unless(defined $self->{pgsql}{activated}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_pgsql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
-        ($self->{pgsql}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
-    }
-    return $self->{pgsql}{activated};
+=pod
+
+=head2 get_pgsql_activated
+
+	my $count = $stats->get_pgsql_activated();
+
+Returns the count of Pgsql databaes currently activated.
+
+=cut
+sub get_pgsql_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{pgsql}->{activated}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_pgsql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?';
+		($self->{stats}->{pgsql}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )};
+	}
+	return $self->{stats}->{pgsql}->{activated};
 }
 
-sub get_groups_in_moderation
-{
-    my $self = shift;
-    unless(defined $self->{groups}{awaiting_moderation}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id=g.object_id LEFT JOIN vhffs_users u ON u.username = g.groupname WHERE o.state = ? AND u.username IS NULL';
-        ($self->{groups}{awaiting_moderation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
-    }
-    return $self->{groups}{awaiting_moderation};
+=pod
+
+=head2 get_groups_in_moderation
+
+	my $count = $stats->get_groups_in_moderation();
+
+Returns the count of groups waiting for moderation.
+
+=cut
+sub get_groups_in_moderation {
+	my $self = shift;
+	unless(defined $self->{stats}->{groups}->{awaiting_moderation}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id=g.object_id LEFT JOIN vhffs_users u ON u.username = g.groupname WHERE o.state = ? AND u.username IS NULL';
+		($self->{stats}->{groups}->{awaiting_moderation}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )};
+	}
+	return $self->{stats}->{groups}->{awaiting_moderation};
 }
 
+=pod
 
-sub get_groups_activated
-{
-    my $self = shift;
-    unless(defined $self->{groups}{activated}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id=g.object_id LEFT JOIN vhffs_users u ON u.username = g.groupname WHERE o.state='.Vhffs::Constants::ACTIVATED.' AND u.username IS NULL';
-        ($self->{groups}{activated}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{groups}{activated};
+=head2 get_groups_activated
+
+	my $count = $stats->get_groups_activated();
+
+Returns the count of groups currently activated.
+
+=cut
+sub get_groups_activated {
+	my $self = shift;
+	unless(defined $self->{stats}->{groups}->{activated}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id=g.object_id LEFT JOIN vhffs_users u ON u.username = g.groupname WHERE o.state='.Vhffs::Constants::ACTIVATED.' AND u.username IS NULL';
+		($self->{stats}->{groups}->{activated}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{groups}->{activated};
 }
 
-sub get_groups_total
-{
-    my $self = shift;
-    unless(defined $self->{groups}{total}) {
-        my $sql = 'SELECT COUNT(*) FROM vhffs_groups g LEFT JOIN vhffs_users u ON u.username = g.groupname WHERE u.username IS NULL';
-        ($self->{groups}{total}) = @{$self->{db}->selectrow_arrayref( $sql )};
-   }
-    return $self->{groups}{total};
+=pod
+
+=head2 get_groups_total
+
+	my $count = $stats->get_groups_total();
+
+Returns the total count of groups.
+
+=cut
+sub get_groups_total {
+	my $self = shift;
+	unless(defined $self->{stats}->{groups}->{total}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_groups g LEFT JOIN vhffs_users u ON u.username = g.groupname WHERE u.username IS NULL';
+		($self->{stats}->{groups}->{total}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{groups}->{total};
 }
 
-sub get_tags_categories_total
-{
-    my $self = shift;
-    unless(defined $self->{tags_categories}{total}) {
-	my $sql = 'SELECT COUNT(*) FROM vhffs_tag_category';
-	($self->{tags_categories}{total}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{tags_categories}{total};
+=pod
+
+=head2 get_tags_categories_total
+
+	my $count = $stats->get_tags_categories_total();
+
+Returns the total count of tags categories.
+
+=cut
+sub get_tags_categories_total {
+	my $self = shift;
+	unless(defined $self->{stats}->{tags_categories}->{total}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_tag_category';
+		($self->{stats}->{tags_categories}->{total}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{tags_categories}->{total};
 }
 
-sub get_tags_total
-{
-    my $self = shift;
-    unless(defined $self->{tags}{total}) {
-	my $sql = 'SELECT COUNT(*) FROM vhffs_tag';
-	($self->{tags}{total}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{tags}{total};
+=pod
+
+=head2 get_tags_total
+
+	my $count = $stats->get_tags_total();
+
+Returns the total count of tags.
+
+=cut
+sub get_tags_total {
+	my $self = shift;
+	unless(defined $self->{stats}->{tags}->{total}) {
+		my $sql = 'SELECT COUNT(*) FROM vhffs_tag';
+		($self->{stats}->{tags}->{total}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{tags}->{total};
 }
 
-sub get_tags_used_total
-{
-    my $self = shift;
-    unless(defined $self->{tags_used}{total}) {
-	my $sql = 'SELECT COUNT(distinct tag_id) FROM vhffs_object_tag';
-	($self->{tags_used}{total}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{tags_used}{total};
+=pod
+
+=head2 get_tags_used_total
+
+	my $count = $stats->get_tags_used_total();
+
+Returns the total count of tags used.
+
+=cut
+sub get_tags_used_total {
+	my $self = shift;
+	unless(defined $self->{stats}->{tags_used}->{total}) {
+		my $sql = 'SELECT COUNT(distinct tag_id) FROM vhffs_object_tag';
+		($self->{stats}->{tags_used}->{total}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{tags_used}->{total};
 }
 
-sub get_tags_groups_total
-{
-    my $self = shift;
-    unless(defined $self->{tags_groups}{total}) {
-	my $sql = 'SELECT COUNT(distinct object_id) FROM vhffs_object_tag';
-	($self->{tags_groups}{total}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{tags_groups}{total};
+=pod
+
+=head2 get_tags_groups_total
+
+	my $count = $stats->get_tags_groups_total();
+
+Returns the total count of tags groups.
+
+=cut
+sub get_tags_groups_total {
+	my $self = shift;
+	unless(defined $self->{stats}->{tags_groups}->{total}) {
+		my $sql = 'SELECT COUNT(distinct object_id) FROM vhffs_object_tag';
+		($self->{stats}->{tags_groups}->{total}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{tags_groups}->{total};
 }
 
-sub get_most_popular_tags
-{
-    my $self = shift;
-    # well, I did not succeed to use $self->{tags}{most_popular}
-    my $tags = [];
-        my $sql = 'SELECT vhffs_tag_category.label as category, vhffs_tag.label as tag_label, COUNT(object_id) as nb_groups
-                FROM vhffs_object_tag, vhffs_tag_category, vhffs_tag
-                WHERE vhffs_tag.category_id=vhffs_tag_category.tag_category_id
-                  AND vhffs_object_tag.tag_id=vhffs_tag.tag_id
-                GROUP BY category,tag_label ORDER BY nb_groups DESC LIMIT 10';
-        my $sth = $self->{db}->prepare($sql);
-        $sth->execute() or return undef;
-        while( (my $t = $sth->fetchrow_hashref() )  ) {
-	      push @$tags, $t;
-        }
-    return $tags;
+=pod
+
+=head2 get_most_popular_tags
+
+	my $tags = $stats->get_most_popular_tags();
+
+Returns the ten most popular tags.
+
+=cut
+sub get_most_popular_tags {
+	my $self = shift;
+	# well, I did not succeed to use $self->{stats}->{tags}->{most_popular}
+	my $tags = [];
+	my $sql = 'SELECT vhffs_tag_category.label as category, vhffs_tag.label as tag_label, COUNT(object_id) as nb_groups
+	        FROM vhffs_object_tag, vhffs_tag_category, vhffs_tag
+	        WHERE vhffs_tag.category_id=vhffs_tag_category.tag_category_id
+	          AND vhffs_object_tag.tag_id=vhffs_tag.tag_id
+	        GROUP BY category,tag_label ORDER BY nb_groups DESC LIMIT 10';
+	my $sth = $self->{main}->get_db_object->prepare($sql);
+	$sth->execute() or return undef;
+	while( (my $t = $sth->fetchrow_hashref() )  ) {
+		push @$tags, $t;
+	}
+	return $tags;
 }
 
-sub get_tags_groups_max
-{
-    my $self = shift;
+=pod
 
-    unless(defined $self->{tags_groups}{max}) {
-	my $sql = 'SELECT MAX(count_tag_id) FROM (select COUNT(tag_id) as count_tag_id, object_id FROM vhffs_object_tag GROUP BY object_id) AS count_tags_groups';
-	($self->{tags_groups}{max}) = @{$self->{db}->selectrow_arrayref( $sql )};
-    }
-    return $self->{tags_groups}{max};
+=head2 get_most_popular_tags
+
+	my $tags = $stats->get_most_popular_tags();
+
+Returns the ten most popular tags.
+
+=cut
+sub get_tags_groups_max {
+	my $self = shift;
+
+	unless(defined $self->{stats}->{tags_groups}->{max}) {
+		my $sql = 'SELECT MAX(count_tag_id) FROM (select COUNT(tag_id) as count_tag_id, object_id FROM vhffs_object_tag GROUP BY object_id) AS count_tags_groups';
+		($self->{stats}->{tags_groups}->{max}) = @{$self->{main}->get_db_object->selectrow_arrayref( $sql )};
+	}
+	return $self->{stats}->{tags_groups}->{max};
 }
 
 1;
-
-


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