Last active
August 29, 2015 14:14
-
-
Save ruslanas/4b8954dd5924bea2af32 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* Downloads latest WordPress and extracts it to script folder | |
* @author Ruslanas Balčiūnas | |
*/ | |
/* DELETE AFTER USAGE */ | |
$fname = 'latest.tar.gz'; | |
file_put_contents($fname, fopen('http://wordpress.org/latest.tar.gz', 'r')); | |
// remove old version | |
if(file_exists('latest.tar')) { | |
unlink('latest.tar'); | |
} | |
$p = new PharData($fname); | |
try { | |
$p->decompress(); | |
} catch (Exception $e) { | |
die($e->getMessage()); | |
} | |
try { | |
$phar = new PharData('latest.tar'); | |
$phar->extractTo('./', null, true); // extract wordpress directory (overwrite) | |
} catch (Exception $e) { | |
$e->getMessage(); | |
} | |
unlink('latest.tar'); | |
unlink($fname); | |
echo 'Done!'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment