From 5821bc291ff9df363c6a63ed8df15180ac036997 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 31 Jan 2017 12:30:44 -0800 Subject: [PATCH] File handler: filter out .git by default when copying folders. --- e107_handlers/file_class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/e107_handlers/file_class.php b/e107_handlers/file_class.php index 8db4ee126..925561c6b 100644 --- a/e107_handlers/file_class.php +++ b/e107_handlers/file_class.php @@ -884,12 +884,15 @@ class e_file * Copy a file, or copy the contents of a folder. * @param string $source Source path * @param string $dest Destination path - * @param int $perm + * @param array $options * @return bool Returns true on success, false on error */ - function copy($source, $dest, $perm = 0755) + function copy($source, $dest, $options=array()) { + $perm = !empty($options['perm']) ? $options['perm'] : 0755; + $filter = !empty($options['git']) ? "" : ".git"; // filter out .git by default. + // Simple copy for a file if(is_file($source)) { @@ -907,7 +910,7 @@ class e_file foreach($dir as $folder) { // Skip pointers - if($folder === '.' || $folder == '..') + if($folder === '.' || $folder == '..' || $folder === $filter) { continue; }