[vhffs-dev] [1003] rewrote Vhffs::Group::is_empty

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


Revision: 1003
Author:   gradator
Date:     2007-10-17 11:09:55 +0000 (Wed, 17 Oct 2007)

Log Message:
-----------
rewrote Vhffs::Group::is_empty

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Group.pm


Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm	2007-10-17 10:45:22 UTC (rev 1002)
+++ trunk/vhffs-api/src/Vhffs/Group.pm	2007-10-17 11:09:55 UTC (rev 1003)
@@ -175,89 +175,10 @@
 	return -1 if( ! defined $self);
 	my $config = $self->{'main'}->get_config;
 
-	my $rows;
-	my $query;
-	my $request;
-
-	if( $config->get_service_availability('web') == 1 ) {
-		$query ='SELECT COUNT(*) FROM vhffs_object WHERE type = ? AND owner_gid=?';
-	    $request = $self->{'db'}->prepare( $query );
-	    $request->execute( Vhffs::Constants::TYPE_WEB, $self->get_gid );
-        ($rows) = $request->fetchrow();
-		return 0 if( $rows != 0 );
-	}
-	
-	if( $config->get_service_availability('cvs') == 1 ) {
-		$query ='SELECT COUNT(*) FROM vhffs_object WHERE type = ? AND owner_gid=?';
-	    $request = $self->{'db'}->prepare( $query );
-	    $request->execute( Vhffs::Constants::TYPE_CVS, $self->get_gid );
-        ($rows) = $request->fetchrow();
-		return 0 if( $rows != 0 );
-	}
-	
-	if( $config->get_service_availability('svn') == 1 ) {
-		$query ='SELECT COUNT(*) FROM vhffs_object WHERE type = ? AND owner_gid=?';
-	    $request = $self->{'db'}->prepare( $query );
-	    $request->execute( Vhffs::Constants::TYPE_SVN, $self->get_gid );
-        ($rows) = $request->fetchrow();
-		return 0 if( $rows != 0 );
-	}
-
-	
-	if( $config->get_service_availability('mail') == 1 ) { 
-		$query ='SELECT COUNT(*) FROM vhffs_object WHERE type = ? AND owner_gid=?';
-	    $request = $self->{'db'}->prepare( $query );
-	    $request->execute( Vhffs::Constants::TYPE_MAIL, $self->get_gid );
-        ($rows) = $request->fetchrow();
-		return 0 if( $rows != 0 );
-	}
-
-
-	if( $config->get_service_availability('dns') == 1 ) {
-		$query ='SELECT COUNT(*) FROM vhffs_object WHERE type = ? AND owner_gid=?';
-	    $request = $self->{'db'}->prepare( $query );
-	    $request->execute( Vhffs::Constants::TYPE_DNS, $self->get_gid );
-        ($rows) = $request->fetchrow();
-		return 0 if( $rows != 0 );
-	}
-
-
-	if( $config->get_service_availability('pgsql') == 1 ) { 
-		$query ='SELECT COUNT(*) FROM vhffs_object WHERE type = ? AND owner_gid=?';
-	    $request = $self->{'db'}->prepare( $query );
-	    $request->execute( Vhffs::Constants::TYPE_PGSQL, $self->get_gid );
-        ($rows) = $request->fetchrow();
-		return 0 if( $rows != 0 );
-	}
-
-
-	if( $config->get_service_availability('mysql') == 1 ) {
-		$query ='SELECT COUNT(*) FROM vhffs_object WHERE type = ? AND owner_gid=?';
-	    $request = $self->{'db'}->prepare( $query );
-	    $request->execute( Vhffs::Constants::TYPE_MYSQL, $self->get_gid );
-        ($rows) = $request->fetchrow();
-		return 0 if( $rows != 0 );
-	}
-
-    if( $config->get_service_availability('mailinglist') == 1) {
-        $query = 'SELECT COUNT(*) FROM vhffs_object WHERE type = ? AND owner_gid = ?';
-        $request = $self->get_db_object()->prepare( $query );
-        $request->execute( Vhffs::Constants::TYPE_ML, $self->get_gid );
-        ($rows) = $request->fetchrow();
-        return 0 if( $rows != 0);
-    }
-
-    if( $config->get_service_availability('repository') == 1) {
-        $query = 'SELECT COUNT(*) FROM vhffs_object WHERE type = ? AND owner_gid = ?';
-        $request = $self->get_db_object()->prepare( $query );
-        $request->execute( Vhffs::Constants::TYPE_REPOSITORY, $self->get_gid );
-        ($rows) = $request->fetchrow();
-        return 0 if( $rows != 0);
-    }
-
-
-	return 1;
-
+	my $query = 'SELECT object_id FROM vhffs_object WHERE owner_gid=? AND object_id!=?';
+	my $request = $self->{'db'}->prepare( $query );
+	$request->execute( $self->get_gid, $self->get_oid );
+	return( $request->fetchrow() == 0 );
 }
 
 


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