Add a few checks
This commit is contained in:
parent
71d1041cb8
commit
9cdc9815ea
@ -10,8 +10,11 @@ class Helper
|
|||||||
*/
|
*/
|
||||||
public static function copyAssets($path, $local_base)
|
public static function copyAssets($path, $local_base)
|
||||||
{
|
{
|
||||||
mkdir($path);
|
if (is_dir($path)) {
|
||||||
static::rmdir($path);
|
static::rmdir($path);
|
||||||
|
} else {
|
||||||
|
mkdir($path);
|
||||||
|
}
|
||||||
|
|
||||||
mkdir($path . DS . 'resources');
|
mkdir($path . DS . 'resources');
|
||||||
static::copyRecursive($local_base . DS . 'resources', $path . DS . 'resources');
|
static::copyRecursive($local_base . DS . 'resources', $path . DS . 'resources');
|
||||||
@ -46,8 +49,11 @@ class Helper
|
|||||||
*/
|
*/
|
||||||
private static function copyRecursive($source, $destination)
|
private static function copyRecursive($source, $destination)
|
||||||
{
|
{
|
||||||
$dir = opendir($source);
|
if (!is_dir($destination)) {
|
||||||
mkdir($destination);
|
mkdir($destination);
|
||||||
|
}
|
||||||
|
|
||||||
|
$dir = opendir($source);
|
||||||
while (false !== ($file = readdir($dir))) {
|
while (false !== ($file = readdir($dir))) {
|
||||||
if ($file != '.' && $file != '..') {
|
if ($file != '.' && $file != '..') {
|
||||||
if (is_dir($source . '/' . $file)) {
|
if (is_dir($source . '/' . $file)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user