mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Add length arg to wp_generate_password() and lengthen secret. Props tellyworth. fixes #6146 for 2.5
git-svn-id: https://develop.svn.wordpress.org/branches/2.5@7798 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c66e9b57dc
commit
c5f5190646
@ -230,7 +230,7 @@ function populate_options() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2.0.3
|
// 2.0.3
|
||||||
add_option('secret', wp_generate_password());
|
add_option('secret', wp_generate_password(64));
|
||||||
|
|
||||||
// 2.1
|
// 2.1
|
||||||
add_option('blog_public', '1');
|
add_option('blog_public', '1');
|
||||||
|
@ -202,6 +202,9 @@ function upgrade_all() {
|
|||||||
if ( $wp_current_db_version < 7499 )
|
if ( $wp_current_db_version < 7499 )
|
||||||
upgrade_250();
|
upgrade_250();
|
||||||
|
|
||||||
|
if ( $wp_current_db_version < 7796 )
|
||||||
|
upgrade_251();
|
||||||
|
|
||||||
maybe_disable_automattic_widgets();
|
maybe_disable_automattic_widgets();
|
||||||
|
|
||||||
$wp_rewrite->flush_rules();
|
$wp_rewrite->flush_rules();
|
||||||
@ -729,6 +732,13 @@ function upgrade_250() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function upgrade_251() {
|
||||||
|
global $wp_current_db_version;
|
||||||
|
|
||||||
|
// Make the secret longer
|
||||||
|
update_option('secret', wp_generate_password(64));
|
||||||
|
}
|
||||||
|
|
||||||
// The functions we use to actually do stuff
|
// The functions we use to actually do stuff
|
||||||
|
|
||||||
// General
|
// General
|
||||||
|
@ -1167,12 +1167,11 @@ if ( !function_exists('wp_generate_password') ) :
|
|||||||
*
|
*
|
||||||
* @return string The random password
|
* @return string The random password
|
||||||
**/
|
**/
|
||||||
function wp_generate_password() {
|
function wp_generate_password($length = 12) {
|
||||||
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()";
|
||||||
$length = 7;
|
|
||||||
$password = '';
|
$password = '';
|
||||||
for ( $i = 0; $i < $length; $i++ )
|
for ( $i = 0; $i < $length; $i++ )
|
||||||
$password .= substr($chars, mt_rand(0, 61), 1);
|
$password .= substr($chars, mt_rand(0, strlen($chars)), 1);
|
||||||
return $password;
|
return $password;
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
@ -16,6 +16,6 @@ $wp_version = '2.5.1-alpha';
|
|||||||
*
|
*
|
||||||
* @global int $wp_db_version
|
* @global int $wp_db_version
|
||||||
*/
|
*/
|
||||||
$wp_db_version = 7583;
|
$wp_db_version = 7796;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user