diff options
author | Christian Pointner <equinox@helsinki.at> | 2010-03-29 07:45:38 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2010-03-29 07:45:38 (GMT) |
commit | d11d2808c4f52d63ee9f7333ba5a66d3b60e1da0 (patch) | |
tree | 96af7d61b247749ea17739518e21f0950a9c0c1f | |
parent | 8906b9a5e8f87af82b67e6b98f60503d4b3f484c (diff) |
cleanup
git-svn-id: https://svn.helsinki.at/rhimport/trunk@31 7c65635b-ec39-4f67-a626-873dbafdd612
-rw-r--r-- | rhimport.pm | 29 |
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; |