Last active
July 14, 2019 04:52
-
-
Save MahdiY/7fbca65821f04029e744fd53a7f44c97 to your computer and use it in GitHub Desktop.
Easy download and extract last wordpress version
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 | |
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