Created
March 15, 2013 15:54
-
-
Save ninnypants/5170883 to your computer and use it in GitHub Desktop.
Download latest WordPress unzip and add keys
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 | |
$fp = fopen('wordpress.zip', 'w'); | |
$ch = curl_init('http://wordpress.org/latest.zip'); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($ch, CURLOPT_FILE, $fp); | |
curl_exec($ch); | |
curl_close($ch); | |
exec('unzip wordpress.zip'); | |
exec('cp -R wordpress/* .'); | |
exec('rm wordpress.zip'); | |
exec('rm -rf wordpress'); | |
$ch = curl_init('https://api.wordpress.org/secret-key/1.1/salt/'); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
$keys = explode("\n", trim($result)); | |
$keys_replace = array( | |
"define('AUTH_KEY', 'put your unique phrase here');", | |
"define('SECURE_AUTH_KEY', 'put your unique phrase here');", | |
"define('LOGGED_IN_KEY', 'put your unique phrase here');", | |
"define('NONCE_KEY', 'put your unique phrase here');", | |
"define('AUTH_SALT', 'put your unique phrase here');", | |
"define('SECURE_AUTH_SALT', 'put your unique phrase here');", | |
"define('LOGGED_IN_SALT', 'put your unique phrase here');", | |
"define('NONCE_SALT', 'put your unique phrase here');", | |
); | |
unset($result); | |
$config = file_get_contents('wp-config-sample.php'); | |
$config = str_replace($keys_replace, $keys, $config); | |
file_put_contents('wp-config.php', $config); | |
exec('rm wp-config-sample.php'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment