Further attempt to self-update

This commit is contained in:
Jay Trees 2022-01-21 15:11:05 +01:00
parent f99c53591f
commit d2a74d0be0
2 changed files with 7 additions and 10 deletions

View file

@ -16,16 +16,13 @@ function delete_directory(string $directoryToDelete)
$filepath = $directoryToDelete . '/' . $filename;
if (is_file($filepath) && !is_dir($filepath)) {
echo 'unlink: ' . $filepath . '<br>';
// unlink($filepath);
unlink($filepath);
}
if (is_dir($filepath)) {
echo 'delete_directory: ' . $filepath . '<br>';
// delete_directory($filepath);
delete_directory($filepath);
}
}
echo 'rmdir (final): ' . $filepath . '<br>';
// rmdir($directoryToDelete);
rmdir($directoryToDelete);
}

View file

@ -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 . '<br>';
// rename($filepath, __DIR__ . '/' . $filename);
rename($filepath_github, $filepath);
}
}