Refactor
This commit is contained in:
parent
c3b6ae0e8e
commit
fb6aa8ce23
1 changed files with 4 additions and 6 deletions
10
index.php
10
index.php
|
@ -84,18 +84,18 @@ $release = $client->api('repo')->releases()->latest('grandeljay', 'wishthis');
|
||||||
$tag = $release['tag_name'];
|
$tag = $release['tag_name'];
|
||||||
$version = str_replace('v', '', $tag);
|
$version = str_replace('v', '', $tag);
|
||||||
|
|
||||||
$filename = __DIR__ . '/' . $tag . '.zip';
|
$zip_filename = __DIR__ . '/' . $tag . '.zip';
|
||||||
|
|
||||||
/** Download */
|
/** Download */
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
$filename,
|
$zip_filename,
|
||||||
file_get_contents('https://github.com/grandeljay/wishthis/archive/refs/tags/' . $tag . '.zip')
|
file_get_contents('https://github.com/grandeljay/wishthis/archive/refs/tags/' . $tag . '.zip')
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Decompress */
|
/** Decompress */
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
|
|
||||||
if ($zip->open($filename)) {
|
if ($zip->open($zip_filename)) {
|
||||||
$zip->extractTo(__DIR__);
|
$zip->extractTo(__DIR__);
|
||||||
$zip->close();
|
$zip->close();
|
||||||
|
|
||||||
|
@ -113,12 +113,10 @@ if ($zip->open($filename)) {
|
||||||
rename($filepath, __DIR__ . '/' . $filename);
|
rename($filepath, __DIR__ . '/' . $filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rename($directory_old, $directory_new);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Delete */
|
/** Delete */
|
||||||
unlink($filename);
|
unlink($zip_filename);
|
||||||
|
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
var_Dump($release);
|
var_Dump($release);
|
||||||
|
|
Loading…
Reference in a new issue