Changeset 35 for trunk/cleanup.php


Ignore:
Timestamp:
Apr 8, 2018, 4:41:57 PM (7 years ago)
Author:
gegorbet
Message:

mods mostly for use of mysqli

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cleanup.php

    r32 r35  
    4444   write_log( "$me: debug db=$db; requestID=$requestID" );
    4545
    46    $us3_link = mysql_connect( $dbhost, $user, $passwd );
     46   $us3_link = mysqli_connect( $dbhost, $user, $passwd, $db );
    4747
    4848   if ( ! $us3_link )
    4949   {
    50       write_log( "$me: could not connect: $dbhost, $user, $passwd" );
     50      write_log( "$me: could not connect: $dbhost, $user, $passwd, $db" );
    5151      mail_to_user( "fail", "Internal Error $requestID\nCould not connect to DB" );
    52       return( -1 );
    53    }
    54 
    55    $result = mysql_select_db( $db, $us3_link );
    56 
    57    if ( ! $result )
    58    {
    59       write_log( "$me: could not select DB $db" );
    60       mail_to_user( "fail", "Internal Error $requestID\n$could not select DB $db" );
    6152      return( -1 );
    6253   }
     
    6556   $query  = "SELECT email, investigatorGUID, editXMLFilename FROM HPCAnalysisRequest " .
    6657             "WHERE HPCAnalysisRequestID=$requestID";
    67    $result = mysql_query( $query, $us3_link );
     58   $result = mysqli_query( $us3_link, $query );
    6859
    6960   if ( ! $result )
    7061   {
    7162      write_log( "$me: Bad query: $query" );
    72       mail_to_user( "fail", "Internal Error $requestID\n$query\n" . mysql_error( $us3_link ) );
     63      mail_to_user( "fail", "Internal Error $requestID\n$query\n" . mysqli_error( $us3_link ) );
    7364      return( -1 );
    7465   }
    7566
    76    list( $email_address, $investigatorGUID, $editXMLFilename ) =  mysql_fetch_array( $result );
     67   list( $email_address, $investigatorGUID, $editXMLFilename ) =  mysqli_fetch_array( $result );
    7768
    7869   $query  = "SELECT personID FROM people " .
    7970             "WHERE personGUID='$investigatorGUID'";
    80    $result = mysql_query( $query, $us3_link );
    81 
    82    list( $personID ) = mysql_fetch_array( $result );
     71   $result = mysqli_query( $us3_link, $query );
     72
     73   list( $personID ) = mysqli_fetch_array( $result );
    8374
    8475   $query  = "SELECT clusterName, submitTime, queueStatus, method "              .
     
    8778             "AND h.HPCAnalysisRequestID=r.HPCAnalysisRequestID";
    8879
    89    $result = mysql_query( $query, $us3_link );
    90 
    91    if ( ! $result )
    92    {
    93       write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) );
     80   $result = mysqli_query( $us3_link, $query );
     81
     82   if ( ! $result )
     83   {
     84      write_log( "$me: Bad query:\n$query\n" . mysqli_error( $us3_link ) );
    9485      return( -1 );
    9586   }
    9687
    97    if ( mysql_num_rows( $result ) == 0 )
     88   if ( mysqli_num_rows( $result ) == 0 )
    9889   {
    9990      write_log( "$me: US3 Table error - No records for requestID: $requestID" );
     
    10192   }
    10293
    103    list( $cluster, $submittime, $queuestatus, $jobtype ) = mysql_fetch_array( $result );
     94   list( $cluster, $submittime, $queuestatus, $jobtype ) = mysqli_fetch_array( $result );
    10495
    10596   // Get the GFAC ID
     
    10798            "WHERE HPCAnalysisRequestID=$requestID";
    10899
    109    $result = mysql_query( $query, $us3_link );
     100   $result = mysqli_query( $us3_link, $query );
    110101
    111102   if ( ! $result )
    112103   {
    113104      write_log( "$me: Bad query: $query" );
    114       mail_to_user( "fail", "Internal Error $requestID\n$query\n" . mysql_error( $us3_link ) );
     105      mail_to_user( "fail", "Internal Error $requestID\n$query\n" . mysqli_error( $us3_link ) );
    115106      return( -1 );
    116107   }
    117108
    118    list( $HPCAnalysisResultID, $gfacID ) = mysql_fetch_array( $result );
     109   list( $HPCAnalysisResultID, $gfacID ) = mysqli_fetch_array( $result );
    119110
    120111   // Get data from global GFAC DB then insert it into US3 DB
    121112
    122    $result = mysql_select_db( $gDB, $gfac_link );
     113/*
     114   $result = mysqli_select_db( $gfac_link, $gDB );
    123115
    124116   if ( ! $result )
     
    128120      return( -1 );
    129121   }
     122 */
    130123
    131124   $query = "SELECT status, cluster, id FROM analysis " .
    132125            "WHERE gfacID='$gfacID'";
    133126
    134    $result = mysql_query( $query, $gfac_link );
     127   $result = mysqli_query( $gfac_link, $query );
    135128   if ( ! $result )
    136129   {
     
    140133   }
    141134   
    142    list( $status, $cluster, $id ) = mysql_fetch_array( $result );
     135   list( $status, $cluster, $id ) = mysqli_fetch_array( $result );
    143136
    144137   $is_us3iab  = preg_match( "/us3iab/", $cluster );
     
    156149            "WHERE gfacID='$gfacID'";
    157150
    158    $result = mysql_query( $query, $gfac_link );
    159 
    160    if ( ! $result )
    161    {
    162       write_log( "$me: Bad query:\n$query\n" . mysql_error( $gfac_link ) );
    163       mail_to_user( "fail", "Internal error " . mysql_error( $gfac_link ) );
     151   $result = mysqli_query( $gfac_link, $query );
     152
     153   if ( ! $result )
     154   {
     155      write_log( "$me: Bad query:\n$query\n" . mysqli_error( $gfac_link ) );
     156      mail_to_user( "fail", "Internal error " . mysqli_error( $gfac_link ) );
    164157      return( -1 );
    165158   }
    166159
    167    list( $analysisID ) = mysql_fetch_array( $result );
     160   list( $analysisID ) = mysqli_fetch_array( $result );
    168161
    169162   // Get the request guid (LIMS submit dir name)
    170163   $query  = "SELECT HPCAnalysisRequestGUID FROM HPCAnalysisRequest " .
    171164             "WHERE HPCAnalysisRequestID = $requestID ";
    172    $result = mysql_query( $query, $us3_link );
     165   $result = mysqli_query( $us3_link, $query );
    173166   
    174167   if ( ! $result )
    175168   {
    176       write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) );
    177    }
    178 
    179    list( $requestGUID ) = mysql_fetch_array( $result );
     169      write_log( "$me: Bad query:\n$query\n" . mysqli_error( $us3_link ) );
     170   }
     171
     172   list( $requestGUID ) = mysqli_fetch_array( $result );
    180173   $output_dir = "$submit_dir/$requestGUID";
    181174
     
    254247            "WHERE analysisID = $analysisID " .
    255248            "ORDER BY time ";
    256    $result = mysql_query( $query, $gfac_link );
     249   $result = mysqli_query( $gfac_link, $query );
    257250
    258251   if ( ! $result )
    259252   {
    260253      // Just log it and continue
    261       write_log( "$me: Bad query:\n$query\n" . mysql_error( $gfac_link ) );
     254      write_log( "$me: Bad query:\n$query\n" . mysqli_error( $gfac_link ) );
    262255   }
    263256
     
    268261                  "Processed: $now\n\n" .
    269262                  "Queue Messages\n\n" ;
    270    if ( mysql_num_rows( $result ) > 0 )
    271    {
    272       while ( list( $message, $time ) = mysql_fetch_array( $result ) )
     263   if ( mysqli_num_rows( $result ) > 0 )
     264   {
     265      while ( list( $message, $time ) = mysqli_fetch_array( $result ) )
    273266         $message_log .= "$time $message\n";
    274267   }
     
    277270            "WHERE analysisID = $analysisID ";
    278271
    279    $result = mysql_query( $query, $gfac_link );
     272   $result = mysqli_query( $gfac_link, $query );
    280273
    281274   if ( ! $result )
    282275   {
    283276      // Just log it and continue
    284       write_log( "$me: Bad query:\n$query\n" . mysql_error( $gfac_link ) );
     277      write_log( "$me: Bad query:\n$query\n" . mysqli_error( $gfac_link ) );
    285278   }
    286279
     
    288281            "WHERE gfacID='$gfacID' ";
    289282
    290    $result = mysql_query( $query, $gfac_link );
    291    list( $queue_msg ) = mysql_fetch_array( $result );
     283   $result = mysqli_query( $gfac_link, $query );
     284   list( $queue_msg ) = mysqli_fetch_array( $result );
    292285
    293286   // But let's allow for investigation of other large stdout and/or stderr
     
    306299   $query = "DELETE from analysis WHERE gfacID='$gfacID'";
    307300
    308    $result = mysql_query( $query, $gfac_link );
     301   $result = mysqli_query( $gfac_link, $query );
    309302
    310303   if ( ! $result )
    311304   {
    312305      // Just log it and continue
    313       write_log( "$me: Bad query:\n$query\n" . mysql_error( $gfac_link ) );
     306      write_log( "$me: Bad query:\n$query\n" . mysqli_error( $gfac_link ) );
    314307   }
    315308
     
    322315   $message_filename = "$output_dir/$db-$requestID-messages.txt";
    323316   file_put_contents( $message_filename, $message_log, FILE_APPEND );
    324   // mysql_close( $gfac_link );
     317  // mysqli_close( $gfac_link );
    325318
    326319   /////////
     
    328321
    329322   $query = "UPDATE HPCAnalysisResult SET "                              .
    330             "stderr='" . mysql_real_escape_string( $stderr, $us3_link ) . "', " .
    331             "stdout='" . mysql_real_escape_string( $stdout, $us3_link ) . "', " .
     323            "stderr='" . mysqli_real_escape_string( $us3_link, $stderr ) . "', " .
     324            "stdout='" . mysqli_real_escape_string( $us3_link, $stdout ) . "', " .
    332325            "queueStatus='completed' " .
    333326            "WHERE HPCAnalysisResultID=$HPCAnalysisResultID";
    334327
    335    $result = mysql_query( $query, $us3_link );
    336 
    337    if ( ! $result )
    338    {
    339       write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) );
    340       mail_to_user( "fail", "Bad query:\n$query\n" . mysql_error( $us3_link ) );
     328   $result = mysqli_query( $us3_link, $query );
     329
     330   if ( ! $result )
     331   {
     332      write_log( "$me: Bad query:\n$query\n" . mysqli_error( $us3_link ) );
     333      mail_to_user( "fail", "Bad query:\n$query\n" . mysqli_error( $us3_link ) );
    341334      return( -1 );
    342335   }
     
    345338   $query = "DELETE from analysis WHERE gfacID='$gfacID'";
    346339
    347    $result = mysql_query( $query, $gfac_link );
     340   $result = mysqli_query( $gfac_link, $query );
    348341
    349342   if ( ! $result )
    350343   {
    351344      // Just log it and continue
    352       write_log( "$me: Bad query:\n$query\n" . mysql_error( $gfac_link ) );
     345      write_log( "$me: Bad query:\n$query\n" . mysqli_error( $gfac_link ) );
    353346   }
    354347
     
    429422                  "mgroupcount = {$otherdata['groupcount']} " .
    430423                  "WHERE HPCAnalysisResultID=$HPCAnalysisResultID";
    431          $result = mysql_query( $query, $us3_link );
     424         $result = mysqli_query( $us3_link, $query );
    432425
    433426         if ( ! $result )
    434427         {
    435             write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) );
     428            write_log( "$me: Bad query:\n$query\n" . mysqli_error( $us3_link ) );
    436429         }
    437430
     
    450443         $modelGUID  = $noise_data[ 'modelGUID' ];
    451444         $noiseGUID  = $noise_data[ 'noiseGUID' ];
     445         $editGUID   = '00000000-0000-0000-0000-000000000000';
     446         if ( isset( $model_data[ 'editGUID' ] ) )
     447            $editGUID   = $model_data[ 'editGUID' ];
    452448
    453449         $query = "INSERT INTO noise SET "  .
    454450                  "noiseGUID='$noiseGUID'," .
    455451                  "modelGUID='$modelGUID'," .
    456                   "editedDataID=1, "        .
     452                  "editedDataID="                .
     453                  "(SELECT editedDataID FROM editedData WHERE editGUID='$editGUID')," .
    457454                  "modelID=1, "             .
    458455                  "noiseType='$type',"      .
    459456                  "description='$desc',"    .
    460                   "xml='" . mysql_real_escape_string( $xml, $us3_link ) . "'";
     457                  "xml='" . mysqli_real_escape_string( $us3_link, $xml ) . "'";
    461458
    462459         // Add later after all files are processed: editDataID, modelID
    463460
    464          $result = mysql_query( $query, $us3_link );
     461         $result = mysqli_query( $us3_link, $query );
    465462
    466463         if ( ! $result )
    467464         {
    468             write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) );
    469             mail_to_user( "fail", "Internal error\n$query\n" . mysql_error( $us3_link ) );
     465            write_log( "$me: Bad query:\n$query\n" . mysqli_error( $us3_link ) );
     466            mail_to_user( "fail", "Internal error\n$query\n" . mysqli_error( $us3_link ) );
    470467            return( -1 );
    471468         }
    472469
    473          $id        = mysql_insert_id( $us3_link );
     470         $id        = mysqli_insert_id( $us3_link );
    474471         $file_type = "noise";
    475472         $noiseIDs[] = $id;
     
    498495                  "mrecsGUID='$mrecGUID'," .
    499496                  "description='$desc',"    .
    500                   "xml='" . mysql_real_escape_string( $xml, $us3_link ) . "'";
     497                  "xml='" . mysqli_real_escape_string( $us3_link, $xml ) . "'";
    501498
    502499         // Add later after all files are processed: editDataID, modelID
    503500
    504          $result = mysql_query( $query, $us3_link );
     501         $result = mysqli_query( $us3_link, $query );
    505502
    506503         if ( ! $result )
    507504         {
    508             write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) );
    509             mail_to_user( "fail", "Internal error\n$query\n" . mysql_error( $us3_link ) );
     505            write_log( "$me: Bad query:\n$query\n" . mysqli_error( $us3_link ) );
     506            mail_to_user( "fail", "Internal error\n$query\n" . mysqli_error( $us3_link ) );
    510507            return( -1 );
    511508         }
    512509
    513          $id         = mysql_insert_id( $us3_link );
     510         $id         = mysqli_insert_id( $us3_link );
    514511         $file_type  = "mrecs";
    515512         $mrecsIDs[] = $id;
     
    543540                  "meniscus='$meniscus'," .
    544541                  "variance='$variance'," .
    545                   "xml='" . mysql_real_escape_string( $xml, $us3_link ) . "'";
    546 
    547          $result = mysql_query( $query, $us3_link );
     542                  "xml='" . mysqli_real_escape_string( $us3_link, $xml ) . "'";
     543
     544         $result = mysqli_query( $us3_link, $query );
    548545
    549546         if ( ! $result )
    550547         {
    551             write_log( "$me: Bad query:\n$query " . mysql_error( $us3_link ) );
    552             mail_to_user( "fail", "Internal error\n$query\n" . mysql_error( $us3_link ) );
     548            write_log( "$me: Bad query:\n$query " . mysqli_error( $us3_link ) );
     549            mail_to_user( "fail", "Internal error\n$query\n" . mysqli_error( $us3_link ) );
    553550            return( -1 );
    554551         }
    555552
    556          $modelID   = mysql_insert_id( $us3_link );
     553         $modelID   = mysqli_insert_id( $us3_link );
    557554         $id        = $modelID;
    558555         $file_type = "model";
     
    560557         $query = "INSERT INTO modelPerson SET " .
    561558                  "modelID=$modelID, personID=$personID";
    562          $result = mysql_query( $query, $us3_link );
     559         $result = mysqli_query( $us3_link, $query );
    563560      }
    564561
     
    571568               "resultID=$id";
    572569
    573       $result = mysql_query( $query, $us3_link );
     570      $result = mysqli_query( $us3_link, $query );
    574571
    575572      if ( ! $result )
    576573      {
    577          write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) );
    578          mail_to_user( "fail", "Internal error\n$query\n" . mysql_error( $us3_link ) );
     574         write_log( "$me: Bad query:\n$query\n" . mysqli_error( $us3_link ) );
     575         mail_to_user( "fail", "Internal error\n$query\n" . mysqli_error( $us3_link ) );
    579576         return( -1 );
    580577      }
     
    595592               "WHERE noiseID=$noiseID";
    596593
    597       $result = mysql_query( $query, $us3_link );
     594      $result = mysqli_query( $us3_link, $query );
    598595
    599596      if ( ! $result )
    600597      {
    601          write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) );
    602          mail_to_user( "fail", "Bad query\n$query\n" . mysql_error( $us3_link ) );
     598         write_log( "$me: Bad query:\n$query\n" . mysqli_error( $us3_link ) );
     599         mail_to_user( "fail", "Bad query\n$query\n" . mysqli_error( $us3_link ) );
    603600         return( -1 );
    604601      }
     
    615612               "WHERE mrecsID=$mrecsID";
    616613
    617       $result = mysql_query( $query, $us3_link );
     614      $result = mysqli_query( $us3_link, $query );
    618615
    619616      if ( ! $result )
    620617      {
    621          write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) );
    622          mail_to_user( "fail", "Bad query\n$query\n" . mysql_error( $us3_link ) );
     618         write_log( "$me: Bad query:\n$query\n" . mysqli_error( $us3_link ) );
     619         mail_to_user( "fail", "Bad query\n$query\n" . mysqli_error( $us3_link ) );
    623620         return( -1 );
    624621      }
     
    633630   $query  = "SELECT HPCAnalysisRequestGUID FROM HPCAnalysisRequest " .
    634631             "WHERE HPCAnalysisRequestID = $requestID ";
    635    $result = mysql_query( $query, $us3_link );
     632   $result = mysqli_query( $us3_link, $query );
    636633   
    637634   if ( ! $result )
    638635   {
    639       write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) );
     636      write_log( "$me: Bad query:\n$query\n" . mysqli_error( $us3_link ) );
    640637   }
    641638   
    642 //   list( $requestGUID ) = mysql_fetch_array( $result );
     639//   list( $requestGUID ) = mysqli_fetch_array( $result );
    643640//   
    644641//   chdir( "$submit_dir/$requestGUID" );
     
    651648   // exec( "rm -rf $gfacID" );
    652649
    653    mysql_close( $us3_link );
     650   mysqli_close( $us3_link );
    654651
    655652   /////////
     
    725722   {
    726723      $limshost    = gethostname();
    727       if ( ! preg_match( "/\./", $limshost ) )
     724      if ( preg_match( "/scyld/", $limshost ) )
     725         $limshost    = 'alamo.uthscsa.edu';
     726      else if ( ! preg_match( "/\./", $limshost ) )
    728727         $limshost    = $limshost . $org_domain;
    729728   }
     
    870869   global $me;
    871870   global $db;
     871   global $dbhost;
    872872   global $status;
    873873   $is_us3iab  = preg_match( "/us3iab/", $cluster );
    874874   $is_jetstr  = preg_match( "/jetstream/", $cluster );
    875 
    876    // Figure out remote directory
     875   $limshost   = $dbhost;
     876   $stderr     = '';
     877   $stdout     = '';
     878   $tarfile    = '';
     879
     880   if ( $limshost == 'localhost' )
     881   {  // If DB host is local host, get full LIMS host name
     882      $limshost    = gethostname();
     883      if ( preg_match( "/scyld/", $limshost ) )
     884         $limshost    = 'alamo.uthscsa.edu';
     885      else if ( ! preg_match( "/\./", $limshost ) )
     886         $limshost    = $limshost . $org_domain;
     887   }
     888
     889   if ( preg_match( "/alamo/", $limshost )  &&
     890        preg_match( "/alamo/", $cluster  ) )
     891   {  // If both LIMS and cluster are alamo, set up local transfers
     892      $is_us3iab   = 1;
     893      if ( ! preg_match( "/\/local/", $work_remote ) )
     894         $work_remote = $work_remote . "/local";
     895   }
     896
     897   // Figure out job's remote (or local) work directory
    877898   $remoteDir = sprintf( "$work_remote/$db-%06d", $requestID );
    878899//write_log( "$me: is_us3iab=$is_us3iab  remoteDir=$remoteDir" );
     
    891912         $lworkdir = "/N/us3_cluster/work/local";
    892913      }
    893       $cmd         = "ssh us3@$clushost 'ls -d $lworkdir' 2/dev/null";
     914      $cmd         = "ssh us3@$clushost 'ls -d $lworkdir' 2>/dev/null";
    894915      exec( $cmd, $output, $stat );
    895916      $work_remote = $output[ 0 ];
     
    934955   }
    935956   else
    936    {
     957   { // Is US3IAB or alamo-to-alamo, so just change to local work directory
    937958      $pwd = chdir( "$remoteDir" );
    938959write_log( "$me: IS US3IAB: pwd=$pwd $remoteDir");
     
    942963   // Write the files to gfacDB
    943964
     965   $secwait    = 10;
     966   $num_try    = 0;
     967   while ( ! file_exists( "stderr" )  &&  $num_try < 3 )
     968   {  // Do waits and retries to let stderr appear
     969      sleep( $secwait );
     970      $num_try++;
     971      $secwait   *= 2;
     972write_log( "$me:  not-exist-stderr: num_try=$num_try" );
     973   }
     974
     975   $lense = 0;
    944976   if ( file_exists( "stderr"  ) )
    945    {  // Filter stderr to not have libnnls debug lines
    946 //      exec( "mv stderr stderr+nnls", $output, $stat );
    947 //      exec( "grep -vi nnls stderr+nnls >stderr", $output, $stat );
     977   {
     978      $lense = filesize( "stderr" );
     979      if ( $lense > 1000000 )
     980      { // Replace exceptionally large stderr with smaller version
     981         exec( "mv stderr stderr-orig", $output, $stat );
     982         exec( "head -n 5000 stderr-orig >stderr-h", $output, $stat );
     983         exec( "tail -n 5000 stderr-orig >stderr-t", $output, $stat );
     984         exec( "cat stderr-h stderr-t >stderr", $output, $stat );
     985      }
    948986      $stderr  = file_get_contents( "stderr" );
    949987   }
    950988   else
     989   {
    951990      $stderr  = "";
     991   }
     992
    952993   if ( file_exists( "stdout" ) ) $stdout  = file_get_contents( "stdout" );
     994
    953995   $fn1_tarfile = "analysis-results.tar";
    954996   $fn2_tarfile = "output/" . $fn1_tarfile;
     
    9581000      $tarfile = file_get_contents( $fn2_tarfile );
    9591001
    960    $lense = strlen( $stderr );
    961    if ( $lense > 1000000 )
    962    { // Replace exceptionally large stderr with smaller version
    963       exec( "mv stderr stderr-orig", $output, $stat );
    964       exec( "head -n 5000 stderr-orig >stderr-h", $output, $stat );
    965       exec( "tail -n 5000 stderr-orig >stderr-t", $output, $stat );
    966       exec( "cat stderr-h stderr-t >stderr", $output, $stat );
    967       $stderr  = file_get_contents( "stderr" );
    968    }
    969 $lent = strlen( $tarfile );
    970 write_log( "$me: tarfile size: $lent");
     1002//   $lense = strlen( $stderr );
     1003//   if ( $lense > 1000000 )
     1004//   { // Replace exceptionally large stderr with smaller version
     1005//      exec( "mv stderr stderr-orig", $output, $stat );
     1006//      exec( "head -n 5000 stderr-orig >stderr-h", $output, $stat );
     1007//      exec( "tail -n 5000 stderr-orig >stderr-t", $output, $stat );
     1008//      exec( "cat stderr-h stderr-t >stderr", $output, $stat );
     1009//      $stderr  = file_get_contents( "stderr" );
     1010//   }
    9711011$lene = strlen( $stderr );
    9721012write_log( "$me: stderr size: $lene  (was $lense)");
    9731013$leno = strlen( $stdout );
    9741014write_log( "$me: stdout size: $leno");
    975 $estarf=mysql_real_escape_string($tarfile,$gfac_link);
     1015$lent = strlen( $tarfile );
     1016write_log( "$me: tarfile size: $lent");
     1017   $esstde = mysqli_real_escape_string( $gfac_link, $stderr );
     1018   $esstdo = mysqli_real_escape_string( $gfac_link, $stdout );
     1019   $estarf = mysqli_real_escape_string( $gfac_link, $tarfile );
     1020$lene = strlen($esstde);
     1021write_log( "$me:  es-stderr size: $lene");
     1022$leno = strlen($esstdo);
     1023write_log( "$me:  es-stdout size: $leno");
    9761024$lenf = strlen($estarf);
    977 write_log( "$me: es-tarfile size: $lenf");
    978 $esstdo=mysql_real_escape_string($stdout,$gfac_link);
    979 $leno = strlen($esstdo);
    980 write_log( "$me: es-stdout size: $leno");
    981 $esstde=mysql_real_escape_string($stderr,$gfac_link);
    982 $lene = strlen($esstde);
    983 write_log( "$me: es-stderr size: $lene");
     1025write_log( "$me:  es-tarfile size: $lenf");
    9841026   $query = "UPDATE analysis SET " .
    985             "stderr='"  . mysql_real_escape_string( $stderr,  $gfac_link ) . "'," .
    986             "stdout='"  . mysql_real_escape_string( $stdout,  $gfac_link ) . "'," .
    987             "tarfile='" . mysql_real_escape_string( $tarfile, $gfac_link ) . "'";
    988 
    989    $result = mysql_query( $query, $gfac_link );
    990 
    991    if ( ! $result )
    992    {
    993       write_log( "$me: Bad query:\n$query\n" . mysql_error( $gfac_link ) );
     1027            "stderr='"  . $esstde . "'," .
     1028            "stdout='"  . $esstdo . "'," .
     1029            "tarfile='" . $estarf . "'";
     1030
     1031   $result = mysqli_query( $gfac_link, $query );
     1032
     1033   if ( ! $result )
     1034   {
     1035      write_log( "$me: Bad query:\n$query\n" . mysqli_error( $gfac_link ) );
    9941036      echo "Bad query\n";
    9951037      return( -1 );
Note: See TracChangeset for help on using the changeset viewer.