mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
File handler: filter out .git by default when copying folders.
This commit is contained in:
@@ -884,12 +884,15 @@ class e_file
|
|||||||
* Copy a file, or copy the contents of a folder.
|
* Copy a file, or copy the contents of a folder.
|
||||||
* @param string $source Source path
|
* @param string $source Source path
|
||||||
* @param string $dest Destination path
|
* @param string $dest Destination path
|
||||||
* @param int $perm
|
* @param array $options
|
||||||
* @return bool Returns true on success, false on error
|
* @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
|
// Simple copy for a file
|
||||||
if(is_file($source))
|
if(is_file($source))
|
||||||
{
|
{
|
||||||
@@ -907,7 +910,7 @@ class e_file
|
|||||||
foreach($dir as $folder)
|
foreach($dir as $folder)
|
||||||
{
|
{
|
||||||
// Skip pointers
|
// Skip pointers
|
||||||
if($folder === '.' || $folder == '..')
|
if($folder === '.' || $folder == '..' || $folder === $filter)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user