本文整理汇总了PHP中recurse_copy函数的典型用法代码示例。如果您正苦于以下问题:PHP recurse_copy函数的具体用法?PHP recurse_copy怎么用?PHP recurse_copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了recurse_copy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copy_vendor
function copy_vendor()
{
if (!file_exists($this->export_location . '/public/vendor/')) {
mkdir($this->export_location . '/public/vendor/', 0777, true);
}
recurse_copy(WWW_FOLDER . '/public/vendor', $this->export_location . '/public/vendor');
echo '{"status":"success", "message":"Vendor files copied."}';
}
示例2: recurse_copy
function recurse_copy($source, $dest)
{
// Check for symlinks
if (is_link($source)) {
return symlink(readlink($source), $dest);
}
// Simple copy for a file
if (is_file($source)) {
return copy($source, $dest);
}
// Make destination directory
if (!is_dir($dest)) {
mkdir($dest);
}
// Loop through the folder
$dir = dir($source);
while (false !== ($entry = $dir->read())) {
// Skip pointers
if ($entry == '.' || $entry == '..') {
continue;
}
// Deep copy directories
recurse_copy("{$source}/{$entry}", "{$dest}/{$entry}");
}
// Clean up
$dir->close();
return true;
}
示例3: changeWidgetDir
function changeWidgetDir($newDir)
{
$defaultDir = str_replace('//', '/', str_replace('\\', '/', dirname(plugin_dir_path(__FILE__)))) . '/custom-widgets/';
if (empty($newDir) || get_option('preset-cdwd') == TRUE || get_option('widgetdir') == '/') {
$newDir = $defaultDir;
$dirchange = TRUE;
}
$newDir = str_replace('//', '/', str_replace('\\', '/', $newDir));
$wpdir = str_replace('//', '/', str_replace('\\', '/', wp_upload_dir()));
$plugindir = str_replace('//', '/', str_replace('\\', '/', dirname(plugin_dir_path(__FILE__))));
if (WPWM_DEBUG == 1) {
$error = TRUE;
$errmsg = "Debug Mode enabled, unrestricted directory changes permitted";
} else {
if (strstr($newDir, $plugindir) == FALSE) {
$error = TRUE;
$errmsg = " ERROR-Custom Widget Directory must be within Wordpress manager plugin directory. The default had been set instead of " . $newDir . '<br/>';
$newDir = dirname(plugin_dir_path(__FILE__)) . '/custom-widgets/';
$dirchange = TRUE;
}
}
$dirchange = TRUE;
$newDir = str_replace('//', '/', str_replace('\\', '/', $newDir));
if (file_exists($newDir) == FALSE) {
$dirDiff = true;
mkdir($newDir, 0755);
$user = exec(whoami);
chown($newDir, $user);
}
$sourceDir = get_option('widgetdir');
if (file_exists($sourceDir)) {
$sourceDir = str_replace('//', '/', str_replace('\\', '/', $sourceDir));
if (strcmp($sourceDir, $wpdir['basedir']) != 0) {
$contents = scandir($sourceDir);
if (SUBSTR($newDir, -1) != '/') {
$newDir .= '/';
}
foreach ($contents as $widgets) {
if ($widgets != "." && $widgets != "..") {
recurse_copy($sourceDir, $newDir);
}
}
if ($sourceDir != $newDir) {
if ($sourceDir != $defaultDir) {
$check = recursiveRemove($sourceDir);
}
}
}
}
update_option('widgetdir', $newDir);
msgDisplay($error, $errmsg, $dirchange, $dirDiff);
}
示例4: main
public function main()
{
if (!is_dir($this->targetDir)) {
throw new BuildException("Invalid symlink target {$this->targetDir}");
}
foreach ($this->items as $item) {
// if there's a source dir set, we're assuming everything is coming from that dir
$sourceItem = $this->sourceDir ? $this->sourceDir . '/' . $item : $item;
if (!recurse_copy($sourceItem, $this->targetDir . '/' . $item)) {
throw new BuildException("Failed copying from {$sourceItem} to " . $this->targetDir);
}
}
}
示例5: recurse_copy
public function recurse_copy($src, $dst)
{
$hm = openhm($src);
@mkhm($dst);
while (false !== ($file = readhm($hm))) {
if ($file != '.' && $file != '..') {
if (is_hm($src . '/' . $file)) {
recurse_copy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
closehm($hm);
}
示例6: recurse_copy
function recurse_copy($src, $dst)
{
$dir = opendir($src);
@mkdir($dst, '01777', TRUE);
while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') {
if (is_dir($src . '/' . $file)) {
recurse_copy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
closedir($dir);
}
示例7: recurse_copy
/**
* Taken from: http://php.net/manual/en/function.copy.php
*
* Recursively copies a directory from $src to $dst.
* If $dst does not exist it is created.
* Omits .svn directories.
* Omits .git directories.
**/
function recurse_copy($src, $dst)
{
$dir = opendir($src);
@mkdir($dst, 0775, true);
while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..' && $file != '.svn' && $file != '.git') {
if (is_dir($src . '/' . $file)) {
recurse_copy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
closedir($dir);
}
示例8: WPPortfolio_fileCopyRecursive
/**
* A recursive function to copy all subdirectories and their contents.
* @param $src The source directory
* @param $dst The target directory
*/
function WPPortfolio_fileCopyRecursive($src, $dst)
{
$dir = opendir($src);
@mkdir($dst);
while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') {
if (is_dir($src . '/' . $file)) {
recurse_copy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
// end while
closedir($dir);
}
示例9: recurse_copy
function recurse_copy($src, $dst)
{
$success = true;
$dir = opendir($src);
@mkdir($dst);
while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') {
if (is_dir($src . '/' . $file)) {
$success = $success && recurse_copy($src . '/' . $file, $dst . '/' . $file);
} else {
$success = $success && copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
closedir($dir);
return $success;
}
示例10: recurse_copy_files
protected function recurse_copy_files($src, $dst)
{
$dir = opendir($src);
if (!file_exists($dst)) {
mkdir($dst, 0777, true);
}
while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') {
if (is_dir($src . '/' . $file)) {
recurse_copy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
closedir($dir);
}
示例11: recurse_copy
/**
* @param string $source
* @param string $destination
*
* @see http://stackoverflow.com/a/2050909/736809
*/
function recurse_copy($source, $destination)
{
$dir = opendir($source);
@mkdir($destination);
while (false !== ($file = readdir($dir))) {
if (!in_array($file, ['.', '..'])) {
if (is_dir($source . '/' . $file)) {
recurse_copy(sprintf('%s/%s', $source, $file), sprintf('%s/%s', $destination, $file));
//recurse_copy($source . '/' . $file,$destination . '/' . $file);
} else {
copy(sprintf('%s/%s', $source, $file), sprintf('%s/%s', $destination, $file));
//copy($source . '/' . $file, $destination . '/' . $file);
}
}
}
closedir($dir);
}
示例12: recurse_copy
function recurse_copy($dossier, $demoUrlDir)
{
$dir = opendir($dossier);
if (!file_exists($demoUrlDir)) {
@mkdir($demoUrlDir);
}
while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') {
/* Add */
if (is_dir($dossier . '/' . $file)) {
recurse_copy($dossier . '/' . $file, $demoUrlDir . '/' . $file);
} else {
copy($dossier . '/' . $file, $demoUrlDir . '/' . $file);
}
}
}
closedir($dir);
}
示例13: filecopy
protected function filecopy($tmpFolder)
{
$dir0s = ob_scandir($tmpFolder);
// copy module to cubi/upgrade folder
foreach ($dir0s as $dir0) {
$dirs = ob_scandir($tmpFolder . "/{$dir0}");
foreach ($dirs as $dir) {
$srcDir = $tmpFolder . "/{$dir0}/{$dir}";
$dstDir = $dir == 'modules' ? OPENBIZ_APP_PATH . "/upgrade/modules" : OPENBIZ_APP_PATH . "/{$dir}";
echo "copy {$srcDir} to {$dstDir} \n";
recurse_copy($srcDir, $dstDir);
if ($dir == 'modules') {
$this->_upgradeModules = ob_scandir($srcDir);
}
}
}
//print_r($this->_upgradeModules);
}
示例14: createProject
public function createProject($projectName, $projectDir)
{
ControllerTray::instance()->renderLayout = false;
$this->data->success = false;
$this->data->projectName = $projectName;
if (!\Fstab::instance()->addProject($projectName, $projectDir)) {
return false;
}
\Fstab::instance()->save();
$commonProject = \Path::instance()->evaluate("common.template.prj");
$projectPath = \Path::instance()->evaluate(":{$projectName}.root") . "{$projectDir}";
if (!is_dir($projectPath)) {
if (!recurse_copy($commonProject, $projectPath)) {
$this->data->success = false;
} else {
$this->data->success = true;
}
}
}
示例15: recurse_copy
function recurse_copy($src, $dst)
{
$dir = opendir($src);
@mkdir($dst);
while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') {
if (is_dir($src . '/' . $file)) {
recurse_copy($src . '/' . $file, $dst . '/' . $file);
echo 'Copying: ' . $src . '/' . $file . ' to ' . $dst . '/' . $file . '<br />';
} else {
copy($src . '/' . $file, $dst . '/' . $file);
echo 'Copying: ' . $src . '/' . $file . ' to ' . $dst . '/' . $file . '<br />';
}
//end if/else
}
//end out if
}
//end while loop
closedir($dir);
}