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


PHP copy_directory函数代码示例

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


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

示例1: copy_directory

 function copy_directory($directory, $destination)
 {
     $destination = $destination . basename($directory);
     # The directory will be created
     if (!file_exists($destination)) {
         if (!mkdir($destination)) {
             return false;
         }
     }
     $directory_list = @scandir($directory);
     # Directory scanning
     if (!$directory_list) {
         return false;
     }
     foreach ($directory_list as $item_name) {
         $item = $directory . DIRECTORY_SEPARATOR . $item_name;
         if ($item_name == '.' || $item_name == '..') {
             continue;
         }
         if (filetype($item) == 'dir') {
             copy_directory($item, $destination . DIRECTORY_SEPARATOR);
         } else {
             var_dump($item);
             var_dump($destination . DIRECTORY_SEPARATOR . $item_name);
             if (!copy($item, $destination . DIRECTORY_SEPARATOR . $item_name)) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:bilgisayarcilik,项目名称:Remote-File-Manager,代码行数:31,代码来源:other_actions.php

示例2: copy_directory

function copy_directory($source, $destination)
{
    global $log;
    if (is_dir($source)) {
        mkdir($destination);
        $directory = dir($source);
        while (FALSE !== ($readdirectory = $directory->read())) {
            if ($readdirectory == '.' || $readdirectory == '..') {
                continue;
            }
            $PathDir = $source . '/' . $readdirectory;
            if (is_dir($PathDir)) {
                copy_directory($PathDir, $destination . '/' . $readdirectory);
                continue;
            }
            try {
                copy($PathDir, $destination . '/' . $readdirectory);
            } catch (\ErrorException $e) {
                $log->error($e->getMessage());
            }
        }
        $directory->close();
    } else {
        try {
            copy($source, $destination);
        } catch (\ErrorException $e) {
            $log->error($e->getMessage());
        }
    }
}
开发者ID:liquispace,项目名称:backup_cmp,代码行数:30,代码来源:backup.php

示例3: unzipFile

function unzipFile($filename, $filenameRail, $feedDirectory)
{
    $results = unzip($filename, $dest_dir = false, $create_zip_name_dir = true, $overwrite = true);
    $results2 = unzip($filenameRail, $dest_dir = false, $create_zip_name_dir = true, $overwrite = true);
    $filenameRailFolder = $feedDirectory . "/gtfs/" . basename($filenameRail, ".zip");
    $test = copy_directory($filenameRailFolder, $feedDirectory . "/" . basename($filenameRail, ".zip"));
}
开发者ID:GrandMasterKev,项目名称:GTFS-Import-Basic,代码行数:7,代码来源:gtfs.library.php

示例4: generateBlog

 public function generateBlog()
 {
     set_time_limit(0);
     global $app;
     $this->parser = new \Parsedown();
     $data = $this->getData();
     $layout = $data['settings']['layout'] ?: 'default';
     $layoutDir = $app->view->getData('layoutsDir') . $layout . '/';
     // first copy all contents of template to public folder
     copy_directory($layoutDir, $this->publicDir);
     // now create actual html pages
     $mustache = new \Mustache_Engine(array('loader' => new \Mustache_Loader_FilesystemLoader($layoutDir), 'partials_loader' => new \Mustache_Loader_FilesystemLoader($layoutDir . '/partials')));
     $mustacheFiles = glob($layoutDir . '/*.mustache');
     $excludedFiles = array('category', 'post', 'page', 'archive', 'tag');
     foreach ($mustacheFiles as $mustacheFile) {
         $fileName = basename($mustacheFile);
         $fileName = str_replace('.mustache', '', $fileName);
         // we will generate these later
         if (true === in_array($fileName, $excludedFiles)) {
             continue;
         }
         $template = $mustache->loadTemplate($fileName);
         $html = $template->render($data);
         file_put_contents($this->publicDir . $fileName . '.html', $html);
     }
     // delete mustache particals folders from public folder
     rrmdir($this->publicDir . 'partials/');
     // delete *.mustache from public dir
     $mustacheFiles = glob($this->publicDir . '/*.mustache');
     foreach ($mustacheFiles as $mustacheFile) {
         @unlink($mustacheFile);
     }
     // generate post files
     $this->generatePostPageFiles($mustache, $data, 'post');
     // generate page files
     $this->generatePostPageFiles($mustache, $data, 'page');
     // generate category and tag files
     $this->generateCategoryTagFiles($mustache, $data, 'category');
     $this->generateCategoryTagFiles($mustache, $data, 'tag');
     // generate archive files
     $this->generateArchiveFiles($mustache, $data);
     // generate RSS file
     $this->generateRSS($data);
     // generate sitemap.xml
     $this->generateSitemap($data);
     // copy blog data file
     copy('data/blog.json', 'public/data/blog.json');
     $message = '';
     $message .= 'Blog has been generated in <strong>public</strong> folder :)<br><br>';
     $message .= '<a id="viewGenLog" class="btn btn-primary">View Log</a><br><br>';
     $message .= '<div id="genlog">' . $this->getGenerateLog($this->generateLog) . '</div>';
     echo $message;
 }
开发者ID:sarfraznawaz2005,项目名称:bloggercms,代码行数:53,代码来源:Generator.php

示例5: copy_directory

/**
 * This procedural script copies all non-blacklisted files from the development folder to the production folder, in preparation for FTPing to the server.
 * 
 * Instructions:
 * To run, simply go to the correct address in your web browser while your local web server is running (e.g. http://localhost:8888/development/deploy.php)
 * To add new files to the blacklist, simply add a new string element to the blacklist array with the full name of the desired folder or file.
 * 
 * Notes:
 * Any new files that are added to development will be copied to production by default. The blacklist array only needs to be modified if tester files or other development-specific files are added to the development folder.
 */
function copy_directory($source, $destination)
{
    mkdir($destination);
    $directory = dir($source);
    while (FALSE !== ($readdirectory = $directory->read())) {
        if ($readdirectory == '.' || $readdirectory == '..') {
            continue;
        }
        $pathDir = $source . '/' . $readdirectory;
        if (is_dir($pathDir)) {
            copy_directory($pathDir, $destination . '/' . $readdirectory);
            continue;
        }
        if (copy($pathDir, $destination . '/' . $readdirectory)) {
            echo "Successfully copied {$pathDir}.\n";
        }
    }
    $directory->close();
}
开发者ID:RishabhJain96,项目名称:RoboWebProj,代码行数:29,代码来源:copy.php

示例6: copy_directory

function copy_directory($source, $destination)
{
    if (is_dir($source)) {
        @mkdir($destination);
        $directory = dir($source);
        while (FALSE !== ($readdirectory = $directory->read())) {
            if ($readdirectory == '.' || $readdirectory == '..') {
                continue;
            }
            $PathDir = $source . '/' . $readdirectory;
            if (is_dir($PathDir)) {
                copy_directory($PathDir, $destination . '/' . $readdirectory);
                continue;
            }
            copy($PathDir, $destination . '/' . $readdirectory);
        }
        $directory->close();
    } else {
        copy($source, $destination);
    }
}
开发者ID:m0o0m,项目名称:m0o0m-mobilehtmlthemes,代码行数:21,代码来源:copy.php

示例7: siteConfig

             }
         } else {
             if ($addons['type'] == 'themes') {
                 $folder = "../plugins/{$addons['folder']}";
                 $copy = @copy_directory("../tmp/{$name_file}", "../themes/{$addons['folder']}");
             } else {
                 if ($addons['type'] == 'admin_themes') {
                     $flback = siteConfig('backend_folder');
                     $folder = "../{$flback}/themes/{$addons['folder']}";
                     $copy = @copy_directory("../tmp/{$name_file}", $folder);
                 } else {
                     if ($addons['type'] == 'updater') {
                         $copy = @copy_directory("../tmp/{$name_file}", "../");
                         $dapur = siteConfig('backend_folder');
                         if (siteConfig('backend_folder') != 'dapur') {
                             @copy_directory("../dapur", "../{$dapur}", true);
                         }
                     } else {
                         $fail = true;
                         alert('error', File_uploaded_not_valid);
                     }
                 }
             }
         }
     }
 }
 if (!isset($fail)) {
     if (isset($folder) and file_exists("{$folder}/installer.php")) {
         @unlink("{$folder}/installer.php");
     }
     if ($copy) {
开发者ID:mul14,项目名称:FiyoCMS,代码行数:31,代码来源:installer.php

示例8: copy_directory

function copy_directory($source, $destination, $cut = null)
{
    $copy = false;
    if (is_dir($source)) {
        @mkdir($destination);
        $directory = dir($source);
        while (FALSE !== ($readdirectory = $directory->read())) {
            if ($readdirectory == '.' || $readdirectory == '..') {
                continue;
            }
            $PathDir = $source . '/' . $readdirectory;
            if (is_dir($PathDir)) {
                copy_directory($PathDir, $destination . '/' . $readdirectory);
                continue;
            }
            $copy = copy($PathDir, $destination . '/' . $readdirectory);
        }
        $directory->close();
    } else {
        $copy = copy($source, $destination);
    }
    if (isset($cut)) {
        delete_directory($source);
    }
    if ($copy) {
        return true;
    } else {
        return false;
    }
}
开发者ID:mul14,项目名称:FiyoCMS,代码行数:30,代码来源:function.php

示例9: copy_directory

function copy_directory($source, $destination, $holo, $name, $check_holo = true)
{
    $log = Logger::getLogger("copy");
    $log->debug("copy directory : " . $source . " in " . $destination);
    if (is_dir($source)) {
        $directory = dir($source);
        while (FALSE !== ($readdirectory = $directory->read())) {
            if ($readdirectory == '.' || $readdirectory == '..' || $readdirectory == '.DS_Store') {
                continue;
            }
            $PathDir = $source . '/' . $readdirectory;
            $log->debug("File : " . $readdirectory . " Path : " . $PathDir . " holo=" . $check_holo);
            if (is_dir($PathDir)) {
                copy_directory($PathDir, $destination . '/' . $readdirectory, $holo, $name, $check_holo);
                continue;
            }
            if ($check_holo == false) {
                $log->debug("holo false => copy " . $PathDir . " in " . $destination . '/' . $readdirectory);
                copy($PathDir, $destination . '/' . $readdirectory);
                if (strstr($readdirectory, ".xml")) {
                    filter_file($destination . '/' . $readdirectory, $name);
                }
            } else {
                if (strpos($readdirectory, $holo)) {
                    $log->debug("holo true => copy " . $PathDir . " in " . $destination . '/' . $readdirectory);
                    copy($PathDir, $destination . '/' . $readdirectory);
                    if (strstr($readdirectory, ".xml")) {
                        filter_file($destination . '/' . $readdirectory, $name);
                    }
                }
            }
        }
        $directory->close();
    } else {
        copy($source, $destination);
    }
}
开发者ID:xi67,项目名称:MAB-LAB,代码行数:37,代码来源:generate_all.php

示例10: mkdir

    }
} else {
    echo 0;
}
if (isset($_POST['patching']) and $_POST['patching'] != false and $site_version != $latest_version and $xml) {
    $plink = $p['link'];
    $root = "../../..";
    $newfile = "{$root}/tmp/patch_{$p['number']}.zip";
    if (!file_exists("{$root}/tmp")) {
        mkdir("{$root}/tmp");
    }
    if (copy($plink, $newfile)) {
        if (extractZip($newfile, "{$root}/tmp")) {
            $dapur = siteConfig('backend_folder');
            if (siteConfig('backend_folder') != 'dapur') {
                copy_directory("{$root}/dapur", "{$root}/{$dapur}", true);
            }
            $db = new FQuery();
            $db->connect();
            $db->update(FDBPrefix . 'setting', array('value' => "{$p['number']}"), "name='version'");
            $sup = $p['number'];
            @unlink("{$root}/installer.php");
            ?>
				<script>		
					$(document).ready(function() {										
						$(".update-info").LoadingDot({
							"speed": 500,
							"maxDots": 4,
							"word": " <?php 
            echo Installing_patch . $p['number'];
            ?>
开发者ID:mul14,项目名称:FiyoCMS,代码行数:31,代码来源:update.php

示例11: file_get_contents

                         
                         This will remove the {FUNCTION} text from
                         the functions file if no extras are needed
     */
     $functions = NULL;
     if ($has_menu) {
         $functions .= file_get_contents(BASE . '/build_parts/wp_nav_menu/_functions.php');
     }
     if ($has_widget) {
         $functions .= file_get_contents(BASE . '/build_parts/register_sidebar/_functions.php');
     }
     if ($has_custom_post_type) {
         // add the include to the functions file
         $functions .= file_get_contents(BASE . '/build_parts/custom_post_type/_functions.php');
         // Copy over the custom_post_type.php file and add edits
         copy_directory(BASE . '/build_parts/custom_post_type/files/', $new_theme . '/inc/php/');
         $custom_post_type_contents = file_get_contents($new_theme . '/inc/php/custom_post_type.php');
         $custom_post_type_name = $_POST['custom_post_type_name'];
         $custom_post_type_info = array('{SINGULAR}' => ucfirst($custom_post_type_name), '{PLURAL}' => Inflect::pluralize(ucfirst($custom_post_type_name)), '{PLURAL_LOWERCASE}' => strtolower(Inflect::pluralize($custom_post_type_name)));
         $custom_post_type_file = fopen($new_theme . '/inc/php/custom_post_type.php', "w+");
         foreach ($custom_post_type_info as $replace => $with) {
             $custom_post_type_contents = preg_replace("/{$replace}/", $with, $custom_post_type_contents);
         }
         fwrite($custom_post_type_file, $custom_post_type_contents);
         fclose($custom_post_type_file);
     }
     $contents = preg_replace("/{FUNCTIONS}/", $functions, $contents);
     break;
 case 'sidebar.php':
     $widget_area = '';
     if ($has_widget) {
开发者ID:redtundra,项目名称:WPBuild,代码行数:30,代码来源:build.php

示例12: copy_directory

/**
 * @author Oliver Tupman <oliver.tupman@centralway.com>
 * Date: 08/06/2012
 * Time: 16:34
 */
echo "[deploy] Starting xBoilerplate deployment\n\n";
function copy_directory($source, $destination)
{
    $result = exec('cp -R ' . $source . ' ' . $destination);
    return $result;
}
$autogeneratedDirs = array('tmp', 'test', 'config');
if (!file_exists('vendor')) {
    die("[deploy] FAILED: Command must be run at the same level as composer.json\n");
}
if (file_exists('httpdocs')) {
    die("[deploy] FAILED: httpdocs directory already exists, remove if you wish to deploy a new xBoilerplate skeleton\n");
}
$baseDir = __DIR__ . DIRECTORY_SEPARATOR;
foreach ($autogeneratedDirs as $directory) {
    if (!file_exists($directory)) {
        mkdir($directory);
    }
}
copy_directory($baseDir . 'httpdocs', '.');
copy($baseDir . 'config' . DIRECTORY_SEPARATOR . 'config.php', 'config' . DIRECTORY_SEPARATOR . 'config.php');
copy($baseDir . "Vagrantfile", "Vagrantfile");
echo "[deploy] SUCCESS: your xBoilerplate skeleton was created\n";
echo "         You can start it by using the command: vagrant up\n";
echo "         And then accessing it via http://10.10.10.10\n";
开发者ID:rolfvandekrol,项目名称:Elastica.io,代码行数:30,代码来源:deploy.php

示例13: copy_directory

/**
 * Copy selected directory
 *
 * @param string $source
 * @param string $destination
 */
function copy_directory($source, $destination)
{
    $file_array = array();
    if (is_file($source)) {
        $perm = fileperms($source);
        copy($source, $destination);
        chmod($destination, 0744);
    }
    if (@is_dir($source)) {
        @mkdir($destination, 0777);
        $dir_handle = opendir($source);
        while ($files = readdir($dir_handle)) {
            if ($files != "." && $files != "..") {
                $file_array[] = $files;
            }
        }
        closedir($dir_handle);
    }
    for ($i = 0; $i < count($file_array); $i++) {
        $file = $file_array[$i];
        if ($destination != "{$source}/{$file}") {
            copy_directory("{$source}/{$file}", "{$destination}/{$file}");
        }
    }
}
开发者ID:huluwa,项目名称:zz_atmailopen,代码行数:31,代码来源:lang.php

示例14: extractZip

     }
 } else {
     if (file_exists($plg)) {
         extractZip($path_file, '../plugins');
         include $plg;
         alert('info', AddOns_installed);
         if (isset($plugin_info)) {
             echo "<div class='install_info'>{$plugin_info}</div>";
         }
     } else {
         if (file_exists($app)) {
             extractZip($path_file, "../{$folback}/apps");
             include $app;
             $insser_apps_data = insert_new_apps($apps_name, $apps_folder, $apps_author, $apps_type);
             if ($apps_type == 1) {
                 copy_directory($apf, "../apps/{$folder}");
                 delete_directory("../{$folback}/apps/{$folder}/{$folder}");
             }
             alert('info', AddOns_installed);
             if (isset($apps_info)) {
                 echo "<div class='install_info'>{$apps_info}</div>";
             }
         } else {
             if (file_exists($thm)) {
                 extractZip($path_file, '../themes');
                 include $thm;
                 alert('info', AddOns_installed);
                 echo "<div class='install_info'>{$theme_info}</div>";
             } else {
                 if (file_exists($atm)) {
                     extractZip($path_file, "../{$folback}/themes");
开发者ID:mul14,项目名称:FiyoCMS,代码行数:31,代码来源:backup.php

示例15: 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));
            }
        }
    }
}
开发者ID:Jandersolutions,项目名称:mautic,代码行数:43,代码来源:upgrade.php


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