private function update_eol_xml($lifedesk_name) { /* taxon = 434 dwc:ScientificName = 434 reference = 614 synonym = 68 commonName = 2 dataObjects = 1705 reference = 0 texts = 1146 images = 559 videos = 0 sounds = 0 */ require_library('ResourceDataObjectElementsSetting'); $resource_path = CONTENT_RESOURCE_LOCAL_PATH . $lifedesk_name . ".xml"; $func = new ResourceDataObjectElementsSetting($lifedesk_name, $resource_path); $xml = file_get_contents($this->text_path["eol_xml"]); $xml = $func->replace_taxon_element_value("dc:source", "replace any existing value", "", $xml, false); $xml = $func->replace_data_object_element_value("dc:source", "replace any existing value", "", $xml, false); $xml = self::remove_tags_in_references($xml); $func->save_resource_document($xml); // zip the xml $command_line = "gzip -c " . CONTENT_RESOURCE_LOCAL_PATH . $lifedesk_name . ".xml >" . CONTENT_RESOURCE_LOCAL_PATH . $lifedesk_name . ".xml.gz"; $output = shell_exec($command_line); }
- If needed ingests TypeInformation text dataObjects - replaces wrong mimeType value */ include_once dirname(__FILE__) . "/../../config/environment.php"; require_library('ResourceDataObjectElementsSetting'); $timestart = time_elapsed(); $resource_id = 341; $resource_path = "http://collections.mnh.si.edu/services/eol/nmnh-birds-response.xml.gz"; //Birds resource $result = $GLOBALS['db_connection']->select("SELECT accesspoint_url FROM resources WHERE id={$resource_id}"); $row = $result->fetch_row(); $new_resource_path = $row[0]; if ($resource_path != $new_resource_path && $new_resource_path != '') { $resource_path = $new_resource_path; } echo "\n processing resource:\n {$resource_path} \n\n"; $nmnh = new ResourceDataObjectElementsSetting($resource_id, $resource_path, 'http://purl.org/dc/dcmitype/StillImage', 2); $xml = $nmnh->set_data_object_rating_on_xml_document(); require_library('connectors/INBioAPI'); $xml = INBioAPI::assign_eol_subjects($xml); $xml = $nmnh->replace_data_object_element_value("mimeType", "audio/wav", "audio/x-wav", $xml); $xml = $nmnh->remove_data_object_of_certain_element_value("mimeType", "audio/x-wav", $xml); // to exclude <dataObject>'s of this element and value $nmnh->save_resource_document($xml); Functions::set_resource_status_to_force_harvest($resource_id); $elapsed_time_sec = time_elapsed() - $timestart; echo "\n"; echo "elapsed time = {$elapsed_time_sec} seconds \n"; echo "elapsed time = " . $elapsed_time_sec / 60 . " minutes \n"; echo "elapsed time = " . $elapsed_time_sec / 60 / 60 . " hours \n"; echo "\n\n Done processing.";