1*cdf0e10cSrcweireval 'exec perl -wS $0 ${1+\"$@\"}' 2*cdf0e10cSrcweir if 0; 3*cdf0e10cSrcweir 4*cdf0e10cSrcweir# This program has to start for the new convwatch, 5*cdf0e10cSrcweir# once on Windows environment and once on Linux environment 6*cdf0e10cSrcweir# Solaris is handled by the linux also. 7*cdf0e10cSrcweir# 8*cdf0e10cSrcweir# This program polls the database (documentcompare) every 60s for new jobs 9*cdf0e10cSrcweir# it runs over the given directory from documentpoolpath and pool, and create for every file 10*cdf0e10cSrcweir# a new database entry in documents. 11*cdf0e10cSrcweir# 12*cdf0e10cSrcweir 13*cdf0e10cSrcweirBEGIN 14*cdf0e10cSrcweir{ 15*cdf0e10cSrcweir # Adding the path of this script file to the include path in the hope 16*cdf0e10cSrcweir # that all used modules can be found in it. 17*cdf0e10cSrcweir $0 =~ /^(.*)[\/\\]/; 18*cdf0e10cSrcweir push @INC, $1; 19*cdf0e10cSrcweir} 20*cdf0e10cSrcweir 21*cdf0e10cSrcweiruse ConvwatchHelper; 22*cdf0e10cSrcweiruse CallExternals; 23*cdf0e10cSrcweiruse stringhelper; 24*cdf0e10cSrcweiruse filehelper; 25*cdf0e10cSrcweiruse oshelper; 26*cdf0e10cSrcweiruse timehelper; 27*cdf0e10cSrcweiruse cwstestresulthelper; 28*cdf0e10cSrcweir 29*cdf0e10cSrcweiruse strict; 30*cdf0e10cSrcweiruse Cwd; 31*cdf0e10cSrcweiruse File::Basename; 32*cdf0e10cSrcweiruse English; # $OSNAME, ... 33*cdf0e10cSrcweiruse Getopt::Long; 34*cdf0e10cSrcweiruse File::Path; 35*cdf0e10cSrcweiruse Cwd 'chdir'; 36*cdf0e10cSrcweir 37*cdf0e10cSrcweirmy $cwd = getcwd(); 38*cdf0e10cSrcweir 39*cdf0e10cSrcweirour $help; # Help option flag 40*cdf0e10cSrcweirour $version; # Version option flag 41*cdf0e10cSrcweirour $test; 42*cdf0e10cSrcweir 43*cdf0e10cSrcweirour $version_info = 'convwatch.pl $Revision: 1.24 $ '; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweirour $SOLARENV; 46*cdf0e10cSrcweirour $COMMON_ENV_TOOLS; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir 49*cdf0e10cSrcweirour $documentpoolname; 50*cdf0e10cSrcweirour $documentpoolpath; 51*cdf0e10cSrcweirour $dbdistinct; 52*cdf0e10cSrcweirour $sParentDistinct; 53*cdf0e10cSrcweirour $sCurrentDocumentPool; 54*cdf0e10cSrcweir 55*cdf0e10cSrcweirour $fs; 56*cdf0e10cSrcweirour @aEntries; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir# Prototypes 59*cdf0e10cSrcweir# sub getJavaFileDirSeparator(); 60*cdf0e10cSrcweirsub readdirectory($$$); 61*cdf0e10cSrcweirsub putDocumentInDB($$$); 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir# flush STDOUT 64*cdf0e10cSrcweirmy $old_handle = select (STDOUT); # "select" STDOUT and save # previously selected handle 65*cdf0e10cSrcweir$| = 1; # perform flush after each write to STDOUT 66*cdf0e10cSrcweirselect ($old_handle); # restore previously selected handle 67*cdf0e10cSrcweir 68*cdf0e10cSrcweirsetPrefix("gfxcmp"); 69*cdf0e10cSrcweir 70*cdf0e10cSrcweirif (!GetOptions( 71*cdf0e10cSrcweir "test" => \$test, 72*cdf0e10cSrcweir "help" => \$help, 73*cdf0e10cSrcweir "version" => \$version 74*cdf0e10cSrcweir )) 75*cdf0e10cSrcweir{ 76*cdf0e10cSrcweir print_usage(*STDERR); 77*cdf0e10cSrcweir exit(1); 78*cdf0e10cSrcweir} 79*cdf0e10cSrcweirif ($help) 80*cdf0e10cSrcweir{ 81*cdf0e10cSrcweir print_usage(*STDOUT); 82*cdf0e10cSrcweir exit(0); 83*cdf0e10cSrcweir} 84*cdf0e10cSrcweir# Check for version option 85*cdf0e10cSrcweirif ($version) 86*cdf0e10cSrcweir{ 87*cdf0e10cSrcweir print STDERR "$version_info\n"; 88*cdf0e10cSrcweir exit(0); 89*cdf0e10cSrcweir} 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 92*cdf0e10cSrcweir# within mysql it is better to use only '/' 93*cdf0e10cSrcweir$fs = "/"; # getJavaFileDirSeparator(); 94*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 95*cdf0e10cSrcweirsub readdirectory($$$) 96*cdf0e10cSrcweir{ 97*cdf0e10cSrcweir my $startdir = shift; 98*cdf0e10cSrcweir my $sValues = shift; 99*cdf0e10cSrcweir my $hook = shift; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir my $myfile; 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir local *DIR; 104*cdf0e10cSrcweir chdir $startdir; 105*cdf0e10cSrcweir cwd(); 106*cdf0e10cSrcweir if (! endswith($startdir, $fs)) 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir $startdir .= $fs; 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir my $nCountFiles = 0; 112*cdf0e10cSrcweir if (opendir (DIR, $startdir)) # Directory oeffnen 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir while ($myfile = readdir(DIR)) 115*cdf0e10cSrcweir { # ein filename holen 116*cdf0e10cSrcweir #if (! -l $myfile) # not a link 117*cdf0e10cSrcweir #{ 118*cdf0e10cSrcweir if (-d $myfile ) # is a directory 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir if ( -l $myfile) 121*cdf0e10cSrcweir { 122*cdf0e10cSrcweir next; 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir if ($myfile ne "." && $myfile ne "..") 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir my $sNewStartDir = $startdir . $myfile ."/"; # neuen Directorystring erstellen 127*cdf0e10cSrcweir if ($sNewStartDir =~ "^\/proc" || 128*cdf0e10cSrcweir $sNewStartDir =~ "^\/dev" || 129*cdf0e10cSrcweir $sNewStartDir =~ "^\/udev" || 130*cdf0e10cSrcweir $sNewStartDir =~ "lost+found" ) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir next; 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir # my $sNewDestDir = $destdir . $myfile ."/"; 135*cdf0e10cSrcweir # do a recursive call 136*cdf0e10cSrcweir # $nCountFiles++; 137*cdf0e10cSrcweir my $nFileCount = readdirectory($sNewStartDir, $sValues, $hook); 138*cdf0e10cSrcweir # workOnDir($sNewDir, $nFileCount); 139*cdf0e10cSrcweir $nCountFiles += $nFileCount; 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir chdir ($startdir); # zurueckwechseln. 142*cdf0e10cSrcweir cwd(); 143*cdf0e10cSrcweir } 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir else 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir # File must exist, be a regular file and must not be the $onlyOnFile 148*cdf0e10cSrcweir if (-f $myfile) 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir # print " $startdir" . "$myfile\n"; 151*cdf0e10cSrcweir $nCountFiles++; 152*cdf0e10cSrcweir # workOnFile($startdir, $myfile, $destdir); 153*cdf0e10cSrcweir $hook->($startdir, $myfile, $sValues); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir #} 157*cdf0e10cSrcweir #else 158*cdf0e10cSrcweir #{ 159*cdf0e10cSrcweir # print "linked file: $dir/$myfile\n"; 160*cdf0e10cSrcweir #} 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir closedir(DIR); 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir else 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir print "could not open $startdir\n"; 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir return $nCountFiles; 169*cdf0e10cSrcweir} 170*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 171*cdf0e10cSrcweirsub putDocumentInDB($$$) 172*cdf0e10cSrcweir{ 173*cdf0e10cSrcweir my $currentDir = shift; 174*cdf0e10cSrcweir my $currentFile = shift; 175*cdf0e10cSrcweir my $sValues = shift; 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir my $sSourceFilename = $currentDir . $currentFile; 178*cdf0e10cSrcweir # we cut down all the previous names like documentpoolpath and the documentpoolname 179*cdf0e10cSrcweir $sSourceFilename = substr($sSourceFilename, length($sCurrentDocumentPool . $fs)); 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir my $sSQL = "INSERT INTO documents (dbdistinct2, name, pagecount, priority, parentdistinct) VALUES"; 182*cdf0e10cSrcweir $sSQL .= "('" . $dbdistinct . "', '" . $sSourceFilename . "', 0, 1, '". $sParentDistinct . "')"; 183*cdf0e10cSrcweir # print $sSQL . "\n"; 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir push(@aEntries, $sSQL); 186*cdf0e10cSrcweir # ExecSQL($sSQL); 187*cdf0e10cSrcweir} 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 190*cdf0e10cSrcweirsub createDBEntriesForEveryDocument($) 191*cdf0e10cSrcweir{ 192*cdf0e10cSrcweir my $sStr = shift; 193*cdf0e10cSrcweir if ($sStr =~ /^MySQL-Error/ ) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir # we don't do anything if an error occured 196*cdf0e10cSrcweir return; 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir # interpret the follows string 200*cdf0e10cSrcweir # documentpoolpath='//so-gfxcmp-documents/doc-pool', documentpool='demo_lla', dbdistinct=62, 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir # my $sDocumentPoolDir; 203*cdf0e10cSrcweir if ( $sStr =~ /documentpoolpath='(.*?)',/ ) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir $documentpoolpath = $1; 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir if (! $documentpoolpath) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir print "Error: no value for documentpoolpath found.\n"; 210*cdf0e10cSrcweir return; 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir # my $sDocumentPool; 214*cdf0e10cSrcweir if ( $sStr =~ /documentpool='(.*?)',/ ) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir $documentpoolname = $1; 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir if (! $documentpoolname) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir print "Error: no value for documentpool found.\n"; 221*cdf0e10cSrcweir return; 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir # my $dbdistinct; 224*cdf0e10cSrcweir if ( $sStr =~ /dbdistinct2='(\S*?)',/ ) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir $dbdistinct = $1; 227*cdf0e10cSrcweir } 228*cdf0e10cSrcweir if (! $dbdistinct) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir print "Error: no dbdistinct given.\n"; 231*cdf0e10cSrcweir return; 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir if (! -d $documentpoolpath ) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir my $sEnv = getEnvironment(); 237*cdf0e10cSrcweir if ( isUnixEnvironment() ) 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir $documentpoolpath = "/net/so-gfxcmp-documents" . $documentpoolpath; 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir if ( -d $documentpoolpath ) 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir print "Warning: given documentpoolpath seems to be local, fix to '$documentpoolpath'\n"; 244*cdf0e10cSrcweir my $sSQL = "UPDATE documentcompare SET documentpoolpath='$documentpoolpath' WHERE dbdistinct2='$dbdistinct'"; 245*cdf0e10cSrcweir print "$sSQL\n"; 246*cdf0e10cSrcweir ExecSQL($sSQL); 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir else 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir print "Error: documentpoolpath '$documentpoolpath' not found. Don't insert anything.\n"; 251*cdf0e10cSrcweir my $sSQL = "UPDATE documentcompare SET state='failed',info='documentpoolpath not found.' WHERE dbdistinct2='$dbdistinct'"; 252*cdf0e10cSrcweir print "$sSQL\n"; 253*cdf0e10cSrcweir ExecSQL($sSQL); 254*cdf0e10cSrcweir return; 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir # create the documentpool directory, to run through 258*cdf0e10cSrcweir $sCurrentDocumentPool = $documentpoolpath; 259*cdf0e10cSrcweir if (! endswith($sCurrentDocumentPool, $fs)) 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir $sCurrentDocumentPool .= $fs; 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir $sCurrentDocumentPool .= $documentpoolname; 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir if ( -d $sCurrentDocumentPool ) 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir if ( $sStr =~ /parentdistinct='(.*?)',/ ) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir $sParentDistinct = $1; 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir else 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir $sParentDistinct = ""; 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir # remove any doubles, if any 277*cdf0e10cSrcweir my $sSQL = "DELETE FROM documents WHERE dbdistinct2='$dbdistinct'"; 278*cdf0e10cSrcweir print "$sSQL\n"; 279*cdf0e10cSrcweir ExecSQL($sSQL); 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir # run over the whole given document pool and store every found document name in the database 282*cdf0e10cSrcweir readdirectory($sCurrentDocumentPool, "", \&putDocumentInDB); 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir chdir $cwd; 285*cdf0e10cSrcweir cwd(); 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir foreach $sSQL (@aEntries) 288*cdf0e10cSrcweir { 289*cdf0e10cSrcweir # print "# $sSQL\n"; 290*cdf0e10cSrcweir print "$sSQL\n"; 291*cdf0e10cSrcweir ExecSQL($sSQL); 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir my $sSQL = "UPDATE documentcompare SET state='inprogress' WHERE dbdistinct2='$dbdistinct'"; 295*cdf0e10cSrcweir print "$sSQL\n"; 296*cdf0e10cSrcweir ExecSQL($sSQL); 297*cdf0e10cSrcweir print "----------------------------------------------------------------------\n"; 298*cdf0e10cSrcweir $sParentDistinct = ""; 299*cdf0e10cSrcweir @aEntries = (); 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir else 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir print "Error: Given document pool '$sCurrentDocumentPool' doesn't exists.\n"; 304*cdf0e10cSrcweir my $sSQL = "UPDATE documentcompare SET state='cancelled' WHERE dbdistinct2='$dbdistinct'"; 305*cdf0e10cSrcweir ExecSQL($sSQL); 306*cdf0e10cSrcweir return; 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir # Send Mail, due to startconvwatch now 309*cdf0e10cSrcweir sendMail($sStr, $documentpoolname, $dbdistinct); 310*cdf0e10cSrcweir} 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 313*cdf0e10cSrcweirsub sendMail($$$) 314*cdf0e10cSrcweir{ 315*cdf0e10cSrcweir my $sStr = shift; 316*cdf0e10cSrcweir my $documentpool = shift; 317*cdf0e10cSrcweir my $dbdistinct = shift; 318*cdf0e10cSrcweir my $sourceversion; 319*cdf0e10cSrcweir if ( $sStr =~ /sourceversion='(.*?)',/ ) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir $sourceversion = $1; 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir if (! $sourceversion) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir print "Warning: no value for sourceversion found.\n"; 326*cdf0e10cSrcweir return; 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir my $destinationversion; 329*cdf0e10cSrcweir if ( $sStr =~ /destinationversion='(.*?)',/ ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir $destinationversion = $1; 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir if (! $destinationversion) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir print "Warning: no value for destinationversion found.\n"; 336*cdf0e10cSrcweir return; 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir my $mailaddress; 339*cdf0e10cSrcweir if ( $sStr =~ /mailfeedback='(.*?)',/ ) 340*cdf0e10cSrcweir { 341*cdf0e10cSrcweir $mailaddress = $1; 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir if (! $mailaddress) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir print "Warning: no value for mailfeedback found.\n"; 346*cdf0e10cSrcweir return; 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir # state is 'inprogress', so send a mail 350*cdf0e10cSrcweir # my $sMailAddress = getMailAddress($sDoneStr); 351*cdf0e10cSrcweir my $sParams = "$sourceversion"; 352*cdf0e10cSrcweir $sParams .= " $destinationversion"; 353*cdf0e10cSrcweir $sParams .= " $documentpool"; 354*cdf0e10cSrcweir $sParams .= " $dbdistinct"; 355*cdf0e10cSrcweir $sParams .= " $mailaddress"; 356*cdf0e10cSrcweir $sParams .= " starts"; # run through state of convwatch 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir my $sMailProgram = appendPath(getQADEVToolsPath(), "mailsend.php"); 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir my $err; 361*cdf0e10cSrcweir my @lines; 362*cdf0e10cSrcweir my $sLine; 363*cdf0e10cSrcweir ($err, @lines) = callphp(getPHPExecutable(), $sMailProgram, $sParams); 364*cdf0e10cSrcweir foreach $sLine (@lines) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir log_print( "Mail: $sLine\n"); 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir if ($documentpool eq "EIS-tests") 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir cwstestresult("running", $dbdistinct, $sourceversion, $destinationversion, $SOLARENV, $COMMON_ENV_TOOLS); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir} 374*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 375*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 376*cdf0e10cSrcweir 377*cdf0e10cSrcweirmy $sEnvironmentCondition; 378*cdf0e10cSrcweirif (isWindowsEnvironment()) 379*cdf0e10cSrcweir{ 380*cdf0e10cSrcweir $sEnvironmentCondition = "environment='" . getEnvironment() . "'"; 381*cdf0e10cSrcweir} 382*cdf0e10cSrcweirelsif (isUnixEnvironment()) 383*cdf0e10cSrcweir{ 384*cdf0e10cSrcweir # $sEnvironmentCondition = " ( environment='unxlngi' OR environment='unxsoli' ) "; 385*cdf0e10cSrcweir $sEnvironmentCondition = " environment='" . getEnvironment() . "'"; 386*cdf0e10cSrcweir} 387*cdf0e10cSrcweirelse 388*cdf0e10cSrcweir{ 389*cdf0e10cSrcweir print "Error: wrong environment.\n"; 390*cdf0e10cSrcweir exit(1); 391*cdf0e10cSrcweir} 392*cdf0e10cSrcweirmy $sWhereClause = "WHERE "; 393*cdf0e10cSrcweirif ($sEnvironmentCondition) 394*cdf0e10cSrcweir{ 395*cdf0e10cSrcweir $sWhereClause .= $sEnvironmentCondition . " AND "; 396*cdf0e10cSrcweir} 397*cdf0e10cSrcweir$sWhereClause .= " state='new'"; 398*cdf0e10cSrcweir 399*cdf0e10cSrcweirsetToolsPath(getQADEVToolsPath()); 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir# ---------------------------------- main loop ---------------------------------- 402*cdf0e10cSrcweirwhile (1) 403*cdf0e10cSrcweir{ 404*cdf0e10cSrcweir my @aResult; 405*cdf0e10cSrcweir my $sSQL = "SELECT documentpoolpath,documentpool,dbdistinct2,sourceversion,destinationversion,mailfeedback,parentdistinct FROM documentcompare $sWhereClause"; 406*cdf0e10cSrcweir @aResult = ExecSQL($sSQL); 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir my $aValue; 409*cdf0e10cSrcweir foreach $aValue (@aResult) 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir # print "# $nValue\n"; 412*cdf0e10cSrcweir createDBEntriesForEveryDocument($aValue); 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir if ($test) 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir last; 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir # wait 30sec. 420*cdf0e10cSrcweir # wait30seconds(); 421*cdf0e10cSrcweir waitAMinute(); 422*cdf0e10cSrcweir checkForStop("stop_fill_documents_loop"); 423*cdf0e10cSrcweir} 424