当前位置: 首页>>代码示例>>PHP>>正文


PHP Functions::file_rename方法代码示例

本文整理汇总了PHP中Functions::file_rename方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::file_rename方法的具体用法?PHP Functions::file_rename怎么用?PHP Functions::file_rename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Functions的用法示例。


在下文中一共展示了Functions::file_rename方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dirname

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";
开发者ID:eliagbayani,项目名称:maps_test,代码行数:31,代码来源:332.php

示例2: dirname

<?php

namespace php_active_record;

/* 
NCBI Bio Projects
partner provides an XML dump
estimated execution time: 
*/
include_once dirname(__FILE__) . "/../../config/environment.php";
require_library('connectors/NCBIProjectsAPI');
$timestart = time_elapsed();
$resource_id = 173;
$func = new NCBIProjectsAPI($resource_id);
$func->get_all_taxa();
if (filesize(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "_working/taxon.tab") > 1000) {
    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::set_resource_status_to_force_harvest($resource_id);
}
$elapsed_time_sec = time_elapsed() - $timestart;
echo "\n\n elapsed time = " . $elapsed_time_sec / 60 . " minutes";
echo "\n elapsed time = " . $elapsed_time_sec / 60 / 60 . " hours";
echo "\n Done processing.\n";
开发者ID:eliagbayani,项目名称:maps_test,代码行数:27,代码来源:ncbi.php

示例3: finalize_dwca_resource

 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);
         }
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:22,代码来源:Functions.php

示例4: dirname

// .3 seconds wait time
include_once dirname(__FILE__) . "/../../config/environment.php";
$resource_id = 15;
if (!Functions::can_this_connector_run($resource_id)) {
    return;
}
require_library('FlickrAPI');
$GLOBALS['ENV_DEBUG'] = false;
$auth_token = NULL;
if (FlickrAPI::valid_auth_token(FLICKR_AUTH_TOKEN)) {
    $auth_token = FLICKR_AUTH_TOKEN;
}
// create new _temp file
if (!($resource_file = Functions::file_open(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "_temp.xml", "w+"))) {
    return;
}
// start the resource file with the XML header
fwrite($resource_file, \SchemaDocument::xml_header());
// query Flickr and write results to file
FlickrAPI::get_all_eol_photos($auth_token, $resource_file);
// write the resource footer
fwrite($resource_file, \SchemaDocument::xml_footer());
fclose($resource_file);
// cache the previous version and make this new version the current version
@unlink(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "_previous.xml");
Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml", CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "_previous.xml");
Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "_temp.xml", CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml");
// set Flickr to force harvest
if (filesize(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml") > 600) {
    Functions::set_resource_status_to_force_harvest($resource_id);
}
开发者ID:eliagbayani,项目名称:maps_test,代码行数:31,代码来源:15.php

示例5: dirname

<?php

namespace php_active_record;

/* connector for Learning + Education Group
Partner provides RSS feed.
estimated execution time: just a few seconds
*/
include_once dirname(__FILE__) . "/../../config/environment.php";
$timestart = time_elapsed();
require_library('connectors/LearningEducationAPI');
$taxa = LearningEducationAPI::get_all_taxa();
$xml = \SchemaDocument::get_taxon_xml($taxa);
$resource_path = CONTENT_RESOURCE_LOCAL_PATH . "257_temp.xml";
if (!($OUT = fopen($resource_path, "w+"))) {
    debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $resource_path);
    return;
}
fwrite($OUT, $xml);
fclose($OUT);
if (filesize($resource_path) > 600) {
    Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . "257.xml", CONTENT_RESOURCE_LOCAL_PATH . "257_previous.xml");
    Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . "257_temp.xml", CONTENT_RESOURCE_LOCAL_PATH . "257.xml");
    $GLOBALS['db_connection']->update("UPDATE resources SET resource_status_id=" . ResourceStatus::find_or_create_by_translated_label('Force Harvest')->id . " WHERE id=257");
}
$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 "\n\n Done processing.";
开发者ID:eliagbayani,项目名称:maps_test,代码行数:30,代码来源:257.php

示例6: dirname

include_once dirname(__FILE__) . "/../../config/environment.php";
$timestart = time_elapsed();
require_library('connectors/ConabioAPI');
$resource_id = 106;
$func = new ConabioAPI();
$func->combine_all_xmls($resource_id);
$resource_path = CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml";
// /* working well - replaces Class='Insecta' to 'Reptilia' if Order=='Squamata' --- WEB-5509
require_library('ResourceDataObjectElementsSetting');
$func = new ResourceDataObjectElementsSetting($resource_id, $resource_path);
$xml = file_get_contents($resource_path);
$xml = $func->replace_taxon_element_value_with_condition("dwc:Class", "Insecta", "Reptilia", $xml, "dwc:Order", "Squamata");
$func->save_resource_document($xml);
// */
// start - this will get Tamborines videos from Vimeo and append it with the main resource 106.xml (DATA-1592)
Functions::file_rename($resource_path, CONTENT_RESOURCE_LOCAL_PATH . "temp_vimeo_to_tamborine1.xml");
get_videos_from_vimeo();
Functions::combine_all_eol_resource_xmls($resource_id, CONTENT_RESOURCE_LOCAL_PATH . "temp_vimeo_to_tamborine*.xml");
unlink(CONTENT_RESOURCE_LOCAL_PATH . "temp_vimeo_to_tamborine1.xml");
unlink(CONTENT_RESOURCE_LOCAL_PATH . "temp_vimeo_to_tamborine2.xml");
// end
if (filesize($resource_path) > 1000) {
    Functions::set_resource_status_to_force_harvest($resource_id);
    Functions::gzip_resource_xml($resource_id);
}
$elapsed_time_sec = time_elapsed() - $timestart;
echo "\n";
echo "elapsed time = " . $elapsed_time_sec / 60 . " minutes \n";
echo "elapsed time = " . $elapsed_time_sec / 60 / 60 . " hours \n";
function get_videos_from_vimeo()
{
开发者ID:eliagbayani,项目名称:maps_test,代码行数:31,代码来源:106.php

示例7: dirname

<?php

namespace php_active_record;

include_once dirname(__FILE__) . "/../../config/environment.php";
require_library('connectors/PaleobiologyAPI');
$paleobiology_connector = new PaleobiologyAPI();
$paleobiology_connector->get_all_taxa();
if (filesize(CONTENT_RESOURCE_LOCAL_PATH . "paleobiology_working/taxon.tab") > 1000) {
    if (is_dir(CONTENT_RESOURCE_LOCAL_PATH . "paleobiology")) {
        recursive_rmdir(CONTENT_RESOURCE_LOCAL_PATH . "paleobiology_previous");
        Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . "paleobiology", CONTENT_RESOURCE_LOCAL_PATH . "paleobiology_previous");
    }
    Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . "paleobiology_working", CONTENT_RESOURCE_LOCAL_PATH . "paleobiology");
    #$GLOBALS['db_connection']->update("UPDATE resources SET resource_status_id=".ResourceStatus::find_or_create_by_translated_label('Force Harvest')->id." WHERE id=6");
}
开发者ID:eliagbayani,项目名称:maps_test,代码行数:16,代码来源:paleobiology.php

示例8: move_up_if_only_directory

 public static function move_up_if_only_directory($directory_path)
 {
     $files = read_dir($directory_path);
     $only_file = null;
     foreach ($files as $file) {
         // there can be only one only file, must not start with a dot
         if ($only_file) {
             return;
         }
         if (substr($file, 0, 1) == ".") {
             continue;
         }
         $only_file = $directory_path . "/" . $file;
     }
     if (is_dir($only_file)) {
         Functions::file_rename($only_file, $directory_path . "_swap");
         rmdir($directory_path);
         if (copy($directory_path . "_swap", $directory_path)) {
             unlink($directory_path . "_swap");
         }
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:22,代码来源:ContentManager.php

示例9: dirname

<?php

namespace php_active_record;

include_once dirname(__FILE__) . "/../../config/environment.php";
require_library('connectors/BiopixAPI');
$biopix_connector = new BiopixAPI();
$biopix_connector->get_all_taxa();
if (filesize(CONTENT_RESOURCE_LOCAL_PATH . "31_working/taxon.tab") > 1000 && filesize(CONTENT_RESOURCE_LOCAL_PATH . "31_working/media_resource.tab") > 1000) {
    if (is_dir(CONTENT_RESOURCE_LOCAL_PATH . "31")) {
        recursive_rmdir(CONTENT_RESOURCE_LOCAL_PATH . "31_previous");
        Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . "31", CONTENT_RESOURCE_LOCAL_PATH . "31_previous");
    }
    Functions::file_rename(CONTENT_RESOURCE_LOCAL_PATH . "31_working", CONTENT_RESOURCE_LOCAL_PATH . "31");
    $GLOBALS['db_connection']->update("UPDATE resources SET resource_status_id=" . ResourceStatus::find_or_create_by_translated_label('Force Harvest')->id . " WHERE id=31");
}
开发者ID:eliagbayani,项目名称:maps_test,代码行数:16,代码来源:31.php


注:本文中的Functions::file_rename方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。