Edit File by line
/home/barbar84/www/wp-admin/includes
File: upgrade.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WordPress Upgrade API
[2] Fix | Delete
*
[3] Fix | Delete
* Most of the functions are pluggable and can be overwritten.
[4] Fix | Delete
*
[5] Fix | Delete
* @package WordPress
[6] Fix | Delete
* @subpackage Administration
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
/** Include user installation customization script. */
[10] Fix | Delete
if ( file_exists( WP_CONTENT_DIR . '/install.php' ) ) {
[11] Fix | Delete
require WP_CONTENT_DIR . '/install.php';
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
/** WordPress Administration API */
[15] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/admin.php';
[16] Fix | Delete
[17] Fix | Delete
/** WordPress Schema API */
[18] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/schema.php';
[19] Fix | Delete
[20] Fix | Delete
if ( ! function_exists( 'wp_install' ) ) :
[21] Fix | Delete
/**
[22] Fix | Delete
* Installs the site.
[23] Fix | Delete
*
[24] Fix | Delete
* Runs the required functions to set up and populate the database,
[25] Fix | Delete
* including primary admin user and initial options.
[26] Fix | Delete
*
[27] Fix | Delete
* @since 2.1.0
[28] Fix | Delete
*
[29] Fix | Delete
* @param string $blog_title Site title.
[30] Fix | Delete
* @param string $user_name User's username.
[31] Fix | Delete
* @param string $user_email User's email.
[32] Fix | Delete
* @param bool $public Whether site is public.
[33] Fix | Delete
* @param string $deprecated Optional. Not used.
[34] Fix | Delete
* @param string $user_password Optional. User's chosen password. Default empty (random password).
[35] Fix | Delete
* @param string $language Optional. Language chosen. Default empty.
[36] Fix | Delete
* @return array {
[37] Fix | Delete
* Data for the newly installed site.
[38] Fix | Delete
*
[39] Fix | Delete
* @type string $url The URL of the site.
[40] Fix | Delete
* @type int $user_id The ID of the site owner.
[41] Fix | Delete
* @type string $password The password of the site owner, if their user account didn't already exist.
[42] Fix | Delete
* @type string $password_message The explanatory message regarding the password.
[43] Fix | Delete
* }
[44] Fix | Delete
*/
[45] Fix | Delete
function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '' ) {
[46] Fix | Delete
if ( ! empty( $deprecated ) ) {
[47] Fix | Delete
_deprecated_argument( __FUNCTION__, '2.6.0' );
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
wp_check_mysql_version();
[51] Fix | Delete
wp_cache_flush();
[52] Fix | Delete
make_db_current_silent();
[53] Fix | Delete
populate_options();
[54] Fix | Delete
populate_roles();
[55] Fix | Delete
[56] Fix | Delete
update_option( 'blogname', $blog_title );
[57] Fix | Delete
update_option( 'admin_email', $user_email );
[58] Fix | Delete
update_option( 'blog_public', $public );
[59] Fix | Delete
[60] Fix | Delete
// Freshness of site - in the future, this could get more specific about actions taken, perhaps.
[61] Fix | Delete
update_option( 'fresh_site', 1 );
[62] Fix | Delete
[63] Fix | Delete
if ( $language ) {
[64] Fix | Delete
update_option( 'WPLANG', $language );
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
$guessurl = wp_guess_url();
[68] Fix | Delete
[69] Fix | Delete
update_option( 'siteurl', $guessurl );
[70] Fix | Delete
[71] Fix | Delete
// If not a public site, don't ping.
[72] Fix | Delete
if ( ! $public ) {
[73] Fix | Delete
update_option( 'default_pingback_flag', 0 );
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
/*
[77] Fix | Delete
* Create default user. If the user already exists, the user tables are
[78] Fix | Delete
* being shared among sites. Just set the role in that case.
[79] Fix | Delete
*/
[80] Fix | Delete
$user_id = username_exists( $user_name );
[81] Fix | Delete
$user_password = trim( $user_password );
[82] Fix | Delete
$email_password = false;
[83] Fix | Delete
$user_created = false;
[84] Fix | Delete
[85] Fix | Delete
if ( ! $user_id && empty( $user_password ) ) {
[86] Fix | Delete
$user_password = wp_generate_password( 12, false );
[87] Fix | Delete
$message = __( '<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.' );
[88] Fix | Delete
$user_id = wp_create_user( $user_name, $user_password, $user_email );
[89] Fix | Delete
update_user_option( $user_id, 'default_password_nag', true, true );
[90] Fix | Delete
$email_password = true;
[91] Fix | Delete
$user_created = true;
[92] Fix | Delete
} elseif ( ! $user_id ) {
[93] Fix | Delete
// Password has been provided.
[94] Fix | Delete
$message = '<em>' . __( 'Your chosen password.' ) . '</em>';
[95] Fix | Delete
$user_id = wp_create_user( $user_name, $user_password, $user_email );
[96] Fix | Delete
$user_created = true;
[97] Fix | Delete
} else {
[98] Fix | Delete
$message = __( 'User already exists. Password inherited.' );
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
$user = new WP_User( $user_id );
[102] Fix | Delete
$user->set_role( 'administrator' );
[103] Fix | Delete
[104] Fix | Delete
if ( $user_created ) {
[105] Fix | Delete
$user->user_url = $guessurl;
[106] Fix | Delete
wp_update_user( $user );
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
wp_install_defaults( $user_id );
[110] Fix | Delete
[111] Fix | Delete
wp_install_maybe_enable_pretty_permalinks();
[112] Fix | Delete
[113] Fix | Delete
flush_rewrite_rules();
[114] Fix | Delete
[115] Fix | Delete
wp_new_blog_notification( $blog_title, $guessurl, $user_id, ( $email_password ? $user_password : __( 'The password you chose during installation.' ) ) );
[116] Fix | Delete
[117] Fix | Delete
wp_cache_flush();
[118] Fix | Delete
[119] Fix | Delete
/**
[120] Fix | Delete
* Fires after a site is fully installed.
[121] Fix | Delete
*
[122] Fix | Delete
* @since 3.9.0
[123] Fix | Delete
*
[124] Fix | Delete
* @param WP_User $user The site owner.
[125] Fix | Delete
*/
[126] Fix | Delete
do_action( 'wp_install', $user );
[127] Fix | Delete
[128] Fix | Delete
return array(
[129] Fix | Delete
'url' => $guessurl,
[130] Fix | Delete
'user_id' => $user_id,
[131] Fix | Delete
'password' => $user_password,
[132] Fix | Delete
'password_message' => $message,
[133] Fix | Delete
);
[134] Fix | Delete
}
[135] Fix | Delete
endif;
[136] Fix | Delete
[137] Fix | Delete
if ( ! function_exists( 'wp_install_defaults' ) ) :
[138] Fix | Delete
/**
[139] Fix | Delete
* Creates the initial content for a newly-installed site.
[140] Fix | Delete
*
[141] Fix | Delete
* Adds the default "Uncategorized" category, the first post (with comment),
[142] Fix | Delete
* first page, and default widgets for default theme for the current version.
[143] Fix | Delete
*
[144] Fix | Delete
* @since 2.1.0
[145] Fix | Delete
*
[146] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[147] Fix | Delete
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
[148] Fix | Delete
* @global string $table_prefix
[149] Fix | Delete
*
[150] Fix | Delete
* @param int $user_id User ID.
[151] Fix | Delete
*/
[152] Fix | Delete
function wp_install_defaults( $user_id ) {
[153] Fix | Delete
global $wpdb, $wp_rewrite, $table_prefix;
[154] Fix | Delete
[155] Fix | Delete
// Default category.
[156] Fix | Delete
$cat_name = __( 'Uncategorized' );
[157] Fix | Delete
/* translators: Default category slug. */
[158] Fix | Delete
$cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) );
[159] Fix | Delete
[160] Fix | Delete
if ( global_terms_enabled() ) {
[161] Fix | Delete
$cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
[162] Fix | Delete
if ( null == $cat_id ) {
[163] Fix | Delete
$wpdb->insert(
[164] Fix | Delete
$wpdb->sitecategories,
[165] Fix | Delete
array(
[166] Fix | Delete
'cat_ID' => 0,
[167] Fix | Delete
'cat_name' => $cat_name,
[168] Fix | Delete
'category_nicename' => $cat_slug,
[169] Fix | Delete
'last_updated' => current_time( 'mysql', true ),
[170] Fix | Delete
)
[171] Fix | Delete
);
[172] Fix | Delete
$cat_id = $wpdb->insert_id;
[173] Fix | Delete
}
[174] Fix | Delete
update_option( 'default_category', $cat_id );
[175] Fix | Delete
} else {
[176] Fix | Delete
$cat_id = 1;
[177] Fix | Delete
}
[178] Fix | Delete
[179] Fix | Delete
$wpdb->insert(
[180] Fix | Delete
$wpdb->terms,
[181] Fix | Delete
array(
[182] Fix | Delete
'term_id' => $cat_id,
[183] Fix | Delete
'name' => $cat_name,
[184] Fix | Delete
'slug' => $cat_slug,
[185] Fix | Delete
'term_group' => 0,
[186] Fix | Delete
)
[187] Fix | Delete
);
[188] Fix | Delete
$wpdb->insert(
[189] Fix | Delete
$wpdb->term_taxonomy,
[190] Fix | Delete
array(
[191] Fix | Delete
'term_id' => $cat_id,
[192] Fix | Delete
'taxonomy' => 'category',
[193] Fix | Delete
'description' => '',
[194] Fix | Delete
'parent' => 0,
[195] Fix | Delete
'count' => 1,
[196] Fix | Delete
)
[197] Fix | Delete
);
[198] Fix | Delete
$cat_tt_id = $wpdb->insert_id;
[199] Fix | Delete
[200] Fix | Delete
// First post.
[201] Fix | Delete
$now = current_time( 'mysql' );
[202] Fix | Delete
$now_gmt = current_time( 'mysql', 1 );
[203] Fix | Delete
$first_post_guid = get_option( 'home' ) . '/?p=1';
[204] Fix | Delete
[205] Fix | Delete
if ( is_multisite() ) {
[206] Fix | Delete
$first_post = get_site_option( 'first_post' );
[207] Fix | Delete
[208] Fix | Delete
if ( ! $first_post ) {
[209] Fix | Delete
$first_post = "<!-- wp:paragraph -->\n<p>" .
[210] Fix | Delete
/* translators: First post content. %s: Site link. */
[211] Fix | Delete
__( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ) .
[212] Fix | Delete
"</p>\n<!-- /wp:paragraph -->";
[213] Fix | Delete
}
[214] Fix | Delete
[215] Fix | Delete
$first_post = sprintf(
[216] Fix | Delete
$first_post,
[217] Fix | Delete
sprintf( '<a href="%s">%s</a>', esc_url( network_home_url() ), get_network()->site_name )
[218] Fix | Delete
);
[219] Fix | Delete
[220] Fix | Delete
// Back-compat for pre-4.4.
[221] Fix | Delete
$first_post = str_replace( 'SITE_URL', esc_url( network_home_url() ), $first_post );
[222] Fix | Delete
$first_post = str_replace( 'SITE_NAME', get_network()->site_name, $first_post );
[223] Fix | Delete
} else {
[224] Fix | Delete
$first_post = "<!-- wp:paragraph -->\n<p>" .
[225] Fix | Delete
/* translators: First post content. %s: Site link. */
[226] Fix | Delete
__( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' ) .
[227] Fix | Delete
"</p>\n<!-- /wp:paragraph -->";
[228] Fix | Delete
}
[229] Fix | Delete
[230] Fix | Delete
$wpdb->insert(
[231] Fix | Delete
$wpdb->posts,
[232] Fix | Delete
array(
[233] Fix | Delete
'post_author' => $user_id,
[234] Fix | Delete
'post_date' => $now,
[235] Fix | Delete
'post_date_gmt' => $now_gmt,
[236] Fix | Delete
'post_content' => $first_post,
[237] Fix | Delete
'post_excerpt' => '',
[238] Fix | Delete
'post_title' => __( 'Hello world!' ),
[239] Fix | Delete
/* translators: Default post slug. */
[240] Fix | Delete
'post_name' => sanitize_title( _x( 'hello-world', 'Default post slug' ) ),
[241] Fix | Delete
'post_modified' => $now,
[242] Fix | Delete
'post_modified_gmt' => $now_gmt,
[243] Fix | Delete
'guid' => $first_post_guid,
[244] Fix | Delete
'comment_count' => 1,
[245] Fix | Delete
'to_ping' => '',
[246] Fix | Delete
'pinged' => '',
[247] Fix | Delete
'post_content_filtered' => '',
[248] Fix | Delete
)
[249] Fix | Delete
);
[250] Fix | Delete
$wpdb->insert(
[251] Fix | Delete
$wpdb->term_relationships,
[252] Fix | Delete
array(
[253] Fix | Delete
'term_taxonomy_id' => $cat_tt_id,
[254] Fix | Delete
'object_id' => 1,
[255] Fix | Delete
)
[256] Fix | Delete
);
[257] Fix | Delete
[258] Fix | Delete
// Default comment.
[259] Fix | Delete
if ( is_multisite() ) {
[260] Fix | Delete
$first_comment_author = get_site_option( 'first_comment_author' );
[261] Fix | Delete
$first_comment_email = get_site_option( 'first_comment_email' );
[262] Fix | Delete
$first_comment_url = get_site_option( 'first_comment_url', network_home_url() );
[263] Fix | Delete
$first_comment = get_site_option( 'first_comment' );
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
$first_comment_author = ! empty( $first_comment_author ) ? $first_comment_author : __( 'A WordPress Commenter' );
[267] Fix | Delete
$first_comment_email = ! empty( $first_comment_email ) ? $first_comment_email : 'wapuu@wordpress.example';
[268] Fix | Delete
$first_comment_url = ! empty( $first_comment_url ) ? $first_comment_url : 'https://wordpress.org/';
[269] Fix | Delete
$first_comment = ! empty( $first_comment ) ? $first_comment : __(
[270] Fix | Delete
'Hi, this is a comment.
[271] Fix | Delete
To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
[272] Fix | Delete
Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.'
[273] Fix | Delete
);
[274] Fix | Delete
$wpdb->insert(
[275] Fix | Delete
$wpdb->comments,
[276] Fix | Delete
array(
[277] Fix | Delete
'comment_post_ID' => 1,
[278] Fix | Delete
'comment_author' => $first_comment_author,
[279] Fix | Delete
'comment_author_email' => $first_comment_email,
[280] Fix | Delete
'comment_author_url' => $first_comment_url,
[281] Fix | Delete
'comment_date' => $now,
[282] Fix | Delete
'comment_date_gmt' => $now_gmt,
[283] Fix | Delete
'comment_content' => $first_comment,
[284] Fix | Delete
'comment_type' => 'comment',
[285] Fix | Delete
)
[286] Fix | Delete
);
[287] Fix | Delete
[288] Fix | Delete
// First page.
[289] Fix | Delete
if ( is_multisite() ) {
[290] Fix | Delete
$first_page = get_site_option( 'first_page' );
[291] Fix | Delete
}
[292] Fix | Delete
[293] Fix | Delete
if ( empty( $first_page ) ) {
[294] Fix | Delete
$first_page = "<!-- wp:paragraph -->\n<p>";
[295] Fix | Delete
/* translators: First page content. */
[296] Fix | Delete
$first_page .= __( "This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:" );
[297] Fix | Delete
$first_page .= "</p>\n<!-- /wp:paragraph -->\n\n";
[298] Fix | Delete
[299] Fix | Delete
$first_page .= "<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><p>";
[300] Fix | Delete
/* translators: First page content. */
[301] Fix | Delete
$first_page .= __( "Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like pi&#241;a coladas. (And gettin' caught in the rain.)" );
[302] Fix | Delete
$first_page .= "</p></blockquote>\n<!-- /wp:quote -->\n\n";
[303] Fix | Delete
[304] Fix | Delete
$first_page .= "<!-- wp:paragraph -->\n<p>";
[305] Fix | Delete
/* translators: First page content. */
[306] Fix | Delete
$first_page .= __( '...or something like this:' );
[307] Fix | Delete
$first_page .= "</p>\n<!-- /wp:paragraph -->\n\n";
[308] Fix | Delete
[309] Fix | Delete
$first_page .= "<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><p>";
[310] Fix | Delete
/* translators: First page content. */
[311] Fix | Delete
$first_page .= __( 'The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.' );
[312] Fix | Delete
$first_page .= "</p></blockquote>\n<!-- /wp:quote -->\n\n";
[313] Fix | Delete
[314] Fix | Delete
$first_page .= "<!-- wp:paragraph -->\n<p>";
[315] Fix | Delete
$first_page .= sprintf(
[316] Fix | Delete
/* translators: First page content. %s: Site admin URL. */
[317] Fix | Delete
__( 'As a new WordPress user, you should go to <a href="%s">your dashboard</a> to delete this page and create new pages for your content. Have fun!' ),
[318] Fix | Delete
admin_url()
[319] Fix | Delete
);
[320] Fix | Delete
$first_page .= "</p>\n<!-- /wp:paragraph -->";
[321] Fix | Delete
}
[322] Fix | Delete
[323] Fix | Delete
$first_post_guid = get_option( 'home' ) . '/?page_id=2';
[324] Fix | Delete
$wpdb->insert(
[325] Fix | Delete
$wpdb->posts,
[326] Fix | Delete
array(
[327] Fix | Delete
'post_author' => $user_id,
[328] Fix | Delete
'post_date' => $now,
[329] Fix | Delete
'post_date_gmt' => $now_gmt,
[330] Fix | Delete
'post_content' => $first_page,
[331] Fix | Delete
'post_excerpt' => '',
[332] Fix | Delete
'comment_status' => 'closed',
[333] Fix | Delete
'post_title' => __( 'Sample Page' ),
[334] Fix | Delete
/* translators: Default page slug. */
[335] Fix | Delete
'post_name' => __( 'sample-page' ),
[336] Fix | Delete
'post_modified' => $now,
[337] Fix | Delete
'post_modified_gmt' => $now_gmt,
[338] Fix | Delete
'guid' => $first_post_guid,
[339] Fix | Delete
'post_type' => 'page',
[340] Fix | Delete
'to_ping' => '',
[341] Fix | Delete
'pinged' => '',
[342] Fix | Delete
'post_content_filtered' => '',
[343] Fix | Delete
)
[344] Fix | Delete
);
[345] Fix | Delete
$wpdb->insert(
[346] Fix | Delete
$wpdb->postmeta,
[347] Fix | Delete
array(
[348] Fix | Delete
'post_id' => 2,
[349] Fix | Delete
'meta_key' => '_wp_page_template',
[350] Fix | Delete
'meta_value' => 'default',
[351] Fix | Delete
)
[352] Fix | Delete
);
[353] Fix | Delete
[354] Fix | Delete
// Privacy Policy page.
[355] Fix | Delete
if ( is_multisite() ) {
[356] Fix | Delete
// Disable by default unless the suggested content is provided.
[357] Fix | Delete
$privacy_policy_content = get_site_option( 'default_privacy_policy_content' );
[358] Fix | Delete
} else {
[359] Fix | Delete
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
[360] Fix | Delete
include_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php';
[361] Fix | Delete
}
[362] Fix | Delete
[363] Fix | Delete
$privacy_policy_content = WP_Privacy_Policy_Content::get_default_content();
[364] Fix | Delete
}
[365] Fix | Delete
[366] Fix | Delete
if ( ! empty( $privacy_policy_content ) ) {
[367] Fix | Delete
$privacy_policy_guid = get_option( 'home' ) . '/?page_id=3';
[368] Fix | Delete
[369] Fix | Delete
$wpdb->insert(
[370] Fix | Delete
$wpdb->posts,
[371] Fix | Delete
array(
[372] Fix | Delete
'post_author' => $user_id,
[373] Fix | Delete
'post_date' => $now,
[374] Fix | Delete
'post_date_gmt' => $now_gmt,
[375] Fix | Delete
'post_content' => $privacy_policy_content,
[376] Fix | Delete
'post_excerpt' => '',
[377] Fix | Delete
'comment_status' => 'closed',
[378] Fix | Delete
'post_title' => __( 'Privacy Policy' ),
[379] Fix | Delete
/* translators: Privacy Policy page slug. */
[380] Fix | Delete
'post_name' => __( 'privacy-policy' ),
[381] Fix | Delete
'post_modified' => $now,
[382] Fix | Delete
'post_modified_gmt' => $now_gmt,
[383] Fix | Delete
'guid' => $privacy_policy_guid,
[384] Fix | Delete
'post_type' => 'page',
[385] Fix | Delete
'post_status' => 'draft',
[386] Fix | Delete
'to_ping' => '',
[387] Fix | Delete
'pinged' => '',
[388] Fix | Delete
'post_content_filtered' => '',
[389] Fix | Delete
)
[390] Fix | Delete
);
[391] Fix | Delete
$wpdb->insert(
[392] Fix | Delete
$wpdb->postmeta,
[393] Fix | Delete
array(
[394] Fix | Delete
'post_id' => 3,
[395] Fix | Delete
'meta_key' => '_wp_page_template',
[396] Fix | Delete
'meta_value' => 'default',
[397] Fix | Delete
)
[398] Fix | Delete
);
[399] Fix | Delete
update_option( 'wp_page_for_privacy_policy', 3 );
[400] Fix | Delete
}
[401] Fix | Delete
[402] Fix | Delete
// Set up default widgets for default theme.
[403] Fix | Delete
update_option(
[404] Fix | Delete
'widget_search',
[405] Fix | Delete
array(
[406] Fix | Delete
2 => array( 'title' => '' ),
[407] Fix | Delete
'_multiwidget' => 1,
[408] Fix | Delete
)
[409] Fix | Delete
);
[410] Fix | Delete
update_option(
[411] Fix | Delete
'widget_recent-posts',
[412] Fix | Delete
array(
[413] Fix | Delete
2 => array(
[414] Fix | Delete
'title' => '',
[415] Fix | Delete
'number' => 5,
[416] Fix | Delete
),
[417] Fix | Delete
'_multiwidget' => 1,
[418] Fix | Delete
)
[419] Fix | Delete
);
[420] Fix | Delete
update_option(
[421] Fix | Delete
'widget_recent-comments',
[422] Fix | Delete
array(
[423] Fix | Delete
2 => array(
[424] Fix | Delete
'title' => '',
[425] Fix | Delete
'number' => 5,
[426] Fix | Delete
),
[427] Fix | Delete
'_multiwidget' => 1,
[428] Fix | Delete
)
[429] Fix | Delete
);
[430] Fix | Delete
update_option(
[431] Fix | Delete
'widget_archives',
[432] Fix | Delete
array(
[433] Fix | Delete
2 => array(
[434] Fix | Delete
'title' => '',
[435] Fix | Delete
'count' => 0,
[436] Fix | Delete
'dropdown' => 0,
[437] Fix | Delete
),
[438] Fix | Delete
'_multiwidget' => 1,
[439] Fix | Delete
)
[440] Fix | Delete
);
[441] Fix | Delete
update_option(
[442] Fix | Delete
'widget_categories',
[443] Fix | Delete
array(
[444] Fix | Delete
2 => array(
[445] Fix | Delete
'title' => '',
[446] Fix | Delete
'count' => 0,
[447] Fix | Delete
'hierarchical' => 0,
[448] Fix | Delete
'dropdown' => 0,
[449] Fix | Delete
),
[450] Fix | Delete
'_multiwidget' => 1,
[451] Fix | Delete
)
[452] Fix | Delete
);
[453] Fix | Delete
update_option(
[454] Fix | Delete
'widget_meta',
[455] Fix | Delete
array(
[456] Fix | Delete
2 => array( 'title' => '' ),
[457] Fix | Delete
'_multiwidget' => 1,
[458] Fix | Delete
)
[459] Fix | Delete
);
[460] Fix | Delete
update_option(
[461] Fix | Delete
'sidebars_widgets',
[462] Fix | Delete
array(
[463] Fix | Delete
'wp_inactive_widgets' => array(),
[464] Fix | Delete
'sidebar-1' => array(
[465] Fix | Delete
0 => 'search-2',
[466] Fix | Delete
1 => 'recent-posts-2',
[467] Fix | Delete
2 => 'recent-comments-2',
[468] Fix | Delete
),
[469] Fix | Delete
'sidebar-2' => array(
[470] Fix | Delete
0 => 'archives-2',
[471] Fix | Delete
1 => 'categories-2',
[472] Fix | Delete
2 => 'meta-2',
[473] Fix | Delete
),
[474] Fix | Delete
'array_version' => 3,
[475] Fix | Delete
)
[476] Fix | Delete
);
[477] Fix | Delete
if ( ! is_multisite() ) {
[478] Fix | Delete
update_user_meta( $user_id, 'show_welcome_panel', 1 );
[479] Fix | Delete
} elseif ( ! is_super_admin( $user_id ) && ! metadata_exists( 'user', $user_id, 'show_welcome_panel' ) ) {
[480] Fix | Delete
update_user_meta( $user_id, 'show_welcome_panel', 2 );
[481] Fix | Delete
}
[482] Fix | Delete
[483] Fix | Delete
if ( is_multisite() ) {
[484] Fix | Delete
// Flush rules to pick up the new page.
[485] Fix | Delete
$wp_rewrite->init();
[486] Fix | Delete
$wp_rewrite->flush_rules();
[487] Fix | Delete
[488] Fix | Delete
$user = new WP_User( $user_id );
[489] Fix | Delete
$wpdb->update( $wpdb->options, array( 'option_value' => $user->user_email ), array( 'option_name' => 'admin_email' ) );
[490] Fix | Delete
[491] Fix | Delete
// Remove all perms except for the login user.
[492] Fix | Delete
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'user_level' ) );
[493] Fix | Delete
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'capabilities' ) );
[494] Fix | Delete
[495] Fix | Delete
// Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.)
[496] Fix | Delete
// TODO: Get previous_blog_id.
[497] Fix | Delete
if ( ! is_super_admin( $user_id ) && 1 != $user_id ) {
[498] Fix | Delete
$wpdb->delete(
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function