Skip to content

Instantly share code, notes, and snippets.

@MahdiY
Last active July 14, 2019 04:52
Show Gist options
  • Save MahdiY/7fbca65821f04029e744fd53a7f44c97 to your computer and use it in GitHub Desktop.
Save MahdiY/7fbca65821f04029e744fd53a7f44c97 to your computer and use it in GitHub Desktop.
Easy download and extract last wordpress version
<?php
if( ! extension_loaded('zip') ) {
die('missing zip extension!');
}
set_time_limit(0);
$file = 'wp.zip';
file_put_contents($file, fopen("https://wordpress.org/latest.zip", 'r'));
$path = pathinfo(realpath($file), PATHINFO_DIRNAME);
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
$zip->extractTo($path);
$zip->close();
echo "OK! wordpress downloaded!";
} else {
echo "Doh! I couldn't download or extract wordpress!";
}
unlink('wpdl.php');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment