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


PHP copyFiles函数代码示例

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


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

示例1: copyFiles

function copyFiles($sd, $dd)
{
    global $fs;
    foreach ($fs->ls($sd) as $fn) {
        $sfp = PathUtil::rel($sd, $fn);
        $dfp = PathUtil::rel($dd, $fn);
        //print "copy $sfp $dfp<BR>\n";
        if ($fs->isDir($sfp)) {
            copyFiles($sfp, $dfp);
        } else {
            $fs->setContent($dfp, $fs->getContent($sfp));
        }
    }
}
开发者ID:hoge1e3,项目名称:jslesson,代码行数:14,代码来源:copySample.php

示例2: copyFiles

function copyFiles($src, $dst)
{
    $dir = opendir($src);
    if (!is_dir($dst)) {
        mkdir($dst, PER_FOLDER) or die("Mkdir problem: " . $dst);
    }
    while (false !== ($file = readdir($dir))) {
        if ($file != '.' && $file != '..') {
            if (is_dir($src . '/' . $file)) {
                copyFiles($src . '/' . $file, $dst . '/' . $file);
                chmodAll($dst . '/' . $file, PER_FILE);
            } else {
                copy($src . '/' . $file, $dst . '/' . $file) or die("Copy problem: " . $src . '/' . $file . "  ->  " . $dst . '/' . $file);
                chmodAll($dst . '/' . $file, PER_FILE);
            }
        }
    }
    closedir($dir);
}
开发者ID:NejcZdovc,项目名称:sumo2,代码行数:19,代码来源:step4.php

示例3: copyFiles

function copyFiles($src, $dst)
{
    if (file_exists($dst)) {
        removeDir($dst);
    }
    if (is_dir($src)) {
        mkdir($dst);
        $files = scandir($src);
        foreach ($files as $file) {
            if ($file != "." && $file != "..") {
                copyFiles("{$src}/{$file}", "{$dst}/{$file}");
            }
        }
    } else {
        if (file_exists($src)) {
            copy($src, $dst);
            removeDir($src);
        }
    }
}
开发者ID:sathish-m,项目名称:CSV-Upload,代码行数:20,代码来源:FormatAndMove.php

示例4: installQubit

function installQubit($qubitWebRoot, $qubitDataRoot)
{
    global $fileSystemPathToWebFiles;
    global $fileSystemPathToDataFiles;
    // Verify that $fileSystemPathToWebFiles and $fileSystemPathToDataFiles exist. Don't bother
    // reporting if they are found.
    if (!file_exists($fileSystemPathToWebFiles)) {
        reportOnProgress("Verifying location of source files", 'Problem', "Can't find {$fileSystemPathToWebFiles}", "Verify that '{$fileSystemPathToWebFiles}' exists");
        $error = true;
    }
    if (!file_exists($fileSystemPathToDataFiles)) {
        reportOnProgress("Verifying location of source files", 'Problem', "Can't find {$fileSystemPathToDataFiles}", "Verify that '{$fileSystemPathToDataFiles}' exists");
        $error = true;
    }
    // If there are errors, return here since we can't go any further, and we don't want to copy any files.
    // return $error;
    // If we made it this far, copy files needed to install Qubit
    $error = copyFiles($fileSystemPathToWebFiles, $qubitWebRoot, 'web');
    $error = copyFiles($fileSystemPathToDataFiles, $qubitDataRoot, 'data');
    // Write out index.php controller file
    $error = writeIndexPhp($qubitWebRoot . 'index.php', $qubitDataRoot . 'lib/QubitConfiguration.class.php');
    // Populate db with structure and sample data. We use Symfony's sfPropelInsertSqlTask() and
    // sfPropelLoadDataTask() objects to do this. To do: Trap errors here and report them with
    // reportOnProgress().
    // First, include Symfony config flass, initialize objects
    require_once $qubitDataRoot . 'lib/QubitConfiguration.class.php';
    $configuration = new QubitConfiguration('dev', true);
    $dispatcher = new sfEventDispatcher();
    $formatter = new sfAnsiColorFormatter();
    // We need to chdir into the data directory or symfony complains
    chdir($qubitDataRoot);
    // Next, copy template for propel.ini and call a symphony task to populate it and databases.yml
    $error = copyPropelIni($qubitDataRoot . 'config/propel.ini.tmpl', $qubitDataRoot . 'config/propel.ini');
    $error = writeDatabaseConfigFiles($dispatcher, $formatter);
    // Then, perform SQL tasks. We're no longer checking for $error here, but the user will see errors
    // if these tasks generate any.
    $insertSql = new sfPropelInsertSqlTask($dispatcher, $formatter);
    $insertSql->run();
    $loadData = new sfPropelLoadDataTask($dispatcher, $formatter);
    $loadData->run(array('qubit'));
    // To do: Perform check to see if mod_rewrite is enabled. We do this by issuing an fopen to a Qubit URL
    return $error;
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:43,代码来源:index.php

示例5: setupGitCacheFolder

    $cache = setupGitCacheFolder($folders);
}
define('GIT_CACHE_DEST', $cache[0]);
if (0 == errorCount()) {
    for ($x = 0; $x < count($folders); $x++) {
        buildFilesList($cache, $files_list, GIT, $exclude_files, $folders[$x]);
    }
}
if (0 == errorCount() && $cache[1] == GITNEW) {
    downloadFiles($files_list);
}
if (0 == errorCount()) {
    backupFiles($tmp_folder, $files_list);
}
if (0 == errorCount()) {
    copyFiles($files_list);
}
if (0 == errorCount()) {
    $dbupdate = updateDB($nuConfigDBHost, $nuConfigDBName, $nuConfigDBUser, $nuConfigDBPassword);
}
if (errorCount() > 0) {
    $finalResult['message'] = 'ERRORS';
} else {
    $finalResult['message'] = 'SUCCESS';
}
$successCount = count($success);
$finalResult['errors'] = $errors;
$finalResult['success'] = array("{$successCount} File(s) updated");
$finalResult['cache'] = $cache;
$finalResult['dbupdate'] = $dbupdate;
$json = json_encode($finalResult);
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:31,代码来源:nuphpgit.php

示例6: copyFiles

/**
 * Copy specified files.
 *
 * @param array $files
 * @param string $src_dir
 * @param string $des_dir
 * @return int
 */
function copyFiles(array $files, $src_dir, $des_dir)
{
    foreach ($files as $i => $file) {
        if (is_array($file)) {
            $dir = $des_dir . DIRECTORY_SEPARATOR . $i;
            if (!file_exists($dir)) {
                mkdir($dir);
            }
            $b = copyFiles($file, $src_dir . DIRECTORY_SEPARATOR . $i, $dir);
            if ($b !== 0) {
                return 1;
            }
        } else {
            if (file_exists($src_dir . DIRECTORY_SEPARATOR . $file)) {
                $b = copy($src_dir . DIRECTORY_SEPARATOR . $file, $des_dir . DIRECTORY_SEPARATOR . $file);
                if (!$b) {
                    echo "Copy {$file} failed!\n";
                    return 1;
                }
            } else {
                echo "{$file} does not exists!\n";
                return 1;
            }
        }
    }
    return 0;
}
开发者ID:wwtg99,项目名称:flight2wwu,代码行数:35,代码来源:wwtinit.php

示例7: UpdateUtility_run

    exit;
}
if (isset($_GET["UpdateUtilityStartTask"])) {
    UpdateUtility_run();
    exit;
}
if (isset($_GET["dmesg"])) {
    dmesg();
    exit;
}
if (isset($_GET["artica-cron-tasks"])) {
    artica_cron_tasks();
    exit;
}
if (isset($_GET["copyFiles"])) {
    copyFiles();
    exit;
}
if (isset($_GET["DeleteFiles"])) {
    DeleteFiles();
    exit;
}
if (isset($_GET["port-list"])) {
    ports_list();
    exit;
}
if (isset($_GET["CleanCacheMem"])) {
    CleanCacheMem();
    exit;
}
if (isset($_GET["files-descriptors"])) {
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:31,代码来源:services.php

示例8: config

#!/usr/bin/env php
<?php 
require $_SERVER['PWD'] . '/.git/hooks/utils.php';
$config = config();
$files = files();
$tmp = copyFiles($files);
if (empty($tmp['files'])) {
    echo "No files to check\n";
    exit(0);
}
if ($tmp['dir'] && !is_dir($tmp['dir'])) {
    echo "{$tmp['dir']} doesn't exist\n";
    exit(1);
}
$config = $config['js']['lint'];
$status = 0;
foreach ($tmp['files'] as $file) {
    if (!preg_match($config['pattern'], $file)) {
        continue;
    }
    $cmd = "jslint -p " . escapeshellarg($file);
    $output = array();
    echo "{$cmd}\n";
    exec($cmd, $output, $return);
    if ($return) {
        echo implode("\n", $output), "\n";
        $status = 1;
    }
}
exit($status);
开发者ID:seungrye,项目名称:git-hooks,代码行数:30,代码来源:lint.php

示例9: createDirs

         $err = $ERR_FILE_NOT_FOUND;
         break;
     }
     if (!file_exists($assetsLCL . arg("target"))) {
         $ret = createDirs($assetsLCL . arg("target"));
         if (!$ret) {
             $err = $ERR_FILE_PERMISSION;
             break;
         }
     }
     $ret = deleteFiles($assetsLCL . arg("target"));
     if (!$ret) {
         $err = $ERR_FILE_PERMISSION;
         break;
     }
     $ret = copyFiles($assetsLCL . arg("path"), $assetsLCL . arg("target"));
     if (!$ret) {
         $err = $ERR_FILE_PERMISSION;
         break;
     }
     break;
 case "spider":
     $ret = spider($assetsLCL . arg("path"), $assetsLCL);
     if (!$ret) {
         $err = $ERR_FILE_NOT_FOUND;
     }
     break;
 case "touch":
     if (!in_array(auth_get_class(), array("admin", "supervisor", "dirprod"))) {
         $err = $ERR_PERMISSION;
         break;
开发者ID:remyla,项目名称:damas-core,代码行数:31,代码来源:file.php

示例10: die

                die("Failed to copy {$srcfile} to {$destfile}\n");
            }
        }
    }
}
// grab project name from cwd
$proj = basename(getcwd());
// first line: $proj ver. VERSION
$readme = file('readme.txt');
if (1 != preg_match('/' . $proj . ' ver\\. (.+)\\s/', $readme[0], $m)) {
    die("Version grab from readme.txt failed");
}
$ver = trim($m[1]);
// target dir for package
$basedir = "{$proj}-{$ver}/";
mkdirR($basedir);
// package files listed in package.lst
$files = file('package.lst');
foreach ($files as $file) {
    $file = str_replace('\\', '/', trim($file));
    $dst = $basedir;
    $dirname = dirname($file);
    if ($dirname != '.') {
        $dst .= $dirname;
        mkdirR($dst);
    }
    //echo $dst."\n";
    copyFiles($file, $dst);
}
chdir($basedir);
system("pkzip -add -dir {$proj}-{$ver}.zip");
开发者ID:siquel,项目名称:yam2d,代码行数:31,代码来源:package.php

示例11: copyFiles

function copyFiles($source, $dest)
{
    global $bfolder;
    global $bcopy;
    if (strlen($source) == '') {
        return;
    }
    if (substr($source, strlen($source) - 1) == '/') {
        $source = substr($source, 0, strlen($source) - 1);
    }
    //print("Copy: $source = $dest \n");
    // -- build file names to copy
    if (is_dir($source)) {
        $handle = opendir($source);
        while ($filename = readdir($handle)) {
            if ($filename != "." && $filename != "..") {
                $tmp = split('/', $source);
                $bcopy[$dest . "/" . $tmp[count($tmp) - 1]] = '^^create_dir~~';
                copyFiles($source . "/" . $filename, $dest . "/" . $tmp[count($tmp) - 1]);
            }
        }
        closedir($handle);
    } else {
        $bcopy[$source] = $dest . "/" . basename($source);
    }
}
开发者ID:visapi,项目名称:Web-2.0-File-Manager,代码行数:26,代码来源:index_srv.php

示例12: copyFiles

function copyFiles($source, $suffixes, $dest_dir)
{
    if (!is_dir($dest_dir)) {
        mkdir($dest_dir);
    }
    $files = array();
    $files = array_merge($files, searchFiles($source, $suffixes));
    foreach ($files as $file) {
        if (is_dir("{$source}/{$file}")) {
            copyFiles("{$source}/{$file}", $suffixes, "{$dest_dir}/{$file}");
        } else {
            copy("{$source}/{$file}", "{$dest_dir}/{$file}");
        }
    }
}
开发者ID:sziszu,项目名称:pefi,代码行数:15,代码来源:util.php

示例13: delTree

    echo "Deleting " . $buildRoot . "/sample ..\n";
    delTree($buildRoot . "/sample");
}
mkdir($buildRoot . "/sample");
//Create the required directories and files for the web application.
copyFiles("common", $buildRoot, $srcRoot);
copyFiles("controllers", $buildRoot, $srcRoot);
copyFiles("public", $buildRoot, $srcRoot);
// Copy composer.json file_exists
copy($buildRoot . "/composer.json", $buildRoot . "/sample/composer.json");
//copy config files.
if (file_exists($buildRoot . "/config")) {
    echo "Deleting " . $buildRoot . "/config ..\n";
    delTree($buildRoot . "/config");
}
copyFiles("config", $buildRoot, $srcRoot, TRUE);
// Delete vendor directory if it exists.
if (file_exists($buildRoot . "/sample/vendor")) {
    echo "Deleting " . $buildRoot . "/sample/vendor...\n";
    delTree($buildRoot . "/sample/vendor");
}
// Execute composer install if vendor directory does not exist.
if (file_exists($buildRoot . "/sample/vendor")) {
    echo "Deleting " . $buildRoot . "/sample/vendor...\n";
    delTree($buildRoot . "/sample/vendor");
}
echo "Executing Composer Install...\n";
$output = `composer -d=build/sample install`;
echo $output;
echo "Build Successfull!\n";
exit(1);
开发者ID:jonestabillo,项目名称:react-server-template,代码行数:31,代码来源:build.php

示例14: configFossology

/**
 * \brief Config fossology
 *
 * @param object $objRef an object reference (should be to ConfigSys)
 *
 * @return boolean
 */
function configFossology($objRef)
{
    if (!is_object($objRef)) {
        return FALSE;
    }
    $debLog = NULL;
    $installLog = NULL;
    //echo "DB: IFOSS: osFlavor is:$objRef->osFlavor\n";
    switch ($objRef->osFlavor) {
        case 'Ubuntu':
        case 'Debian':
            $debApache = "ln -s /usr/local/etc/fossology/conf/src-install-apache-example.conf /etc/apache2/sites-enabled/fossology.conf";
            $last = exec($debApache, $out, $rtn);
            //echo "last is:$last\nresults of update are:\n";print_r($out) . "\n";
            if ($rtn != 0) {
                echo "Failed to config fossology!\nTranscript is:\n";
                echo implode("\n", $out) . "\n";
                return FALSE;
            }
            break;
        case 'Fedora':
        case 'RedHat':
            $initPostgres = "service postgresql initdb";
            $startPostgres = "service postgresql start";
            $restartPostgres = "service postgresql restart";
            $psqlFile = "../dataFiles/pkginstall/redhat/6.x/pg_hba.conf";
            echo "** Initial postgresql **\n";
            $last = exec($initPostgres, $out, $rtn);
            if ($rtn != 0) {
                echo "Failed to initial postgresql!\nTranscript is:\n";
                echo implode("\n", $out) . "\n";
                return FALSE;
            }
            echo "** Start postgresql **\n";
            $last = exec($startPostgres, $out, $rtn);
            if ($rtn != 0) {
                echo "Failed to start postgresql!\nTranscript is:\n";
                echo implode("\n", $out) . "\n";
                return FALSE;
            }
            echo "** Configure pg_hba.conf **\n";
            try {
                copyFiles($psqlFile, "/var/lib/pgsql/data/");
            } catch (Exception $e) {
                echo "Failure: Could not copy postgres config files\n";
            }
            $last = exec($restartPostgres, $out, $rtn);
            if ($rtn != 0) {
                echo "Failed to restart postgresql!\nTranscript is:\n";
                return FALSE;
            }
            break;
        default:
            echo "FATAL! Unrecongnized OS/Release, not one of Ubuntu, Debian, RedHat" . " or Fedora\n";
            return FALSE;
            break;
    }
    return TRUE;
}
开发者ID:pombredanne,项目名称:fossology-test,代码行数:66,代码来源:srcConfig.php

示例15: foreach

 foreach ($domains as $domain) {
     $delete .= ' AND ids.domainID!="' . $domain . '"';
 }
 $qD = $db->query('SELECT def.moduleName, domain.name, ids.ID FROM cms_modules_def as def LEFT JOIN cms_domains_ids as ids ON def.ID=ids.elementID LEFT JOIN cms_domains as domain ON ids.domainID=domain.ID WHERE def.ID="' . $id . '" AND ids.type="mod" ' . $delete . '');
 while ($rD = $db->fetch($qD)) {
     $db->query("DELETE FROM cms_domains_ids WHERE elementID='" . $id . "' AND type='mod'");
     recursive_remove_directory('../../modules/' . $rD['name'] . '/' . $rD['moduleName'] . '/');
 }
 //Add
 $moduleData = $db->get($db->query('SELECT moduleName FROM cms_modules_def WHERE ID="' . $id . '"'));
 foreach ($domains as $domain) {
     $qA = $db->rows($db->query('SELECT ID FROM cms_domains_ids WHERE domainID="' . $domain . '" AND elementID="' . $id . '" AND type="mod" '));
     if ($qA == 0) {
         $nameD = $db->get($db->query('SELECT name FROM cms_domains WHERE ID="' . $domain . '"'));
         if (!is_dir('../../modules/' . $nameD['name'] . '/' . $moduleData['moduleName'] . '')) {
             copyFiles('../../modules/default/' . $moduleData['moduleName'] . '/', '../../modules/' . $nameD['name'] . '/' . $moduleData['moduleName'] . '/');
             chmodAll('../../modules/' . $nameD['name'] . '/' . $moduleData['moduleName'] . '/');
         }
         $files = scandir('../../modules/default/images/');
         foreach ($files as $file) {
             if (strlen($file) > 2) {
                 if (!is_file('../../modules/' . $nameD['name'] . '/images/' . $file)) {
                     copy('../../modules/default/images/' . $file, '../../modules/' . $nameD['name'] . '/images/' . $file);
                     chmod('../../modules/' . $nameD['name'] . '/images/' . $file, PER_FILE);
                 }
             }
         }
         $db->query("INSERT INTO cms_domains_ids (elementID,domainID,type) VALUES ('" . $id . "','" . $domain . "','" . $db->filter('ver') . "')");
     }
 }
 echo 'ok';
开发者ID:NejcZdovc,项目名称:sumo2,代码行数:31,代码来源:module.data.php


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