exit; } //read in the configuration file $filepath = "harvest.cfg"; $parsed_ini = parse_ini_file($filepath, true); $sierra_info = $parsed_ini["sierra"]; $location = $parsed_ini["catalog"]["location"]; //$timestamp = time() - (2*24*60*60); // yesterday $timestamp = $parsed_ini["catalog"]["last_harvested"]; $sierra = new Sierra($sierra_info['host'], $sierra_info['user'], $sierra_info['password']); if (!$timestamp || $timestamp == '') { //full load echo "Running full export of marc files as no date specified\n"; $new_timestamp = time(); //removed the old include_options array from export functions. No need to supply the record type here, as the default is 'bib' $results = $sierra->exportRecords($location); } else { echo "Running incremental load to retrieve records after " . $timestamp . "\n"; //convert to timestamp $contimestamp = strtotime($timestamp); echo "Converted timestamp from {$timestamp} to {$contimestamp} which is " . date("Y-m-d\\TH:i", $contimestamp) . "\n"; //removed the old include_options array from export functions. No need to supply the record type here, as the default is 'bib' $results = $sierra->exportRecordsModifiedAfter($contimestamp, $location); $new_timestamp = time(); } //we should only update the timestamp if the load was successful //if ($results){ $new_timestamp = date("Y-m-d\\TH:i", $new_timestamp); if (update_cfg($parsed_ini, $filepath, $new_timestamp)) { echo "\nWrote last date harvested to file: " . $new_timestamp; }