Created
July 23, 2023 22:26
-
-
Save bethropolis/66d6e99114d7cdead883e545af7364f8 to your computer and use it in GitHub Desktop.
suplike installer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function downloadFile($url, $destination) | |
{ | |
$fileContents = @file_get_contents($url); | |
if ($fileContents === false) { | |
die("Error: Failed to download the file from $url"); | |
} | |
$result = file_put_contents($destination, $fileContents); | |
if ($result === false) { | |
die("Error: Failed to save the file to $destination"); | |
} | |
} | |
function extractZip($zipFile, $destination) | |
{ | |
if (!class_exists('ZipArchive')) { | |
die("Error: ZipArchive class is not available. Please enable the PHP Zip extension."); | |
} | |
$zip = new ZipArchive(); | |
$result = $zip->open($zipFile); | |
if ($result !== true) { | |
die("Error: Failed to open the zip file ($result)"); | |
} | |
if (!$zip->extractTo($destination)) { | |
die("Error: Failed to extract the zip file to $destination"); | |
} | |
$zip->close(); | |
} | |
$zipFileUrl = 'https://github.com/bethropolis/suplike-social-website/releases/download/1.5.1/compressed-suplike-v1.5.1.zip'; // URL of the zip file to download | |
$tempZipFile = 'temp.zip'; // Temporary file to store the downloaded zip | |
try { | |
// Download the zip file | |
downloadFile($zipFileUrl, $tempZipFile); | |
// Extract the contents of the zip file | |
extractZip($tempZipFile, './'); | |
// Delete the temporary zip file | |
unlink($tempZipFile); | |
echo 'Installation completed!'; | |
} catch (Exception $e) { | |
echo 'Installation failed: ' . $e->getMessage(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
check out: https://github.com/bethropolis/suplike-social-website/