Skip to content

Instantly share code, notes, and snippets.

@bethropolis
Created July 23, 2023 22:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bethropolis/66d6e99114d7cdead883e545af7364f8 to your computer and use it in GitHub Desktop.
Save bethropolis/66d6e99114d7cdead883e545af7364f8 to your computer and use it in GitHub Desktop.
suplike installer
<?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();
}
?>
@bethropolis
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment