version 1.1.1.1, 2011/06/03 09:28:47 |
version 1.3, 2011/07/20 07:52:32 |
|
|
use warnings; |
use warnings; |
my $EXPAND_SYMLINKS = 1; |
my $EXPAND_SYMLINKS = 1; |
my $QUERY_Z = "SELECT ID,Path,file_priority FROM upload_files WHERE Status=0 AND type_file=0"; |
my $QUERY_Z = "SELECT ID,Path,file_priority FROM upload_files WHERE Status=0 AND type_file=0"; |
my $QUERY_J = "SELECT ID,Path,file_priority FROM upload_files WHERE Status=0 AND type_file=1"; |
my $QUERY_P = "SELECT ID,Path,file_priority FROM upload_files WHERE Status=0 AND type_file=1"; |
my $QUERY_P = "SELECT ID,Path,file_priority FROM upload_files WHERE Status=0 AND type_file=2"; |
|
my $QUERY_T = "SELECT ID,Path,file_priority FROM upload_files WHERE Status=0 AND type_file=3"; |
|
|
|
my $sth; |
my $sth; |
|
|
|
|
if($dbids[$i]) # element exists (THIS CODE SHOULD BE FIXED) |
if($dbids[$i]) # element exists (THIS CODE SHOULD BE FIXED) |
{ |
{ |
#convert samba-paths to local unix paths |
#convert samba-paths to local unix paths |
$dbpaths[$i] = substr($dbpaths[$i], 23); # remove \\fileserver\wideprint\ |
$dbpaths[$i] = substr($dbpaths[$i], 13); # remove \\fileserver\ |
$dbpaths[$i] =~ tr/\\/\//; # convert each \ to / |
$dbpaths[$i] =~ tr/\\/\//; # convert each \ to / |
$dbpaths[$i] = '/WIDEPRINT/' . $dbpaths[$i]; |
$dbpaths[$i] = '/mnt/rmt_maket/' . $dbpaths[$i]; |
$dbpaths[$i] = substr($dbpaths[$i], 0, ( index($dbpaths[$i], ' ', 0) ) ); |
$dbpaths[$i] = substr($dbpaths[$i], 0, ( index($dbpaths[$i], ' ', 0) ) ); |
# |
# |
# We must not save non-existent local file in array! |
# We must not save non-existent local file in array! |
|
|
} |
} |
|
|
|
|
sub jpegs_list() |
|
{ |
|
my @dbids; |
|
my @dbpaths; |
|
my $i = 0; |
|
|
|
$sth = $db::dbh->prepare($QUERY_J); |
|
$sth->execute( ); |
|
while(($dbids[$i], $dbpaths[$i]) = $sth->fetchrow_array( ) ) |
|
{ |
|
$dbpaths[$i] = substr($dbpaths[$i], 23); |
|
$dbpaths[$i] =~ tr/\\/\//; |
|
$dbpaths[$i] = '/WIDEPRINT/' . $dbpaths[$i]; |
|
$dbpaths[$i] = substr($dbpaths[$i], 0, ( index($dbpaths[$i], ' ', 0) ) ); |
|
if($EXPAND_SYMLINKS && -e $dbpaths[$i]) |
|
{ |
|
chomp( $_ = `dirname $dbpaths[$i] | xargs /usr/bin/readlink` ); |
|
chomp( $dbpaths[$i] = $_ . '/' . `basename $dbpaths[$i]` ); |
|
} |
|
$i++; |
|
} |
|
|
|
$i--; |
|
$#dbids = $i; |
|
$#dbpaths = $i; |
|
|
|
log::filelist(\@dbpaths); |
|
|
|
return( (\@dbids, \@dbpaths) ); |
|
} |
|
|
|
|
|
sub probas_list() |
sub probas_list() |
{ |
{ |
my @dbids; |
my @dbids; |
|
|
|
|
log::filelist(\@dbpaths); |
log::filelist(\@dbpaths); |
|
|
|
|
return( (\@dbids, \@dbpaths) ); |
|
} |
|
|
|
|
|
sub tpps_list() |
|
{ |
|
my @dbids; |
|
my @dbpaths; |
|
my $i = 0; |
|
|
|
$sth = $db::dbh->prepare($QUERY_T); |
|
$sth->execute( ); |
|
while(($dbids[$i], $dbpaths[$i]) = $sth->fetchrow_array( ) ) |
|
{ |
|
$dbpaths[$i] = substr($dbpaths[$i], 23); |
|
$dbpaths[$i] =~ tr/\\/\//; |
|
$dbpaths[$i] = '/WIDEPRINT/' . $dbpaths[$i]; |
|
$dbpaths[$i] = substr($dbpaths[$i], 0, ( index($dbpaths[$i], ' ', 0) ) ); |
|
if($EXPAND_SYMLINKS && -e $dbpaths[$i]) |
|
{ |
|
chomp( $_ = `dirname $dbpaths[$i] | xargs /usr/bin/readlink` ); |
|
chomp( $dbpaths[$i] = $_ . '/' . `basename $dbpaths[$i]` ); |
|
} |
|
$i++; |
|
} |
|
|
|
$i--; |
|
$#dbids = $i; |
|
$#dbpaths = $i; |
|
|
|
log::filelist(\@dbpaths); |
|
|
|
return( (\@dbids, \@dbpaths) ); |
return( (\@dbids, \@dbpaths) ); |
} |
} |