Changeset 8
- Timestamp:
- Apr 30, 2015, 2:23:05 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cleanup_aira.php
r7 r8 450 450 451 451 } 452 else // It's a model file 452 453 else if ( preg_match( "/\.mrecs/", $fn ) > 0 ) // It's an mrecs file 454 { 455 $xml = file_get_contents( $fn ); 456 $mrecs_data = parse_xml( $xml, "modelrecords" ); 457 $desc = $mrecs_data[ 'description' ]; 458 $editGUID = $mrecs_data[ 'editGUID' ]; 459 write_log( "$me: mrecs file editGUID=$editGUID" ); 460 if ( strlen( $editGUID ) < 36 ) 461 $editGUID = "12345678-0123-5678-0123-567890123456"; 462 $mrecGUID = $mrecs_data[ 'mrecGUID' ]; 463 $modelGUID = $mrecs_data[ 'modelGUID' ]; 464 465 $query = "INSERT INTO pcsa_modelrecs SET " . 466 "editedDataID=" . 467 "(SELECT editedDataID FROM editedData WHERE editGUID='$editGUID')," . 468 "modelID=0, " . 469 "mrecsGUID='$mrecGUID'," . 470 "description='$desc'," . 471 "xml='" . mysql_real_escape_string( $xml, $us3_link ) . "'"; 472 473 // Add later after all files are processed: editDataID, modelID 474 475 $result = mysql_query( $query, $us3_link ); 476 477 if ( ! $result ) 478 { 479 write_log( "$me: Bad query:\n$query\n" . mysql_error( $us3_link ) ); 480 mail_to_user( "fail", "Internal error\n$query\n" . mysql_error( $us3_link ) ); 481 return( -1 ); 482 } 483 484 $id = mysql_insert_id( $us3_link ); 485 $file_type = "mrecs"; 486 $mrecsIDs[] = $id; 487 488 // Keep track of modelGUIDs for later, when we replace them 489 $rmodlGUIDs[ $id ] = $modelGUID; 490 //write_log( "$me: mrecs file inserted into DB : id=$id" ); 491 } 492 493 else // It's a model file 453 494 { 454 495 $xml = file_get_contents( $fn );
Note:
See TracChangeset
for help on using the changeset viewer.