summaryrefslogtreecommitdiff
path: root/rhimport.pm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2010-03-29 07:45:38 (GMT)
committerChristian Pointner <equinox@helsinki.at>2010-03-29 07:45:38 (GMT)
commit7a1f33fbfd87161e3ac518f2f758571ceb36e9ae (patch)
tree96af7d61b247749ea17739518e21f0950a9c0c1f /rhimport.pm
parentd66dc3239664f5035ee7d28e138c4799122028b0 (diff)
cleanup
Diffstat (limited to 'rhimport.pm')
-rw-r--r--rhimport.pm29
1 files changed, 16 insertions, 13 deletions
diff --git a/rhimport.pm b/rhimport.pm
index 333e61c..324dd84 100644
--- a/rhimport.pm
+++ b/rhimport.pm
@@ -27,8 +27,7 @@ package rhimport;
sub get_dropboxes
{
- my $dbh = shift;
- my $user = shift;
+ my ($dbh, $user) = @_;
my $sql = qq{select USER_PERMS.GROUP_NAME,DROPBOXES.PATH,DROPBOXES.TO_CART from USER_PERMS, DROPBOXES where USER_PERMS.USER_NAME='$user' and DROPBOXES.GROUP_NAME=USER_PERMS.GROUP_NAME;};
my $sth = $dbh->prepare($sql);
@@ -70,8 +69,7 @@ sub get_dropboxes
sub get_cart_range
{
- my $dbh = shift;
- my $group = shift;
+ my ($dbh, $group) = @_;
my $sql = qq{select DEFAULT_LOW_CART,DEFAULT_HIGH_CART from GROUPS where NAME='$group';};
my $sth = $dbh->prepare($sql);
@@ -85,8 +83,7 @@ sub get_cart_range
sub get_used_carts
{
- my $dbh = shift;
- my $group = shift;
+ my ($dbh, $group) = @_;
my ($low_cart, $high_cart) = get_cart_range($dbh, $group);
my @carts;
@@ -95,9 +92,7 @@ sub get_used_carts
sub clear_carts
{
- my $dbh = shift;
- my $group = shift;
- my $to_cart = shift;
+ my ($dbh, $group, $to_cart) = @_;
my ($low_cart, $high_cart) = ($to_cart, $to_cart);
if($to_cart == 0) {
@@ -111,10 +106,7 @@ sub clear_carts
my $sth = $dbh->prepare($sql);
$sth->execute();
while(my $cut_name = $sth->fetchrow_array()) {
- my $filename = "/var/snd/$cut_name.wav";
-
- ### call unlink!!!
- print " - deleting $filename\n";
+ delete_file("/var/snd/$cut_name.wav");
}
$sth->finish();
@@ -192,9 +184,20 @@ sub import_file
$| = 1;
sleep(1);
+ ### copy file to master server and
+ ### remotly call rdimport
+
print "Ok\n";
return 0;
}
+sub delete_file
+{
+ my ($filename) = @_;
+
+ print " - deleting $filename\n";
+ ### call unlink on remote machine (master server)
+}
+
1;