From fb6aa8ce23423dd0fae47c0181249969aab3e707 Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Fri, 21 Jan 2022 14:38:02 +0100 Subject: [PATCH] Refactor --- index.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index 44f9aaf1..51ae998d 100644 --- a/index.php +++ b/index.php @@ -84,18 +84,18 @@ $release = $client->api('repo')->releases()->latest('grandeljay', 'wishthis'); $tag = $release['tag_name']; $version = str_replace('v', '', $tag); -$filename = __DIR__ . '/' . $tag . '.zip'; +$zip_filename = __DIR__ . '/' . $tag . '.zip'; /** Download */ file_put_contents( - $filename, + $zip_filename, file_get_contents('https://github.com/grandeljay/wishthis/archive/refs/tags/' . $tag . '.zip') ); /** Decompress */ $zip = new ZipArchive(); -if ($zip->open($filename)) { +if ($zip->open($zip_filename)) { $zip->extractTo(__DIR__); $zip->close(); @@ -113,12 +113,10 @@ if ($zip->open($filename)) { rename($filepath, __DIR__ . '/' . $filename); } } - - rename($directory_old, $directory_new); } /** Delete */ -unlink($filename); +unlink($zip_filename); echo '
';
 var_Dump($release);