Exemplo n.º 1
0
 function get_all_taxa()
 {
     require_library('connectors/USDAfsfeisAPI');
     $resource_id = false;
     $group["Plantae"] = "plants";
     $func = new USDAfsfeisAPI($resource_id, $group);
     $records = $func->prepare_taxa_urls();
     /*
     [taxonID] => WISFLO
     [url] => http://www.fs.fed.us/database/feis/plants/vine/wisspp/all.html
     [sciname] => Wisteria floribunda
     [vernacular] => Japanese wisteria
     [kingdom] => Plantae
     */
     $info = self::get_spreadsheet($this->pages['mappings']);
     $subsections = $info['subsections'];
     $habitats = $info['habitats'];
     foreach ($records as $record) {
         // $record['url'] = 'http://www.fs.fed.us/database/feis/plants/tree/robpse/all.html'; //debug
         // $record['url'] = 'http://www.fs.fed.us/database/feis/plants/cactus/echfen/all.html'; //debug
         // $record['url'] = 'http://www.fs.fed.us/database/feis/plants/tree/alnrho/all.html'; //debug
         // $record['url'] = 'http://www.fs.fed.us/database/feis/plants/fern/botspp/all.html'; //debug
         // $record['url'] = 'http://www.fs.fed.us/database/feis/plants/forb/corvar/all.html'; //debug
         $rec = self::process_page($record['url']);
         $rec['taxon_id'] = $record['taxonID'];
         $rec['kingdom'] = $record['kingdom'];
         $rec['sciname'] = $record['sciname'];
         if (@$rec['life_form'] || @$rec['habitat']) {
             self::create_archive($rec, $habitats, $subsections);
             // print_r($rec);
         }
         // break; //debug
     }
     $this->archive_builder->finalize(TRUE);
     if ($val = $this->debug) {
         print_r($val);
     }
 }
Exemplo n.º 2
0
<?php

namespace php_active_record;

/* execution time: 2.7 hours */
include_once dirname(__FILE__) . "/../../config/environment.php";
require_library('connectors/USDAfsfeisAPI');
$timestart = time_elapsed();
$resource_id = "505";
$group["Plantae"] = "plants";
$func = new USDAfsfeisAPI($resource_id, $group);
$func->get_all_taxa();
Functions::finalize_dwca_resource($resource_id);
$elapsed_time_sec = time_elapsed() - $timestart;
echo "\n\n";
echo "\n elapsed time = {$elapsed_time_sec} seconds";
echo "\n elapsed time = " . $elapsed_time_sec / 60 . " minutes";
echo "\n elapsed time = " . $elapsed_time_sec / 60 / 60 . " hours";
echo "\n Done processing.";