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


PHP copy_dir函数代码示例

本文整理汇总了PHP中copy_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP copy_dir函数的具体用法?PHP copy_dir怎么用?PHP copy_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: copy_dir

 function copy_dir($thisfolder, $folder)
 {
     $thisdir = get_dir_file_info($thisfolder);
     foreach ($thisdir as $f) {
         if (is_dir($f['server_path'])) {
             $main_app = str_replace('\\plugins\\' . $folder . '\\files', '', $f['server_path']);
             if (is_dir($main_app)) {
                 $subfolder = get_dir_file_info($f['server_path']);
                 copy_dir($f['server_path'], $folder);
             } else {
                 mkdir($main_app);
                 echo "<span style='color:#66ae61'>mkdir: " . $main_app . "</span><br/>";
                 $subfolder = get_dir_file_info($f['server_path']);
                 copy_dir($f['server_path'], $folder);
             }
         } else {
             $new_loc = str_replace('\\plugins\\' . $folder . '\\files', '', $f['server_path']);
             if (copy($f['server_path'], $new_loc)) {
                 echo "<span style='color:#66ae61'>copied: " . $new_loc . "</span><br/>";
             } else {
                 echo "<span style='color:#f00'>failed: " . $new_loc . "</span><br/>";
             }
         }
     }
 }
开发者ID:bmfelix,项目名称:godraft,代码行数:25,代码来源:admin_plugin.php

示例2: generate

 /**
  * Generate a child theme.
  *
  * @since 1.1.0
  */
 public function generate()
 {
     global $wp_filesystem;
     WP_Filesystem();
     $parent = wp_get_theme($this->template);
     if (!$parent->exists()) {
         return new WP_Error('invalid_template', esc_html__('Invalid parent theme slug.', 'audiotheme-agent'));
     }
     $parts = explode('/', $parent->get_template());
     $slug = sprintf('%s-child', reset($parts));
     $directory = path_join($parent->get_theme_root(), $slug);
     if ($wp_filesystem->exists($directory)) {
         return new WP_Error('directory_exists', esc_html__('Child theme directory already exists.', 'audiotheme-agent'));
     }
     if (false === $wp_filesystem->mkdir($directory)) {
         return new WP_Error('fs_error', esc_html__('Could not create child theme directory.', 'audiotheme-agent'));
     }
     $source = audiotheme_agent()->get_path('data/child-theme/');
     copy_dir($source, $directory);
     if ($parent->get_screenshot()) {
         $wp_filesystem->copy(path_join($parent->get_template_directory(), $parent->get_screenshot('relative')), path_join($directory, $parent->get_screenshot('relative')));
     }
     $data = array('{{author}}' => wp_get_current_user()->display_name, '{{author_url}}' => wp_get_current_user()->user_url, '{{name}}' => $parent->get('Name'), '{{slug}}' => $parent->get_template(), '{{url}}' => esc_url(home_url()));
     $files = array('functions.php', 'style.css');
     foreach ($files as $file) {
         $filename = path_join($directory, $file);
         $contents = $wp_filesystem->get_contents($filename);
         $contents = str_replace(array_keys($data), array_values($data), $contents);
         $wp_filesystem->put_contents($filename, $contents);
     }
     return true;
 }
开发者ID:audiotheme,项目名称:audiotheme-agent,代码行数:37,代码来源:ChildTheme.php

示例3: copy_dir

/**
 * 拷贝目录及下面所有文件
 *
 * @param string $from 原路径
 * @param string $to   目标路径
 *
 * @return bool true拷贝成功,否则false
 */
function copy_dir($from, $to)
{
    $from = dir_path($from);
    $to = dir_path($to);
    if (!is_dir($from)) {
        return false;
    }
    if ($from == $to) {
        return true;
    }
    !is_dir($to) && create_dir($to);
    $list = glob($from . '*');
    if (!empty($list)) {
        foreach ($list as $v) {
            $path = $to . basename($v);
            if (is_dir($v)) {
                copy_dir($v, $path);
            } else {
                copy($v, $path);
                chmod($path, 0755);
            }
        }
    }
    return true;
}
开发者ID:yunsite,项目名称:yablog,代码行数:33,代码来源:dir.php

示例4: create_execution_env

/**
 * 
 * @param type $study_name the name of the study directory
 * @return the job id
 */
function create_execution_env($study_name, $script_name)
{
    include 'config.inc.php';
    $jobid = create_job_id($study_name, $script_name);
    $job_dir = get_job_exec_dir($jobid);
    while (is_dir($job_dir)) {
        // the sandbox directory is already existing, sleep 1 second and generate another ID
        sleep(1);
        $jobid = create_job_id($study_name, $script_name);
        $job_dir = get_job_exec_dir($jobid);
    }
    mkdir($job_dir, 0777, true);
    // [job_root_dir]/[job_id]/data --> ../../data/[fs_root]/[study_name]/data
    $datadir = $NC_CONFIG["symlink_prefix"] . "/" . $study_name . "/data";
    $pipelinedir = get_absolute_path($study_name . "/pipeline");
    $resultsdir = $NC_CONFIG["symlink_prefix"] . "/" . $study_name . "/results/" . $jobid;
    OC_Filesystem::mkdir("{$study_name}/results/{$jobid}");
    # le dir /data e /results sono link simbolici alle vere directory del caso di studio
    mkdir($job_dir . "/pipeline");
    symlink($datadir, $job_dir . "/data");
    symlink($resultsdir, $job_dir . "/results");
    # creo il file in cui verrà rediretto lo standard output
    $date = date("Y-m-d H:i:s");
    OC_Filesystem::file_put_contents(get_job_output_file($study_name, $jobid), "Standard output for job {$jobid}, run at {$date}\n");
    $jobinfo = array("jobid" => $jobid, "study" => $study_name);
    save_job_info($study_name, $jobid, $jobinfo);
    # copia gli script del caso di studio nella pipeline
    copy_dir($pipelinedir, $job_dir . "/pipeline");
    return $jobid;
}
开发者ID:v-iacovella,项目名称:NeuroBox,代码行数:35,代码来源:execute.php

示例5: update_xpress

/**
 * Upgrade the XPressME .
 *
 * @param string $from New release unzipped path.
 * @param string $to Path to old WordPress installation.
 * @return WP_Error|null WP_Error on failure, null on success.
 */
function update_xpress($from, $to) {
	global $wp_filesystem, $_old_xpress_files, $wpdb;
	show_message( __('Disable overwrite of wp-config.php...', 'xpressme') );
	// remove wp-config.php from the new version into place.
	$wp_config = $from . 'wp-config.php';
	if ( !$wp_filesystem->delete($wp_config, true)){
		return new WP_Error('delete_failed', $this->strings['delete_failed']);
	}

	// Copy new versions of XPressME Integration Kit files into place.
	show_message( __('Copy new versions of XPressME Integration Kit files into place...', 'xpressme') );
	$result = copy_dir($from . $distro, $to);
	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($maintenance_file);
		$wp_filesystem->delete($from, true);
		return $result;
	}

	// Remove old files
	show_message( __('Remove an unnecessary, old file...', 'xpressme') );
	foreach ( $_old_xpress_files as $old_file ) {
		$old_file = $to . $old_file;
		if ( !$wp_filesystem->exists($old_file) )
			continue;
		$wp_filesystem->delete($old_file, true);
	}
	show_message( __('Set templates directory chmod 777', 'xpressme') );
	$wp_filesystem->chmod($to . 'templates/', 0777);

	// Remove working directory
	$working_dir = dirname(dirname($from));
	show_message( sprintf(__('Remove working directory(%s)...', 'xpressme'),$working_dir) );
	$wp_filesystem->delete($working_dir, true);

}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:42,代码来源:update_xpress.php

示例6: add_lang

function add_lang()
{
    global $smarty, $lang;
    $chinese_name = post('chinese_name');
    $foreign_name = post('foreign_name');
    $pack_name = post('pack_name');
    $short_name = post('short_name');
    $index_entrance = post('index_entrance');
    $admin_entrance = post('admin_entrance');
    if ($chinese_name != '' && $foreign_name != '' && $pack_name != '' && $index_entrance != '' && $admin_entrance != '' && $index_entrance != 'index.php' && $admin_entrance != 'admin.php') {
        $var_value = $pack_name . '{v}' . $index_entrance . '{v}' . $admin_entrance . '{v}' . $chinese_name . '{v}' . $foreign_name;
        $obj = new varia();
        $obj->add_var_value('languages', $var_value);
        $site = get_site_info();
        $obj->add_var_value('site_title', $site['title'], $pack_name);
        $obj->add_var_value('site_name', $site['name'], $pack_name);
        $obj->add_var_value('site_record', $site['record'], $pack_name);
        $obj->add_var_value('site_tech', $site['tech'], $pack_name);
        $obj->add_var_value('site_keywords', $site['keywords'], $pack_name);
        $obj->add_var_value('site_description', $site['description'], $pack_name);
        $obj->add_var_value('notice', '', $pack_name, true);
        $obj->add_var_value('service_code', '', $pack_name, true);
        $obj->add_var_value('user_agreement', '', $pack_name, true);
        $obj = new channel();
        $obj->set_where('cha_original = 0');
        $list = $obj->get_list();
        for ($i = 0; $i < count($list); $i++) {
            $obj->clear_value();
            $obj->set_value('cha_lang', $pack_name);
            $obj->set_value('cha_code', $list[$i]['cha_code']);
            $obj->set_value('cha_name', $list[$i]['cha_name']);
            $obj->set_value('cha_original', $list[$i]['cha_original']);
            $obj->add();
        }
        if (!file_exists('languages/' . $pack_name)) {
            copy_dir('languages/' . S_LANG, 'languages/' . $pack_name);
        }
        if (S_MULTILINGUAL) {
            $file = file_get_contents('admin/index.txt');
            $file = str_replace('{$pack_name}', $pack_name, $file);
            $file = str_replace('{$index_entrance}', $index_entrance, $file);
            $file = str_replace('{$admin_entrance}', $admin_entrance, $file);
            file_put_contents($index_entrance, $file);
            $file = file_get_contents('admin/admin.txt');
            $file = str_replace('{$pack_name}', $pack_name, $file);
            $file = str_replace('{$index_entrance}', $index_entrance, $file);
            $file = str_replace('{$admin_entrance}', $admin_entrance, $file);
            file_put_contents($admin_entrance, $file);
        }
        $info_text = '添加语言成功';
    } else {
        $info_text = '的输入不合法,添加语言失败';
    }
    $smarty->assign('info_text', $info_text);
    $smarty->assign('link_text', $lang['return_list']);
    $smarty->assign('link_href', url(array('channel' => 'file', 'mod' => 'lang_lists')));
}
开发者ID:jechiy,项目名称:xiu-cms,代码行数:57,代码来源:deal.php

示例7: copy_dir

 function copy_dir($abs_item, $abs_new_item)
 {
     if (nx_isFTPMode()) {
         $tmp_dir = nx_ftp_make_local_copy($abs_item);
         $res = $GLOBALS['FTPCONNECTION']->putRecursive($tmp_dir, $abs_new_item);
         remove($tmp_dir);
         return $res;
     } else {
         return copy_dir($abs_item, $abs_new_item);
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:11,代码来源:File_Operations.php

示例8: copy_dir

function copy_dir($src, $dst)
{
    $dir = opendir($src);
    if (!is_dir($dst)) {
        mkdir($dst);
    }
    while (false !== ($file = readdir($dir))) {
        if ($file != '.' && $file != '..') {
            if (is_dir($src . '/' . $file)) {
                copy_dir($src . '/' . $file, $dst . '/' . $file);
            } else {
                copy($src . '/' . $file, $dst . '/' . $file);
            }
        }
    }
    closedir($dir);
}
开发者ID:wogu,项目名称:df21d,代码行数:17,代码来源:create-project.php

示例9: update_core

/**
 * Upgrade the core of WordPress.
 *
 * This will create a .maintenance file at the base of the WordPress directory
 * to ensure that people can not access the web site, when the files are being
 * copied to their locations.
 *
 * The files in the {@link $_old_files} list will be removed and the new files
 * copied from the zip file after the database is upgraded.
 *
 * The steps for the upgrader for after the new release is downloaded and
 * unzipped is:
 *   1. Test unzipped location for select files to ensure that unzipped worked.
 *   2. Create the .maintenance file in current WordPress base.
 *   3. Copy new WordPress directory over old WordPress files.
 *   4. Upgrade WordPress to new version.
 *   5. Delete new WordPress directory path.
 *   6. Delete .maintenance file.
 *   7. Remove old files.
 *   8. Delete 'update_core' option.
 *
 * There are several areas of failure. For instance if PHP times out before step
 * 6, then you will not be able to access any portion of your site. Also, since
 * the upgrade will not continue where it left off, you will not be able to
 * automatically remove old files and remove the 'update_core' option. This
 * isn't that bad.
 *
 * If the copy of the new WordPress over the old fails, then the worse is that
 * the new WordPress directory will remain.
 *
 * If it is assumed that every file will be copied over, including plugins and
 * themes, then if you edit the default theme, you should rename it, so that
 * your changes remain.
 *
 * @since 2.7.0
 *
 * @param string $from New release unzipped path.
 * @param string $to Path to old WordPress installation.
 * @return WP_Error|null WP_Error on failure, null on success.
 */
function update_core($from, $to)
{
    global $wp_filesystem, $_old_files;
    @set_time_limit(300);
    // Sanity check the unzipped distribution
    apply_filters('update_feedback', __('Verifying the unpacked files'));
    if (!$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') || !$wp_filesystem->exists($from . '/wordpress/wp-includes/functions.php')) {
        $wp_filesystem->delete($from, true);
        return new WP_Error('insane_distro', __('The update could not be unpacked'));
    }
    apply_filters('update_feedback', __('Installing the latest version'));
    // Create maintenance file to signal that we are upgrading
    $maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
    $maintenance_file = $to . '.maintenance';
    $wp_filesystem->delete($maintenance_file);
    $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE);
    // Copy new versions of WP files into place.
    $result = copy_dir($from . '/wordpress', $to);
    if (is_wp_error($result)) {
        $wp_filesystem->delete($maintenance_file);
        $wp_filesystem->delete($from, true);
        return $result;
    }
    // Remove old files
    foreach ($_old_files as $old_file) {
        $old_file = $to . $old_file;
        if (!$wp_filesystem->exists($old_file)) {
            continue;
        }
        $wp_filesystem->delete($old_file, true);
    }
    // Upgrade DB with separate request
    apply_filters('update_feedback', __('Upgrading database'));
    $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db');
    wp_remote_post($db_upgrade_url, array('timeout' => 60));
    // Remove working directory
    $wp_filesystem->delete($from, true);
    // Force refresh of update information
    if (function_exists('delete_transient')) {
        delete_transient('update_core');
    } else {
        delete_option('update_core');
    }
    // Remove maintenance file, we're done.
    $wp_filesystem->delete($maintenance_file);
}
开发者ID:klr2003,项目名称:sourceread,代码行数:86,代码来源:update-core.php

示例10: copy_dir

function copy_dir($dir2copy, $dir_paste)
{
    if (is_dir($dir2copy)) {
        if ($dh = opendir($dir2copy)) {
            while (($file = readdir($dh)) !== false) {
                if (!is_dir($dir_paste)) {
                    mkdir($dir_paste, 0755);
                }
                if (is_dir($dir2copy . $file) && $file != '..' && $file != '.') {
                    copy_dir($dir2copy . $file . '/', $dir_paste . $file . '/');
                } elseif ($file != '..' && $file != '.') {
                    copy($dir2copy . $file, $dir_paste . $file);
                }
            }
            closedir($dh);
        }
    }
}
开发者ID:tmaski45,项目名称:tedmatuszewski.com,代码行数:18,代码来源:backup.php

示例11: copy_dir

function copy_dir($from, $to)
{
    @mkdir($to);
    $d = dir($from);
    while (($f = $d->read()) !== false) {
        if ($f[0] != '.') {
            $from_path = "{$from}/{$f}";
            $to_path = "{$to}/{$f}";
            if (is_dir($from_path)) {
                copy_dir($from_path, $to_path);
            } else {
                if (!copy($from_path, $to_path)) {
                    die('<p>Copy failed');
                }
            }
        }
    }
}
开发者ID:raynaldmo,项目名称:php-education,代码行数:18,代码来源:install.php

示例12: rapidology_updater

/**
 *
 * This is a very simple plugin that should be deleted as soon as the update is finished.
 * Upon acceptance from the WordPress repo we need to rename the plugin folder from rapidology to rapidology-by-leadpages
 * to recieve updates from the repo
 *
 */
function rapidology_updater()
{
    add_option('update_refresh', 0);
    $old_file = WP_PLUGIN_DIR . '/rapidology';
    $new_file = WP_PLUGIN_DIR . '/rapidology-by-leadpages';
    $update_folder = WP_PLUGIN_DIR . '/rapidology-by-leadpages.zip';
    //deactivate old rapidology
    if (empty($wp_filesystem)) {
        require_once ABSPATH . '/wp-admin/includes/file.php';
        WP_Filesystem();
    }
    if (!file_exists($new_file)) {
        mkdir($new_file, 0777);
        $result = copy_dir($old_file, $new_file, array('.DS_Store', '.git', '.gitignore', '.idea'));
        deactivate_plugins('rapidology/rapidology.php');
        delTree($old_file);
        update_option('update_refresh', true);
    }
}
开发者ID:brett1776,项目名称:rapidology-plugin,代码行数:26,代码来源:rapidology_updater.php

示例13: edit

 public function edit($data)
 {
     $dir = __ROOTDIR__ . '/lang/' . in($data['lang']);
     $info = $this->info($data['id']);
     if (!is_dir($dir)) {
         if (!@mkdir($dir, 0777)) {
             return false;
         }
         @copy_dir(__ROOTDIR__ . '/lang/zh', $dir);
     } else {
         if (!@copy_dir(__ROOTDIR__ . '/lang/' . $info['lang'], $dir)) {
             return false;
         }
     }
     if (is_dir($dir)) {
         @del_dir(__ROOTDIR__ . '/lang/' . $info['lang']);
     }
     $condition['id'] = intval($data['id']);
     return $this->model->table('lang')->data($data)->where($condition)->update();
 }
开发者ID:JamesKid,项目名称:teach,代码行数:20,代码来源:langModel.class.php

示例14: upgrade

 public function upgrade()
 {
     $dir = __ROOTDIR__ . '/data/update/';
     if (!file_exists($dir . '/ver.xml')) {
         $this->msg('升级信息文件不存在!', 0);
         return;
     }
     $xml = file_get_contents($dir . '/ver.xml');
     $info = Xml::decode($xml);
     $time = $info['ver']['vertime'];
     if ($time != $this->config['ver_date']) {
         $this->msg('该更新包不适合当前版本!', 0);
         return;
     }
     if (!copy_dir($dir . '/update', __ROOTDIR__, true)) {
         $this->msg('移动文件失败!', 0);
         return;
     }
     if ($info['ver']['sql'] == '1') {
         model('update')->index();
     }
     del_dir($dir);
     $this->msg('升级成功!清空手动清空所有缓存!');
 }
开发者ID:JamesKid,项目名称:teach,代码行数:24,代码来源:upgradeMod.class.php

示例15: copy_dir

function copy_dir($dir2copy, $dir_paste)
{
    // On vérifie si $dir2copy est un dossier
    if (is_dir($dir2copy)) {
        // Si oui, on l'ouvre
        if ($dh = opendir($dir2copy)) {
            // On liste les dossiers et fichiers de $dir2copy
            while (($file = readdir($dh)) !== false) {
                // Si le dossier dans lequel on veut coller n'ex iste pas, on le créé
                if (!is_dir($dir_paste)) {
                    mkdir($dir_paste, 0777);
                }
                // S'il s'agit d'un dossier, on relance la fonction récursive
                if (is_dir($dir2copy . $file) && $file != '..' && $file != '.') {
                    copy_dir($dir2copy . $file . '/', $dir_paste . $file . '/');
                } elseif ($file != '..' && $file != '.') {
                    copy($dir2copy . $file, $dir_paste . $file);
                }
            }
            // On ferme $dir2copy
            closedir($dh);
        }
    }
}
开发者ID:yvanvenumiere,项目名称:veezycrud,代码行数:24,代码来源:functions.php


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