--- a/wp/wp-admin/includes/schema.php Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/includes/schema.php Tue Dec 15 13:49:49 2020 +0100
@@ -11,7 +11,7 @@
/**
* Declare these as global in case schema.php is included from a function.
*
- * @global wpdb $wpdb
+ * @global wpdb $wpdb WordPress database abstraction object.
* @global array $wp_queries
* @global string $charset_collate
*/
@@ -29,8 +29,8 @@
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param string $scope Optional. The tables for which to retrieve SQL. Can be all, global, ms_global, or blog tables. Defaults to all.
- * @param int $blog_id Optional. The site ID for which to retrieve SQL. Default is the current site ID.
+ * @param string $scope Optional. The tables for which to retrieve SQL. Can be all, global, ms_global, or blog tables. Defaults to all.
+ * @param int $blog_id Optional. The site ID for which to retrieve SQL. Default is the current site ID.
* @return string The SQL needed to create the requested tables.
*/
function wp_get_db_schema( $scope = 'all', $blog_id = null ) {
@@ -52,7 +52,7 @@
*/
$max_index_length = 191;
- // Blog specific tables.
+ // Blog-specific tables.
$blog_tables = "CREATE TABLE $wpdb->termmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
term_id bigint(20) unsigned NOT NULL default '0',
@@ -111,7 +111,7 @@
comment_karma int(11) NOT NULL default '0',
comment_approved varchar(20) NOT NULL default '1',
comment_agent varchar(255) NOT NULL default '',
- comment_type varchar(20) NOT NULL default '',
+ comment_type varchar(20) NOT NULL default 'comment',
comment_parent bigint(20) unsigned NOT NULL default '0',
user_id bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (comment_ID),
@@ -144,7 +144,8 @@
option_value longtext NOT NULL,
autoload varchar(20) NOT NULL default 'yes',
PRIMARY KEY (option_id),
- UNIQUE KEY option_name (option_name)
+ UNIQUE KEY option_name (option_name),
+ KEY autoload (autoload)
) $charset_collate;
CREATE TABLE $wpdb->postmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
@@ -204,7 +205,7 @@
KEY user_email (user_email)
) $charset_collate;\n";
- // Multisite users table
+ // Multisite users table.
$users_multi_table = "CREATE TABLE $wpdb->users (
ID bigint(20) unsigned NOT NULL auto_increment,
user_login varchar(60) NOT NULL default '',
@@ -235,7 +236,7 @@
KEY meta_key (meta_key($max_index_length))
) $charset_collate;\n";
- // Global tables
+ // Global tables.
if ( $is_multisite ) {
$global_tables = $users_multi_table . $usermeta_table;
} else {
@@ -260,13 +261,6 @@
KEY domain (domain(50),path(5)),
KEY lang_id (lang_id)
) $charset_collate;
-CREATE TABLE $wpdb->blog_versions (
- blog_id bigint(20) NOT NULL default '0',
- db_version varchar(20) NOT NULL default '',
- last_updated datetime NOT NULL default '0000-00-00 00:00:00',
- PRIMARY KEY (blog_id),
- KEY db_version (db_version)
-) $charset_collate;
CREATE TABLE $wpdb->blogmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
blog_id bigint(20) NOT NULL default '0',
@@ -358,9 +352,9 @@
* @since 1.5.0
* @since 5.1.0 The $options parameter has been added.
*
- * @global wpdb $wpdb WordPress database abstraction object.
- * @global int $wp_db_version
- * @global int $wp_current_db_version
+ * @global wpdb $wpdb WordPress database abstraction object.
+ * @global int $wp_db_version WordPress database version.
+ * @global int $wp_current_db_version The old (current) database version.
*
* @param array $options Optional. Custom option $key => $value pairs to use. Default empty array.
*/
@@ -375,13 +369,6 @@
*/
do_action( 'populate_options' );
- if ( ini_get( 'safe_mode' ) ) {
- // Safe mode can break mkdir() so use a flat structure by default.
- $uploads_use_yearmonth_folders = 0;
- } else {
- $uploads_use_yearmonth_folders = 1;
- }
-
// If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme.
$stylesheet = WP_DEFAULT_THEME;
$template = WP_DEFAULT_THEME;
@@ -400,13 +387,13 @@
$gmt_offset = 0;
/*
* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14)
- * or a valid timezone string (America/New_York). See https://secure.php.net/manual/en/timezones.php
+ * or a valid timezone string (America/New_York). See https://www.php.net/manual/en/timezones.php
* for all timezone strings supported by PHP.
*/
$offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings
if ( is_numeric( $offset_or_tz ) ) {
$gmt_offset = $offset_or_tz;
- } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) {
+ } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) {
$timezone_string = $offset_or_tz;
}
@@ -414,11 +401,11 @@
'siteurl' => $guessurl,
'home' => $guessurl,
'blogname' => __( 'My Site' ),
- /* translators: site tagline */
+ /* translators: Site tagline. */
'blogdescription' => __( 'Just another WordPress site' ),
'users_can_register' => 0,
'admin_email' => 'you@example.com',
- /* translators: default start of the week. 0 = Sunday, 1 = Monday */
+ /* translators: Default start of the week. 0 = Sunday, 1 = Monday. */
'start_of_week' => _x( '1', 'start of week' ),
'use_balanceTags' => 0,
'use_smilies' => 1,
@@ -435,11 +422,11 @@
'default_ping_status' => 'open',
'default_pingback_flag' => 1,
'posts_per_page' => 10,
- /* translators: default date format, see https://secure.php.net/date */
+ /* translators: Default date format, see https://www.php.net/date */
'date_format' => __( 'F j, Y' ),
- /* translators: default time format, see https://secure.php.net/date */
+ /* translators: Default time format, see https://www.php.net/date */
'time_format' => __( 'g:i a' ),
- /* translators: links last updated date format, see https://secure.php.net/date */
+ /* translators: Links last updated date format, see https://www.php.net/date */
'links_updated_date_format' => __( 'F j, Y g:i a' ),
'comment_moderation' => 0,
'moderation_notify' => 1,
@@ -454,36 +441,34 @@
'comment_max_links' => 2,
'gmt_offset' => $gmt_offset,
- // 1.5
+ // 1.5.0
'default_email_category' => 1,
'recently_edited' => '',
'template' => $template,
'stylesheet' => $stylesheet,
- 'comment_whitelist' => 1,
- 'blacklist_keys' => '',
'comment_registration' => 0,
'html_type' => 'text/html',
// 1.5.1
'use_trackback' => 0,
- // 2.0
+ // 2.0.0
'default_role' => 'subscriber',
'db_version' => $wp_db_version,
// 2.0.1
- 'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders,
+ 'uploads_use_yearmonth_folders' => 1,
'upload_path' => '',
- // 2.1
+ // 2.1.0
'blog_public' => '1',
'default_link_category' => 2,
'show_on_front' => 'posts',
- // 2.2
+ // 2.2.0
'tag_base' => '',
- // 2.5
+ // 2.5.0
'show_avatars' => '1',
'avatar_rating' => 'G',
'upload_url_path' => '',
@@ -493,10 +478,10 @@
'medium_size_w' => 300,
'medium_size_h' => 300,
- // 2.6
+ // 2.6.0
'avatar_default' => 'mystery',
- // 2.7
+ // 2.7.0
'large_size_w' => 1024,
'large_size_h' => 1024,
'image_default_link_type' => 'none',
@@ -516,17 +501,17 @@
'widget_rss' => array(),
'uninstall_plugins' => array(),
- // 2.8
+ // 2.8.0
'timezone_string' => $timezone_string,
- // 3.0
+ // 3.0.0
'page_for_posts' => 0,
'page_on_front' => 0,
- // 3.1
+ // 3.1.0
'default_post_format' => 0,
- // 3.5
+ // 3.5.0
'link_manager_enabled' => 0,
// 4.3.0
@@ -542,35 +527,51 @@
// 4.9.8
'show_comments_cookies_opt_in' => 1,
+
+ // 5.3.0
+ 'admin_email_lifespan' => ( time() + 6 * MONTH_IN_SECONDS ),
+
+ // 5.5.0
+ 'disallowed_keys' => '',
+ 'comment_previously_approved' => 1,
+ 'auto_plugin_theme_update_emails' => array(),
);
- // 3.3
+ // 3.3.0
if ( ! is_multisite() ) {
$defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version
? $wp_current_db_version : $wp_db_version;
}
- // 3.0 multisite
+ // 3.0.0 multisite.
if ( is_multisite() ) {
- /* translators: site tagline */
+ /* translators: %s: Network title. */
$defaults['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name );
$defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/';
}
$options = wp_parse_args( $options, $defaults );
- // Set autoload to no for these options
- $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins' );
+ // Set autoload to no for these options.
+ $fat_options = array(
+ 'moderation_keys',
+ 'recently_edited',
+ 'disallowed_keys',
+ 'uninstall_plugins',
+ 'auto_plugin_theme_update_emails',
+ );
$keys = "'" . implode( "', '", array_keys( $options ) ) . "'";
$existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$insert = '';
+
foreach ( $options as $option => $value ) {
- if ( in_array( $option, $existing_options ) ) {
+ if ( in_array( $option, $existing_options, true ) ) {
continue;
}
- if ( in_array( $option, $fat_options ) ) {
+
+ if ( in_array( $option, $fat_options, true ) ) {
$autoload = 'no';
} else {
$autoload = 'yes';
@@ -579,9 +580,11 @@
if ( is_array( $value ) ) {
$value = serialize( $value );
}
+
if ( ! empty( $insert ) ) {
$insert .= ', ';
}
+
$insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload );
}
@@ -680,7 +683,7 @@
// Delete obsolete magpie stuff.
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" );
- // Clear expired transients
+ // Clear expired transients.
delete_expired_transients( true );
}
@@ -706,15 +709,14 @@
* @since 2.0.0
*/
function populate_roles_160() {
- // Add roles
-
+ // Add roles.
add_role( 'administrator', 'Administrator' );
add_role( 'editor', 'Editor' );
add_role( 'author', 'Author' );
add_role( 'contributor', 'Contributor' );
add_role( 'subscriber', 'Subscriber' );
- // Add caps for Administrator role
+ // Add caps for Administrator role.
$role = get_role( 'administrator' );
$role->add_cap( 'switch_themes' );
$role->add_cap( 'edit_themes' );
@@ -747,7 +749,7 @@
$role->add_cap( 'level_1' );
$role->add_cap( 'level_0' );
- // Add caps for Editor role
+ // Add caps for Editor role.
$role = get_role( 'editor' );
$role->add_cap( 'moderate_comments' );
$role->add_cap( 'manage_categories' );
@@ -769,7 +771,7 @@
$role->add_cap( 'level_1' );
$role->add_cap( 'level_0' );
- // Add caps for Author role
+ // Add caps for Author role.
$role = get_role( 'author' );
$role->add_cap( 'upload_files' );
$role->add_cap( 'edit_posts' );
@@ -780,14 +782,14 @@
$role->add_cap( 'level_1' );
$role->add_cap( 'level_0' );
- // Add caps for Contributor role
+ // Add caps for Contributor role.
$role = get_role( 'contributor' );
$role->add_cap( 'edit_posts' );
$role->add_cap( 'read' );
$role->add_cap( 'level_1' );
$role->add_cap( 'level_0' );
- // Add caps for Subscriber role
+ // Add caps for Subscriber role.
$role = get_role( 'subscriber' );
$role->add_cap( 'read' );
$role->add_cap( 'level_0' );
@@ -947,9 +949,9 @@
*
* @since 3.0.0
*
- * @global wpdb $wpdb
+ * @global wpdb $wpdb WordPress database abstraction object.
* @global object $current_site
- * @global WP_Rewrite $wp_rewrite
+ * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param int $network_id ID of network to populate.
* @param string $domain The domain name for the network (eg. "example.com").
@@ -965,10 +967,10 @@
global $wpdb, $current_site, $wp_rewrite;
$errors = new WP_Error();
- if ( '' == $domain ) {
+ if ( '' === $domain ) {
$errors->add( 'empty_domain', __( 'You must provide a domain name.' ) );
}
- if ( '' == $site_name ) {
+ if ( '' === $site_name ) {
$errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) );
}
@@ -1081,18 +1083,18 @@
$msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>';
$msg .= '<p>' . sprintf(
- /* translators: %s: host name */
+ /* translators: %s: Host name. */
__( 'The installer attempted to contact a random hostname (%s) on your domain.' ),
'<code>' . $hostname . '</code>'
);
if ( ! empty( $errstr ) ) {
- /* translators: %s: error message */
+ /* translators: %s: Error message. */
$msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' );
}
$msg .= '</p>';
$msg .= '<p>' . sprintf(
- /* translators: %s: asterisk symbol (*) */
+ /* translators: %s: Asterisk symbol (*). */
__( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.' ),
'<code>*</code>'
) . '</p>';
@@ -1147,7 +1149,7 @@
$allowed_themes[ WP_DEFAULT_THEME ] = true;
}
- // If WP_DEFAULT_THEME doesn't exist, also whitelist the latest core default theme.
+ // If WP_DEFAULT_THEME doesn't exist, also include the latest core default theme.
if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) {
$core_default = WP_Theme::get_core_default_theme();
if ( $core_default ) {
@@ -1155,6 +1157,12 @@
}
}
+ if ( function_exists( 'clean_network_cache' ) ) {
+ clean_network_cache( $network_id );
+ } else {
+ wp_cache_delete( $network_id, 'networks' );
+ }
+
wp_cache_delete( 'networks_have_paths', 'site-options' );
if ( ! is_multisite() ) {
@@ -1239,9 +1247,9 @@
'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
'wpmu_upgrade_site' => $wp_db_version,
'welcome_email' => $welcome_email,
- /* translators: %s: site link */
+ /* translators: %s: Site link. */
'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ),
- // @todo - network admins should have a method of editing the network siteurl (used for cookie hash)
+ // @todo - Network admins should have a method of editing the network siteurl (used for cookie hash).
'siteurl' => get_option( 'siteurl' ) . '/',
'add_new_users' => '0',
'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1',