Edit File by line
/home/barbar84/www/wp-admin/includes
File: upgrade.php
$wpdb->usermeta,
[500] Fix | Delete
array(
[501] Fix | Delete
'user_id' => $user_id,
[502] Fix | Delete
'meta_key' => $wpdb->base_prefix . '1_capabilities',
[503] Fix | Delete
)
[504] Fix | Delete
);
[505] Fix | Delete
}
[506] Fix | Delete
}
[507] Fix | Delete
}
[508] Fix | Delete
endif;
[509] Fix | Delete
[510] Fix | Delete
/**
[511] Fix | Delete
* Maybe enable pretty permalinks on installation.
[512] Fix | Delete
*
[513] Fix | Delete
* If after enabling pretty permalinks don't work, fallback to query-string permalinks.
[514] Fix | Delete
*
[515] Fix | Delete
* @since 4.2.0
[516] Fix | Delete
*
[517] Fix | Delete
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
[518] Fix | Delete
*
[519] Fix | Delete
* @return bool Whether pretty permalinks are enabled. False otherwise.
[520] Fix | Delete
*/
[521] Fix | Delete
function wp_install_maybe_enable_pretty_permalinks() {
[522] Fix | Delete
global $wp_rewrite;
[523] Fix | Delete
[524] Fix | Delete
// Bail if a permalink structure is already enabled.
[525] Fix | Delete
if ( get_option( 'permalink_structure' ) ) {
[526] Fix | Delete
return true;
[527] Fix | Delete
}
[528] Fix | Delete
[529] Fix | Delete
/*
[530] Fix | Delete
* The Permalink structures to attempt.
[531] Fix | Delete
*
[532] Fix | Delete
* The first is designed for mod_rewrite or nginx rewriting.
[533] Fix | Delete
*
[534] Fix | Delete
* The second is PATHINFO-based permalinks for web server configurations
[535] Fix | Delete
* without a true rewrite module enabled.
[536] Fix | Delete
*/
[537] Fix | Delete
$permalink_structures = array(
[538] Fix | Delete
'/%year%/%monthnum%/%day%/%postname%/',
[539] Fix | Delete
'/index.php/%year%/%monthnum%/%day%/%postname%/',
[540] Fix | Delete
);
[541] Fix | Delete
[542] Fix | Delete
foreach ( (array) $permalink_structures as $permalink_structure ) {
[543] Fix | Delete
$wp_rewrite->set_permalink_structure( $permalink_structure );
[544] Fix | Delete
[545] Fix | Delete
/*
[546] Fix | Delete
* Flush rules with the hard option to force refresh of the web-server's
[547] Fix | Delete
* rewrite config file (e.g. .htaccess or web.config).
[548] Fix | Delete
*/
[549] Fix | Delete
$wp_rewrite->flush_rules( true );
[550] Fix | Delete
[551] Fix | Delete
$test_url = '';
[552] Fix | Delete
[553] Fix | Delete
// Test against a real WordPress post.
[554] Fix | Delete
$first_post = get_page_by_path( sanitize_title( _x( 'hello-world', 'Default post slug' ) ), OBJECT, 'post' );
[555] Fix | Delete
if ( $first_post ) {
[556] Fix | Delete
$test_url = get_permalink( $first_post->ID );
[557] Fix | Delete
}
[558] Fix | Delete
[559] Fix | Delete
/*
[560] Fix | Delete
* Send a request to the site, and check whether
[561] Fix | Delete
* the 'x-pingback' header is returned as expected.
[562] Fix | Delete
*
[563] Fix | Delete
* Uses wp_remote_get() instead of wp_remote_head() because web servers
[564] Fix | Delete
* can block head requests.
[565] Fix | Delete
*/
[566] Fix | Delete
$response = wp_remote_get( $test_url, array( 'timeout' => 5 ) );
[567] Fix | Delete
$x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' );
[568] Fix | Delete
$pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header;
[569] Fix | Delete
[570] Fix | Delete
if ( $pretty_permalinks ) {
[571] Fix | Delete
return true;
[572] Fix | Delete
}
[573] Fix | Delete
}
[574] Fix | Delete
[575] Fix | Delete
/*
[576] Fix | Delete
* If it makes it this far, pretty permalinks failed.
[577] Fix | Delete
* Fallback to query-string permalinks.
[578] Fix | Delete
*/
[579] Fix | Delete
$wp_rewrite->set_permalink_structure( '' );
[580] Fix | Delete
$wp_rewrite->flush_rules( true );
[581] Fix | Delete
[582] Fix | Delete
return false;
[583] Fix | Delete
}
[584] Fix | Delete
[585] Fix | Delete
if ( ! function_exists( 'wp_new_blog_notification' ) ) :
[586] Fix | Delete
/**
[587] Fix | Delete
* Notifies the site admin that the installation of WordPress is complete.
[588] Fix | Delete
*
[589] Fix | Delete
* Sends an email to the new administrator that the installation is complete
[590] Fix | Delete
* and provides them with a record of their login credentials.
[591] Fix | Delete
*
[592] Fix | Delete
* @since 2.1.0
[593] Fix | Delete
*
[594] Fix | Delete
* @param string $blog_title Site title.
[595] Fix | Delete
* @param string $blog_url Site URL.
[596] Fix | Delete
* @param int $user_id Administrator's user ID.
[597] Fix | Delete
* @param string $password Administrator's password. Note that a placeholder message is
[598] Fix | Delete
* usually passed instead of the actual password.
[599] Fix | Delete
*/
[600] Fix | Delete
function wp_new_blog_notification( $blog_title, $blog_url, $user_id, $password ) {
[601] Fix | Delete
$user = new WP_User( $user_id );
[602] Fix | Delete
$email = $user->user_email;
[603] Fix | Delete
$name = $user->user_login;
[604] Fix | Delete
$login_url = wp_login_url();
[605] Fix | Delete
[606] Fix | Delete
$message = sprintf(
[607] Fix | Delete
/* translators: New site notification email. 1: New site URL, 2: User login, 3: User password or password reset link, 4: Login URL. */
[608] Fix | Delete
__(
[609] Fix | Delete
'Your new WordPress site has been successfully set up at:
[610] Fix | Delete
[611] Fix | Delete
%1$s
[612] Fix | Delete
[613] Fix | Delete
You can log in to the administrator account with the following information:
[614] Fix | Delete
[615] Fix | Delete
Username: %2$s
[616] Fix | Delete
Password: %3$s
[617] Fix | Delete
Log in here: %4$s
[618] Fix | Delete
[619] Fix | Delete
We hope you enjoy your new site. Thanks!
[620] Fix | Delete
[621] Fix | Delete
--The WordPress Team
[622] Fix | Delete
https://wordpress.org/
[623] Fix | Delete
'
[624] Fix | Delete
),
[625] Fix | Delete
$blog_url,
[626] Fix | Delete
$name,
[627] Fix | Delete
$password,
[628] Fix | Delete
$login_url
[629] Fix | Delete
);
[630] Fix | Delete
[631] Fix | Delete
$installed_email = array(
[632] Fix | Delete
'to' => $email,
[633] Fix | Delete
'subject' => __( 'New WordPress Site' ),
[634] Fix | Delete
'message' => $message,
[635] Fix | Delete
'headers' => '',
[636] Fix | Delete
);
[637] Fix | Delete
[638] Fix | Delete
/**
[639] Fix | Delete
* Filters the contents of the email sent to the site administrator when WordPress is installed.
[640] Fix | Delete
*
[641] Fix | Delete
* @since 5.6.0
[642] Fix | Delete
*
[643] Fix | Delete
* @param array $installed_email {
[644] Fix | Delete
* Used to build wp_mail().
[645] Fix | Delete
*
[646] Fix | Delete
* @type string $to The email address of the recipient.
[647] Fix | Delete
* @type string $subject The subject of the email.
[648] Fix | Delete
* @type string $message The content of the email.
[649] Fix | Delete
* @type string $headers Headers.
[650] Fix | Delete
* }
[651] Fix | Delete
* @param WP_User $user The site administrator user object.
[652] Fix | Delete
* @param string $blog_title The site title.
[653] Fix | Delete
* @param string $blog_url The site URL.
[654] Fix | Delete
* @param string $password The site administrator's password. Note that a placeholder message
[655] Fix | Delete
* is usually passed instead of the user's actual password.
[656] Fix | Delete
*/
[657] Fix | Delete
$installed_email = apply_filters( 'wp_installed_email', $installed_email, $user, $blog_title, $blog_url, $password );
[658] Fix | Delete
[659] Fix | Delete
wp_mail(
[660] Fix | Delete
$installed_email['to'],
[661] Fix | Delete
$installed_email['subject'],
[662] Fix | Delete
$installed_email['message'],
[663] Fix | Delete
$installed_email['headers']
[664] Fix | Delete
);
[665] Fix | Delete
}
[666] Fix | Delete
endif;
[667] Fix | Delete
[668] Fix | Delete
if ( ! function_exists( 'wp_upgrade' ) ) :
[669] Fix | Delete
/**
[670] Fix | Delete
* Runs WordPress Upgrade functions.
[671] Fix | Delete
*
[672] Fix | Delete
* Upgrades the database if needed during a site update.
[673] Fix | Delete
*
[674] Fix | Delete
* @since 2.1.0
[675] Fix | Delete
*
[676] Fix | Delete
* @global int $wp_current_db_version The old (current) database version.
[677] Fix | Delete
* @global int $wp_db_version The new database version.
[678] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[679] Fix | Delete
*/
[680] Fix | Delete
function wp_upgrade() {
[681] Fix | Delete
global $wp_current_db_version, $wp_db_version, $wpdb;
[682] Fix | Delete
[683] Fix | Delete
$wp_current_db_version = __get_option( 'db_version' );
[684] Fix | Delete
[685] Fix | Delete
// We are up to date. Nothing to do.
[686] Fix | Delete
if ( $wp_db_version == $wp_current_db_version ) {
[687] Fix | Delete
return;
[688] Fix | Delete
}
[689] Fix | Delete
[690] Fix | Delete
if ( ! is_blog_installed() ) {
[691] Fix | Delete
return;
[692] Fix | Delete
}
[693] Fix | Delete
[694] Fix | Delete
wp_check_mysql_version();
[695] Fix | Delete
wp_cache_flush();
[696] Fix | Delete
pre_schema_upgrade();
[697] Fix | Delete
make_db_current_silent();
[698] Fix | Delete
upgrade_all();
[699] Fix | Delete
if ( is_multisite() && is_main_site() ) {
[700] Fix | Delete
upgrade_network();
[701] Fix | Delete
}
[702] Fix | Delete
wp_cache_flush();
[703] Fix | Delete
[704] Fix | Delete
if ( is_multisite() ) {
[705] Fix | Delete
update_site_meta( get_current_blog_id(), 'db_version', $wp_db_version );
[706] Fix | Delete
update_site_meta( get_current_blog_id(), 'db_last_updated', microtime() );
[707] Fix | Delete
}
[708] Fix | Delete
[709] Fix | Delete
/**
[710] Fix | Delete
* Fires after a site is fully upgraded.
[711] Fix | Delete
*
[712] Fix | Delete
* @since 3.9.0
[713] Fix | Delete
*
[714] Fix | Delete
* @param int $wp_db_version The new $wp_db_version.
[715] Fix | Delete
* @param int $wp_current_db_version The old (current) $wp_db_version.
[716] Fix | Delete
*/
[717] Fix | Delete
do_action( 'wp_upgrade', $wp_db_version, $wp_current_db_version );
[718] Fix | Delete
}
[719] Fix | Delete
endif;
[720] Fix | Delete
[721] Fix | Delete
/**
[722] Fix | Delete
* Functions to be called in installation and upgrade scripts.
[723] Fix | Delete
*
[724] Fix | Delete
* Contains conditional checks to determine which upgrade scripts to run,
[725] Fix | Delete
* based on database version and WP version being updated-to.
[726] Fix | Delete
*
[727] Fix | Delete
* @ignore
[728] Fix | Delete
* @since 1.0.1
[729] Fix | Delete
*
[730] Fix | Delete
* @global int $wp_current_db_version The old (current) database version.
[731] Fix | Delete
* @global int $wp_db_version The new database version.
[732] Fix | Delete
*/
[733] Fix | Delete
function upgrade_all() {
[734] Fix | Delete
global $wp_current_db_version, $wp_db_version;
[735] Fix | Delete
[736] Fix | Delete
$wp_current_db_version = __get_option( 'db_version' );
[737] Fix | Delete
[738] Fix | Delete
// We are up to date. Nothing to do.
[739] Fix | Delete
if ( $wp_db_version == $wp_current_db_version ) {
[740] Fix | Delete
return;
[741] Fix | Delete
}
[742] Fix | Delete
[743] Fix | Delete
// If the version is not set in the DB, try to guess the version.
[744] Fix | Delete
if ( empty( $wp_current_db_version ) ) {
[745] Fix | Delete
$wp_current_db_version = 0;
[746] Fix | Delete
[747] Fix | Delete
// If the template option exists, we have 1.5.
[748] Fix | Delete
$template = __get_option( 'template' );
[749] Fix | Delete
if ( ! empty( $template ) ) {
[750] Fix | Delete
$wp_current_db_version = 2541;
[751] Fix | Delete
}
[752] Fix | Delete
}
[753] Fix | Delete
[754] Fix | Delete
if ( $wp_current_db_version < 6039 ) {
[755] Fix | Delete
upgrade_230_options_table();
[756] Fix | Delete
}
[757] Fix | Delete
[758] Fix | Delete
populate_options();
[759] Fix | Delete
[760] Fix | Delete
if ( $wp_current_db_version < 2541 ) {
[761] Fix | Delete
upgrade_100();
[762] Fix | Delete
upgrade_101();
[763] Fix | Delete
upgrade_110();
[764] Fix | Delete
upgrade_130();
[765] Fix | Delete
}
[766] Fix | Delete
[767] Fix | Delete
if ( $wp_current_db_version < 3308 ) {
[768] Fix | Delete
upgrade_160();
[769] Fix | Delete
}
[770] Fix | Delete
[771] Fix | Delete
if ( $wp_current_db_version < 4772 ) {
[772] Fix | Delete
upgrade_210();
[773] Fix | Delete
}
[774] Fix | Delete
[775] Fix | Delete
if ( $wp_current_db_version < 4351 ) {
[776] Fix | Delete
upgrade_old_slugs();
[777] Fix | Delete
}
[778] Fix | Delete
[779] Fix | Delete
if ( $wp_current_db_version < 5539 ) {
[780] Fix | Delete
upgrade_230();
[781] Fix | Delete
}
[782] Fix | Delete
[783] Fix | Delete
if ( $wp_current_db_version < 6124 ) {
[784] Fix | Delete
upgrade_230_old_tables();
[785] Fix | Delete
}
[786] Fix | Delete
[787] Fix | Delete
if ( $wp_current_db_version < 7499 ) {
[788] Fix | Delete
upgrade_250();
[789] Fix | Delete
}
[790] Fix | Delete
[791] Fix | Delete
if ( $wp_current_db_version < 7935 ) {
[792] Fix | Delete
upgrade_252();
[793] Fix | Delete
}
[794] Fix | Delete
[795] Fix | Delete
if ( $wp_current_db_version < 8201 ) {
[796] Fix | Delete
upgrade_260();
[797] Fix | Delete
}
[798] Fix | Delete
[799] Fix | Delete
if ( $wp_current_db_version < 8989 ) {
[800] Fix | Delete
upgrade_270();
[801] Fix | Delete
}
[802] Fix | Delete
[803] Fix | Delete
if ( $wp_current_db_version < 10360 ) {
[804] Fix | Delete
upgrade_280();
[805] Fix | Delete
}
[806] Fix | Delete
[807] Fix | Delete
if ( $wp_current_db_version < 11958 ) {
[808] Fix | Delete
upgrade_290();
[809] Fix | Delete
}
[810] Fix | Delete
[811] Fix | Delete
if ( $wp_current_db_version < 15260 ) {
[812] Fix | Delete
upgrade_300();
[813] Fix | Delete
}
[814] Fix | Delete
[815] Fix | Delete
if ( $wp_current_db_version < 19389 ) {
[816] Fix | Delete
upgrade_330();
[817] Fix | Delete
}
[818] Fix | Delete
[819] Fix | Delete
if ( $wp_current_db_version < 20080 ) {
[820] Fix | Delete
upgrade_340();
[821] Fix | Delete
}
[822] Fix | Delete
[823] Fix | Delete
if ( $wp_current_db_version < 22422 ) {
[824] Fix | Delete
upgrade_350();
[825] Fix | Delete
}
[826] Fix | Delete
[827] Fix | Delete
if ( $wp_current_db_version < 25824 ) {
[828] Fix | Delete
upgrade_370();
[829] Fix | Delete
}
[830] Fix | Delete
[831] Fix | Delete
if ( $wp_current_db_version < 26148 ) {
[832] Fix | Delete
upgrade_372();
[833] Fix | Delete
}
[834] Fix | Delete
[835] Fix | Delete
if ( $wp_current_db_version < 26691 ) {
[836] Fix | Delete
upgrade_380();
[837] Fix | Delete
}
[838] Fix | Delete
[839] Fix | Delete
if ( $wp_current_db_version < 29630 ) {
[840] Fix | Delete
upgrade_400();
[841] Fix | Delete
}
[842] Fix | Delete
[843] Fix | Delete
if ( $wp_current_db_version < 33055 ) {
[844] Fix | Delete
upgrade_430();
[845] Fix | Delete
}
[846] Fix | Delete
[847] Fix | Delete
if ( $wp_current_db_version < 33056 ) {
[848] Fix | Delete
upgrade_431();
[849] Fix | Delete
}
[850] Fix | Delete
[851] Fix | Delete
if ( $wp_current_db_version < 35700 ) {
[852] Fix | Delete
upgrade_440();
[853] Fix | Delete
}
[854] Fix | Delete
[855] Fix | Delete
if ( $wp_current_db_version < 36686 ) {
[856] Fix | Delete
upgrade_450();
[857] Fix | Delete
}
[858] Fix | Delete
[859] Fix | Delete
if ( $wp_current_db_version < 37965 ) {
[860] Fix | Delete
upgrade_460();
[861] Fix | Delete
}
[862] Fix | Delete
[863] Fix | Delete
if ( $wp_current_db_version < 44719 ) {
[864] Fix | Delete
upgrade_510();
[865] Fix | Delete
}
[866] Fix | Delete
[867] Fix | Delete
if ( $wp_current_db_version < 45744 ) {
[868] Fix | Delete
upgrade_530();
[869] Fix | Delete
}
[870] Fix | Delete
[871] Fix | Delete
if ( $wp_current_db_version < 48575 ) {
[872] Fix | Delete
upgrade_550();
[873] Fix | Delete
}
[874] Fix | Delete
[875] Fix | Delete
if ( $wp_current_db_version < 49752 ) {
[876] Fix | Delete
upgrade_560();
[877] Fix | Delete
}
[878] Fix | Delete
[879] Fix | Delete
maybe_disable_link_manager();
[880] Fix | Delete
[881] Fix | Delete
maybe_disable_automattic_widgets();
[882] Fix | Delete
[883] Fix | Delete
update_option( 'db_version', $wp_db_version );
[884] Fix | Delete
update_option( 'db_upgraded', true );
[885] Fix | Delete
}
[886] Fix | Delete
[887] Fix | Delete
/**
[888] Fix | Delete
* Execute changes made in WordPress 1.0.
[889] Fix | Delete
*
[890] Fix | Delete
* @ignore
[891] Fix | Delete
* @since 1.0.0
[892] Fix | Delete
*
[893] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[894] Fix | Delete
*/
[895] Fix | Delete
function upgrade_100() {
[896] Fix | Delete
global $wpdb;
[897] Fix | Delete
[898] Fix | Delete
// Get the title and ID of every post, post_name to check if it already has a value.
[899] Fix | Delete
$posts = $wpdb->get_results( "SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''" );
[900] Fix | Delete
if ( $posts ) {
[901] Fix | Delete
foreach ( $posts as $post ) {
[902] Fix | Delete
if ( '' === $post->post_name ) {
[903] Fix | Delete
$newtitle = sanitize_title( $post->post_title );
[904] Fix | Delete
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID ) );
[905] Fix | Delete
}
[906] Fix | Delete
}
[907] Fix | Delete
}
[908] Fix | Delete
[909] Fix | Delete
$categories = $wpdb->get_results( "SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories" );
[910] Fix | Delete
foreach ( $categories as $category ) {
[911] Fix | Delete
if ( '' === $category->category_nicename ) {
[912] Fix | Delete
$newtitle = sanitize_title( $category->cat_name );
[913] Fix | Delete
$wpdb->update( $wpdb->categories, array( 'category_nicename' => $newtitle ), array( 'cat_ID' => $category->cat_ID ) );
[914] Fix | Delete
}
[915] Fix | Delete
}
[916] Fix | Delete
[917] Fix | Delete
$sql = "UPDATE $wpdb->options
[918] Fix | Delete
SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/')
[919] Fix | Delete
WHERE option_name LIKE %s
[920] Fix | Delete
AND option_value LIKE %s";
[921] Fix | Delete
$wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( 'links_rating_image' ) . '%', $wpdb->esc_like( 'wp-links/links-images/' ) . '%' ) );
[922] Fix | Delete
[923] Fix | Delete
$done_ids = $wpdb->get_results( "SELECT DISTINCT post_id FROM $wpdb->post2cat" );
[924] Fix | Delete
if ( $done_ids ) :
[925] Fix | Delete
$done_posts = array();
[926] Fix | Delete
foreach ( $done_ids as $done_id ) :
[927] Fix | Delete
$done_posts[] = $done_id->post_id;
[928] Fix | Delete
endforeach;
[929] Fix | Delete
$catwhere = ' AND ID NOT IN (' . implode( ',', $done_posts ) . ')';
[930] Fix | Delete
else :
[931] Fix | Delete
$catwhere = '';
[932] Fix | Delete
endif;
[933] Fix | Delete
[934] Fix | Delete
$allposts = $wpdb->get_results( "SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere" );
[935] Fix | Delete
if ( $allposts ) :
[936] Fix | Delete
foreach ( $allposts as $post ) {
[937] Fix | Delete
// Check to see if it's already been imported.
[938] Fix | Delete
$cat = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category ) );
[939] Fix | Delete
if ( ! $cat && 0 != $post->post_category ) { // If there's no result.
[940] Fix | Delete
$wpdb->insert(
[941] Fix | Delete
$wpdb->post2cat,
[942] Fix | Delete
array(
[943] Fix | Delete
'post_id' => $post->ID,
[944] Fix | Delete
'category_id' => $post->post_category,
[945] Fix | Delete
)
[946] Fix | Delete
);
[947] Fix | Delete
}
[948] Fix | Delete
}
[949] Fix | Delete
endif;
[950] Fix | Delete
}
[951] Fix | Delete
[952] Fix | Delete
/**
[953] Fix | Delete
* Execute changes made in WordPress 1.0.1.
[954] Fix | Delete
*
[955] Fix | Delete
* @ignore
[956] Fix | Delete
* @since 1.0.1
[957] Fix | Delete
*
[958] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[959] Fix | Delete
*/
[960] Fix | Delete
function upgrade_101() {
[961] Fix | Delete
global $wpdb;
[962] Fix | Delete
[963] Fix | Delete
// Clean up indices, add a few.
[964] Fix | Delete
add_clean_index( $wpdb->posts, 'post_name' );
[965] Fix | Delete
add_clean_index( $wpdb->posts, 'post_status' );
[966] Fix | Delete
add_clean_index( $wpdb->categories, 'category_nicename' );
[967] Fix | Delete
add_clean_index( $wpdb->comments, 'comment_approved' );
[968] Fix | Delete
add_clean_index( $wpdb->comments, 'comment_post_ID' );
[969] Fix | Delete
add_clean_index( $wpdb->links, 'link_category' );
[970] Fix | Delete
add_clean_index( $wpdb->links, 'link_visible' );
[971] Fix | Delete
}
[972] Fix | Delete
[973] Fix | Delete
/**
[974] Fix | Delete
* Execute changes made in WordPress 1.2.
[975] Fix | Delete
*
[976] Fix | Delete
* @ignore
[977] Fix | Delete
* @since 1.2.0
[978] Fix | Delete
*
[979] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[980] Fix | Delete
*/
[981] Fix | Delete
function upgrade_110() {
[982] Fix | Delete
global $wpdb;
[983] Fix | Delete
[984] Fix | Delete
// Set user_nicename.
[985] Fix | Delete
$users = $wpdb->get_results( "SELECT ID, user_nickname, user_nicename FROM $wpdb->users" );
[986] Fix | Delete
foreach ( $users as $user ) {
[987] Fix | Delete
if ( '' === $user->user_nicename ) {
[988] Fix | Delete
$newname = sanitize_title( $user->user_nickname );
[989] Fix | Delete
$wpdb->update( $wpdb->users, array( 'user_nicename' => $newname ), array( 'ID' => $user->ID ) );
[990] Fix | Delete
}
[991] Fix | Delete
}
[992] Fix | Delete
[993] Fix | Delete
$users = $wpdb->get_results( "SELECT ID, user_pass from $wpdb->users" );
[994] Fix | Delete
foreach ( $users as $row ) {
[995] Fix | Delete
if ( ! preg_match( '/^[A-Fa-f0-9]{32}$/', $row->user_pass ) ) {
[996] Fix | Delete
$wpdb->update( $wpdb->users, array( 'user_pass' => md5( $row->user_pass ) ), array( 'ID' => $row->ID ) );
[997] Fix | Delete
}
[998] Fix | Delete
}
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function