[vhffs-dev] [491] This should avoid tons of useless log messages

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


Revision: 491
Author:   beuss
Date:     2007-02-22 07:47:02 +0000 (Thu, 22 Feb 2007)

Log Message:
-----------
This should avoid tons of useless log messages

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-robots/src/update_quota_used.pl


Modified: branches/vhffs_4.1/vhffs-robots/src/update_quota_used.pl
===================================================================
--- branches/vhffs_4.1/vhffs-robots/src/update_quota_used.pl	2007-02-20 20:05:24 UTC (rev 490)
+++ branches/vhffs_4.1/vhffs-robots/src/update_quota_used.pl	2007-02-22 07:47:02 UTC (rev 491)
@@ -48,25 +48,20 @@
 my $groups = Vhffs::Group::getall( $vhffs , Vhffs::Constants::ACTIVATED );
 my $group;
 my $blocks;
-my $inodes;
-my $su;
+my $used;
 my $dev = Quota::getqcarg($vhffs->get_config->get_datadir);
 
-foreach $group ( @{$groups} )
-{
-	if( $group->fetch > 0 )
-	{
-		($blocks,undef,undef,undef,$inodes,undef,undef,undef) = Quota::query($dev, $group->get_gid, 1);
-		if ( defined $blocks )
-		{
-			$su = ($blocks+1024-($blocks%1024))/1024;
-			$group->set_quota_used( $su );
-			if( $group->commit > 0 )
-			{
-				Vhffs::Robots::vhffs_log( sprintf( "Update quota used for group %s set %s" , $group->get_groupname , $su ) , $vhffs);
-			}
-		}
-	}
+foreach $group ( @$groups ) {
+	($blocks,undef,undef,undef,undef,undef,undef,undef) = Quota::query($dev, $group->get_gid, 1);
+    if(defined($blocks)) {
+        $used = ($blocks + 1024 - ($blocks % 1024)) / 1024;
+        if($group->get_quota_used() != $used) {
+            $group->set_quota_used( $used );
+            if( $group->commit > 0 ) {
+    			Vhffs::Robots::vhffs_log( sprintf( "Update quota used for group %s set %s" , $group->get_groupname , $used ) , $vhffs);
+		    }
+	    }   
+    }
 }
 
 Vhffs::Robots::unlock( $vhffs );


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