[vhffs-dev] [1021] Fixed Vhffs::Group::is_empty function |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1021
Author: gradator
Date: 2007-10-24 22:16:38 +0000 (Wed, 24 Oct 2007)
Log Message:
-----------
Fixed Vhffs::Group::is_empty function
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Functions.pm
trunk/vhffs-api/src/Vhffs/Group.pm
Modified: trunk/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Functions.pm 2007-10-24 11:57:15 UTC (rev 1020)
+++ trunk/vhffs-api/src/Vhffs/Functions.pm 2007-10-24 22:16:38 UTC (rev 1021)
@@ -274,7 +274,7 @@
Subject => $subject,
Type => 'text/plain; charset=utf-8',
Encoding => '8bit',
- Data => "$message";
+ Data => $message;
$msg->send;
return 1;
Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm 2007-10-24 11:57:15 UTC (rev 1020)
+++ trunk/vhffs-api/src/Vhffs/Group.pm 2007-10-24 22:16:38 UTC (rev 1021)
@@ -173,13 +173,15 @@
sub is_empty
{
my $self = shift;
- return -1 if( ! defined $self);
- my $config = $self->{'main'}->get_config;
+ return -1 unless defined $self;
- my $query = 'SELECT object_id FROM vhffs_object WHERE owner_gid=? AND object_id!=?';
+ my $query = 'SELECT COUNT(*) 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 );
+ my ( $rows ) = $request->fetchrow();
+
+ return 1 if( $rows == 0 );
+ return 0;
}