本文整理汇总了PHP中copy_files函数的典型用法代码示例。如果您正苦于以下问题:PHP copy_files函数的具体用法?PHP copy_files怎么用?PHP copy_files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了copy_files函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_contents
function save_contents($outputs, $output_file, $contents)
{
$tmp_file = $output_file . '.tmp';
file_put_contents($tmp_file, $contents);
copy_files($outputs, $tmp_file, $output_file);
echo "Saving to <b>{$output_file}.</b></br></br>\n\n";
unlink($tmp_file);
}
示例2: main
/**
* The main function of the script.
*/
function main()
{
global $db, $claspages, $pages, $thissite, $claspages_to_sites_slugs, $pages_to_sites_slugs;
create_sites();
store_blogs_information();
store_users_information();
populate_main_site_tables();
populate_main_blog_tables();
populate_plugin_site_tables();
populate_plugin_blog_tables();
find_and_replace();
copy_files();
disconnect_sites();
}
示例3: index
function index()
{
if (!IS_POST) {
$this->display('index.html');
} else {
$seller_name = empty($_POST['seller']) ? '' : trim($_POST['seller']);
$buyer_name = empty($_POST['buyer']) ? '' : trim($_POST['buyer']);
if (!$seller_name || !$buyer_name) {
$this->show_message('请填写卖家用户名和买家用户名');
return;
}
/* 检查用户名 */
$ms =& ms();
if (!$ms->user->check_username($seller_name)) {
$error_msg = array('user_exists' => '卖家用户名已存在,请您换一个', 'invalid_user_name' => '卖家用户名不符合要求,请您换一个', 'blocked_user_name' => '卖家用户名不符合要求,请您换一个', 'unknow_error' => '卖家用户名不符合要求,请您换一个');
$error = $ms->user->get_error();
$this->show_message($error_msg[$error[0]['msg']]);
return;
}
if (!$ms->user->check_username($buyer_name)) {
$error_msg = array('user_exists' => '买家用户名已存在,请您换一个', 'invalid_user_name' => '买家用户名不符合要求,请您换一个', 'blocked_user_name' => '买家用户名不符合要求,请您换一个', 'unknow_error' => '买家用户名不符合要求,请您换一个');
$error = $ms->user->get_error();
$this->show_message($error_msg[$error[0]['msg']]);
return;
}
/* 注册用户 */
$this->_seller_id = $ms->user->register($seller_name, '123456', 'seller@ecmall.com', array('real_name' => '超级卖家'));
$this->_buyer_id = $ms->user->register($buyer_name, '123456', 'buyer@ecmall.com', array('real_name' => '超级买家'));
/* 复制文件 */
copy_files(APP_ROOT . '/data', ROOT_PATH . '/data');
/* 运行sql */
$mod =& m('privilege');
$sqls = get_sql(APP_ROOT . '/initdata.sql');
foreach ($sqls as $sql) {
$sql = str_replace('{seller_id}', $this->_seller_id, $sql);
$sql = str_replace('{buyer_id}', $this->_buyer_id, $sql);
$mod->db->query($sql);
}
/* 清除缓存 */
$cache_server =& cache_server();
$cache_server->clear();
/* 锁定文件 */
touch(LOCK_FILE);
/* 运行成功 */
$this->show_message('恭喜!测试数据安装成功!');
}
}
示例4: do_others
/**
* 其它设置
*
* @access public
* @param string $system_lang 系统语言
* @param string $disable_captcha 是否开启验证码
* @param array $goods_types 预选商品类型
* @param string $install_demo 是否安装测试数据
* @param string $integrate_code 用户接口
* @return boolean 成功返回true,失败返回false
*/
function do_others($system_lang, $captcha, $goods_types, $install_demo, $integrate_code)
{
global $err, $_LANG;
/* 安装预选商品类型 */
if (!install_goods_types($goods_types, $system_lang))
{
$err->add(implode('', $err->last_message()));
return false;
}
/* 安装测试数据 */
if (intval($install_demo))
{
if (file_exists(ROOT_PATH . 'demo/'. $system_lang . '.sql'))
{
$sql_files = array(ROOT_PATH . 'demo/'. $system_lang . '.sql');
}
else
{
$sql_files = array(ROOT_PATH . 'demo/zh_cn.sql');
}
if (!install_data($sql_files))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/brandlogo/', ROOT_PATH . 'data/brandlogo/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/200905/goods_img/', ROOT_PATH . 'images/200905/goods_img/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/200905/thumb_img/', ROOT_PATH . 'images/200905/thumb_img/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/200905/source_img/', ROOT_PATH . 'images/200905/source_img/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/afficheimg/', ROOT_PATH . 'data/afficheimg/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/packimg/', ROOT_PATH . 'data/packimg/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/cardimg/', ROOT_PATH . 'data/cardimg/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
}
include(ROOT_PATH . 'data/config.php');
include_once(ROOT_PATH . 'includes/cls_mysql.php');
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
/* 更新 ECSHOP 语言 */
$sql = "UPDATE $prefix"."shop_config SET value='" . $system_lang . "' WHERE code='lang'";
if (!$db->query($sql, 'SILENT'))
{
$err->add($db->errno() .' '. $db->error());
return false;
}
/* 更新用户接口 */
if (!empty($integrate_code))
{
$sql = "UPDATE $prefix"."shop_config SET value='" . $integrate_code . "' WHERE code='integrate_code'";
if (!$db->query($sql, 'SILENT'))
{
$err->add($db->errno() .' '. $db->error());
return false;
}
}
/* 处理验证码 */
if (!empty($captcha))
//.........这里部分代码省略.........
示例5: isset
echo "cannot copy: {$from_file} to {$to_file}!\n";
continue;
} else {
echo "\tcreate {$to_file}\n";
}
}
}
}
$app_name = isset($argv[1]) ? $argv[1] : exit("No Application Location Specified.\n");
$x = explode(DIRECTORY_SEPARATOR, $app_name);
$short_name = end($x);
$app_location = getcwd() . DIRECTORY_SEPARATOR . $app_name;
echo "Creating application: {$short_name}\n";
echo "Location: {$app_location}\n\n";
mk_dir($app_location);
$folders = array('app' => 'app', 'models' => 'app' . DIRECTORY_SEPARATOR . 'models', 'controllers' => 'app' . DIRECTORY_SEPARATOR . 'controllers', 'helpers' => 'app' . DIRECTORY_SEPARATOR . 'helpers', 'views' => 'app' . DIRECTORY_SEPARATOR . 'views', 'layouts' => 'app' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'layouts', 'conf' => 'conf', 'scripts' => 'scripts', 'db' => 'db', 'libs' => 'libs', 'doc' => 'doc', 'log' => 'log', 'public' => 'public', 'js' => 'public' . DIRECTORY_SEPARATOR . 'javascript', 'css' => 'public' . DIRECTORY_SEPARATOR . 'stylesheet', 'img' => 'public' . DIRECTORY_SEPARATOR . 'images');
foreach ($folders as $folder) {
mk_dir($app_location . DIRECTORY_SEPARATOR . $folder);
}
copy_files($medick_core . DIRECTORY_SEPARATOR . 'skel' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'javascript' . DIRECTORY_SEPARATOR, $app_location . DIRECTORY_SEPARATOR . $folders['js']);
$files = array('skel' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'index.php' => 'public' . DIRECTORY_SEPARATOR . 'index.php', 'skel' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'default.htaccess' => 'public' . DIRECTORY_SEPARATOR . '.htaccess', 'skel' . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR . 'generator.php' => 'scripts' . DIRECTORY_SEPARATOR . 'generator.php', 'skel' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'application.xml' => 'conf' . DIRECTORY_SEPARATOR . $short_name . '.xml', 'skel' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'database.ini' => 'conf' . DIRECTORY_SEPARATOR . 'database.ini', 'skel' . DIRECTORY_SEPARATOR . 'db' . DIRECTORY_SEPARATOR . 'schema.sql' => 'db' . DIRECTORY_SEPARATOR . 'schema.sql', 'skel' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'index.html' => 'public' . DIRECTORY_SEPARATOR . 'index.html', 'skel' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'stylesheet' . DIRECTORY_SEPARATOR . 'medick.css' => 'public' . DIRECTORY_SEPARATOR . 'stylesheet' . DIRECTORY_SEPARATOR . $short_name . '.css', 'skel' . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'app_controller.php' => 'app' . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR . 'application.php', 'skel' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'application.routes.php' => 'conf' . DIRECTORY_SEPARATOR . $short_name . '.routes.php');
$search = array('${medick.core}', '${app.path}', '${app.name}', '${ds}', '${medick.version}', '${date}');
$replace = array($medick_core, $app_location, $short_name, DIRECTORY_SEPARATOR, $medick_version, date('Y M d H:i:s'));
foreach ($files as $from => $file) {
$contents = str_replace($search, $replace, file_get_contents($medick_core . DIRECTORY_SEPARATOR . $from));
list($to, $orig) = explode(DIRECTORY_SEPARATOR, $file, 2);
write_file($contents, $app_location . DIRECTORY_SEPARATOR . $folders[$to] . DIRECTORY_SEPARATOR . $orig);
}
// plain file
write_file(' ', $app_location . DIRECTORY_SEPARATOR . $folders['log'] . DIRECTORY_SEPARATOR . $short_name . '.log', 0777);
echo "\nMedick (\$v: {$medick_version}) [ DONE ].\n";
示例6: die
if (!copy_files(ROOT_PATH . 'demo/200905/goods_img/', ROOT_PATH . 'images/200905/goods_img/')) {
die(implode(',', $err->last_message()));
}
if (!copy_files(ROOT_PATH . 'demo/200905/thumb_img/', ROOT_PATH . 'images/200905/thumb_img/')) {
die(implode(',', $err->last_message()));
}
if (!copy_files(ROOT_PATH . 'demo/200905/source_img/', ROOT_PATH . 'images/200905/source_img/')) {
die(implode(',', $err->last_message()));
}
if (!copy_files(ROOT_PATH . 'demo/afficheimg/', ROOT_PATH . 'data/afficheimg/')) {
die(implode(',', $err->last_message()));
}
if (!copy_files(ROOT_PATH . 'demo/packimg/', ROOT_PATH . 'data/packimg/')) {
die(implode(',', $err->last_message()));
}
if (!copy_files(ROOT_PATH . 'demo/cardimg/', ROOT_PATH . 'data/cardimg/')) {
die(implode(',', $err->last_message()));
}
$result = array('msg' => 'OK', 'cur_ver' => $cur_ver, 'needup_ver_list' => $needup_ver_list);
echo $json->encode($result);
break;
/* 获得某个SQL文件的SQL语句数 */
/* 获得某个SQL文件的SQL语句数 */
case 'get_record_number':
include_once ROOT_PATH . 'includes/cls_json.php';
$json = new JSON();
$next_ver = isset($_REQUEST['next_ver']) ? $_REQUEST['next_ver'] : '';
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : '';
if ($next_ver === '' || $type === '') {
die('EMPTY');
}
示例7: process_file
/**
* 复制文件
* @return 成功返回true,失败返回错误信息
*/
function process_file()
{
/* 复制品牌图片 */
$from = $this->sroot . '/syssite/home/shop/1/pictures/brandimg/';
$to = $this->troot . '/data/brandlogo/';
copy_files($from, $to);
/* 复制 html 编辑器的图片 */
$from = $this->sroot . '/syssite/home/shop/1/pictures/newsimg/';
$to = $this->troot . '/images/upload/Image/';
copy_files($from, $to);
/* 复制商品图片 */
$to = $this->troot . '/images/' . date('Ym') . '/';
$from = $this->sroot . '/syssite/home/shop/1/pictures/productsimg/big/';
copy_files($from, $to, 'big_');
$from = $this->sroot . '/syssite/home/shop/1/pictures/productsimg/small/';
copy_files($from, $to, 'small_');
$from = $this->sroot . '/syssite/home/shop/1/pictures/productsimg/big/';
copy_files($from, $to, 'original_');
/* 复制友情链接图片 */
$from = $this->sroot . '/syssite/home/shop/1/pictures/linkimg/';
$to = $this->troot . '/data/afficheimg/';
copy_files($from, $to);
/* 复制证书 */
$from = $this->sroot . '/cert/';
$to = $this->troot . '/cert/';
copy_files($from, $to);
return TRUE;
}
示例8: copy_directories
/**
* Copy directories
*
* @param string $dir
* @param array &$errorLog
* @param bool $createDest
*
* @return bool|void
*/
function copy_directories($dir, &$errorLog, $createDest = true)
{
// Ensure the destination directory exists
$exists = file_exists(MAUTIC_ROOT . $dir);
if ($createDest && !$exists) {
mkdir(MAUTIC_ROOT . $dir, 0755, true);
} elseif (!$exists) {
$errorLog[] = sprintf('%s does not exist.', MAUTIC_ROOT . $dir);
return false;
}
// Copy root level files first
copy_files($dir, $errorLog);
$iterator = new DirectoryIterator(MAUTIC_UPGRADE_ROOT . $dir);
/** @var DirectoryIterator $directory */
foreach ($iterator as $directory) {
// Sanity checks
if (!$directory->isDot() && $directory->isDir()) {
$src = $directory->getPath() . '/' . $directory->getFilename();
$dest = str_replace(MAUTIC_UPGRADE_ROOT, MAUTIC_ROOT, $src);
$result = copy_directory($src, $dest);
if ($result !== true) {
if (is_array($result)) {
$errorLog += $result;
} else {
$errorLog[] = $result;
}
}
$deleteDir = recursive_remove_directory($src);
if (!$deleteDir) {
$errorLog[] = sprintf('Failed to remove the upgrade directory %s folder', str_replace(MAUTIC_UPGRADE_ROOT, '', $src));
}
}
}
}
示例9: copy_files
/**
* Function to copy directory tree from skins_original to skins
*
* @param string $source_dir Source directory name
* @param string $parent_dir Parent directory name
* @param string $destination_dir Destination directory name
*
* @return bool
*/
function copy_files($source_dir, $parent_dir, $destination_dir, &$failedList)
{
$result = true;
$dir_permission = 0777;
if (constant('LC_SUPHP_MODE') != 0) {
$data = parse_config();
$dir_permission = isset($data['privileged_permission_dir']) ? base_convert($data['privileged_permission_dir'], 8, 10) : 0711;
}
if ($handle = @opendir(constant('LC_DIR_ROOT') . $source_dir)) {
while (($file = readdir($handle)) !== false) {
$sourceFile = constant('LC_DIR_ROOT') . $source_dir . '/' . $file;
$destinationFile = constant('LC_DIR_ROOT') . $destination_dir . '/' . $parent_dir . '/' . $file;
// .htaccess files must be already presented in the destination directory and they should't have writable permissions for web server user
if (@is_file($sourceFile) && $file != '.htaccess') {
if (!@copy($sourceFile, $destinationFile)) {
echo xtr('Copying: [:source_dir:parent_dir/:file] to [:destination_dir:parent_dir/:file]... ', array(':source_dir' => $source_dir, ':parent_dir' => $parent_dir, ':file' => $file, ':destination_dir' => $destination_dir)) . status(false) . "<BR>\n";
$result = false;
$failedList[] = sprintf('copy(%s, %s)', $sourceFile, $destinationFile);
}
flush();
} elseif (@is_dir($sourceFile) && $file != '.' && $file != '..') {
echo xtr('Creating directory: [:destination_dir:parent_dir/:file]... ', array(':destination_dir' => $destination_dir, ':parent_dir' => $parent_dir, ':file' => $file));
if (!@file_exists($destinationFile)) {
if (!@mkdir($destinationFile, $dir_permission)) {
echo status(false);
$result = false;
$failedList[] = sprintf('mkdir(%s)', $destinationFile);
} else {
echo status(true);
}
} else {
echo '<span class="status-already-exists">' . xtr('Already exists') . '</span>';
}
echo "<br />\n";
flush();
$result &= copy_files($source_dir . '/' . $file, $parent_dir . '/' . $file, $destination_dir, $failedList);
}
}
closedir($handle);
} else {
echo status(false) . "<br />\n";
$result = false;
$failedList[] = sprintf('opendir(%s)', constant('LC_DIR_ROOT') . $source_dir);
}
return $result;
}
示例10: str_replace
if (is_file($library . $lib)) {
$lib_files[] = $library . $lib;
$all_files[] = $library . $lib;
} else {
echo '<b>File not found ' . $library . $lib . '</b>';
}
}
$output_file = $output_dir . $filename;
echo '<pre>';
if (count($lib_files) > 0) {
$compressor = str_replace(array('OUTPUT', 'INPUTS'), array($output_file, implode(' ', $lib_files)), $script_builder);
$command = str_replace('/', '\\', $compressor);
system($command);
echo $command;
post_process($output_file);
copy_files($additional_outputs, $output_file, $filename);
}
echo '</pre>';
}
//do docs
/*echo '<pre>';
$docs = str_replace('INPUTS', implode(' ', $all_files), $doc_builder);
$command = str_replace('/','\\', $docs);
system($command);
echo '</pre>';
*/
//*** post processing, ESC does strange things to try{} catch{} finally{} blocks, and a few others.
function post_process($file)
{
$contents = file_get_contents($file);
$contents = str_replace('};catch{', '}catch{', $contents);
示例11: file_query
function file_query($file)
{
$src = "/storage/hurricanearchive/SouthernOralHist_USM";
$src1 = "/storage/hurricanearchive/SouthernOralHist_USM/Transcripts";
$q = "INSERT INTO katrina_update.omeka_files (";
foreach ($file as $k => $v) {
$q .= $k . ",";
}
$q .= ") VALUES (";
foreach ($file as $k => $v) {
if ($k != 'added') {
$q .= "'" . $v . "',";
}
}
$q .= "CURRENT_TIMESTAMP,CURRENT_TIMESTAMP";
$q .= ")";
$ext = array_reverse(explode('.', $file['archive_filename']));
if ($ext[0] == 'mp3' | $ext[0] == 'MP3') {
copy_files($src, '', $file);
} else {
copy_files($src1, '', $file);
}
return $q;
}
示例12: build
/**
* Build output
*
* @param $path_src
* @param $path_out
*/
function build($path_src, $path_out, $is_fast = false)
{
$template_file = $path_src . '/template.html';
$index_file = $path_out . '/index.html';
$dirs = array('/css', '/js', '/files', '/fonts');
foreach ($dirs as $dir) {
copy_files($path_src . $dir, $path_out . $dir);
}
create_dir("{$path_out}/session");
if (!$is_fast) {
create_session_files("{$path_out}/session");
}
create_dir("{$path_out}/audio");
create_dir("{$path_out}/images/thumbs");
copy_file($path_src, $path_out, 'images/background.png');
$template = file_get_contents($template_file);
$html = preg_replace_callback('/\\{\\{([^}]+)\\}\\}/', "template_callback", $template);
file_put_contents($index_file, $html);
}
示例13: copy
// copy('root.txt', $projDir.'php\cbm\root.txt');
copy('index.php', $projDir . 'scripts\\cbm\\index.php');
copy('inflector.php', $projDir . 'scripts\\cbm\\inflector.php');
copy('php_utils.php', $projDir . 'scripts\\cbm\\php_utils.php');
copy('cpp.php', $projDir . 'scripts\\cbm\\cpp.php');
copy('thrift.php', $projDir . 'scripts\\cbm\\thrift.php');
copy('sql.php', $projDir . 'scripts\\cbm\\sql.php');
//将thrift接口文件复制到cbm项目
copy('cbm.thrift', $projDir . 'thrift\\cbm.thrift');
// copy('ctrl.thrift', $projDir.'thrift\ctrl.thrift');
copy('SQLServerHelper.py', $projDir . 'thrift\\SQLServerHelper.py');
copy('SQLClientHelper.py', $projDir . 'thrift\\SQLClientHelper.py');
copy('CbmRtti.py', $projDir . 'thrift\\CbmRtti.py');
copy('SQLClientHelper.h', $projDir . 'thrift\\SQLClientHelper.h');
copy('SQLClientHelper.cpp', $projDir . 'thrift\\SQLClientHelper.cpp');
copy('SQLClientHelper.php', $projDir . 'thrift\\SQLClientHelper.php');
}
//生成
$tables = build_cbm_tables();
//建立表关系映射
$relations = build_cbm_relations($tables);
//生成Entity.h和Entity.cpp文件
make_cpp_files($tables, $relations);
//生成cbm.thrift
make_thrift_files($tables, $relations);
merge_thrift_files();
//生成cbm_data.sql文件
// make_sql_files();
//复制文件到cbm/php目录下
copy_files();