diff --git a/includes/functions/deleteDirectory.php b/includes/functions/deleteDirectory.php
index acc6bed4..787d1393 100644
--- a/includes/functions/deleteDirectory.php
+++ b/includes/functions/deleteDirectory.php
@@ -16,16 +16,13 @@ function delete_directory(string $directoryToDelete)
$filepath = $directoryToDelete . '/' . $filename;
if (is_file($filepath) && !is_dir($filepath)) {
- echo 'unlink: ' . $filepath . '
';
- // unlink($filepath);
+ unlink($filepath);
}
if (is_dir($filepath)) {
- echo 'delete_directory: ' . $filepath . '
';
- // delete_directory($filepath);
+ delete_directory($filepath);
}
}
- echo 'rmdir (final): ' . $filepath . '
';
- // rmdir($directoryToDelete);
+ rmdir($directoryToDelete);
}
diff --git a/index.php b/index.php
index 7ab602b2..bf0c4191 100644
--- a/index.php
+++ b/index.php
@@ -106,14 +106,14 @@ if ($zip->open($zip_filename)) {
continue;
}
- $filepath = $directory_wishthis_github . '/' . $filename;
+ $filepath = __DIR__ . '/' . $filename;
+ $filepath_github = $directory_wishthis_github . '/' . $filename;
- if (is_dir($filepath)) {
+ if (is_dir($filepath) && is_dir($filepath_github)) {
delete_directory($filepath);
}
- echo 'reanme: ' . $filepath . ' to ' . __DIR__ . '/' . $filename . '
';
- // rename($filepath, __DIR__ . '/' . $filename);
+ rename($filepath_github, $filepath);
}
}