Example #1
0
 public static function finalize_dwca_resource($resource_id, $big_file = false)
 {
     if (filesize(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "_working/taxon.tab") > 200) {
         if (is_dir(CONTENT_RESOURCE_LOCAL_PATH . $resource_id)) {
             recursive_rmdir(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "_previous");
             Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . $resource_id, CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "_previous");
         }
         Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "_working", CONTENT_RESOURCE_LOCAL_PATH . $resource_id);
         Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "_working.tar.gz", CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".tar.gz");
         Functions::set_resource_status_to_force_harvest($resource_id);
         Functions::count_resource_tab_files($resource_id);
         if (!$big_file) {
             if ($undefined_uris = Functions::get_undefined_uris_from_resource($resource_id)) {
                 print_r($undefined_uris);
             }
             echo "\nUndefined URIs: " . count($undefined_uris) . "\n";
             require_library('connectors/DWCADiagnoseAPI');
             $func = new DWCADiagnoseAPI();
             $func->check_unique_ids($resource_id);
         }
     }
 }
Example #2
0
include_once dirname(__FILE__) . "/../../config/environment.php";
require_library('connectors/I3InteractiveAPI');
$timestart = time_elapsed();
$params["resource_id"] = 332;
$params["process occurrence"] = false;
$params["dwca_file"] = "http://localhost/cp/3IInteractive/DwCArchive_Cicadellinae.zip";
$params["dwca_file"] = "http://dmitriev.speciesfile.org/Export/DwCArchive_Cicadellinae.zip";
$func = new I3InteractiveAPI($params);
$func->get_all_taxa();
if (filesize(CONTENT_RESOURCE_LOCAL_PATH . $params["resource_id"] . "_working/taxon.tab") > 1000) {
    if (is_dir(CONTENT_RESOURCE_LOCAL_PATH . $params["resource_id"])) {
        recursive_rmdir(CONTENT_RESOURCE_LOCAL_PATH . $params["resource_id"] . "_previous");
        Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . $params["resource_id"], CONTENT_RESOURCE_LOCAL_PATH . $params["resource_id"] . "_previous");
    }
    Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . $params["resource_id"] . "_working", CONTENT_RESOURCE_LOCAL_PATH . $params["resource_id"]);
    Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . $params["resource_id"] . "_working.tar.gz", CONTENT_RESOURCE_LOCAL_PATH . $params["resource_id"] . ".tar.gz");
    Functions::set_resource_status_to_force_harvest($params["resource_id"]);
    Functions::count_resource_tab_files($params["resource_id"]);
    if ($undefined_uris = Functions::get_undefined_uris_from_resource($params["resource_id"])) {
        print_r($undefined_uris);
    }
    echo "\nUndefined URIs: " . count($undefined_uris) . "\n";
    require_library('connectors/DWCADiagnoseAPI');
    $func = new DWCADiagnoseAPI();
    $func->check_unique_ids($params["resource_id"]);
}
$elapsed_time_sec = time_elapsed() - $timestart;
echo "\n\n";
echo "\n elapsed time = " . $elapsed_time_sec / 60 . " minutes";
echo "\n elapsed time = " . $elapsed_time_sec / 60 / 60 . " hours";
echo "\n Done processing.\n";
Example #3
0
$destination = DOC_ROOT . "app/app2";
echo "\n" . filetype($source) . "\n";
echo "\n" . filetype($destination) . "\n";
exit;
*/
/*
$folder = "/";
$folder = DOC_ROOT . "/temp" . "/folder2";
$folder = CONTENT_RESOURCE_LOCAL_PATH;
Functions::file_rename($source, $destination);
exit("\n\n");
*/
// /*
$resource_id = "Coral_Skeletons";
//355;
$func = new DWCADiagnoseAPI();
// Functions::count_resource_tab_files($resource_id);
// names_breakdown(355);
// exit;
// */
//=========================================================
$func->check_unique_ids($resource_id);
return;
//=========================================================
// $func->cannot_delete(); return;
//=========================================================
// $func->get_undefined_uris(); return;
//=========================================================
$elapsed_time_sec = time_elapsed() - $timestart;
echo "\n\n";
echo "elapsed time = " . $elapsed_time_sec / 60 . " minutes \n";