wp/wp-admin/includes/schema.php
author ymh <ymh.work@gmail.com>
Wed, 21 Sep 2022 18:19:35 +0200
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
permissions -rw-r--r--
Site enmi version 09/2022
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * WordPress Administration Scheme API
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * Here we keep the DB structure and option values.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 * @subpackage Administration
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    11
/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    12
 * Declare these as global in case schema.php is included from a function.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    13
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    14
 * @global wpdb   $wpdb            WordPress database abstraction object.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    15
 * @global array  $wp_queries
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    16
 * @global string $charset_collate
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    17
 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
global $wpdb, $wp_queries, $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
 * The database character collate.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
$charset_collate = $wpdb->get_charset_collate();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
 * Retrieve the SQL for creating database tables.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
 * @since 3.3.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    30
 * @global wpdb $wpdb WordPress database abstraction object.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    31
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    32
 * @param string $scope   Optional. The tables for which to retrieve SQL. Can be all, global, ms_global, or blog tables. Defaults to all.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    33
 * @param int    $blog_id Optional. The site ID for which to retrieve SQL. Default is the current site ID.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
 * @return string The SQL needed to create the requested tables.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
function wp_get_db_schema( $scope = 'all', $blog_id = null ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
	global $wpdb;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    39
	$charset_collate = $wpdb->get_charset_collate();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    41
	if ( $blog_id && $blog_id != $wpdb->blogid ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
		$old_blog_id = $wpdb->set_blog_id( $blog_id );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    43
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
	// Engage multisite if in the middle of turning it on from network.php.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
	$is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    48
	/*
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    49
	 * Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    50
	 * As of 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    51
	 * used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    52
	 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    53
	$max_index_length = 191;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    54
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    55
	// Blog-specific tables.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    56
	$blog_tables = "CREATE TABLE $wpdb->termmeta (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    57
	meta_id bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    58
	term_id bigint(20) unsigned NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    59
	meta_key varchar(255) default NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    60
	meta_value longtext,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    61
	PRIMARY KEY  (meta_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    62
	KEY term_id (term_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    63
	KEY meta_key (meta_key($max_index_length))
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    64
) $charset_collate;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    65
CREATE TABLE $wpdb->terms (
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
 term_id bigint(20) unsigned NOT NULL auto_increment,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
 name varchar(200) NOT NULL default '',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
 slug varchar(200) NOT NULL default '',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
 term_group bigint(10) NOT NULL default 0,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
 PRIMARY KEY  (term_id),
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    71
 KEY slug (slug($max_index_length)),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    72
 KEY name (name($max_index_length))
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
CREATE TABLE $wpdb->term_taxonomy (
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
 term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
 term_id bigint(20) unsigned NOT NULL default 0,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
 taxonomy varchar(32) NOT NULL default '',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
 description longtext NOT NULL,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
 parent bigint(20) unsigned NOT NULL default 0,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
 count bigint(20) NOT NULL default 0,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
 PRIMARY KEY  (term_taxonomy_id),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
 UNIQUE KEY term_id_taxonomy (term_id,taxonomy),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
 KEY taxonomy (taxonomy)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
CREATE TABLE $wpdb->term_relationships (
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
 object_id bigint(20) unsigned NOT NULL default 0,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
 term_taxonomy_id bigint(20) unsigned NOT NULL default 0,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
 term_order int(11) NOT NULL default 0,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
 PRIMARY KEY  (object_id,term_taxonomy_id),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
 KEY term_taxonomy_id (term_taxonomy_id)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
CREATE TABLE $wpdb->commentmeta (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    93
	meta_id bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    94
	comment_id bigint(20) unsigned NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    95
	meta_key varchar(255) default NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    96
	meta_value longtext,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    97
	PRIMARY KEY  (meta_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    98
	KEY comment_id (comment_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    99
	KEY meta_key (meta_key($max_index_length))
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
CREATE TABLE $wpdb->comments (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   102
	comment_ID bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   103
	comment_post_ID bigint(20) unsigned NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   104
	comment_author tinytext NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   105
	comment_author_email varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   106
	comment_author_url varchar(200) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   107
	comment_author_IP varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   108
	comment_date datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   109
	comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   110
	comment_content text NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   111
	comment_karma int(11) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   112
	comment_approved varchar(20) NOT NULL default '1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   113
	comment_agent varchar(255) NOT NULL default '',
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   114
	comment_type varchar(20) NOT NULL default 'comment',
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   115
	comment_parent bigint(20) unsigned NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   116
	user_id bigint(20) unsigned NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   117
	PRIMARY KEY  (comment_ID),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   118
	KEY comment_post_ID (comment_post_ID),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   119
	KEY comment_approved_date_gmt (comment_approved,comment_date_gmt),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   120
	KEY comment_date_gmt (comment_date_gmt),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   121
	KEY comment_parent (comment_parent),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   122
	KEY comment_author_email (comment_author_email(10))
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
CREATE TABLE $wpdb->links (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   125
	link_id bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   126
	link_url varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   127
	link_name varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   128
	link_image varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   129
	link_target varchar(25) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   130
	link_description varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   131
	link_visible varchar(20) NOT NULL default 'Y',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   132
	link_owner bigint(20) unsigned NOT NULL default '1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   133
	link_rating int(11) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   134
	link_updated datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   135
	link_rel varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   136
	link_notes mediumtext NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   137
	link_rss varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   138
	PRIMARY KEY  (link_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   139
	KEY link_visible (link_visible)
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
CREATE TABLE $wpdb->options (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   142
	option_id bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   143
	option_name varchar(191) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   144
	option_value longtext NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   145
	autoload varchar(20) NOT NULL default 'yes',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   146
	PRIMARY KEY  (option_id),
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   147
	UNIQUE KEY option_name (option_name),
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   148
	KEY autoload (autoload)
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
CREATE TABLE $wpdb->postmeta (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   151
	meta_id bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   152
	post_id bigint(20) unsigned NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   153
	meta_key varchar(255) default NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   154
	meta_value longtext,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   155
	PRIMARY KEY  (meta_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   156
	KEY post_id (post_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   157
	KEY meta_key (meta_key($max_index_length))
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
CREATE TABLE $wpdb->posts (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   160
	ID bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   161
	post_author bigint(20) unsigned NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   162
	post_date datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   163
	post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   164
	post_content longtext NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   165
	post_title text NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   166
	post_excerpt text NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   167
	post_status varchar(20) NOT NULL default 'publish',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   168
	comment_status varchar(20) NOT NULL default 'open',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   169
	ping_status varchar(20) NOT NULL default 'open',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   170
	post_password varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   171
	post_name varchar(200) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   172
	to_ping text NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   173
	pinged text NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   174
	post_modified datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   175
	post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   176
	post_content_filtered longtext NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   177
	post_parent bigint(20) unsigned NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   178
	guid varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   179
	menu_order int(11) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   180
	post_type varchar(20) NOT NULL default 'post',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   181
	post_mime_type varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   182
	comment_count bigint(20) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   183
	PRIMARY KEY  (ID),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   184
	KEY post_name (post_name($max_index_length)),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   185
	KEY type_status_date (post_type,post_status,post_date,ID),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   186
	KEY post_parent (post_parent),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   187
	KEY post_author (post_author)
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
) $charset_collate;\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
	// Single site users table. The multisite flavor of the users table is handled below.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
	$users_single_table = "CREATE TABLE $wpdb->users (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   192
	ID bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   193
	user_login varchar(60) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   194
	user_pass varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   195
	user_nicename varchar(50) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   196
	user_email varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   197
	user_url varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   198
	user_registered datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   199
	user_activation_key varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   200
	user_status int(11) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   201
	display_name varchar(250) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   202
	PRIMARY KEY  (ID),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   203
	KEY user_login_key (user_login),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   204
	KEY user_nicename (user_nicename),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   205
	KEY user_email (user_email)
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
) $charset_collate;\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   208
	// Multisite users table.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
	$users_multi_table = "CREATE TABLE $wpdb->users (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   210
	ID bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   211
	user_login varchar(60) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   212
	user_pass varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   213
	user_nicename varchar(50) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   214
	user_email varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   215
	user_url varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   216
	user_registered datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   217
	user_activation_key varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   218
	user_status int(11) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   219
	display_name varchar(250) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   220
	spam tinyint(2) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   221
	deleted tinyint(2) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   222
	PRIMARY KEY  (ID),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   223
	KEY user_login_key (user_login),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   224
	KEY user_nicename (user_nicename),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   225
	KEY user_email (user_email)
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
) $charset_collate;\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   228
	// Usermeta.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
	$usermeta_table = "CREATE TABLE $wpdb->usermeta (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   230
	umeta_id bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   231
	user_id bigint(20) unsigned NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   232
	meta_key varchar(255) default NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   233
	meta_value longtext,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   234
	PRIMARY KEY  (umeta_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   235
	KEY user_id (user_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   236
	KEY meta_key (meta_key($max_index_length))
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
) $charset_collate;\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   239
	// Global tables.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   240
	if ( $is_multisite ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   241
		$global_tables = $users_multi_table . $usermeta_table;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   242
	} else {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
		$global_tables = $users_single_table . $usermeta_table;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   244
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
	// Multisite global tables.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
	$ms_global_tables = "CREATE TABLE $wpdb->blogs (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   248
	blog_id bigint(20) NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   249
	site_id bigint(20) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   250
	domain varchar(200) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   251
	path varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   252
	registered datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   253
	last_updated datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   254
	public tinyint(2) NOT NULL default '1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   255
	archived tinyint(2) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   256
	mature tinyint(2) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   257
	spam tinyint(2) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   258
	deleted tinyint(2) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   259
	lang_id int(11) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   260
	PRIMARY KEY  (blog_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   261
	KEY domain (domain(50),path(5)),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   262
	KEY lang_id (lang_id)
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
) $charset_collate;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   264
CREATE TABLE $wpdb->blogmeta (
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   265
	meta_id bigint(20) unsigned NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   266
	blog_id bigint(20) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   267
	meta_key varchar(255) default NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   268
	meta_value longtext,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   269
	PRIMARY KEY  (meta_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   270
	KEY meta_key (meta_key($max_index_length)),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   271
	KEY blog_id (blog_id)
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   272
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
CREATE TABLE $wpdb->registration_log (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   274
	ID bigint(20) NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   275
	email varchar(255) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   276
	IP varchar(30) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   277
	blog_id bigint(20) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   278
	date_registered datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   279
	PRIMARY KEY  (ID),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   280
	KEY IP (IP)
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   281
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
CREATE TABLE $wpdb->site (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   283
	id bigint(20) NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   284
	domain varchar(200) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   285
	path varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   286
	PRIMARY KEY  (id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   287
	KEY domain (domain(140),path(51))
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   288
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   289
CREATE TABLE $wpdb->sitemeta (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   290
	meta_id bigint(20) NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   291
	site_id bigint(20) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   292
	meta_key varchar(255) default NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   293
	meta_value longtext,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   294
	PRIMARY KEY  (meta_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   295
	KEY meta_key (meta_key($max_index_length)),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   296
	KEY site_id (site_id)
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
) $charset_collate;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   298
CREATE TABLE $wpdb->signups (
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   299
	signup_id bigint(20) NOT NULL auto_increment,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   300
	domain varchar(200) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   301
	path varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   302
	title longtext NOT NULL,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   303
	user_login varchar(60) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   304
	user_email varchar(100) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   305
	registered datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   306
	activated datetime NOT NULL default '0000-00-00 00:00:00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   307
	active tinyint(1) NOT NULL default '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   308
	activation_key varchar(50) NOT NULL default '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   309
	meta longtext,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   310
	PRIMARY KEY  (signup_id),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   311
	KEY activation_key (activation_key),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   312
	KEY user_email (user_email),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   313
	KEY user_login_email (user_login,user_email),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   314
	KEY domain_path (domain(140),path(51))
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   315
) $charset_collate;";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   316
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   317
	switch ( $scope ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   318
		case 'blog':
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   319
			$queries = $blog_tables;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   320
			break;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   321
		case 'global':
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   322
			$queries = $global_tables;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   323
			if ( $is_multisite ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   324
				$queries .= $ms_global_tables;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   325
			}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   326
			break;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   327
		case 'ms_global':
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   328
			$queries = $ms_global_tables;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   329
			break;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   330
		case 'all':
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   331
		default:
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   332
			$queries = $global_tables . $blog_tables;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   333
			if ( $is_multisite ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   334
				$queries .= $ms_global_tables;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   335
			}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   336
			break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   337
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   338
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   339
	if ( isset( $old_blog_id ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   340
		$wpdb->set_blog_id( $old_blog_id );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   341
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   342
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
	return $queries;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   344
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   345
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   346
// Populate for back compat.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   347
$wp_queries = wp_get_db_schema( 'all' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   348
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   349
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   350
 * Create WordPress options and set the default values.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   351
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   352
 * @since 1.5.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   353
 * @since 5.1.0 The $options parameter has been added.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   354
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   355
 * @global wpdb $wpdb                  WordPress database abstraction object.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   356
 * @global int  $wp_db_version         WordPress database version.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   357
 * @global int  $wp_current_db_version The old (current) database version.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   358
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   359
 * @param array $options Optional. Custom option $key => $value pairs to use. Default empty array.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   360
 */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   361
function populate_options( array $options = array() ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   362
	global $wpdb, $wp_db_version, $wp_current_db_version;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   363
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   364
	$guessurl = wp_guess_url();
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   365
	/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   366
	 * Fires before creating WordPress options and populating their default values.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   367
	 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   368
	 * @since 2.6.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   369
	 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   370
	do_action( 'populate_options' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   371
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   372
	// If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   373
	$stylesheet = WP_DEFAULT_THEME;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   374
	$template   = WP_DEFAULT_THEME;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   375
	$theme      = wp_get_theme( WP_DEFAULT_THEME );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   376
	if ( ! $theme->exists() ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   377
		$theme = WP_Theme::get_core_default_theme();
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   378
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   379
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   380
	// If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   381
	if ( $theme ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   382
		$stylesheet = $theme->get_stylesheet();
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   383
		$template   = $theme->get_template();
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   384
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   385
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   386
	$timezone_string = '';
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   387
	$gmt_offset      = 0;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   388
	/*
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   389
	 * translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14)
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   390
	 * or a valid timezone string (America/New_York). See https://www.php.net/manual/en/timezones.php
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   391
	 * for all timezone strings supported by PHP.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   392
	 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   393
	$offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   394
	if ( is_numeric( $offset_or_tz ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   395
		$gmt_offset = $offset_or_tz;
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   396
	} elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   397
			$timezone_string = $offset_or_tz;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   398
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   399
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   400
	$defaults = array(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   401
		'siteurl'                         => $guessurl,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   402
		'home'                            => $guessurl,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   403
		'blogname'                        => __( 'My Site' ),
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   404
		/* translators: Site tagline. */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   405
		'blogdescription'                 => __( 'Just another WordPress site' ),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   406
		'users_can_register'              => 0,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   407
		'admin_email'                     => 'you@example.com',
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   408
		/* translators: Default start of the week. 0 = Sunday, 1 = Monday. */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   409
		'start_of_week'                   => _x( '1', 'start of week' ),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   410
		'use_balanceTags'                 => 0,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   411
		'use_smilies'                     => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   412
		'require_name_email'              => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   413
		'comments_notify'                 => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   414
		'posts_per_rss'                   => 10,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   415
		'rss_use_excerpt'                 => 0,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   416
		'mailserver_url'                  => 'mail.example.com',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   417
		'mailserver_login'                => 'login@example.com',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   418
		'mailserver_pass'                 => 'password',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   419
		'mailserver_port'                 => 110,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   420
		'default_category'                => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   421
		'default_comment_status'          => 'open',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   422
		'default_ping_status'             => 'open',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   423
		'default_pingback_flag'           => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   424
		'posts_per_page'                  => 10,
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   425
		/* translators: Default date format, see https://www.php.net/manual/datetime.format.php */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   426
		'date_format'                     => __( 'F j, Y' ),
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   427
		/* translators: Default time format, see https://www.php.net/manual/datetime.format.php */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   428
		'time_format'                     => __( 'g:i a' ),
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   429
		/* translators: Links last updated date format, see https://www.php.net/manual/datetime.format.php */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   430
		'links_updated_date_format'       => __( 'F j, Y g:i a' ),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   431
		'comment_moderation'              => 0,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   432
		'moderation_notify'               => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   433
		'permalink_structure'             => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   434
		'rewrite_rules'                   => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   435
		'hack_file'                       => 0,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   436
		'blog_charset'                    => 'UTF-8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   437
		'moderation_keys'                 => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   438
		'active_plugins'                  => array(),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   439
		'category_base'                   => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   440
		'ping_sites'                      => 'http://rpc.pingomatic.com/',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   441
		'comment_max_links'               => 2,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   442
		'gmt_offset'                      => $gmt_offset,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   443
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   444
		// 1.5.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   445
		'default_email_category'          => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   446
		'recently_edited'                 => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   447
		'template'                        => $template,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   448
		'stylesheet'                      => $stylesheet,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   449
		'comment_registration'            => 0,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   450
		'html_type'                       => 'text/html',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   451
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   452
		// 1.5.1
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   453
		'use_trackback'                   => 0,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   454
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   455
		// 2.0.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   456
		'default_role'                    => 'subscriber',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   457
		'db_version'                      => $wp_db_version,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   458
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   459
		// 2.0.1
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   460
		'uploads_use_yearmonth_folders'   => 1,
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   461
		'upload_path'                     => '',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   462
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   463
		// 2.1.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   464
		'blog_public'                     => '1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   465
		'default_link_category'           => 2,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   466
		'show_on_front'                   => 'posts',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   467
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   468
		// 2.2.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   469
		'tag_base'                        => '',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   470
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   471
		// 2.5.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   472
		'show_avatars'                    => '1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   473
		'avatar_rating'                   => 'G',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   474
		'upload_url_path'                 => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   475
		'thumbnail_size_w'                => 150,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   476
		'thumbnail_size_h'                => 150,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   477
		'thumbnail_crop'                  => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   478
		'medium_size_w'                   => 300,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   479
		'medium_size_h'                   => 300,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   480
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   481
		// 2.6.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   482
		'avatar_default'                  => 'mystery',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   483
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   484
		// 2.7.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   485
		'large_size_w'                    => 1024,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   486
		'large_size_h'                    => 1024,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   487
		'image_default_link_type'         => 'none',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   488
		'image_default_size'              => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   489
		'image_default_align'             => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   490
		'close_comments_for_old_posts'    => 0,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   491
		'close_comments_days_old'         => 14,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   492
		'thread_comments'                 => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   493
		'thread_comments_depth'           => 5,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   494
		'page_comments'                   => 0,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   495
		'comments_per_page'               => 50,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   496
		'default_comments_page'           => 'newest',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   497
		'comment_order'                   => 'asc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   498
		'sticky_posts'                    => array(),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   499
		'widget_categories'               => array(),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   500
		'widget_text'                     => array(),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   501
		'widget_rss'                      => array(),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   502
		'uninstall_plugins'               => array(),
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   503
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   504
		// 2.8.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   505
		'timezone_string'                 => $timezone_string,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   506
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   507
		// 3.0.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   508
		'page_for_posts'                  => 0,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   509
		'page_on_front'                   => 0,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   510
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   511
		// 3.1.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   512
		'default_post_format'             => 0,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   513
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   514
		// 3.5.0
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   515
		'link_manager_enabled'            => 0,
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   516
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   517
		// 4.3.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   518
		'finished_splitting_shared_terms' => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   519
		'site_icon'                       => 0,
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   520
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   521
		// 4.4.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   522
		'medium_large_size_w'             => 768,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   523
		'medium_large_size_h'             => 0,
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   524
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   525
		// 4.9.6
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   526
		'wp_page_for_privacy_policy'      => 0,
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   527
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   528
		// 4.9.8
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   529
		'show_comments_cookies_opt_in'    => 1,
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   530
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   531
		// 5.3.0
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   532
		'admin_email_lifespan'            => ( time() + 6 * MONTH_IN_SECONDS ),
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   533
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   534
		// 5.5.0
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   535
		'disallowed_keys'                 => '',
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   536
		'comment_previously_approved'     => 1,
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   537
		'auto_plugin_theme_update_emails' => array(),
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   538
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   539
		// 5.6.0
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   540
		'auto_update_core_dev'            => 'enabled',
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   541
		'auto_update_core_minor'          => 'enabled',
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   542
		// Default to enabled for new installs.
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   543
		// See https://core.trac.wordpress.org/ticket/51742.
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   544
		'auto_update_core_major'          => 'enabled',
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   545
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   546
		// 5.8.0
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   547
		'wp_force_deactivated_plugins'    => array(),
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   548
	);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   549
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   550
	// 3.3.0
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   551
	if ( ! is_multisite() ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   552
		$defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   553
			? $wp_current_db_version : $wp_db_version;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   554
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   555
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   556
	// 3.0.0 multisite.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   557
	if ( is_multisite() ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   558
		/* translators: %s: Network title. */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   559
		$defaults['blogdescription']     = sprintf( __( 'Just another %s site' ), get_network()->site_name );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   560
		$defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   561
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   562
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   563
	$options = wp_parse_args( $options, $defaults );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   564
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   565
	// Set autoload to no for these options.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   566
	$fat_options = array(
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   567
		'moderation_keys',
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   568
		'recently_edited',
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   569
		'disallowed_keys',
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   570
		'uninstall_plugins',
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   571
		'auto_plugin_theme_update_emails',
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   572
	);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   573
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   574
	$keys             = "'" . implode( "', '", array_keys( $options ) ) . "'";
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   575
	$existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   576
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   577
	$insert = '';
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   578
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   579
	foreach ( $options as $option => $value ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   580
		if ( in_array( $option, $existing_options, true ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   581
			continue;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   582
		}
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   583
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   584
		if ( in_array( $option, $fat_options, true ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   585
			$autoload = 'no';
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   586
		} else {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   587
			$autoload = 'yes';
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   588
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   589
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   590
		if ( is_array( $value ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   591
			$value = serialize( $value );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   592
		}
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   593
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   594
		if ( ! empty( $insert ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   595
			$insert .= ', ';
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   596
		}
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   597
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   598
		$insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   599
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   600
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   601
	if ( ! empty( $insert ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   602
		$wpdb->query( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   603
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   604
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   605
	// In case it is set, but blank, update "home".
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   606
	if ( ! __get_option( 'home' ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   607
		update_option( 'home', $guessurl );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   608
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   609
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   610
	// Delete unused options.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   611
	$unusedoptions = array(
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   612
		'blodotgsping_url',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   613
		'bodyterminator',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   614
		'emailtestonly',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   615
		'phoneemail_separator',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   616
		'smilies_directory',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   617
		'subjectprefix',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   618
		'use_bbcode',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   619
		'use_blodotgsping',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   620
		'use_phoneemail',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   621
		'use_quicktags',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   622
		'use_weblogsping',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   623
		'weblogs_cache_file',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   624
		'use_preview',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   625
		'use_htmltrans',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   626
		'smilies_directory',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   627
		'fileupload_allowedusers',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   628
		'use_phoneemail',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   629
		'default_post_status',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   630
		'default_post_category',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   631
		'archive_mode',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   632
		'time_difference',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   633
		'links_minadminlevel',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   634
		'links_use_adminlevels',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   635
		'links_rating_type',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   636
		'links_rating_char',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   637
		'links_rating_ignore_zero',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   638
		'links_rating_single_image',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   639
		'links_rating_image0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   640
		'links_rating_image1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   641
		'links_rating_image2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   642
		'links_rating_image3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   643
		'links_rating_image4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   644
		'links_rating_image5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   645
		'links_rating_image6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   646
		'links_rating_image7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   647
		'links_rating_image8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   648
		'links_rating_image9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   649
		'links_recently_updated_time',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   650
		'links_recently_updated_prepend',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   651
		'links_recently_updated_append',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   652
		'weblogs_cacheminutes',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   653
		'comment_allowed_tags',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   654
		'search_engine_friendly_urls',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   655
		'default_geourl_lat',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   656
		'default_geourl_lon',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   657
		'use_default_geourl',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   658
		'weblogs_xml_url',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   659
		'new_users_can_blog',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   660
		'_wpnonce',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   661
		'_wp_http_referer',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   662
		'Update',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   663
		'action',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   664
		'rich_editing',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   665
		'autosave_interval',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   666
		'deactivated_plugins',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   667
		'can_compress_scripts',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   668
		'page_uris',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   669
		'update_core',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   670
		'update_plugins',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   671
		'update_themes',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   672
		'doing_cron',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   673
		'random_seed',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   674
		'rss_excerpt_length',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   675
		'secret',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   676
		'use_linksupdate',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   677
		'default_comment_status_page',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   678
		'wporg_popular_tags',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   679
		'what_to_show',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   680
		'rss_language',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   681
		'language',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   682
		'enable_xmlrpc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   683
		'enable_app',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   684
		'embed_autourls',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   685
		'default_post_edit_rows',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   686
		'gzipcompression',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   687
		'advanced_edit',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   688
	);
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   689
	foreach ( $unusedoptions as $option ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   690
		delete_option( $option );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   691
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   692
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   693
	// Delete obsolete magpie stuff.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   694
	$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   695
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   696
	// Clear expired transients.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   697
	delete_expired_transients( true );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   698
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   699
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   700
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   701
 * Execute WordPress role creation for the various WordPress versions.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   702
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   703
 * @since 2.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   704
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   705
function populate_roles() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   706
	populate_roles_160();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   707
	populate_roles_210();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   708
	populate_roles_230();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   709
	populate_roles_250();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   710
	populate_roles_260();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   711
	populate_roles_270();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   712
	populate_roles_280();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   713
	populate_roles_300();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   714
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   715
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   716
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   717
 * Create the roles for WordPress 2.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   718
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   719
 * @since 2.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   720
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   721
function populate_roles_160() {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   722
	// Add roles.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   723
	add_role( 'administrator', 'Administrator' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   724
	add_role( 'editor', 'Editor' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   725
	add_role( 'author', 'Author' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   726
	add_role( 'contributor', 'Contributor' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   727
	add_role( 'subscriber', 'Subscriber' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   728
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   729
	// Add caps for Administrator role.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   730
	$role = get_role( 'administrator' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   731
	$role->add_cap( 'switch_themes' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   732
	$role->add_cap( 'edit_themes' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   733
	$role->add_cap( 'activate_plugins' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   734
	$role->add_cap( 'edit_plugins' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   735
	$role->add_cap( 'edit_users' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   736
	$role->add_cap( 'edit_files' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   737
	$role->add_cap( 'manage_options' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   738
	$role->add_cap( 'moderate_comments' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   739
	$role->add_cap( 'manage_categories' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   740
	$role->add_cap( 'manage_links' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   741
	$role->add_cap( 'upload_files' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   742
	$role->add_cap( 'import' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   743
	$role->add_cap( 'unfiltered_html' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   744
	$role->add_cap( 'edit_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   745
	$role->add_cap( 'edit_others_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   746
	$role->add_cap( 'edit_published_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   747
	$role->add_cap( 'publish_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   748
	$role->add_cap( 'edit_pages' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   749
	$role->add_cap( 'read' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   750
	$role->add_cap( 'level_10' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   751
	$role->add_cap( 'level_9' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   752
	$role->add_cap( 'level_8' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   753
	$role->add_cap( 'level_7' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   754
	$role->add_cap( 'level_6' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   755
	$role->add_cap( 'level_5' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   756
	$role->add_cap( 'level_4' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   757
	$role->add_cap( 'level_3' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   758
	$role->add_cap( 'level_2' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   759
	$role->add_cap( 'level_1' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   760
	$role->add_cap( 'level_0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   761
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   762
	// Add caps for Editor role.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   763
	$role = get_role( 'editor' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   764
	$role->add_cap( 'moderate_comments' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   765
	$role->add_cap( 'manage_categories' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   766
	$role->add_cap( 'manage_links' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   767
	$role->add_cap( 'upload_files' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   768
	$role->add_cap( 'unfiltered_html' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   769
	$role->add_cap( 'edit_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   770
	$role->add_cap( 'edit_others_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   771
	$role->add_cap( 'edit_published_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   772
	$role->add_cap( 'publish_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   773
	$role->add_cap( 'edit_pages' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   774
	$role->add_cap( 'read' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   775
	$role->add_cap( 'level_7' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   776
	$role->add_cap( 'level_6' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   777
	$role->add_cap( 'level_5' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   778
	$role->add_cap( 'level_4' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   779
	$role->add_cap( 'level_3' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   780
	$role->add_cap( 'level_2' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   781
	$role->add_cap( 'level_1' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   782
	$role->add_cap( 'level_0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   783
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   784
	// Add caps for Author role.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   785
	$role = get_role( 'author' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   786
	$role->add_cap( 'upload_files' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   787
	$role->add_cap( 'edit_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   788
	$role->add_cap( 'edit_published_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   789
	$role->add_cap( 'publish_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   790
	$role->add_cap( 'read' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   791
	$role->add_cap( 'level_2' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   792
	$role->add_cap( 'level_1' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   793
	$role->add_cap( 'level_0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   794
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   795
	// Add caps for Contributor role.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   796
	$role = get_role( 'contributor' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   797
	$role->add_cap( 'edit_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   798
	$role->add_cap( 'read' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   799
	$role->add_cap( 'level_1' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   800
	$role->add_cap( 'level_0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   801
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   802
	// Add caps for Subscriber role.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   803
	$role = get_role( 'subscriber' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   804
	$role->add_cap( 'read' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   805
	$role->add_cap( 'level_0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   806
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   807
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   808
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   809
 * Create and modify WordPress roles for WordPress 2.1.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   810
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   811
 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   812
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   813
function populate_roles_210() {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   814
	$roles = array( 'administrator', 'editor' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   815
	foreach ( $roles as $role ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   816
		$role = get_role( $role );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   817
		if ( empty( $role ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   818
			continue;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   819
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   820
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   821
		$role->add_cap( 'edit_others_pages' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   822
		$role->add_cap( 'edit_published_pages' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   823
		$role->add_cap( 'publish_pages' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   824
		$role->add_cap( 'delete_pages' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   825
		$role->add_cap( 'delete_others_pages' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   826
		$role->add_cap( 'delete_published_pages' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   827
		$role->add_cap( 'delete_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   828
		$role->add_cap( 'delete_others_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   829
		$role->add_cap( 'delete_published_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   830
		$role->add_cap( 'delete_private_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   831
		$role->add_cap( 'edit_private_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   832
		$role->add_cap( 'read_private_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   833
		$role->add_cap( 'delete_private_pages' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   834
		$role->add_cap( 'edit_private_pages' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   835
		$role->add_cap( 'read_private_pages' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   836
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   837
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   838
	$role = get_role( 'administrator' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   839
	if ( ! empty( $role ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   840
		$role->add_cap( 'delete_users' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   841
		$role->add_cap( 'create_users' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   842
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   843
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   844
	$role = get_role( 'author' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   845
	if ( ! empty( $role ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   846
		$role->add_cap( 'delete_posts' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   847
		$role->add_cap( 'delete_published_posts' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   848
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   849
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   850
	$role = get_role( 'contributor' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   851
	if ( ! empty( $role ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   852
		$role->add_cap( 'delete_posts' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   853
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   854
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   855
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   856
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   857
 * Create and modify WordPress roles for WordPress 2.3.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   858
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   859
 * @since 2.3.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   860
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   861
function populate_roles_230() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   862
	$role = get_role( 'administrator' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   863
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   864
	if ( ! empty( $role ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   865
		$role->add_cap( 'unfiltered_upload' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   866
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   867
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   868
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   869
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   870
 * Create and modify WordPress roles for WordPress 2.5.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   871
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   872
 * @since 2.5.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   873
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   874
function populate_roles_250() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   875
	$role = get_role( 'administrator' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   876
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   877
	if ( ! empty( $role ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   878
		$role->add_cap( 'edit_dashboard' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   879
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   880
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   881
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   882
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   883
 * Create and modify WordPress roles for WordPress 2.6.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   884
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   885
 * @since 2.6.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   886
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   887
function populate_roles_260() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   888
	$role = get_role( 'administrator' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   889
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   890
	if ( ! empty( $role ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   891
		$role->add_cap( 'update_plugins' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   892
		$role->add_cap( 'delete_plugins' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   893
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   894
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   895
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   896
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   897
 * Create and modify WordPress roles for WordPress 2.7.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   898
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   899
 * @since 2.7.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   900
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   901
function populate_roles_270() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   902
	$role = get_role( 'administrator' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   903
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   904
	if ( ! empty( $role ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   905
		$role->add_cap( 'install_plugins' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   906
		$role->add_cap( 'update_themes' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   907
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   908
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   909
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   910
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   911
 * Create and modify WordPress roles for WordPress 2.8.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   912
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   913
 * @since 2.8.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   914
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   915
function populate_roles_280() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   916
	$role = get_role( 'administrator' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   917
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   918
	if ( ! empty( $role ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   919
		$role->add_cap( 'install_themes' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   920
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   921
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   922
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   923
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   924
 * Create and modify WordPress roles for WordPress 3.0.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   925
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   926
 * @since 3.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   927
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   928
function populate_roles_300() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   929
	$role = get_role( 'administrator' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   930
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   931
	if ( ! empty( $role ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   932
		$role->add_cap( 'update_core' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   933
		$role->add_cap( 'list_users' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   934
		$role->add_cap( 'remove_users' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   935
		$role->add_cap( 'promote_users' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   936
		$role->add_cap( 'edit_theme_options' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   937
		$role->add_cap( 'delete_themes' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   938
		$role->add_cap( 'export' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   939
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   940
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   941
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   942
if ( ! function_exists( 'install_network' ) ) :
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   943
	/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   944
	 * Install Network.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   945
	 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   946
	 * @since 3.0.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   947
	 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   948
	function install_network() {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   949
		if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   950
			define( 'WP_INSTALLING_NETWORK', true );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   951
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   952
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   953
		dbDelta( wp_get_db_schema( 'global' ) );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   954
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   955
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   956
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   957
/**
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   958
 * Populate network settings.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   959
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   960
 * @since 3.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   961
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   962
 * @global wpdb       $wpdb         WordPress database abstraction object.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   963
 * @global object     $current_site
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   964
 * @global WP_Rewrite $wp_rewrite   WordPress rewrite component.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   965
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   966
 * @param int    $network_id        ID of network to populate.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   967
 * @param string $domain            The domain name for the network (eg. "example.com").
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   968
 * @param string $email             Email address for the network administrator.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   969
 * @param string $site_name         The name of the network.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   970
 * @param string $path              Optional. The path to append to the network's domain name. Default '/'.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   971
 * @param bool   $subdomain_install Optional. Whether the network is a subdomain installation or a subdirectory installation.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   972
 *                                  Default false, meaning the network is a subdirectory installation.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   973
 * @return bool|WP_Error True on success, or WP_Error on warning (with the installation otherwise successful,
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   974
 *                       so the error code must be checked) or failure.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   975
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   976
function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   977
	global $wpdb, $current_site, $wp_rewrite;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   978
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   979
	$errors = new WP_Error();
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   980
	if ( '' === $domain ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   981
		$errors->add( 'empty_domain', __( 'You must provide a domain name.' ) );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   982
	}
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   983
	if ( '' === $site_name ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   984
		$errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   985
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   986
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   987
	// Check for network collision.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   988
	$network_exists = false;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   989
	if ( is_multisite() ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   990
		if ( get_network( (int) $network_id ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   991
			$errors->add( 'siteid_exists', __( 'The network already exists.' ) );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   992
		}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   993
	} else {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   994
		if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   995
			$errors->add( 'siteid_exists', __( 'The network already exists.' ) );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   996
		}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   997
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   998
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   999
	if ( ! is_email( $email ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1000
		$errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1001
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1002
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1003
	if ( $errors->has_errors() ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1004
		return $errors;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1005
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1006
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1007
	if ( 1 == $network_id ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1008
		$wpdb->insert(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1009
			$wpdb->site,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1010
			array(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1011
				'domain' => $domain,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1012
				'path'   => $path,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1013
			)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1014
		);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1015
		$network_id = $wpdb->insert_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1016
	} else {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1017
		$wpdb->insert(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1018
			$wpdb->site,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1019
			array(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1020
				'domain' => $domain,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1021
				'path'   => $path,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1022
				'id'     => $network_id,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1023
			)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1024
		);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1025
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1026
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1027
	populate_network_meta(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1028
		$network_id,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1029
		array(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1030
			'admin_email'       => $email,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1031
			'site_name'         => $site_name,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1032
			'subdomain_install' => $subdomain_install,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1033
		)
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1034
	);
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1035
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1036
	$site_user = get_userdata( (int) $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", 'admin_user_id', $network_id ) ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1037
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1038
	/*
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1039
	 * When upgrading from single to multisite, assume the current site will
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1040
	 * become the main site of the network. When using populate_network()
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1041
	 * to create another network in an existing multisite environment, skip
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1042
	 * these steps since the main site of the new network has not yet been
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1043
	 * created.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1044
	 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1045
	if ( ! is_multisite() ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1046
		$current_site            = new stdClass;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1047
		$current_site->domain    = $domain;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1048
		$current_site->path      = $path;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1049
		$current_site->site_name = ucfirst( $domain );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1050
		$wpdb->insert(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1051
			$wpdb->blogs,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1052
			array(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1053
				'site_id'    => $network_id,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1054
				'blog_id'    => 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1055
				'domain'     => $domain,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1056
				'path'       => $path,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1057
				'registered' => current_time( 'mysql' ),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1058
			)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1059
		);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1060
		$current_site->blog_id = $wpdb->insert_id;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1061
		update_user_meta( $site_user->ID, 'source_domain', $domain );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1062
		update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1063
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1064
		if ( $subdomain_install ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1065
			$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1066
		} else {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1067
			$wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1068
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1069
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1070
		flush_rewrite_rules();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1071
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1072
		if ( ! $subdomain_install ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1073
			return true;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1074
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1075
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1076
		$vhost_ok = false;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1077
		$errstr   = '';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1078
		$hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname!
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1079
		$page     = wp_remote_get(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1080
			'http://' . $hostname,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1081
			array(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1082
				'timeout'     => 5,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1083
				'httpversion' => '1.1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1084
			)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1085
		);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1086
		if ( is_wp_error( $page ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1087
			$errstr = $page->get_error_message();
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1088
		} elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1089
				$vhost_ok = true;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1090
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1091
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1092
		if ( ! $vhost_ok ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1093
			$msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1094
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1095
			$msg .= '<p>' . sprintf(
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1096
				/* translators: %s: Host name. */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1097
				__( 'The installer attempted to contact a random hostname (%s) on your domain.' ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1098
				'<code>' . $hostname . '</code>'
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1099
			);
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1100
			if ( ! empty( $errstr ) ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1101
				/* translators: %s: Error message. */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1102
				$msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1103
			}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1104
			$msg .= '</p>';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1105
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1106
			$msg .= '<p>' . sprintf(
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1107
				/* translators: %s: Asterisk symbol (*). */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1108
				__( '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.' ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1109
				'<code>*</code>'
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1110
			) . '</p>';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1111
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1112
			$msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1113
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1114
			return new WP_Error( 'no_wildcard_dns', $msg );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1115
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1116
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1117
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1118
	return true;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1119
}
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1120
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1121
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1122
 * Creates WordPress network meta and sets the default values.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1123
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1124
 * @since 5.1.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1125
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1126
 * @global wpdb $wpdb          WordPress database abstraction object.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1127
 * @global int  $wp_db_version WordPress database version.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1128
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1129
 * @param int   $network_id Network ID to populate meta for.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1130
 * @param array $meta       Optional. Custom meta $key => $value pairs to use. Default empty array.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1131
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1132
function populate_network_meta( $network_id, array $meta = array() ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1133
	global $wpdb, $wp_db_version;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1134
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1135
	$network_id = (int) $network_id;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1136
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1137
	$email             = ! empty( $meta['admin_email'] ) ? $meta['admin_email'] : '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1138
	$subdomain_install = isset( $meta['subdomain_install'] ) ? (int) $meta['subdomain_install'] : 0;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1139
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1140
	// If a user with the provided email does not exist, default to the current user as the new network admin.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1141
	$site_user = ! empty( $email ) ? get_user_by( 'email', $email ) : false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1142
	if ( false === $site_user ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1143
		$site_user = wp_get_current_user();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1144
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1145
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1146
	if ( empty( $email ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1147
		$email = $site_user->user_email;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1148
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1149
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1150
	$template       = get_option( 'template' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1151
	$stylesheet     = get_option( 'stylesheet' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1152
	$allowed_themes = array( $stylesheet => true );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1153
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1154
	if ( $template != $stylesheet ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1155
		$allowed_themes[ $template ] = true;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1156
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1157
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1158
	if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1159
		$allowed_themes[ WP_DEFAULT_THEME ] = true;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1160
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1161
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1162
	// If WP_DEFAULT_THEME doesn't exist, also include the latest core default theme.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1163
	if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1164
		$core_default = WP_Theme::get_core_default_theme();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1165
		if ( $core_default ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1166
			$allowed_themes[ $core_default->get_stylesheet() ] = true;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1167
		}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1168
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1169
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1170
	if ( function_exists( 'clean_network_cache' ) ) {
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1171
		clean_network_cache( $network_id );
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1172
	} else {
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1173
		wp_cache_delete( $network_id, 'networks' );
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1174
	}
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1175
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1176
	wp_cache_delete( 'networks_have_paths', 'site-options' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1177
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1178
	if ( ! is_multisite() ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1179
		$site_admins = array( $site_user->user_login );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1180
		$users       = get_users(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1181
			array(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1182
				'fields' => array( 'user_login' ),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1183
				'role'   => 'administrator',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1184
			)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1185
		);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1186
		if ( $users ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1187
			foreach ( $users as $user ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1188
				$site_admins[] = $user->user_login;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1189
			}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1190
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1191
			$site_admins = array_unique( $site_admins );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1192
		}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1193
	} else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1194
		$site_admins = get_site_option( 'site_admins' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1195
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1196
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1197
	/* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1198
	$welcome_email = __(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1199
		'Howdy USERNAME,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1200
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1201
Your new SITE_NAME site has been successfully set up at:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1202
BLOG_URL
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1203
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1204
You can log in to the administrator account with the following information:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1205
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1206
Username: USERNAME
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1207
Password: PASSWORD
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1208
Log in here: BLOG_URLwp-login.php
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1209
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1210
We hope you enjoy your new site. Thanks!
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1211
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1212
--The Team @ SITE_NAME'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1213
	);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1214
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1215
	$misc_exts        = array(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1216
		// Images.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1217
		'jpg',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1218
		'jpeg',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1219
		'png',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1220
		'gif',
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
  1221
		'webp',
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1222
		// Video.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1223
		'mov',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1224
		'avi',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1225
		'mpg',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1226
		'3gp',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1227
		'3g2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1228
		// "audio".
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1229
		'midi',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1230
		'mid',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1231
		// Miscellaneous.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1232
		'pdf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1233
		'doc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1234
		'ppt',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1235
		'odt',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1236
		'pptx',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1237
		'docx',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1238
		'pps',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1239
		'ppsx',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1240
		'xls',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1241
		'xlsx',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1242
		'key',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1243
	);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1244
	$audio_exts       = wp_get_audio_extensions();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1245
	$video_exts       = wp_get_video_extensions();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1246
	$upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1247
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1248
	$sitemeta = array(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1249
		'site_name'                   => __( 'My Network' ),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1250
		'admin_email'                 => $email,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1251
		'admin_user_id'               => $site_user->ID,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1252
		'registration'                => 'none',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1253
		'upload_filetypes'            => implode( ' ', $upload_filetypes ),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1254
		'blog_upload_space'           => 100,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1255
		'fileupload_maxk'             => 1500,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1256
		'site_admins'                 => $site_admins,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1257
		'allowedthemes'               => $allowed_themes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1258
		'illegal_names'               => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1259
		'wpmu_upgrade_site'           => $wp_db_version,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1260
		'welcome_email'               => $welcome_email,
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1261
		/* translators: %s: Site link. */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1262
		'first_post'                  => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ),
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1263
		// @todo - Network admins should have a method of editing the network siteurl (used for cookie hash).
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1264
		'siteurl'                     => get_option( 'siteurl' ) . '/',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1265
		'add_new_users'               => '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1266
		'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1267
		'subdomain_install'           => $subdomain_install,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1268
		'global_terms_enabled'        => global_terms_enabled() ? '1' : '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1269
		'ms_files_rewriting'          => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1270
		'initial_db_version'          => get_option( 'initial_db_version' ),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1271
		'active_sitewide_plugins'     => array(),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1272
		'WPLANG'                      => get_locale(),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1273
	);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1274
	if ( ! $subdomain_install ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1275
		$sitemeta['illegal_names'][] = 'blog';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1276
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1277
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1278
	$sitemeta = wp_parse_args( $meta, $sitemeta );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1279
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1280
	/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1281
	 * Filters meta for a network on creation.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1282
	 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1283
	 * @since 3.7.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1284
	 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1285
	 * @param array $sitemeta   Associative array of network meta keys and values to be inserted.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1286
	 * @param int   $network_id ID of network to populate.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1287
	 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1288
	$sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1289
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1290
	$insert = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1291
	foreach ( $sitemeta as $meta_key => $meta_value ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1292
		if ( is_array( $meta_value ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1293
			$meta_value = serialize( $meta_value );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1294
		}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1295
		if ( ! empty( $insert ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1296
			$insert .= ', ';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1297
		}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1298
		$insert .= $wpdb->prepare( '( %d, %s, %s)', $network_id, $meta_key, $meta_value );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1299
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1300
	$wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1301
}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1302
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1303
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1304
 * Creates WordPress site meta and sets the default values.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1305
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1306
 * @since 5.1.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1307
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1308
 * @global wpdb $wpdb WordPress database abstraction object.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1309
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1310
 * @param int   $site_id Site ID to populate meta for.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1311
 * @param array $meta    Optional. Custom meta $key => $value pairs to use. Default empty array.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1312
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1313
function populate_site_meta( $site_id, array $meta = array() ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1314
	global $wpdb;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1315
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1316
	$site_id = (int) $site_id;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1317
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1318
	if ( ! is_site_meta_supported() ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1319
		return;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1320
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1321
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1322
	if ( empty( $meta ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1323
		return;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1324
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1325
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1326
	/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1327
	 * Filters meta for a site on creation.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1328
	 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1329
	 * @since 5.2.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1330
	 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1331
	 * @param array $meta    Associative array of site meta keys and values to be inserted.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1332
	 * @param int   $site_id ID of site to populate.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1333
	 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1334
	$site_meta = apply_filters( 'populate_site_meta', $meta, $site_id );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1335
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1336
	$insert = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1337
	foreach ( $site_meta as $meta_key => $meta_value ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1338
		if ( is_array( $meta_value ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1339
			$meta_value = serialize( $meta_value );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1340
		}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1341
		if ( ! empty( $insert ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1342
			$insert .= ', ';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1343
		}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1344
		$insert .= $wpdb->prepare( '( %d, %s, %s)', $site_id, $meta_key, $meta_value );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1345
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1346
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1347
	$wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1348
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1349
	wp_cache_delete( $site_id, 'blog_meta' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1350
	wp_cache_set_sites_last_changed();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1351
}