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