forked from projects/fipamo
ro
68469d958b
Patch for a bug that was deleteting the subdirectories of the theme css folder holding additional theme assets when being published and tested in the theme kit. also removed an unneccessary helper script and organized directory actions in their own helper file to keep it all tidy
39 lines
966 B
PHP
39 lines
966 B
PHP
<?php
|
|
|
|
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!');
|
|
}
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|