mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-14 18:02:01 -04:00
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Modules\BHDModuleManager\Traits;
|
|
|
|
trait Upload
|
|
{
|
|
function recurse_copy($src, $dst)
|
|
{
|
|
$dir = opendir($src);
|
|
@mkdir($dst);
|
|
while (false !== ($file = readdir($dir))) {
|
|
if (($file != '.') && ($file != '..')) {
|
|
if (is_dir($src . '/' . $file)) {
|
|
$this->recurse_copy($src . '/' . $file, $dst . '/' . $file);
|
|
} else {
|
|
copy($src . '/' . $file, $dst . '/' . $file);
|
|
}
|
|
}
|
|
}
|
|
closedir($dir);
|
|
}
|
|
|
|
function delete_directory($dirname)
|
|
{
|
|
if (is_dir($dirname))
|
|
$dir_handle = opendir($dirname);
|
|
if (!$dir_handle)
|
|
return false;
|
|
while ($file = readdir($dir_handle)) {
|
|
if ($file != "." && $file != "..") {
|
|
if (!is_dir($dirname . "/" . $file))
|
|
unlink($dirname . "/" . $file);
|
|
else
|
|
$this->delete_directory($dirname . '/' . $file);
|
|
}
|
|
}
|
|
closedir($dir_handle);
|
|
rmdir($dirname);
|
|
return true;
|
|
}
|
|
}
|