From d2a74d0be051b5b35cd8d71422a661d286550c74 Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Fri, 21 Jan 2022 15:11:05 +0100 Subject: [PATCH] Further attempt to self-update --- includes/functions/deleteDirectory.php | 9 +++------ index.php | 8 ++++---- 2 files changed, 7 insertions(+), 10 deletions(-) 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); } }