本文整理汇总了PHP中recursive_rmdir函数的典型用法代码示例。如果您正苦于以下问题:PHP recursive_rmdir函数的具体用法?PHP recursive_rmdir怎么用?PHP recursive_rmdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了recursive_rmdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_all_taxa
function get_all_taxa()
{
require_library('connectors/INBioAPI');
$func = new INBioAPI();
$paths = $func->extract_archive_file($this->dwca_file, "meta.xml");
$archive_path = $paths['archive_path'];
$temp_dir = $paths['temp_dir'];
$harvester = new ContentArchiveReader(NULL, $archive_path);
$tables = $harvester->tables;
if (!($this->fields["taxa"] = $tables["http://rs.tdwg.org/dwc/terms/taxon"][0]->fields)) {
debug("Invalid archive file. Program will terminate.");
return false;
}
self::build_taxa_rank_array($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/Taxon'));
self::create_instances_from_taxon_object($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/Taxon'));
self::get_objects($harvester->process_row_type('http://eol.org/schema/media/Document'));
self::get_references($harvester->process_row_type('http://rs.gbif.org/terms/1.0/Reference'));
self::get_agents($harvester->process_row_type('http://eol.org/schema/agent/Agent'));
self::get_vernaculars($harvester->process_row_type('http://rs.gbif.org/terms/1.0/VernacularName'));
$this->archive_builder->finalize(TRUE);
// remove temp dir
recursive_rmdir($temp_dir);
echo "\n temporary directory removed: " . $temp_dir;
print_r($this->debug);
}
示例2: get_all_taxa
function get_all_taxa($taxa_list_text_file = NULL)
{
$this->TEMP_FILE_PATH = create_temp_dir() . "/";
if ($taxa_list_text_file) {
if ($contents = Functions::lookup_with_cache($taxa_list_text_file, $this->download_options)) {
self::save_to_taxa_text_file($contents);
}
} else {
self::generate_taxa_list();
}
/* debug: stop operation here if you only want to generate taxa list */
//return;
self::save_data_to_text();
/* debug: stop operation here if you only want to generate processed text files */
//return;
if ($taxa_list_text_file) {
echo "\n\n finished processing: [{$taxa_list_text_file}]\n\n";
return;
// you need to consolidate the processed text files before proceeding.
}
self::process_text_file();
$this->archive_builder->finalize(true);
// remove temp dir
recursive_rmdir($this->TEMP_FILE_PATH);
echo "\n temporary directory removed: " . $this->TEMP_FILE_PATH;
}
示例3: recursive_rmdir
function recursive_rmdir($directory, $empty = false)
{
$directory = preg_replace('@[\\/]$@', '', $directory);
if (!file_exists($directory) || !is_dir($directory)) {
return false;
} elseif (!is_readable($directory)) {
return false;
} else {
$handle = opendir($directory);
while (false !== ($item = readdir($handle))) {
if ($item != '.' && $item != '..') {
$path = $directory . DIRECTORY_SEPARATOR . $item;
if (is_dir($path)) {
recursive_rmdir($path);
} elseif (unlink($path)) {
echo $path . "\n";
}
}
}
closedir($handle);
if ($empty == false) {
if (rmdir($directory)) {
echo $directory . "\n";
} else {
return false;
}
}
return true;
}
}
示例4: get_all_taxa
function get_all_taxa()
{
$this->institution_uris = self::get_institution_uris();
self::load_zip_contents();
print_r($this->text_path);
require_library('connectors/FishBaseAPI');
$func = new FishBaseAPI();
$fields = array("lngSpeciesSenior_ID", "lngSpecies_ID", "lngRepository_ID", "strCatNr", "lngPrepMeth_ID", "lngPersPrep_ID", "lngPersID2_ID", "lngPersID3_ID", "bytCountPrep", "lngDocuTypeSpecimen", "lngPrep_ID", "txtPrepNotes", "lngSpecimen_ID", "strTypeStat", "lngLoc_ID", "strLocName", "txtLocDescr", "sngElevation", "sngLatitudeWGS84", "sngLongitudeWGS84", "lngMacrohabitat_ID", "lngPermanency_ID", "strDepth", "lngGeology_ID", "lngSpecLocal_ID");
$records_specimen = $func->make_array($this->text_path["sd_specimen"], $fields, "", array());
array_shift($records_specimen);
$fields = array("lngPersIdent_ID", "lngSpecimen_ID");
$records_specimen_identifier = $func->make_array($this->text_path["sd_specimen_identifier"], $fields, "", array());
array_shift($records_specimen_identifier);
$fields = array("lngSpeciesSenior_ID", "lngMacroMicro_ID", "lngSpecies_ID");
$records_habitat = $func->make_array($this->text_path["sd_macro_locality"], $fields, "", array());
array_shift($records_habitat);
/*
$fields = array("lngLoc_ID", "strLocName", "txtLocDescr", "sngElevation", "sngLatitudeWGS84", "sngLongitudeWGS84", "lngMacrohabitat_ID", "lngPermanency_ID", "strDepth", "lngGeology_ID", "lngSpecLocal_ID", "lngSpecimen_ID", "lngSpeciesSenior_ID", "lngSpecies_ID");
$records_locality = $func->make_array($this->text_path["sd_locality"], $fields, "", array());
array_shift($records_locality);
*/
$this->assemble_identified_by($records_specimen_identifier);
$this->create_instances_from_taxon_object($records_specimen, "specimen");
// $this->create_instances_from_taxon_object($records_locality, "locality");
$this->create_instances_from_taxon_object($records_habitat, "habitat");
$this->create_archive();
// remove temp dir
$path = $this->text_path["sd_specimen"];
$parts = pathinfo($path);
$parts["dirname"] = str_ireplace("/type_specimen", "", $parts["dirname"]);
recursive_rmdir($parts["dirname"]);
debug("\n temporary directory removed: " . $parts["dirname"]);
}
示例5: get_all_taxa
function get_all_taxa()
{
/*
$id = "100001";
$arr = array("distribution", "chromosome", "taxon_name", "taxonomy", "synonyms", "taxon_ref", "images");
foreach($arr as $type)
{
if($type == "taxon_name") $url = TROPICOS_API_SERVICE . $id . "?format=json&apikey=" . TROPICOS_API_KEY;
elseif($type == "taxonomy") $url = TROPICOS_API_SERVICE . $id . "/HigherTaxa?format=xml&apikey=" . TROPICOS_API_KEY;
elseif($type == "synonyms") $url = TROPICOS_API_SERVICE . $id . "/Synonyms?format=xml&apikey=" . TROPICOS_API_KEY;
elseif($type == "taxon_ref") $url = TROPICOS_API_SERVICE . $id . "/References?format=xml&apikey=" . TROPICOS_API_KEY;
elseif($type == "distribution") $url = TROPICOS_API_SERVICE . $id . "/Distributions?format=xml&apikey=" . TROPICOS_API_KEY;
elseif($type == "images") $url = TROPICOS_API_SERVICE . $id . "/Images?format=xml&apikey=" . TROPICOS_API_KEY;
elseif($type == "chromosome") $url = TROPICOS_API_SERVICE . $id . "/ChromosomeCounts?format=xml&apikey=" . TROPICOS_API_KEY;
echo "\n $type: [$url]";
}
exit;
*/
self::assemble_id_list();
exit;
self::process_taxa();
$this->archive_builder->finalize(TRUE);
// remove temp dir
recursive_rmdir($this->TEMP_DIR);
echo "\n temporary directory removed: " . $this->TEMP_DIR;
}
示例6: export_gbif_to_eol
function export_gbif_to_eol($params)
{
require_library('connectors/INBioAPI');
$func = new INBioAPI();
$paths = $func->extract_archive_file($params["dwca_file"], "meta.xml");
$archive_path = $paths['archive_path'];
$temp_dir = $paths['temp_dir'];
$harvester = new ContentArchiveReader(NULL, $archive_path);
$tables = $harvester->tables;
if (!($this->fields["occurrence"] = $tables["http://rs.tdwg.org/dwc/terms/occurrence"][0]->fields)) {
debug("Invalid archive file. Program will terminate.");
return false;
}
/*
$harvester->process_row_type() - this will convert rows into array.
*/
// $r = $harvester->process_row_type('http://rs.tdwg.org/dwc/terms/occurrence');
// $r = $harvester->process_row_type('http://rs.gbif.org/terms/1.0/Multimedia');
// print_r($r); exit;
self::create_instances_from_taxon_object($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/occurrence'));
self::get_media_objects($harvester->process_row_type('http://rs.gbif.org/terms/1.0/Multimedia'));
// self::get_objects($harvester->process_row_type('http://eol.org/schema/media/Document'));
// self::get_references($harvester->process_row_type('http://rs.gbif.org/terms/1.0/Reference'));
// self::get_agents($harvester->process_row_type('http://eol.org/schema/agent/Agent'));
// self::get_vernaculars($harvester->process_row_type('http://rs.gbif.org/terms/1.0/VernacularName'));
$this->archive_builder->finalize(TRUE);
// remove temp dir
recursive_rmdir($temp_dir);
echo "\n temporary directory removed: " . $temp_dir;
}
示例7: get_all_taxa
function get_all_taxa()
{
self::initialize_dump_file();
$this->agent_ids = self::get_object_agents($this->agents);
// /* normal operation
$this->save_data_to_text();
$this->access_dump_file(false, "synonyms");
$this->access_dump_file(false, "objects");
$this->process_taxa();
// */
/* use this if the dump file has already been created - works okay!
$dump_file = DOC_ROOT . "tmp/turbellarian_dump/turbellarian_dump.txt";
$this->access_dump_file($dump_file, "synonyms");
$this->access_dump_file($dump_file, "objects");
$this->process_taxa($dump_file);
*/
/* manually adding Bilateria */
$rec = array();
$rec["sciname"] = "Bilateria";
$rec["taxon_id"] = "Bilateria";
$rec["authorship"] = "";
$rec["parent_id"] = "";
$rec["status"] = "";
$this->create_instances_from_taxon_object($rec);
$this->create_archive();
/* remove temp dir */
recursive_rmdir($this->TEMP_DIR);
echo "\n temporary directory removed: " . $this->TEMP_DIR;
}
示例8: generate_EnvEOL_data
function generate_EnvEOL_data()
{
require_library('connectors/IUCNRedlistDataConnector');
$func = new IUCNRedlistDataConnector();
$basenames = array("eol_env_annotations_noParentTerms");
// list of needed basenames
$options = $this->download_options;
$options['expire_seconds'] = 2592000 * 3;
// 3 months before cache expires
$text_path = $func->load_zip_contents($this->species_list_export, $options, $basenames, ".tsv");
print_r($text_path);
self::csv_to_array($text_path[$basenames[0]]);
$this->archive_builder->finalize(TRUE);
// remove temp dir
$parts = pathinfo($text_path[$basenames[0]]);
recursive_rmdir($parts["dirname"]);
debug("\n temporary directory removed: " . $parts["dirname"]);
recursive_rmdir($this->TEMP_DIR);
// comment this if u want to check "need_to_check_tc_id.txt"
/* run problematic tc_ids with cache=0 --- a utility
$tc_ids = self::get_dump();
foreach($tc_ids as $tc_id)
{
$rec['taxon_id'] = $tc_id;
self::prepare_taxon($rec);
}
exit("\n-exit-\n");
*/
}
示例9: load_xml_string
function load_xml_string()
{
$file_contents = "";
debug("Please wait, downloading resource document...");
if (preg_match("/^(.*)\\.(gz|gzip)\$/", $this->xml_path, $arr)) {
$path_parts = pathinfo($this->xml_path);
$filename = $path_parts['basename'];
$temp_dir = create_temp_dir() . "/";
debug("temp file path: " . $temp_dir);
if ($file_contents = Functions::get_remote_file($this->xml_path, array('timeout' => 172800))) {
$temp_file_path = $temp_dir . "/" . $filename;
$TMP = fopen($temp_file_path, "w");
fwrite($TMP, $file_contents);
fclose($TMP);
shell_exec("gunzip -f {$temp_file_path}");
$this->xml_path = $temp_dir . str_ireplace(".gz", "", $filename);
debug("xml path: " . $this->xml_path);
} else {
debug("Connector terminated. Remote files are not ready.");
return false;
}
echo "\n {$temp_dir} \n";
$file_contents = Functions::get_remote_file($this->xml_path, array('timeout' => 172800));
recursive_rmdir($temp_dir);
// remove temp dir
echo "\n temporary directory removed: [{$temp_dir}]\n";
}
return $file_contents;
}
示例10: export_gbif_to_eol
function export_gbif_to_eol($params)
{
$this->uris = self::get_uris($params);
require_library('connectors/INBioAPI');
$func = new INBioAPI();
$paths = $func->extract_archive_file($params["dwca_file"], "meta.xml", array("timeout" => 7200, "expire_seconds" => false));
// "expire_seconds" -- false => won't expire; 0 => expires now
$archive_path = $paths['archive_path'];
$temp_dir = $paths['temp_dir'];
$this->harvester = new ContentArchiveReader(NULL, $archive_path);
if (!@$this->harvester->tables["http://rs.tdwg.org/dwc/terms/occurrence"][0]->fields) {
debug("Invalid archive file. Program will terminate.");
return false;
}
if ($params["dataset"] == "NMNH") {
self::process_row_type($params);
} elseif ($params["dataset"] == "NHM") {
self::process_row_type_from_NHM($temp_dir . "/" . $params['location']);
}
$this->archive_builder->finalize(TRUE);
// remove temp dir
recursive_rmdir($temp_dir);
echo "\n temporary directory removed: " . $temp_dir;
print_r($this->debug);
}
示例11: uninstall
public function uninstall()
{
recursive_rmdir(DATA_DIR . '/Base_Theme/templates/default/images');
Variable::delete('default_theme');
Variable::delete('preload_image_cache_default');
Variable::delete('preload_image_cache_selected');
return true;
}
示例12: get_all_taxa
function get_all_taxa()
{
if (self::process_text_files()) {
$this->create_archive();
// remove temp dir
$parts = pathinfo($this->text_path["1"]);
recursive_rmdir($parts["dirname"]);
debug("\n temporary directory removed: " . $parts["dirname"]);
}
}
示例13: get_all_taxa
function get_all_taxa()
{
self::process_text_files();
// remove temp dir
$path = $this->text_path["species"];
$parts = pathinfo($path);
$parts["dirname"] = str_ireplace("/rotifers", "", $parts["dirname"]);
recursive_rmdir($parts["dirname"]);
debug("\n temporary directory removed: " . $parts["dirname"]);
}
示例14: export_lifedesk_to_eol
function export_lifedesk_to_eol($params)
{
require_library('connectors/LifeDeskToScratchpadAPI');
$func = new LifeDeskToScratchpadAPI();
if ($this->text_path = $func->load_zip_contents($params["lifedesk"])) {
self::update_eol_xml("LD_" . $params["name"]);
}
// remove temp dir
$parts = pathinfo($this->text_path["eol_xml"]);
recursive_rmdir($parts["dirname"]);
debug("\n temporary directory removed: " . $parts["dirname"]);
}
示例15: get_all_taxa
function get_all_taxa()
{
$this->stored_offline_urls = $this->get_rows_from_dump_file($this->stored_offline_urls_dump_file);
$this->create_reference();
$urls = self::get_urls_to_process();
$this->process_urls($urls);
$this->manuall_add_taxon();
$this->archive_builder->finalize(TRUE);
recursive_rmdir($this->TEMP_DIR);
// comment this line to check offline_urls.txt
debug("\n temporary directory removed: " . $this->TEMP_DIR);
}