author | Anthony Ly <anthonyly.com@gmail.com> |
Wed, 19 Dec 2012 17:46:52 -0800 | |
changeset 204 | 09a1c134465b |
parent 194 | 32102edaa81b |
permissions | -rw-r--r-- |
136 | 1 |
<?php |
2 |
/** |
|
3 |
* WordPress Administration Scheme API |
|
4 |
* |
|
5 |
* Here we keep the DB structure and option values. |
|
6 |
* |
|
7 |
* @package WordPress |
|
8 |
* @subpackage Administration |
|
9 |
*/ |
|
10 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
11 |
// Declare these as global in case schema.php is included from a function. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
12 |
global $wpdb, $wp_queries, $charset_collate; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
13 |
|
136 | 14 |
/** |
15 |
* The database character collate. |
|
16 |
* @var string |
|
17 |
* @global string |
|
18 |
* @name $charset_collate |
|
19 |
*/ |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
20 |
$charset_collate = $wpdb->get_charset_collate(); |
136 | 21 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
22 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
23 |
* Retrieve the SQL for creating database tables. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
24 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
25 |
* @since 3.3.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
26 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
27 |
* @param string $scope Optional. The tables for which to retrieve SQL. Can be all, global, ms_global, or blog tables. Defaults to all. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
28 |
* @param int $blog_id Optional. The blog ID for which to retrieve SQL. Default is the current blog ID. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
29 |
* @return string The SQL needed to create the requested tables. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
30 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
31 |
function wp_get_db_schema( $scope = 'all', $blog_id = null ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
32 |
global $wpdb; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
33 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
34 |
$charset_collate = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
35 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
36 |
if ( ! empty($wpdb->charset) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
37 |
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
38 |
if ( ! empty($wpdb->collate) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
39 |
$charset_collate .= " COLLATE $wpdb->collate"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
40 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
41 |
if ( $blog_id && $blog_id != $wpdb->blogid ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
42 |
$old_blog_id = $wpdb->set_blog_id( $blog_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
43 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
44 |
// Engage multisite if in the middle of turning it on from network.php. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
45 |
$is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
46 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
47 |
// Blog specific tables. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
48 |
$blog_tables = "CREATE TABLE $wpdb->terms ( |
136 | 49 |
term_id bigint(20) unsigned NOT NULL auto_increment, |
50 |
name varchar(200) NOT NULL default '', |
|
51 |
slug varchar(200) NOT NULL default '', |
|
52 |
term_group bigint(10) NOT NULL default 0, |
|
53 |
PRIMARY KEY (term_id), |
|
54 |
UNIQUE KEY slug (slug), |
|
55 |
KEY name (name) |
|
56 |
) $charset_collate; |
|
57 |
CREATE TABLE $wpdb->term_taxonomy ( |
|
58 |
term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment, |
|
59 |
term_id bigint(20) unsigned NOT NULL default 0, |
|
60 |
taxonomy varchar(32) NOT NULL default '', |
|
61 |
description longtext NOT NULL, |
|
62 |
parent bigint(20) unsigned NOT NULL default 0, |
|
63 |
count bigint(20) NOT NULL default 0, |
|
64 |
PRIMARY KEY (term_taxonomy_id), |
|
65 |
UNIQUE KEY term_id_taxonomy (term_id,taxonomy), |
|
66 |
KEY taxonomy (taxonomy) |
|
67 |
) $charset_collate; |
|
68 |
CREATE TABLE $wpdb->term_relationships ( |
|
69 |
object_id bigint(20) unsigned NOT NULL default 0, |
|
70 |
term_taxonomy_id bigint(20) unsigned NOT NULL default 0, |
|
71 |
term_order int(11) NOT NULL default 0, |
|
72 |
PRIMARY KEY (object_id,term_taxonomy_id), |
|
73 |
KEY term_taxonomy_id (term_taxonomy_id) |
|
74 |
) $charset_collate; |
|
75 |
CREATE TABLE $wpdb->commentmeta ( |
|
76 |
meta_id bigint(20) unsigned NOT NULL auto_increment, |
|
77 |
comment_id bigint(20) unsigned NOT NULL default '0', |
|
78 |
meta_key varchar(255) default NULL, |
|
79 |
meta_value longtext, |
|
80 |
PRIMARY KEY (meta_id), |
|
81 |
KEY comment_id (comment_id), |
|
82 |
KEY meta_key (meta_key) |
|
83 |
) $charset_collate; |
|
84 |
CREATE TABLE $wpdb->comments ( |
|
85 |
comment_ID bigint(20) unsigned NOT NULL auto_increment, |
|
86 |
comment_post_ID bigint(20) unsigned NOT NULL default '0', |
|
87 |
comment_author tinytext NOT NULL, |
|
88 |
comment_author_email varchar(100) NOT NULL default '', |
|
89 |
comment_author_url varchar(200) NOT NULL default '', |
|
90 |
comment_author_IP varchar(100) NOT NULL default '', |
|
91 |
comment_date datetime NOT NULL default '0000-00-00 00:00:00', |
|
92 |
comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', |
|
93 |
comment_content text NOT NULL, |
|
94 |
comment_karma int(11) NOT NULL default '0', |
|
95 |
comment_approved varchar(20) NOT NULL default '1', |
|
96 |
comment_agent varchar(255) NOT NULL default '', |
|
97 |
comment_type varchar(20) NOT NULL default '', |
|
98 |
comment_parent bigint(20) unsigned NOT NULL default '0', |
|
99 |
user_id bigint(20) unsigned NOT NULL default '0', |
|
100 |
PRIMARY KEY (comment_ID), |
|
101 |
KEY comment_post_ID (comment_post_ID), |
|
102 |
KEY comment_approved_date_gmt (comment_approved,comment_date_gmt), |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
103 |
KEY comment_date_gmt (comment_date_gmt), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
104 |
KEY comment_parent (comment_parent) |
136 | 105 |
) $charset_collate; |
106 |
CREATE TABLE $wpdb->links ( |
|
107 |
link_id bigint(20) unsigned NOT NULL auto_increment, |
|
108 |
link_url varchar(255) NOT NULL default '', |
|
109 |
link_name varchar(255) NOT NULL default '', |
|
110 |
link_image varchar(255) NOT NULL default '', |
|
111 |
link_target varchar(25) NOT NULL default '', |
|
112 |
link_description varchar(255) NOT NULL default '', |
|
113 |
link_visible varchar(20) NOT NULL default 'Y', |
|
114 |
link_owner bigint(20) unsigned NOT NULL default '1', |
|
115 |
link_rating int(11) NOT NULL default '0', |
|
116 |
link_updated datetime NOT NULL default '0000-00-00 00:00:00', |
|
117 |
link_rel varchar(255) NOT NULL default '', |
|
118 |
link_notes mediumtext NOT NULL, |
|
119 |
link_rss varchar(255) NOT NULL default '', |
|
120 |
PRIMARY KEY (link_id), |
|
121 |
KEY link_visible (link_visible) |
|
122 |
) $charset_collate; |
|
123 |
CREATE TABLE $wpdb->options ( |
|
124 |
option_id bigint(20) unsigned NOT NULL auto_increment, |
|
125 |
option_name varchar(64) NOT NULL default '', |
|
126 |
option_value longtext NOT NULL, |
|
127 |
autoload varchar(20) NOT NULL default 'yes', |
|
128 |
PRIMARY KEY (option_id), |
|
129 |
UNIQUE KEY option_name (option_name) |
|
130 |
) $charset_collate; |
|
131 |
CREATE TABLE $wpdb->postmeta ( |
|
132 |
meta_id bigint(20) unsigned NOT NULL auto_increment, |
|
133 |
post_id bigint(20) unsigned NOT NULL default '0', |
|
134 |
meta_key varchar(255) default NULL, |
|
135 |
meta_value longtext, |
|
136 |
PRIMARY KEY (meta_id), |
|
137 |
KEY post_id (post_id), |
|
138 |
KEY meta_key (meta_key) |
|
139 |
) $charset_collate; |
|
140 |
CREATE TABLE $wpdb->posts ( |
|
141 |
ID bigint(20) unsigned NOT NULL auto_increment, |
|
142 |
post_author bigint(20) unsigned NOT NULL default '0', |
|
143 |
post_date datetime NOT NULL default '0000-00-00 00:00:00', |
|
144 |
post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', |
|
145 |
post_content longtext NOT NULL, |
|
146 |
post_title text NOT NULL, |
|
147 |
post_excerpt text NOT NULL, |
|
148 |
post_status varchar(20) NOT NULL default 'publish', |
|
149 |
comment_status varchar(20) NOT NULL default 'open', |
|
150 |
ping_status varchar(20) NOT NULL default 'open', |
|
151 |
post_password varchar(20) NOT NULL default '', |
|
152 |
post_name varchar(200) NOT NULL default '', |
|
153 |
to_ping text NOT NULL, |
|
154 |
pinged text NOT NULL, |
|
155 |
post_modified datetime NOT NULL default '0000-00-00 00:00:00', |
|
156 |
post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
157 |
post_content_filtered longtext NOT NULL, |
136 | 158 |
post_parent bigint(20) unsigned NOT NULL default '0', |
159 |
guid varchar(255) NOT NULL default '', |
|
160 |
menu_order int(11) NOT NULL default '0', |
|
161 |
post_type varchar(20) NOT NULL default 'post', |
|
162 |
post_mime_type varchar(100) NOT NULL default '', |
|
163 |
comment_count bigint(20) NOT NULL default '0', |
|
164 |
PRIMARY KEY (ID), |
|
165 |
KEY post_name (post_name), |
|
166 |
KEY type_status_date (post_type,post_status,post_date,ID), |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
167 |
KEY post_parent (post_parent), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
168 |
KEY post_author (post_author) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
169 |
) $charset_collate;\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
170 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
171 |
// Single site users table. The multisite flavor of the users table is handled below. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
172 |
$users_single_table = "CREATE TABLE $wpdb->users ( |
136 | 173 |
ID bigint(20) unsigned NOT NULL auto_increment, |
174 |
user_login varchar(60) NOT NULL default '', |
|
175 |
user_pass varchar(64) NOT NULL default '', |
|
176 |
user_nicename varchar(50) NOT NULL default '', |
|
177 |
user_email varchar(100) NOT NULL default '', |
|
178 |
user_url varchar(100) NOT NULL default '', |
|
179 |
user_registered datetime NOT NULL default '0000-00-00 00:00:00', |
|
180 |
user_activation_key varchar(60) NOT NULL default '', |
|
181 |
user_status int(11) NOT NULL default '0', |
|
182 |
display_name varchar(250) NOT NULL default '', |
|
183 |
PRIMARY KEY (ID), |
|
184 |
KEY user_login_key (user_login), |
|
185 |
KEY user_nicename (user_nicename) |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
186 |
) $charset_collate;\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
187 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
188 |
// Multisite users table |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
189 |
$users_multi_table = "CREATE TABLE $wpdb->users ( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
190 |
ID bigint(20) unsigned NOT NULL auto_increment, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
191 |
user_login varchar(60) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
192 |
user_pass varchar(64) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
193 |
user_nicename varchar(50) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
194 |
user_email varchar(100) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
195 |
user_url varchar(100) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
196 |
user_registered datetime NOT NULL default '0000-00-00 00:00:00', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
197 |
user_activation_key varchar(60) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
198 |
user_status int(11) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
199 |
display_name varchar(250) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
200 |
spam tinyint(2) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
201 |
deleted tinyint(2) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
202 |
PRIMARY KEY (ID), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
203 |
KEY user_login_key (user_login), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
204 |
KEY user_nicename (user_nicename) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
205 |
) $charset_collate;\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
206 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
207 |
// usermeta |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
208 |
$usermeta_table = "CREATE TABLE $wpdb->usermeta ( |
136 | 209 |
umeta_id bigint(20) unsigned NOT NULL auto_increment, |
210 |
user_id bigint(20) unsigned NOT NULL default '0', |
|
211 |
meta_key varchar(255) default NULL, |
|
212 |
meta_value longtext, |
|
213 |
PRIMARY KEY (umeta_id), |
|
214 |
KEY user_id (user_id), |
|
215 |
KEY meta_key (meta_key) |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
216 |
) $charset_collate;\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
217 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
218 |
// Global tables |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
219 |
if ( $is_multisite ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
220 |
$global_tables = $users_multi_table . $usermeta_table; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
221 |
else |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
222 |
$global_tables = $users_single_table . $usermeta_table; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
223 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
224 |
// Multisite global tables. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
225 |
$ms_global_tables = "CREATE TABLE $wpdb->blogs ( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
226 |
blog_id bigint(20) NOT NULL auto_increment, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
227 |
site_id bigint(20) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
228 |
domain varchar(200) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
229 |
path varchar(100) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
230 |
registered datetime NOT NULL default '0000-00-00 00:00:00', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
231 |
last_updated datetime NOT NULL default '0000-00-00 00:00:00', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
232 |
public tinyint(2) NOT NULL default '1', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
233 |
archived enum('0','1') NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
234 |
mature tinyint(2) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
235 |
spam tinyint(2) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
236 |
deleted tinyint(2) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
237 |
lang_id int(11) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
238 |
PRIMARY KEY (blog_id), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
239 |
KEY domain (domain(50),path(5)), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
240 |
KEY lang_id (lang_id) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
241 |
) $charset_collate; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
242 |
CREATE TABLE $wpdb->blog_versions ( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
243 |
blog_id bigint(20) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
244 |
db_version varchar(20) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
245 |
last_updated datetime NOT NULL default '0000-00-00 00:00:00', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
246 |
PRIMARY KEY (blog_id), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
247 |
KEY db_version (db_version) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
248 |
) $charset_collate; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
249 |
CREATE TABLE $wpdb->registration_log ( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
250 |
ID bigint(20) NOT NULL auto_increment, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
251 |
email varchar(255) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
252 |
IP varchar(30) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
253 |
blog_id bigint(20) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
254 |
date_registered datetime NOT NULL default '0000-00-00 00:00:00', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
255 |
PRIMARY KEY (ID), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
256 |
KEY IP (IP) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
257 |
) $charset_collate; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
258 |
CREATE TABLE $wpdb->site ( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
259 |
id bigint(20) NOT NULL auto_increment, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
260 |
domain varchar(200) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
261 |
path varchar(100) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
262 |
PRIMARY KEY (id), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
263 |
KEY domain (domain,path) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
264 |
) $charset_collate; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
265 |
CREATE TABLE $wpdb->sitemeta ( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
266 |
meta_id bigint(20) NOT NULL auto_increment, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
267 |
site_id bigint(20) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
268 |
meta_key varchar(255) default NULL, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
269 |
meta_value longtext, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
270 |
PRIMARY KEY (meta_id), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
271 |
KEY meta_key (meta_key), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
272 |
KEY site_id (site_id) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
273 |
) $charset_collate; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
274 |
CREATE TABLE $wpdb->signups ( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
275 |
domain varchar(200) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
276 |
path varchar(100) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
277 |
title longtext NOT NULL, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
278 |
user_login varchar(60) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
279 |
user_email varchar(100) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
280 |
registered datetime NOT NULL default '0000-00-00 00:00:00', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
281 |
activated datetime NOT NULL default '0000-00-00 00:00:00', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
282 |
active tinyint(1) NOT NULL default '0', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
283 |
activation_key varchar(50) NOT NULL default '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
284 |
meta longtext, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
285 |
KEY activation_key (activation_key), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
286 |
KEY domain (domain) |
136 | 287 |
) $charset_collate;"; |
288 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
289 |
switch ( $scope ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
290 |
case 'blog' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
291 |
$queries = $blog_tables; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
292 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
293 |
case 'global' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
294 |
$queries = $global_tables; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
295 |
if ( $is_multisite ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
296 |
$queries .= $ms_global_tables; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
297 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
298 |
case 'ms_global' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
299 |
$queries = $ms_global_tables; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
300 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
301 |
default: |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
302 |
case 'all' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
303 |
$queries = $global_tables . $blog_tables; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
304 |
if ( $is_multisite ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
305 |
$queries .= $ms_global_tables; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
306 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
307 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
308 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
309 |
if ( isset( $old_blog_id ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
310 |
$wpdb->set_blog_id( $old_blog_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
311 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
312 |
return $queries; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
313 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
314 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
315 |
// Populate for back compat. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
316 |
$wp_queries = wp_get_db_schema( 'all' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
317 |
|
136 | 318 |
/** |
319 |
* Create WordPress options and set the default values. |
|
320 |
* |
|
321 |
* @since 1.5.0 |
|
322 |
* @uses $wpdb |
|
323 |
* @uses $wp_db_version |
|
324 |
*/ |
|
325 |
function populate_options() { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
326 |
global $wpdb, $wp_db_version, $current_site, $wp_current_db_version; |
136 | 327 |
|
328 |
$guessurl = wp_guess_url(); |
|
329 |
||
330 |
do_action('populate_options'); |
|
331 |
||
332 |
if ( ini_get('safe_mode') ) { |
|
333 |
// Safe mode can break mkdir() so use a flat structure by default. |
|
334 |
$uploads_use_yearmonth_folders = 0; |
|
335 |
} else { |
|
336 |
$uploads_use_yearmonth_folders = 1; |
|
337 |
} |
|
338 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
339 |
$template = WP_DEFAULT_THEME; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
340 |
// If default theme is a child theme, we need to get its template |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
341 |
$theme = wp_get_theme( $template ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
342 |
if ( ! $theme->errors() ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
343 |
$template = $theme->get_template(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
344 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
345 |
$timezone_string = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
346 |
$gmt_offset = 0; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
347 |
/* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
348 |
or a valid timezone string (America/New_York). See http://us3.php.net/manual/en/timezones.php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
349 |
for all timezone strings supported by PHP. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
350 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
351 |
$offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
352 |
if ( is_numeric( $offset_or_tz ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
353 |
$gmt_offset = $offset_or_tz; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
354 |
elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
355 |
$timezone_string = $offset_or_tz; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
356 |
|
136 | 357 |
$options = array( |
358 |
'siteurl' => $guessurl, |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
359 |
'blogname' => __('My Site'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
360 |
/* translators: blog tagline */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
361 |
'blogdescription' => __('Just another WordPress site'), |
136 | 362 |
'users_can_register' => 0, |
363 |
'admin_email' => 'you@example.com', |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
364 |
/* translators: default start of the week. 0 = Sunday, 1 = Monday */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
365 |
'start_of_week' => _x( '1', 'start of week' ), |
136 | 366 |
'use_balanceTags' => 0, |
367 |
'use_smilies' => 1, |
|
368 |
'require_name_email' => 1, |
|
369 |
'comments_notify' => 1, |
|
370 |
'posts_per_rss' => 10, |
|
371 |
'rss_use_excerpt' => 0, |
|
372 |
'mailserver_url' => 'mail.example.com', |
|
373 |
'mailserver_login' => 'login@example.com', |
|
374 |
'mailserver_pass' => 'password', |
|
375 |
'mailserver_port' => 110, |
|
376 |
'default_category' => 1, |
|
377 |
'default_comment_status' => 'open', |
|
378 |
'default_ping_status' => 'open', |
|
379 |
'default_pingback_flag' => 1, |
|
380 |
'posts_per_page' => 10, |
|
381 |
/* translators: default date format, see http://php.net/date */ |
|
382 |
'date_format' => __('F j, Y'), |
|
383 |
/* translators: default time format, see http://php.net/date */ |
|
384 |
'time_format' => __('g:i a'), |
|
385 |
/* translators: links last updated date format, see http://php.net/date */ |
|
386 |
'links_updated_date_format' => __('F j, Y g:i a'), |
|
387 |
'links_recently_updated_prepend' => '<em>', |
|
388 |
'links_recently_updated_append' => '</em>', |
|
389 |
'links_recently_updated_time' => 120, |
|
390 |
'comment_moderation' => 0, |
|
391 |
'moderation_notify' => 1, |
|
392 |
'permalink_structure' => '', |
|
393 |
'gzipcompression' => 0, |
|
394 |
'hack_file' => 0, |
|
395 |
'blog_charset' => 'UTF-8', |
|
396 |
'moderation_keys' => '', |
|
397 |
'active_plugins' => array(), |
|
398 |
'home' => $guessurl, |
|
399 |
'category_base' => '', |
|
400 |
'ping_sites' => 'http://rpc.pingomatic.com/', |
|
401 |
'advanced_edit' => 0, |
|
402 |
'comment_max_links' => 2, |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
403 |
'gmt_offset' => $gmt_offset, |
136 | 404 |
|
405 |
// 1.5 |
|
406 |
'default_email_category' => 1, |
|
407 |
'recently_edited' => '', |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
408 |
'template' => $template, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
409 |
'stylesheet' => WP_DEFAULT_THEME, |
136 | 410 |
'comment_whitelist' => 1, |
411 |
'blacklist_keys' => '', |
|
412 |
'comment_registration' => 0, |
|
413 |
'html_type' => 'text/html', |
|
414 |
||
415 |
// 1.5.1 |
|
416 |
'use_trackback' => 0, |
|
417 |
||
418 |
// 2.0 |
|
419 |
'default_role' => 'subscriber', |
|
420 |
'db_version' => $wp_db_version, |
|
421 |
||
422 |
// 2.0.1 |
|
423 |
'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders, |
|
424 |
'upload_path' => '', |
|
425 |
||
426 |
// 2.1 |
|
427 |
'blog_public' => '1', |
|
428 |
'default_link_category' => 2, |
|
429 |
'show_on_front' => 'posts', |
|
430 |
||
431 |
// 2.2 |
|
432 |
'tag_base' => '', |
|
433 |
||
434 |
// 2.5 |
|
435 |
'show_avatars' => '1', |
|
436 |
'avatar_rating' => 'G', |
|
437 |
'upload_url_path' => '', |
|
438 |
'thumbnail_size_w' => 150, |
|
439 |
'thumbnail_size_h' => 150, |
|
440 |
'thumbnail_crop' => 1, |
|
441 |
'medium_size_w' => 300, |
|
442 |
'medium_size_h' => 300, |
|
443 |
||
444 |
// 2.6 |
|
445 |
'avatar_default' => 'mystery', |
|
446 |
||
447 |
// 2.7 |
|
448 |
'large_size_w' => 1024, |
|
449 |
'large_size_h' => 1024, |
|
450 |
'image_default_link_type' => 'file', |
|
451 |
'image_default_size' => '', |
|
452 |
'image_default_align' => '', |
|
453 |
'close_comments_for_old_posts' => 0, |
|
454 |
'close_comments_days_old' => 14, |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
455 |
'thread_comments' => 1, |
136 | 456 |
'thread_comments_depth' => 5, |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
457 |
'page_comments' => 0, |
136 | 458 |
'comments_per_page' => 50, |
459 |
'default_comments_page' => 'newest', |
|
460 |
'comment_order' => 'asc', |
|
461 |
'sticky_posts' => array(), |
|
462 |
'widget_categories' => array(), |
|
463 |
'widget_text' => array(), |
|
464 |
'widget_rss' => array(), |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
465 |
'uninstall_plugins' => array(), |
136 | 466 |
|
467 |
// 2.8 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
468 |
'timezone_string' => $timezone_string, |
136 | 469 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
470 |
// 3.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
471 |
'page_for_posts' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
472 |
'page_on_front' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
473 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
474 |
// 3.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
475 |
'default_post_format' => 0, |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
476 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
477 |
// 3.5 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
478 |
'link_manager_enabled' => 0, |
136 | 479 |
); |
480 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
481 |
// 3.3 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
482 |
if ( ! is_multisite() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
483 |
$options['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
484 |
? $wp_current_db_version : $wp_db_version; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
485 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
486 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
487 |
// 3.0 multisite |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
488 |
if ( is_multisite() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
489 |
/* translators: blog tagline */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
490 |
$options[ 'blogdescription' ] = sprintf(__('Just another %s site'), $current_site->site_name ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
491 |
$options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
492 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
493 |
|
136 | 494 |
// Set autoload to no for these options |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
495 |
$fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins' ); |
136 | 496 |
|
497 |
$existing_options = $wpdb->get_col("SELECT option_name FROM $wpdb->options"); |
|
498 |
||
499 |
$insert = ''; |
|
500 |
foreach ( $options as $option => $value ) { |
|
501 |
if ( in_array($option, $existing_options) ) |
|
502 |
continue; |
|
503 |
if ( in_array($option, $fat_options) ) |
|
504 |
$autoload = 'no'; |
|
505 |
else |
|
506 |
$autoload = 'yes'; |
|
507 |
||
508 |
$option = $wpdb->escape($option); |
|
509 |
if ( is_array($value) ) |
|
510 |
$value = serialize($value); |
|
511 |
$value = $wpdb->escape($value); |
|
512 |
if ( !empty($insert) ) |
|
513 |
$insert .= ', '; |
|
514 |
$insert .= "('$option', '$value', '$autoload')"; |
|
515 |
} |
|
516 |
||
517 |
if ( !empty($insert) ) |
|
518 |
$wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert); |
|
519 |
||
520 |
// in case it is set, but blank, update "home" |
|
521 |
if ( !__get_option('home') ) update_option('home', $guessurl); |
|
522 |
||
523 |
// Delete unused options |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
524 |
$unusedoptions = array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
525 |
'blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
526 |
'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
527 |
'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
528 |
'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
529 |
'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
530 |
'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
531 |
'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
532 |
'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
533 |
'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
534 |
'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
535 |
'_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
536 |
'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
537 |
'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
538 |
'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
539 |
'autoembed_urls', 'default_post_edit_rows', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
540 |
); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
541 |
foreach ( $unusedoptions as $option ) |
136 | 542 |
delete_option($option); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
543 |
|
136 | 544 |
// delete obsolete magpie stuff |
545 |
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'"); |
|
546 |
} |
|
547 |
||
548 |
/** |
|
549 |
* Execute WordPress role creation for the various WordPress versions. |
|
550 |
* |
|
551 |
* @since 2.0.0 |
|
552 |
*/ |
|
553 |
function populate_roles() { |
|
554 |
populate_roles_160(); |
|
555 |
populate_roles_210(); |
|
556 |
populate_roles_230(); |
|
557 |
populate_roles_250(); |
|
558 |
populate_roles_260(); |
|
559 |
populate_roles_270(); |
|
560 |
populate_roles_280(); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
561 |
populate_roles_300(); |
136 | 562 |
} |
563 |
||
564 |
/** |
|
565 |
* Create the roles for WordPress 2.0 |
|
566 |
* |
|
567 |
* @since 2.0.0 |
|
568 |
*/ |
|
569 |
function populate_roles_160() { |
|
570 |
// Add roles |
|
571 |
||
572 |
// Dummy gettext calls to get strings in the catalog. |
|
573 |
/* translators: user role */ |
|
574 |
_x('Administrator', 'User role'); |
|
575 |
/* translators: user role */ |
|
576 |
_x('Editor', 'User role'); |
|
577 |
/* translators: user role */ |
|
578 |
_x('Author', 'User role'); |
|
579 |
/* translators: user role */ |
|
580 |
_x('Contributor', 'User role'); |
|
581 |
/* translators: user role */ |
|
582 |
_x('Subscriber', 'User role'); |
|
583 |
||
584 |
add_role('administrator', 'Administrator'); |
|
585 |
add_role('editor', 'Editor'); |
|
586 |
add_role('author', 'Author'); |
|
587 |
add_role('contributor', 'Contributor'); |
|
588 |
add_role('subscriber', 'Subscriber'); |
|
589 |
||
590 |
// Add caps for Administrator role |
|
591 |
$role =& get_role('administrator'); |
|
592 |
$role->add_cap('switch_themes'); |
|
593 |
$role->add_cap('edit_themes'); |
|
594 |
$role->add_cap('activate_plugins'); |
|
595 |
$role->add_cap('edit_plugins'); |
|
596 |
$role->add_cap('edit_users'); |
|
597 |
$role->add_cap('edit_files'); |
|
598 |
$role->add_cap('manage_options'); |
|
599 |
$role->add_cap('moderate_comments'); |
|
600 |
$role->add_cap('manage_categories'); |
|
601 |
$role->add_cap('manage_links'); |
|
602 |
$role->add_cap('upload_files'); |
|
603 |
$role->add_cap('import'); |
|
604 |
$role->add_cap('unfiltered_html'); |
|
605 |
$role->add_cap('edit_posts'); |
|
606 |
$role->add_cap('edit_others_posts'); |
|
607 |
$role->add_cap('edit_published_posts'); |
|
608 |
$role->add_cap('publish_posts'); |
|
609 |
$role->add_cap('edit_pages'); |
|
610 |
$role->add_cap('read'); |
|
611 |
$role->add_cap('level_10'); |
|
612 |
$role->add_cap('level_9'); |
|
613 |
$role->add_cap('level_8'); |
|
614 |
$role->add_cap('level_7'); |
|
615 |
$role->add_cap('level_6'); |
|
616 |
$role->add_cap('level_5'); |
|
617 |
$role->add_cap('level_4'); |
|
618 |
$role->add_cap('level_3'); |
|
619 |
$role->add_cap('level_2'); |
|
620 |
$role->add_cap('level_1'); |
|
621 |
$role->add_cap('level_0'); |
|
622 |
||
623 |
// Add caps for Editor role |
|
624 |
$role =& get_role('editor'); |
|
625 |
$role->add_cap('moderate_comments'); |
|
626 |
$role->add_cap('manage_categories'); |
|
627 |
$role->add_cap('manage_links'); |
|
628 |
$role->add_cap('upload_files'); |
|
629 |
$role->add_cap('unfiltered_html'); |
|
630 |
$role->add_cap('edit_posts'); |
|
631 |
$role->add_cap('edit_others_posts'); |
|
632 |
$role->add_cap('edit_published_posts'); |
|
633 |
$role->add_cap('publish_posts'); |
|
634 |
$role->add_cap('edit_pages'); |
|
635 |
$role->add_cap('read'); |
|
636 |
$role->add_cap('level_7'); |
|
637 |
$role->add_cap('level_6'); |
|
638 |
$role->add_cap('level_5'); |
|
639 |
$role->add_cap('level_4'); |
|
640 |
$role->add_cap('level_3'); |
|
641 |
$role->add_cap('level_2'); |
|
642 |
$role->add_cap('level_1'); |
|
643 |
$role->add_cap('level_0'); |
|
644 |
||
645 |
// Add caps for Author role |
|
646 |
$role =& get_role('author'); |
|
647 |
$role->add_cap('upload_files'); |
|
648 |
$role->add_cap('edit_posts'); |
|
649 |
$role->add_cap('edit_published_posts'); |
|
650 |
$role->add_cap('publish_posts'); |
|
651 |
$role->add_cap('read'); |
|
652 |
$role->add_cap('level_2'); |
|
653 |
$role->add_cap('level_1'); |
|
654 |
$role->add_cap('level_0'); |
|
655 |
||
656 |
// Add caps for Contributor role |
|
657 |
$role =& get_role('contributor'); |
|
658 |
$role->add_cap('edit_posts'); |
|
659 |
$role->add_cap('read'); |
|
660 |
$role->add_cap('level_1'); |
|
661 |
$role->add_cap('level_0'); |
|
662 |
||
663 |
// Add caps for Subscriber role |
|
664 |
$role =& get_role('subscriber'); |
|
665 |
$role->add_cap('read'); |
|
666 |
$role->add_cap('level_0'); |
|
667 |
} |
|
668 |
||
669 |
/** |
|
670 |
* Create and modify WordPress roles for WordPress 2.1. |
|
671 |
* |
|
672 |
* @since 2.1.0 |
|
673 |
*/ |
|
674 |
function populate_roles_210() { |
|
675 |
$roles = array('administrator', 'editor'); |
|
676 |
foreach ($roles as $role) { |
|
677 |
$role =& get_role($role); |
|
678 |
if ( empty($role) ) |
|
679 |
continue; |
|
680 |
||
681 |
$role->add_cap('edit_others_pages'); |
|
682 |
$role->add_cap('edit_published_pages'); |
|
683 |
$role->add_cap('publish_pages'); |
|
684 |
$role->add_cap('delete_pages'); |
|
685 |
$role->add_cap('delete_others_pages'); |
|
686 |
$role->add_cap('delete_published_pages'); |
|
687 |
$role->add_cap('delete_posts'); |
|
688 |
$role->add_cap('delete_others_posts'); |
|
689 |
$role->add_cap('delete_published_posts'); |
|
690 |
$role->add_cap('delete_private_posts'); |
|
691 |
$role->add_cap('edit_private_posts'); |
|
692 |
$role->add_cap('read_private_posts'); |
|
693 |
$role->add_cap('delete_private_pages'); |
|
694 |
$role->add_cap('edit_private_pages'); |
|
695 |
$role->add_cap('read_private_pages'); |
|
696 |
} |
|
697 |
||
698 |
$role =& get_role('administrator'); |
|
699 |
if ( ! empty($role) ) { |
|
700 |
$role->add_cap('delete_users'); |
|
701 |
$role->add_cap('create_users'); |
|
702 |
} |
|
703 |
||
704 |
$role =& get_role('author'); |
|
705 |
if ( ! empty($role) ) { |
|
706 |
$role->add_cap('delete_posts'); |
|
707 |
$role->add_cap('delete_published_posts'); |
|
708 |
} |
|
709 |
||
710 |
$role =& get_role('contributor'); |
|
711 |
if ( ! empty($role) ) { |
|
712 |
$role->add_cap('delete_posts'); |
|
713 |
} |
|
714 |
} |
|
715 |
||
716 |
/** |
|
717 |
* Create and modify WordPress roles for WordPress 2.3. |
|
718 |
* |
|
719 |
* @since 2.3.0 |
|
720 |
*/ |
|
721 |
function populate_roles_230() { |
|
722 |
$role =& get_role( 'administrator' ); |
|
723 |
||
724 |
if ( !empty( $role ) ) { |
|
725 |
$role->add_cap( 'unfiltered_upload' ); |
|
726 |
} |
|
727 |
} |
|
728 |
||
729 |
/** |
|
730 |
* Create and modify WordPress roles for WordPress 2.5. |
|
731 |
* |
|
732 |
* @since 2.5.0 |
|
733 |
*/ |
|
734 |
function populate_roles_250() { |
|
735 |
$role =& get_role( 'administrator' ); |
|
736 |
||
737 |
if ( !empty( $role ) ) { |
|
738 |
$role->add_cap( 'edit_dashboard' ); |
|
739 |
} |
|
740 |
} |
|
741 |
||
742 |
/** |
|
743 |
* Create and modify WordPress roles for WordPress 2.6. |
|
744 |
* |
|
745 |
* @since 2.6.0 |
|
746 |
*/ |
|
747 |
function populate_roles_260() { |
|
748 |
$role =& get_role( 'administrator' ); |
|
749 |
||
750 |
if ( !empty( $role ) ) { |
|
751 |
$role->add_cap( 'update_plugins' ); |
|
752 |
$role->add_cap( 'delete_plugins' ); |
|
753 |
} |
|
754 |
} |
|
755 |
||
756 |
/** |
|
757 |
* Create and modify WordPress roles for WordPress 2.7. |
|
758 |
* |
|
759 |
* @since 2.7.0 |
|
760 |
*/ |
|
761 |
function populate_roles_270() { |
|
762 |
$role =& get_role( 'administrator' ); |
|
763 |
||
764 |
if ( !empty( $role ) ) { |
|
765 |
$role->add_cap( 'install_plugins' ); |
|
766 |
$role->add_cap( 'update_themes' ); |
|
767 |
} |
|
768 |
} |
|
769 |
||
770 |
/** |
|
771 |
* Create and modify WordPress roles for WordPress 2.8. |
|
772 |
* |
|
773 |
* @since 2.8.0 |
|
774 |
*/ |
|
775 |
function populate_roles_280() { |
|
776 |
$role =& get_role( 'administrator' ); |
|
777 |
||
778 |
if ( !empty( $role ) ) { |
|
779 |
$role->add_cap( 'install_themes' ); |
|
780 |
} |
|
781 |
} |
|
782 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
783 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
784 |
* Create and modify WordPress roles for WordPress 3.0. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
785 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
786 |
* @since 3.0.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
787 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
788 |
function populate_roles_300() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
789 |
$role =& get_role( 'administrator' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
790 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
791 |
if ( !empty( $role ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
792 |
$role->add_cap( 'update_core' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
793 |
$role->add_cap( 'list_users' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
794 |
$role->add_cap( 'remove_users' ); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
795 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
796 |
// Never used, will be removed. create_users or |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
797 |
// promote_users is the capability you're looking for. |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
798 |
$role->add_cap( 'add_users' ); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
799 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
800 |
$role->add_cap( 'promote_users' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
801 |
$role->add_cap( 'edit_theme_options' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
802 |
$role->add_cap( 'delete_themes' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
803 |
$role->add_cap( 'export' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
804 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
805 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
806 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
807 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
808 |
* Install Network. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
809 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
810 |
* @since 3.0.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
811 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
812 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
813 |
if ( !function_exists( 'install_network' ) ) : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
814 |
function install_network() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
815 |
if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
816 |
define( 'WP_INSTALLING_NETWORK', true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
817 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
818 |
dbDelta( wp_get_db_schema( 'global' ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
819 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
820 |
endif; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
821 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
822 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
823 |
* populate network settings |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
824 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
825 |
* @since 3.0.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
826 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
827 |
* @param int $network_id id of network to populate |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
828 |
* @return bool|WP_Error True on success, or WP_Error on warning (with the install otherwise successful, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
829 |
* so the error code must be checked) or failure. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
830 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
831 |
function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
832 |
global $wpdb, $current_site, $wp_db_version, $wp_rewrite; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
833 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
834 |
$errors = new WP_Error(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
835 |
if ( '' == $domain ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
836 |
$errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
837 |
if ( '' == $site_name ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
838 |
$errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
839 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
840 |
// check for network collision |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
841 |
if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
842 |
$errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
843 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
844 |
$site_user = get_user_by( 'email', $email ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
845 |
if ( ! is_email( $email ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
846 |
$errors->add( 'invalid_email', __( 'You must provide a valid e-mail address.' ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
847 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
848 |
if ( $errors->get_error_code() ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
849 |
return $errors; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
850 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
851 |
// set up site tables |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
852 |
$template = get_option( 'template' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
853 |
$stylesheet = get_option( 'stylesheet' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
854 |
$allowed_themes = array( $stylesheet => true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
855 |
if ( $template != $stylesheet ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
856 |
$allowed_themes[ $template ] = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
857 |
if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
858 |
$allowed_themes[ WP_DEFAULT_THEME ] = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
859 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
860 |
if ( 1 == $network_id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
861 |
$wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
862 |
$network_id = $wpdb->insert_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
863 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
864 |
$wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, 'id' => $network_id ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
865 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
866 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
867 |
if ( !is_multisite() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
868 |
$site_admins = array( $site_user->user_login ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
869 |
$users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
870 |
if ( $users ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
871 |
foreach ( $users as $user ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
872 |
if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
873 |
$site_admins[] = $user->user_login; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
874 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
875 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
876 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
877 |
$site_admins = get_site_option( 'site_admins' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
878 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
879 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
880 |
$welcome_email = __( 'Dear User, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
881 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
882 |
Your new SITE_NAME site has been successfully set up at: |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
883 |
BLOG_URL |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
884 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
885 |
You can log in to the administrator account with the following information: |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
886 |
Username: USERNAME |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
887 |
Password: PASSWORD |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
888 |
Log in here: BLOG_URLwp-login.php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
889 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
890 |
We hope you enjoy your new site. Thanks! |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
891 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
892 |
--The Team @ SITE_NAME' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
893 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
894 |
$sitemeta = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
895 |
'site_name' => $site_name, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
896 |
'admin_email' => $site_user->user_email, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
897 |
'admin_user_id' => $site_user->ID, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
898 |
'registration' => 'none', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
899 |
'upload_filetypes' => 'jpg jpeg png gif mp3 mov avi wmv midi mid pdf', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
900 |
'blog_upload_space' => 100, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
901 |
'fileupload_maxk' => 1500, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
902 |
'site_admins' => $site_admins, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
903 |
'allowedthemes' => $allowed_themes, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
904 |
'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
905 |
'wpmu_upgrade_site' => $wp_db_version, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
906 |
'welcome_email' => $welcome_email, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
907 |
'first_post' => __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
908 |
// @todo - network admins should have a method of editing the network siteurl (used for cookie hash) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
909 |
'siteurl' => get_option( 'siteurl' ) . '/', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
910 |
'add_new_users' => '0', |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
911 |
'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1', |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
912 |
'subdomain_install' => intval( $subdomain_install ), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
913 |
'global_terms_enabled' => global_terms_enabled() ? '1' : '0', |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
914 |
'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0', |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
915 |
'initial_db_version' => get_option( 'initial_db_version' ), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
916 |
'active_sitewide_plugins' => array(), |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
917 |
'WPLANG' => get_locale(), |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
918 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
919 |
if ( ! $subdomain_install ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
920 |
$sitemeta['illegal_names'][] = 'blog'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
921 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
922 |
$insert = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
923 |
foreach ( $sitemeta as $meta_key => $meta_value ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
924 |
$meta_key = $wpdb->escape( $meta_key ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
925 |
if ( is_array( $meta_value ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
926 |
$meta_value = serialize( $meta_value ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
927 |
$meta_value = $wpdb->escape( $meta_value ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
928 |
if ( !empty( $insert ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
929 |
$insert .= ', '; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
930 |
$insert .= "( $network_id, '$meta_key', '$meta_value')"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
931 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
932 |
$wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
933 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
934 |
// When upgrading from single to multisite, assume the current site will become the main site of the network. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
935 |
// When using populate_network() to create another network in an existing multisite environment, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
936 |
// skip these steps since the main site of the new network has not yet been created. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
937 |
if ( ! is_multisite() ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
938 |
$current_site = new stdClass; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
939 |
$current_site->domain = $domain; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
940 |
$current_site->path = $path; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
941 |
$current_site->site_name = ucfirst( $domain ); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
942 |
$wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ) ) ); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
943 |
$current_site->blog_id = $blog_id = $wpdb->insert_id; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
944 |
update_user_meta( $site_user->ID, 'source_domain', $domain ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
945 |
update_user_meta( $site_user->ID, 'primary_blog', $blog_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
946 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
947 |
if ( $subdomain_install ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
948 |
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
949 |
else |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
950 |
$wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
951 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
952 |
flush_rewrite_rules(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
953 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
954 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
955 |
if ( $subdomain_install ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
956 |
$vhost_ok = false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
957 |
$errstr = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
958 |
$hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
959 |
$page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
960 |
if ( is_wp_error( $page ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
961 |
$errstr = $page->get_error_message(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
962 |
elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
963 |
$vhost_ok = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
964 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
965 |
if ( ! $vhost_ok ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
966 |
$msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
967 |
$msg .= '<p>' . sprintf( __( 'The installer attempted to contact a random hostname (<code>%1$s</code>) on your domain.' ), $hostname ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
968 |
if ( ! empty ( $errstr ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
969 |
$msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
970 |
$msg .= '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
971 |
$msg .= '<p>' . __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a <code>*</code> hostname record pointing at your web server in your DNS configuration tool.' ) . '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
972 |
$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>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
973 |
return new WP_Error( 'no_wildcard_dns', $msg ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
974 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
975 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
976 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
977 |
return true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
978 |
} |