diff --git a/app/Helpers/DirectoryHelpers.php b/app/Helpers/DirectoryHelpers.php new file mode 100644 index 0000000..b9bcb24 --- /dev/null +++ b/app/Helpers/DirectoryHelpers.php @@ -0,0 +1,38 @@ +isDot()) { + if ($object->isDir()) { + delete_directory($object->getPathname()); + } else { + unlink($object->getPathname()); + } + } + } + rmdir($dirPath); + } else { + throw new Exception(__FUNCTION__ . '(dirPath): dirPath is not a directory!'); + } +} + +function copy_directory($src, $dst) +{ + if (file_exists($dst)) { + rrmdir($dst); + } + if (is_dir($src)) { + mkdir($dst); + $files = scandir($src); + foreach ($files as $file) { + if ($file != "." && $file != "..") { + copy_directory("$src/$file", "$dst/$file"); + } + } + } elseif (file_exists($src)) { + copy($src, $dst); + } +} diff --git a/app/Helpers/PageSorter.php b/app/Helpers/PageSorter.php deleted file mode 100644 index d439057..0000000 --- a/app/Helpers/PageSorter.php +++ /dev/null @@ -1,10 +0,0 @@ -loadAllPages(); - echo(count($pages)); -} diff --git a/app/Helpers/StringHelpers.php b/app/Helpers/StringHelpers.php index 7019655..df23c51 100644 --- a/app/Helpers/StringHelpers.php +++ b/app/Helpers/StringHelpers.php @@ -62,22 +62,3 @@ function createAppKey() { return 'base64:' . base64_encode(Encrypter::generateKey(config('app.cipher'))); } - -function delete_directory($dirPath) -{ - if (is_dir($dirPath)) { - $objects = new DirectoryIterator($dirPath); - foreach ($objects as $object) { - if (!$object->isDot()) { - if ($object->isDir()) { - delete_directory($object->getPathname()); - } else { - unlink($object->getPathname()); - } - } - } - rmdir($dirPath); - } else { - throw new Exception(__FUNCTION__ . '(dirPath): dirPath is not a directory!'); - } -} diff --git a/app/Services/Assets/AssetService.php b/app/Services/Assets/AssetService.php index e230678..f1ac0e8 100644 --- a/app/Services/Assets/AssetService.php +++ b/app/Services/Assets/AssetService.php @@ -86,11 +86,17 @@ class AssetService copy($file, $cssPath . $path[6]); } else { // if there is a type/font folder, move it + $typePath = explode('/', $file); - if (is_dir($cssPath . $typePath[6])) { - delete_directory($cssPath . $typePath[6]); + $src = '../content/themes/' . $this->currentTheme . '/assets/css/' . $typePath[6]; + $dst = $cssPath . $typePath[6]; + if (is_dir($dst)) { + delete_directory($dst); + copy_directory($src, $dst); + } else { + copy_directory($src, $dst); } - rename($file, $cssPath . $typePath[6]); + //rename($file, $cssPath . $typePath[6]); } } $newjs = glob('../content/themes/' . $this->currentTheme . '/assets/scripts/*');