87 term_order int(11) NOT NULL default 0, |
88 term_order int(11) NOT NULL default 0, |
88 PRIMARY KEY (object_id,term_taxonomy_id), |
89 PRIMARY KEY (object_id,term_taxonomy_id), |
89 KEY term_taxonomy_id (term_taxonomy_id) |
90 KEY term_taxonomy_id (term_taxonomy_id) |
90 ) $charset_collate; |
91 ) $charset_collate; |
91 CREATE TABLE $wpdb->commentmeta ( |
92 CREATE TABLE $wpdb->commentmeta ( |
92 meta_id bigint(20) unsigned NOT NULL auto_increment, |
93 meta_id bigint(20) unsigned NOT NULL auto_increment, |
93 comment_id bigint(20) unsigned NOT NULL default '0', |
94 comment_id bigint(20) unsigned NOT NULL default '0', |
94 meta_key varchar(255) default NULL, |
95 meta_key varchar(255) default NULL, |
95 meta_value longtext, |
96 meta_value longtext, |
96 PRIMARY KEY (meta_id), |
97 PRIMARY KEY (meta_id), |
97 KEY comment_id (comment_id), |
98 KEY comment_id (comment_id), |
98 KEY meta_key (meta_key($max_index_length)) |
99 KEY meta_key (meta_key($max_index_length)) |
99 ) $charset_collate; |
100 ) $charset_collate; |
100 CREATE TABLE $wpdb->comments ( |
101 CREATE TABLE $wpdb->comments ( |
101 comment_ID bigint(20) unsigned NOT NULL auto_increment, |
102 comment_ID bigint(20) unsigned NOT NULL auto_increment, |
102 comment_post_ID bigint(20) unsigned NOT NULL default '0', |
103 comment_post_ID bigint(20) unsigned NOT NULL default '0', |
103 comment_author tinytext NOT NULL, |
104 comment_author tinytext NOT NULL, |
104 comment_author_email varchar(100) NOT NULL default '', |
105 comment_author_email varchar(100) NOT NULL default '', |
105 comment_author_url varchar(200) NOT NULL default '', |
106 comment_author_url varchar(200) NOT NULL default '', |
106 comment_author_IP varchar(100) NOT NULL default '', |
107 comment_author_IP varchar(100) NOT NULL default '', |
107 comment_date datetime NOT NULL default '0000-00-00 00:00:00', |
108 comment_date datetime NOT NULL default '0000-00-00 00:00:00', |
108 comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', |
109 comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', |
109 comment_content text NOT NULL, |
110 comment_content text NOT NULL, |
110 comment_karma int(11) NOT NULL default '0', |
111 comment_karma int(11) NOT NULL default '0', |
111 comment_approved varchar(20) NOT NULL default '1', |
112 comment_approved varchar(20) NOT NULL default '1', |
112 comment_agent varchar(255) NOT NULL default '', |
113 comment_agent varchar(255) NOT NULL default '', |
113 comment_type varchar(20) NOT NULL default '', |
114 comment_type varchar(20) NOT NULL default '', |
114 comment_parent bigint(20) unsigned NOT NULL default '0', |
115 comment_parent bigint(20) unsigned NOT NULL default '0', |
115 user_id bigint(20) unsigned NOT NULL default '0', |
116 user_id bigint(20) unsigned NOT NULL default '0', |
116 PRIMARY KEY (comment_ID), |
117 PRIMARY KEY (comment_ID), |
117 KEY comment_post_ID (comment_post_ID), |
118 KEY comment_post_ID (comment_post_ID), |
118 KEY comment_approved_date_gmt (comment_approved,comment_date_gmt), |
119 KEY comment_approved_date_gmt (comment_approved,comment_date_gmt), |
119 KEY comment_date_gmt (comment_date_gmt), |
120 KEY comment_date_gmt (comment_date_gmt), |
120 KEY comment_parent (comment_parent), |
121 KEY comment_parent (comment_parent), |
121 KEY comment_author_email (comment_author_email(10)) |
122 KEY comment_author_email (comment_author_email(10)) |
122 ) $charset_collate; |
123 ) $charset_collate; |
123 CREATE TABLE $wpdb->links ( |
124 CREATE TABLE $wpdb->links ( |
124 link_id bigint(20) unsigned NOT NULL auto_increment, |
125 link_id bigint(20) unsigned NOT NULL auto_increment, |
125 link_url varchar(255) NOT NULL default '', |
126 link_url varchar(255) NOT NULL default '', |
126 link_name varchar(255) NOT NULL default '', |
127 link_name varchar(255) NOT NULL default '', |
127 link_image varchar(255) NOT NULL default '', |
128 link_image varchar(255) NOT NULL default '', |
128 link_target varchar(25) NOT NULL default '', |
129 link_target varchar(25) NOT NULL default '', |
129 link_description varchar(255) NOT NULL default '', |
130 link_description varchar(255) NOT NULL default '', |
130 link_visible varchar(20) NOT NULL default 'Y', |
131 link_visible varchar(20) NOT NULL default 'Y', |
131 link_owner bigint(20) unsigned NOT NULL default '1', |
132 link_owner bigint(20) unsigned NOT NULL default '1', |
132 link_rating int(11) NOT NULL default '0', |
133 link_rating int(11) NOT NULL default '0', |
133 link_updated datetime NOT NULL default '0000-00-00 00:00:00', |
134 link_updated datetime NOT NULL default '0000-00-00 00:00:00', |
134 link_rel varchar(255) NOT NULL default '', |
135 link_rel varchar(255) NOT NULL default '', |
135 link_notes mediumtext NOT NULL, |
136 link_notes mediumtext NOT NULL, |
136 link_rss varchar(255) NOT NULL default '', |
137 link_rss varchar(255) NOT NULL default '', |
137 PRIMARY KEY (link_id), |
138 PRIMARY KEY (link_id), |
138 KEY link_visible (link_visible) |
139 KEY link_visible (link_visible) |
139 ) $charset_collate; |
140 ) $charset_collate; |
140 CREATE TABLE $wpdb->options ( |
141 CREATE TABLE $wpdb->options ( |
141 option_id bigint(20) unsigned NOT NULL auto_increment, |
142 option_id bigint(20) unsigned NOT NULL auto_increment, |
142 option_name varchar(191) NOT NULL default '', |
143 option_name varchar(191) NOT NULL default '', |
143 option_value longtext NOT NULL, |
144 option_value longtext NOT NULL, |
144 autoload varchar(20) NOT NULL default 'yes', |
145 autoload varchar(20) NOT NULL default 'yes', |
145 PRIMARY KEY (option_id), |
146 PRIMARY KEY (option_id), |
146 UNIQUE KEY option_name (option_name) |
147 UNIQUE KEY option_name (option_name) |
147 ) $charset_collate; |
148 ) $charset_collate; |
148 CREATE TABLE $wpdb->postmeta ( |
149 CREATE TABLE $wpdb->postmeta ( |
149 meta_id bigint(20) unsigned NOT NULL auto_increment, |
150 meta_id bigint(20) unsigned NOT NULL auto_increment, |
150 post_id bigint(20) unsigned NOT NULL default '0', |
151 post_id bigint(20) unsigned NOT NULL default '0', |
151 meta_key varchar(255) default NULL, |
152 meta_key varchar(255) default NULL, |
152 meta_value longtext, |
153 meta_value longtext, |
153 PRIMARY KEY (meta_id), |
154 PRIMARY KEY (meta_id), |
154 KEY post_id (post_id), |
155 KEY post_id (post_id), |
155 KEY meta_key (meta_key($max_index_length)) |
156 KEY meta_key (meta_key($max_index_length)) |
156 ) $charset_collate; |
157 ) $charset_collate; |
157 CREATE TABLE $wpdb->posts ( |
158 CREATE TABLE $wpdb->posts ( |
158 ID bigint(20) unsigned NOT NULL auto_increment, |
159 ID bigint(20) unsigned NOT NULL auto_increment, |
159 post_author bigint(20) unsigned NOT NULL default '0', |
160 post_author bigint(20) unsigned NOT NULL default '0', |
160 post_date datetime NOT NULL default '0000-00-00 00:00:00', |
161 post_date datetime NOT NULL default '0000-00-00 00:00:00', |
161 post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', |
162 post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', |
162 post_content longtext NOT NULL, |
163 post_content longtext NOT NULL, |
163 post_title text NOT NULL, |
164 post_title text NOT NULL, |
164 post_excerpt text NOT NULL, |
165 post_excerpt text NOT NULL, |
165 post_status varchar(20) NOT NULL default 'publish', |
166 post_status varchar(20) NOT NULL default 'publish', |
166 comment_status varchar(20) NOT NULL default 'open', |
167 comment_status varchar(20) NOT NULL default 'open', |
167 ping_status varchar(20) NOT NULL default 'open', |
168 ping_status varchar(20) NOT NULL default 'open', |
168 post_password varchar(255) NOT NULL default '', |
169 post_password varchar(255) NOT NULL default '', |
169 post_name varchar(200) NOT NULL default '', |
170 post_name varchar(200) NOT NULL default '', |
170 to_ping text NOT NULL, |
171 to_ping text NOT NULL, |
171 pinged text NOT NULL, |
172 pinged text NOT NULL, |
172 post_modified datetime NOT NULL default '0000-00-00 00:00:00', |
173 post_modified datetime NOT NULL default '0000-00-00 00:00:00', |
173 post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', |
174 post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', |
174 post_content_filtered longtext NOT NULL, |
175 post_content_filtered longtext NOT NULL, |
175 post_parent bigint(20) unsigned NOT NULL default '0', |
176 post_parent bigint(20) unsigned NOT NULL default '0', |
176 guid varchar(255) NOT NULL default '', |
177 guid varchar(255) NOT NULL default '', |
177 menu_order int(11) NOT NULL default '0', |
178 menu_order int(11) NOT NULL default '0', |
178 post_type varchar(20) NOT NULL default 'post', |
179 post_type varchar(20) NOT NULL default 'post', |
179 post_mime_type varchar(100) NOT NULL default '', |
180 post_mime_type varchar(100) NOT NULL default '', |
180 comment_count bigint(20) NOT NULL default '0', |
181 comment_count bigint(20) NOT NULL default '0', |
181 PRIMARY KEY (ID), |
182 PRIMARY KEY (ID), |
182 KEY post_name (post_name($max_index_length)), |
183 KEY post_name (post_name($max_index_length)), |
183 KEY type_status_date (post_type,post_status,post_date,ID), |
184 KEY type_status_date (post_type,post_status,post_date,ID), |
184 KEY post_parent (post_parent), |
185 KEY post_parent (post_parent), |
185 KEY post_author (post_author) |
186 KEY post_author (post_author) |
186 ) $charset_collate;\n"; |
187 ) $charset_collate;\n"; |
187 |
188 |
188 // Single site users table. The multisite flavor of the users table is handled below. |
189 // Single site users table. The multisite flavor of the users table is handled below. |
189 $users_single_table = "CREATE TABLE $wpdb->users ( |
190 $users_single_table = "CREATE TABLE $wpdb->users ( |
190 ID bigint(20) unsigned NOT NULL auto_increment, |
191 ID bigint(20) unsigned NOT NULL auto_increment, |
191 user_login varchar(60) NOT NULL default '', |
192 user_login varchar(60) NOT NULL default '', |
192 user_pass varchar(255) NOT NULL default '', |
193 user_pass varchar(255) NOT NULL default '', |
193 user_nicename varchar(50) NOT NULL default '', |
194 user_nicename varchar(50) NOT NULL default '', |
194 user_email varchar(100) NOT NULL default '', |
195 user_email varchar(100) NOT NULL default '', |
195 user_url varchar(100) NOT NULL default '', |
196 user_url varchar(100) NOT NULL default '', |
196 user_registered datetime NOT NULL default '0000-00-00 00:00:00', |
197 user_registered datetime NOT NULL default '0000-00-00 00:00:00', |
197 user_activation_key varchar(255) NOT NULL default '', |
198 user_activation_key varchar(255) NOT NULL default '', |
198 user_status int(11) NOT NULL default '0', |
199 user_status int(11) NOT NULL default '0', |
199 display_name varchar(250) NOT NULL default '', |
200 display_name varchar(250) NOT NULL default '', |
200 PRIMARY KEY (ID), |
201 PRIMARY KEY (ID), |
201 KEY user_login_key (user_login), |
202 KEY user_login_key (user_login), |
202 KEY user_nicename (user_nicename), |
203 KEY user_nicename (user_nicename), |
203 KEY user_email (user_email) |
204 KEY user_email (user_email) |
204 ) $charset_collate;\n"; |
205 ) $charset_collate;\n"; |
205 |
206 |
206 // Multisite users table |
207 // Multisite users table |
207 $users_multi_table = "CREATE TABLE $wpdb->users ( |
208 $users_multi_table = "CREATE TABLE $wpdb->users ( |
208 ID bigint(20) unsigned NOT NULL auto_increment, |
209 ID bigint(20) unsigned NOT NULL auto_increment, |
209 user_login varchar(60) NOT NULL default '', |
210 user_login varchar(60) NOT NULL default '', |
210 user_pass varchar(255) NOT NULL default '', |
211 user_pass varchar(255) NOT NULL default '', |
211 user_nicename varchar(50) NOT NULL default '', |
212 user_nicename varchar(50) NOT NULL default '', |
212 user_email varchar(100) NOT NULL default '', |
213 user_email varchar(100) NOT NULL default '', |
213 user_url varchar(100) NOT NULL default '', |
214 user_url varchar(100) NOT NULL default '', |
214 user_registered datetime NOT NULL default '0000-00-00 00:00:00', |
215 user_registered datetime NOT NULL default '0000-00-00 00:00:00', |
215 user_activation_key varchar(255) NOT NULL default '', |
216 user_activation_key varchar(255) NOT NULL default '', |
216 user_status int(11) NOT NULL default '0', |
217 user_status int(11) NOT NULL default '0', |
217 display_name varchar(250) NOT NULL default '', |
218 display_name varchar(250) NOT NULL default '', |
218 spam tinyint(2) NOT NULL default '0', |
219 spam tinyint(2) NOT NULL default '0', |
219 deleted tinyint(2) NOT NULL default '0', |
220 deleted tinyint(2) NOT NULL default '0', |
220 PRIMARY KEY (ID), |
221 PRIMARY KEY (ID), |
221 KEY user_login_key (user_login), |
222 KEY user_login_key (user_login), |
222 KEY user_nicename (user_nicename), |
223 KEY user_nicename (user_nicename), |
223 KEY user_email (user_email) |
224 KEY user_email (user_email) |
224 ) $charset_collate;\n"; |
225 ) $charset_collate;\n"; |
225 |
226 |
226 // Usermeta. |
227 // Usermeta. |
227 $usermeta_table = "CREATE TABLE $wpdb->usermeta ( |
228 $usermeta_table = "CREATE TABLE $wpdb->usermeta ( |
228 umeta_id bigint(20) unsigned NOT NULL auto_increment, |
229 umeta_id bigint(20) unsigned NOT NULL auto_increment, |
229 user_id bigint(20) unsigned NOT NULL default '0', |
230 user_id bigint(20) unsigned NOT NULL default '0', |
230 meta_key varchar(255) default NULL, |
231 meta_key varchar(255) default NULL, |
231 meta_value longtext, |
232 meta_value longtext, |
232 PRIMARY KEY (umeta_id), |
233 PRIMARY KEY (umeta_id), |
233 KEY user_id (user_id), |
234 KEY user_id (user_id), |
234 KEY meta_key (meta_key($max_index_length)) |
235 KEY meta_key (meta_key($max_index_length)) |
235 ) $charset_collate;\n"; |
236 ) $charset_collate;\n"; |
236 |
237 |
237 // Global tables |
238 // Global tables |
238 if ( $is_multisite ) |
239 if ( $is_multisite ) { |
239 $global_tables = $users_multi_table . $usermeta_table; |
240 $global_tables = $users_multi_table . $usermeta_table; |
240 else |
241 } else { |
241 $global_tables = $users_single_table . $usermeta_table; |
242 $global_tables = $users_single_table . $usermeta_table; |
|
243 } |
242 |
244 |
243 // Multisite global tables. |
245 // Multisite global tables. |
244 $ms_global_tables = "CREATE TABLE $wpdb->blogs ( |
246 $ms_global_tables = "CREATE TABLE $wpdb->blogs ( |
245 blog_id bigint(20) NOT NULL auto_increment, |
247 blog_id bigint(20) NOT NULL auto_increment, |
246 site_id bigint(20) NOT NULL default '0', |
248 site_id bigint(20) NOT NULL default '0', |
247 domain varchar(200) NOT NULL default '', |
249 domain varchar(200) NOT NULL default '', |
248 path varchar(100) NOT NULL default '', |
250 path varchar(100) NOT NULL default '', |
249 registered datetime NOT NULL default '0000-00-00 00:00:00', |
251 registered datetime NOT NULL default '0000-00-00 00:00:00', |
250 last_updated datetime NOT NULL default '0000-00-00 00:00:00', |
252 last_updated datetime NOT NULL default '0000-00-00 00:00:00', |
251 public tinyint(2) NOT NULL default '1', |
253 public tinyint(2) NOT NULL default '1', |
252 archived tinyint(2) NOT NULL default '0', |
254 archived tinyint(2) NOT NULL default '0', |
253 mature tinyint(2) NOT NULL default '0', |
255 mature tinyint(2) NOT NULL default '0', |
254 spam tinyint(2) NOT NULL default '0', |
256 spam tinyint(2) NOT NULL default '0', |
255 deleted tinyint(2) NOT NULL default '0', |
257 deleted tinyint(2) NOT NULL default '0', |
256 lang_id int(11) NOT NULL default '0', |
258 lang_id int(11) NOT NULL default '0', |
257 PRIMARY KEY (blog_id), |
259 PRIMARY KEY (blog_id), |
258 KEY domain (domain(50),path(5)), |
260 KEY domain (domain(50),path(5)), |
259 KEY lang_id (lang_id) |
261 KEY lang_id (lang_id) |
260 ) $charset_collate; |
262 ) $charset_collate; |
261 CREATE TABLE $wpdb->blog_versions ( |
263 CREATE TABLE $wpdb->blog_versions ( |
262 blog_id bigint(20) NOT NULL default '0', |
264 blog_id bigint(20) NOT NULL default '0', |
263 db_version varchar(20) NOT NULL default '', |
265 db_version varchar(20) NOT NULL default '', |
264 last_updated datetime NOT NULL default '0000-00-00 00:00:00', |
266 last_updated datetime NOT NULL default '0000-00-00 00:00:00', |
265 PRIMARY KEY (blog_id), |
267 PRIMARY KEY (blog_id), |
266 KEY db_version (db_version) |
268 KEY db_version (db_version) |
|
269 ) $charset_collate; |
|
270 CREATE TABLE $wpdb->blogmeta ( |
|
271 meta_id bigint(20) unsigned NOT NULL auto_increment, |
|
272 blog_id bigint(20) NOT NULL default '0', |
|
273 meta_key varchar(255) default NULL, |
|
274 meta_value longtext, |
|
275 PRIMARY KEY (meta_id), |
|
276 KEY meta_key (meta_key($max_index_length)), |
|
277 KEY blog_id (blog_id) |
267 ) $charset_collate; |
278 ) $charset_collate; |
268 CREATE TABLE $wpdb->registration_log ( |
279 CREATE TABLE $wpdb->registration_log ( |
269 ID bigint(20) NOT NULL auto_increment, |
280 ID bigint(20) NOT NULL auto_increment, |
270 email varchar(255) NOT NULL default '', |
281 email varchar(255) NOT NULL default '', |
271 IP varchar(30) NOT NULL default '', |
282 IP varchar(30) NOT NULL default '', |
272 blog_id bigint(20) NOT NULL default '0', |
283 blog_id bigint(20) NOT NULL default '0', |
273 date_registered datetime NOT NULL default '0000-00-00 00:00:00', |
284 date_registered datetime NOT NULL default '0000-00-00 00:00:00', |
274 PRIMARY KEY (ID), |
285 PRIMARY KEY (ID), |
275 KEY IP (IP) |
286 KEY IP (IP) |
276 ) $charset_collate; |
287 ) $charset_collate; |
277 CREATE TABLE $wpdb->site ( |
288 CREATE TABLE $wpdb->site ( |
278 id bigint(20) NOT NULL auto_increment, |
289 id bigint(20) NOT NULL auto_increment, |
279 domain varchar(200) NOT NULL default '', |
290 domain varchar(200) NOT NULL default '', |
280 path varchar(100) NOT NULL default '', |
291 path varchar(100) NOT NULL default '', |
281 PRIMARY KEY (id), |
292 PRIMARY KEY (id), |
282 KEY domain (domain(140),path(51)) |
293 KEY domain (domain(140),path(51)) |
283 ) $charset_collate; |
294 ) $charset_collate; |
284 CREATE TABLE $wpdb->sitemeta ( |
295 CREATE TABLE $wpdb->sitemeta ( |
285 meta_id bigint(20) NOT NULL auto_increment, |
296 meta_id bigint(20) NOT NULL auto_increment, |
286 site_id bigint(20) NOT NULL default '0', |
297 site_id bigint(20) NOT NULL default '0', |
287 meta_key varchar(255) default NULL, |
298 meta_key varchar(255) default NULL, |
288 meta_value longtext, |
299 meta_value longtext, |
289 PRIMARY KEY (meta_id), |
300 PRIMARY KEY (meta_id), |
290 KEY meta_key (meta_key($max_index_length)), |
301 KEY meta_key (meta_key($max_index_length)), |
291 KEY site_id (site_id) |
302 KEY site_id (site_id) |
292 ) $charset_collate; |
303 ) $charset_collate; |
293 CREATE TABLE $wpdb->signups ( |
304 CREATE TABLE $wpdb->signups ( |
294 signup_id bigint(20) NOT NULL auto_increment, |
305 signup_id bigint(20) NOT NULL auto_increment, |
295 domain varchar(200) NOT NULL default '', |
306 domain varchar(200) NOT NULL default '', |
296 path varchar(100) NOT NULL default '', |
307 path varchar(100) NOT NULL default '', |
297 title longtext NOT NULL, |
308 title longtext NOT NULL, |
298 user_login varchar(60) NOT NULL default '', |
309 user_login varchar(60) NOT NULL default '', |
299 user_email varchar(100) NOT NULL default '', |
310 user_email varchar(100) NOT NULL default '', |
300 registered datetime NOT NULL default '0000-00-00 00:00:00', |
311 registered datetime NOT NULL default '0000-00-00 00:00:00', |
301 activated datetime NOT NULL default '0000-00-00 00:00:00', |
312 activated datetime NOT NULL default '0000-00-00 00:00:00', |
302 active tinyint(1) NOT NULL default '0', |
313 active tinyint(1) NOT NULL default '0', |
303 activation_key varchar(50) NOT NULL default '', |
314 activation_key varchar(50) NOT NULL default '', |
304 meta longtext, |
315 meta longtext, |
305 PRIMARY KEY (signup_id), |
316 PRIMARY KEY (signup_id), |
306 KEY activation_key (activation_key), |
317 KEY activation_key (activation_key), |
307 KEY user_email (user_email), |
318 KEY user_email (user_email), |
308 KEY user_login_email (user_login,user_email), |
319 KEY user_login_email (user_login,user_email), |
309 KEY domain_path (domain(140),path(51)) |
320 KEY domain_path (domain(140),path(51)) |
310 ) $charset_collate;"; |
321 ) $charset_collate;"; |
311 |
322 |
312 switch ( $scope ) { |
323 switch ( $scope ) { |
313 case 'blog' : |
324 case 'blog': |
314 $queries = $blog_tables; |
325 $queries = $blog_tables; |
315 break; |
326 break; |
316 case 'global' : |
327 case 'global': |
317 $queries = $global_tables; |
328 $queries = $global_tables; |
318 if ( $is_multisite ) |
329 if ( $is_multisite ) { |
319 $queries .= $ms_global_tables; |
330 $queries .= $ms_global_tables; |
|
331 } |
320 break; |
332 break; |
321 case 'ms_global' : |
333 case 'ms_global': |
322 $queries = $ms_global_tables; |
334 $queries = $ms_global_tables; |
323 break; |
335 break; |
324 case 'all' : |
336 case 'all': |
325 default: |
337 default: |
326 $queries = $global_tables . $blog_tables; |
338 $queries = $global_tables . $blog_tables; |
327 if ( $is_multisite ) |
339 if ( $is_multisite ) { |
328 $queries .= $ms_global_tables; |
340 $queries .= $ms_global_tables; |
|
341 } |
329 break; |
342 break; |
330 } |
343 } |
331 |
344 |
332 if ( isset( $old_blog_id ) ) |
345 if ( isset( $old_blog_id ) ) { |
333 $wpdb->set_blog_id( $old_blog_id ); |
346 $wpdb->set_blog_id( $old_blog_id ); |
|
347 } |
334 |
348 |
335 return $queries; |
349 return $queries; |
336 } |
350 } |
337 |
351 |
338 // Populate for back compat. |
352 // Populate for back compat. |
377 $stylesheet = $theme->get_stylesheet(); |
395 $stylesheet = $theme->get_stylesheet(); |
378 $template = $theme->get_template(); |
396 $template = $theme->get_template(); |
379 } |
397 } |
380 |
398 |
381 $timezone_string = ''; |
399 $timezone_string = ''; |
382 $gmt_offset = 0; |
400 $gmt_offset = 0; |
383 /* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14) |
401 /* |
384 or a valid timezone string (America/New_York). See https://secure.php.net/manual/en/timezones.php |
402 * translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14) |
385 for all timezone strings supported by PHP. |
403 * or a valid timezone string (America/New_York). See https://secure.php.net/manual/en/timezones.php |
386 */ |
404 * for all timezone strings supported by PHP. |
387 $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); |
405 */ |
388 if ( is_numeric( $offset_or_tz ) ) |
406 $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings |
|
407 if ( is_numeric( $offset_or_tz ) ) { |
389 $gmt_offset = $offset_or_tz; |
408 $gmt_offset = $offset_or_tz; |
390 elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) |
409 } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) { |
391 $timezone_string = $offset_or_tz; |
410 $timezone_string = $offset_or_tz; |
392 |
411 } |
393 $options = array( |
412 |
394 'siteurl' => $guessurl, |
413 $defaults = array( |
395 'home' => $guessurl, |
414 'siteurl' => $guessurl, |
396 'blogname' => __('My Site'), |
415 'home' => $guessurl, |
397 /* translators: site tagline */ |
416 'blogname' => __( 'My Site' ), |
398 'blogdescription' => __('Just another WordPress site'), |
417 /* translators: site tagline */ |
399 'users_can_register' => 0, |
418 'blogdescription' => __( 'Just another WordPress site' ), |
400 'admin_email' => 'you@example.com', |
419 'users_can_register' => 0, |
401 /* translators: default start of the week. 0 = Sunday, 1 = Monday */ |
420 'admin_email' => 'you@example.com', |
402 'start_of_week' => _x( '1', 'start of week' ), |
421 /* translators: default start of the week. 0 = Sunday, 1 = Monday */ |
403 'use_balanceTags' => 0, |
422 'start_of_week' => _x( '1', 'start of week' ), |
404 'use_smilies' => 1, |
423 'use_balanceTags' => 0, |
405 'require_name_email' => 1, |
424 'use_smilies' => 1, |
406 'comments_notify' => 1, |
425 'require_name_email' => 1, |
407 'posts_per_rss' => 10, |
426 'comments_notify' => 1, |
408 'rss_use_excerpt' => 0, |
427 'posts_per_rss' => 10, |
409 'mailserver_url' => 'mail.example.com', |
428 'rss_use_excerpt' => 0, |
410 'mailserver_login' => 'login@example.com', |
429 'mailserver_url' => 'mail.example.com', |
411 'mailserver_pass' => 'password', |
430 'mailserver_login' => 'login@example.com', |
412 'mailserver_port' => 110, |
431 'mailserver_pass' => 'password', |
413 'default_category' => 1, |
432 'mailserver_port' => 110, |
414 'default_comment_status' => 'open', |
433 'default_category' => 1, |
415 'default_ping_status' => 'open', |
434 'default_comment_status' => 'open', |
416 'default_pingback_flag' => 1, |
435 'default_ping_status' => 'open', |
417 'posts_per_page' => 10, |
436 'default_pingback_flag' => 1, |
418 /* translators: default date format, see https://secure.php.net/date */ |
437 'posts_per_page' => 10, |
419 'date_format' => __('F j, Y'), |
438 /* translators: default date format, see https://secure.php.net/date */ |
420 /* translators: default time format, see https://secure.php.net/date */ |
439 'date_format' => __( 'F j, Y' ), |
421 'time_format' => __('g:i a'), |
440 /* translators: default time format, see https://secure.php.net/date */ |
422 /* translators: links last updated date format, see https://secure.php.net/date */ |
441 'time_format' => __( 'g:i a' ), |
423 'links_updated_date_format' => __('F j, Y g:i a'), |
442 /* translators: links last updated date format, see https://secure.php.net/date */ |
424 'comment_moderation' => 0, |
443 'links_updated_date_format' => __( 'F j, Y g:i a' ), |
425 'moderation_notify' => 1, |
444 'comment_moderation' => 0, |
426 'permalink_structure' => '', |
445 'moderation_notify' => 1, |
427 'rewrite_rules' => '', |
446 'permalink_structure' => '', |
428 'hack_file' => 0, |
447 'rewrite_rules' => '', |
429 'blog_charset' => 'UTF-8', |
448 'hack_file' => 0, |
430 'moderation_keys' => '', |
449 'blog_charset' => 'UTF-8', |
431 'active_plugins' => array(), |
450 'moderation_keys' => '', |
432 'category_base' => '', |
451 'active_plugins' => array(), |
433 'ping_sites' => 'http://rpc.pingomatic.com/', |
452 'category_base' => '', |
434 'comment_max_links' => 2, |
453 'ping_sites' => 'http://rpc.pingomatic.com/', |
435 'gmt_offset' => $gmt_offset, |
454 'comment_max_links' => 2, |
436 |
455 'gmt_offset' => $gmt_offset, |
437 // 1.5 |
456 |
438 'default_email_category' => 1, |
457 // 1.5 |
439 'recently_edited' => '', |
458 'default_email_category' => 1, |
440 'template' => $template, |
459 'recently_edited' => '', |
441 'stylesheet' => $stylesheet, |
460 'template' => $template, |
442 'comment_whitelist' => 1, |
461 'stylesheet' => $stylesheet, |
443 'blacklist_keys' => '', |
462 'comment_whitelist' => 1, |
444 'comment_registration' => 0, |
463 'blacklist_keys' => '', |
445 'html_type' => 'text/html', |
464 'comment_registration' => 0, |
446 |
465 'html_type' => 'text/html', |
447 // 1.5.1 |
466 |
448 'use_trackback' => 0, |
467 // 1.5.1 |
449 |
468 'use_trackback' => 0, |
450 // 2.0 |
469 |
451 'default_role' => 'subscriber', |
470 // 2.0 |
452 'db_version' => $wp_db_version, |
471 'default_role' => 'subscriber', |
453 |
472 'db_version' => $wp_db_version, |
454 // 2.0.1 |
473 |
455 'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders, |
474 // 2.0.1 |
456 'upload_path' => '', |
475 'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders, |
457 |
476 'upload_path' => '', |
458 // 2.1 |
477 |
459 'blog_public' => '1', |
478 // 2.1 |
460 'default_link_category' => 2, |
479 'blog_public' => '1', |
461 'show_on_front' => 'posts', |
480 'default_link_category' => 2, |
462 |
481 'show_on_front' => 'posts', |
463 // 2.2 |
482 |
464 'tag_base' => '', |
483 // 2.2 |
465 |
484 'tag_base' => '', |
466 // 2.5 |
485 |
467 'show_avatars' => '1', |
486 // 2.5 |
468 'avatar_rating' => 'G', |
487 'show_avatars' => '1', |
469 'upload_url_path' => '', |
488 'avatar_rating' => 'G', |
470 'thumbnail_size_w' => 150, |
489 'upload_url_path' => '', |
471 'thumbnail_size_h' => 150, |
490 'thumbnail_size_w' => 150, |
472 'thumbnail_crop' => 1, |
491 'thumbnail_size_h' => 150, |
473 'medium_size_w' => 300, |
492 'thumbnail_crop' => 1, |
474 'medium_size_h' => 300, |
493 'medium_size_w' => 300, |
475 |
494 'medium_size_h' => 300, |
476 // 2.6 |
495 |
477 'avatar_default' => 'mystery', |
496 // 2.6 |
478 |
497 'avatar_default' => 'mystery', |
479 // 2.7 |
498 |
480 'large_size_w' => 1024, |
499 // 2.7 |
481 'large_size_h' => 1024, |
500 'large_size_w' => 1024, |
482 'image_default_link_type' => 'none', |
501 'large_size_h' => 1024, |
483 'image_default_size' => '', |
502 'image_default_link_type' => 'none', |
484 'image_default_align' => '', |
503 'image_default_size' => '', |
485 'close_comments_for_old_posts' => 0, |
504 'image_default_align' => '', |
486 'close_comments_days_old' => 14, |
505 'close_comments_for_old_posts' => 0, |
487 'thread_comments' => 1, |
506 'close_comments_days_old' => 14, |
488 'thread_comments_depth' => 5, |
507 'thread_comments' => 1, |
489 'page_comments' => 0, |
508 'thread_comments_depth' => 5, |
490 'comments_per_page' => 50, |
509 'page_comments' => 0, |
491 'default_comments_page' => 'newest', |
510 'comments_per_page' => 50, |
492 'comment_order' => 'asc', |
511 'default_comments_page' => 'newest', |
493 'sticky_posts' => array(), |
512 'comment_order' => 'asc', |
494 'widget_categories' => array(), |
513 'sticky_posts' => array(), |
495 'widget_text' => array(), |
514 'widget_categories' => array(), |
496 'widget_rss' => array(), |
515 'widget_text' => array(), |
497 'uninstall_plugins' => array(), |
516 'widget_rss' => array(), |
498 |
517 'uninstall_plugins' => array(), |
499 // 2.8 |
518 |
500 'timezone_string' => $timezone_string, |
519 // 2.8 |
501 |
520 'timezone_string' => $timezone_string, |
502 // 3.0 |
521 |
503 'page_for_posts' => 0, |
522 // 3.0 |
504 'page_on_front' => 0, |
523 'page_for_posts' => 0, |
505 |
524 'page_on_front' => 0, |
506 // 3.1 |
525 |
507 'default_post_format' => 0, |
526 // 3.1 |
508 |
527 'default_post_format' => 0, |
509 // 3.5 |
528 |
510 'link_manager_enabled' => 0, |
529 // 3.5 |
511 |
530 'link_manager_enabled' => 0, |
512 // 4.3.0 |
531 |
513 'finished_splitting_shared_terms' => 1, |
532 // 4.3.0 |
514 'site_icon' => 0, |
533 'finished_splitting_shared_terms' => 1, |
515 |
534 'site_icon' => 0, |
516 // 4.4.0 |
535 |
517 'medium_large_size_w' => 768, |
536 // 4.4.0 |
518 'medium_large_size_h' => 0, |
537 'medium_large_size_w' => 768, |
|
538 'medium_large_size_h' => 0, |
519 |
539 |
520 // 4.9.6 |
540 // 4.9.6 |
521 'wp_page_for_privacy_policy' => 0, |
541 'wp_page_for_privacy_policy' => 0, |
522 |
542 |
523 // 4.9.8 |
543 // 4.9.8 |
524 'show_comments_cookies_opt_in' => 0, |
544 'show_comments_cookies_opt_in' => 1, |
525 ); |
545 ); |
526 |
546 |
527 // 3.3 |
547 // 3.3 |
528 if ( ! is_multisite() ) { |
548 if ( ! is_multisite() ) { |
529 $options['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version |
549 $defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version |
530 ? $wp_current_db_version : $wp_db_version; |
550 ? $wp_current_db_version : $wp_db_version; |
531 } |
551 } |
532 |
552 |
533 // 3.0 multisite |
553 // 3.0 multisite |
534 if ( is_multisite() ) { |
554 if ( is_multisite() ) { |
535 /* translators: site tagline */ |
555 /* translators: site tagline */ |
536 $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), get_network()->site_name ); |
556 $defaults['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name ); |
537 $options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/'; |
557 $defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/'; |
538 } |
558 } |
|
559 |
|
560 $options = wp_parse_args( $options, $defaults ); |
539 |
561 |
540 // Set autoload to no for these options |
562 // Set autoload to no for these options |
541 $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins' ); |
563 $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins' ); |
542 |
564 |
543 $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; |
565 $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; |
544 $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); |
566 $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
545 |
567 |
546 $insert = ''; |
568 $insert = ''; |
547 foreach ( $options as $option => $value ) { |
569 foreach ( $options as $option => $value ) { |
548 if ( in_array($option, $existing_options) ) |
570 if ( in_array( $option, $existing_options ) ) { |
549 continue; |
571 continue; |
550 if ( in_array($option, $fat_options) ) |
572 } |
|
573 if ( in_array( $option, $fat_options ) ) { |
551 $autoload = 'no'; |
574 $autoload = 'no'; |
552 else |
575 } else { |
553 $autoload = 'yes'; |
576 $autoload = 'yes'; |
554 |
577 } |
555 if ( is_array($value) ) |
578 |
556 $value = serialize($value); |
579 if ( is_array( $value ) ) { |
557 if ( !empty($insert) ) |
580 $value = serialize( $value ); |
|
581 } |
|
582 if ( ! empty( $insert ) ) { |
558 $insert .= ', '; |
583 $insert .= ', '; |
559 $insert .= $wpdb->prepare( "(%s, %s, %s)", $option, $value, $autoload ); |
584 } |
560 } |
585 $insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload ); |
561 |
586 } |
562 if ( !empty($insert) ) |
587 |
563 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert); |
588 if ( ! empty( $insert ) ) { |
|
589 $wpdb->query( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
590 } |
564 |
591 |
565 // In case it is set, but blank, update "home". |
592 // In case it is set, but blank, update "home". |
566 if ( !__get_option('home') ) update_option('home', $guessurl); |
593 if ( ! __get_option( 'home' ) ) { |
|
594 update_option( 'home', $guessurl ); |
|
595 } |
567 |
596 |
568 // Delete unused options. |
597 // Delete unused options. |
569 $unusedoptions = array( |
598 $unusedoptions = array( |
570 'blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', |
599 'blodotgsping_url', |
571 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', |
600 'bodyterminator', |
572 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', |
601 'emailtestonly', |
573 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', |
602 'phoneemail_separator', |
574 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', |
603 'smilies_directory', |
575 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', |
604 'subjectprefix', |
576 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', |
605 'use_bbcode', |
577 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', |
606 'use_blodotgsping', |
578 'links_recently_updated_time', 'links_recently_updated_prepend', 'links_recently_updated_append', |
607 'use_phoneemail', |
579 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', |
608 'use_quicktags', |
580 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', |
609 'use_weblogsping', |
581 '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', |
610 'weblogs_cache_file', |
582 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', |
611 'use_preview', |
583 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page', |
612 'use_htmltrans', |
584 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app', |
613 'smilies_directory', |
585 'embed_autourls', 'default_post_edit_rows', 'gzipcompression', 'advanced_edit' |
614 'fileupload_allowedusers', |
|
615 'use_phoneemail', |
|
616 'default_post_status', |
|
617 'default_post_category', |
|
618 'archive_mode', |
|
619 'time_difference', |
|
620 'links_minadminlevel', |
|
621 'links_use_adminlevels', |
|
622 'links_rating_type', |
|
623 'links_rating_char', |
|
624 'links_rating_ignore_zero', |
|
625 'links_rating_single_image', |
|
626 'links_rating_image0', |
|
627 'links_rating_image1', |
|
628 'links_rating_image2', |
|
629 'links_rating_image3', |
|
630 'links_rating_image4', |
|
631 'links_rating_image5', |
|
632 'links_rating_image6', |
|
633 'links_rating_image7', |
|
634 'links_rating_image8', |
|
635 'links_rating_image9', |
|
636 'links_recently_updated_time', |
|
637 'links_recently_updated_prepend', |
|
638 'links_recently_updated_append', |
|
639 'weblogs_cacheminutes', |
|
640 'comment_allowed_tags', |
|
641 'search_engine_friendly_urls', |
|
642 'default_geourl_lat', |
|
643 'default_geourl_lon', |
|
644 'use_default_geourl', |
|
645 'weblogs_xml_url', |
|
646 'new_users_can_blog', |
|
647 '_wpnonce', |
|
648 '_wp_http_referer', |
|
649 'Update', |
|
650 'action', |
|
651 'rich_editing', |
|
652 'autosave_interval', |
|
653 'deactivated_plugins', |
|
654 'can_compress_scripts', |
|
655 'page_uris', |
|
656 'update_core', |
|
657 'update_plugins', |
|
658 'update_themes', |
|
659 'doing_cron', |
|
660 'random_seed', |
|
661 'rss_excerpt_length', |
|
662 'secret', |
|
663 'use_linksupdate', |
|
664 'default_comment_status_page', |
|
665 'wporg_popular_tags', |
|
666 'what_to_show', |
|
667 'rss_language', |
|
668 'language', |
|
669 'enable_xmlrpc', |
|
670 'enable_app', |
|
671 'embed_autourls', |
|
672 'default_post_edit_rows', |
|
673 'gzipcompression', |
|
674 'advanced_edit', |
586 ); |
675 ); |
587 foreach ( $unusedoptions as $option ) |
676 foreach ( $unusedoptions as $option ) { |
588 delete_option($option); |
677 delete_option( $option ); |
|
678 } |
589 |
679 |
590 // Delete obsolete magpie stuff. |
680 // Delete obsolete magpie stuff. |
591 $wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'"); |
681 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" ); |
592 |
682 |
593 // Clear expired transients |
683 // Clear expired transients |
594 delete_expired_transients( true ); |
684 delete_expired_transients( true ); |
595 } |
685 } |
596 |
686 |
616 * @since 2.0.0 |
706 * @since 2.0.0 |
617 */ |
707 */ |
618 function populate_roles_160() { |
708 function populate_roles_160() { |
619 // Add roles |
709 // Add roles |
620 |
710 |
621 // Dummy gettext calls to get strings in the catalog. |
711 add_role( 'administrator', 'Administrator' ); |
622 /* translators: user role */ |
712 add_role( 'editor', 'Editor' ); |
623 _x('Administrator', 'User role'); |
713 add_role( 'author', 'Author' ); |
624 /* translators: user role */ |
714 add_role( 'contributor', 'Contributor' ); |
625 _x('Editor', 'User role'); |
715 add_role( 'subscriber', 'Subscriber' ); |
626 /* translators: user role */ |
|
627 _x('Author', 'User role'); |
|
628 /* translators: user role */ |
|
629 _x('Contributor', 'User role'); |
|
630 /* translators: user role */ |
|
631 _x('Subscriber', 'User role'); |
|
632 |
|
633 add_role('administrator', 'Administrator'); |
|
634 add_role('editor', 'Editor'); |
|
635 add_role('author', 'Author'); |
|
636 add_role('contributor', 'Contributor'); |
|
637 add_role('subscriber', 'Subscriber'); |
|
638 |
716 |
639 // Add caps for Administrator role |
717 // Add caps for Administrator role |
640 $role = get_role('administrator'); |
718 $role = get_role( 'administrator' ); |
641 $role->add_cap('switch_themes'); |
719 $role->add_cap( 'switch_themes' ); |
642 $role->add_cap('edit_themes'); |
720 $role->add_cap( 'edit_themes' ); |
643 $role->add_cap('activate_plugins'); |
721 $role->add_cap( 'activate_plugins' ); |
644 $role->add_cap('edit_plugins'); |
722 $role->add_cap( 'edit_plugins' ); |
645 $role->add_cap('edit_users'); |
723 $role->add_cap( 'edit_users' ); |
646 $role->add_cap('edit_files'); |
724 $role->add_cap( 'edit_files' ); |
647 $role->add_cap('manage_options'); |
725 $role->add_cap( 'manage_options' ); |
648 $role->add_cap('moderate_comments'); |
726 $role->add_cap( 'moderate_comments' ); |
649 $role->add_cap('manage_categories'); |
727 $role->add_cap( 'manage_categories' ); |
650 $role->add_cap('manage_links'); |
728 $role->add_cap( 'manage_links' ); |
651 $role->add_cap('upload_files'); |
729 $role->add_cap( 'upload_files' ); |
652 $role->add_cap('import'); |
730 $role->add_cap( 'import' ); |
653 $role->add_cap('unfiltered_html'); |
731 $role->add_cap( 'unfiltered_html' ); |
654 $role->add_cap('edit_posts'); |
732 $role->add_cap( 'edit_posts' ); |
655 $role->add_cap('edit_others_posts'); |
733 $role->add_cap( 'edit_others_posts' ); |
656 $role->add_cap('edit_published_posts'); |
734 $role->add_cap( 'edit_published_posts' ); |
657 $role->add_cap('publish_posts'); |
735 $role->add_cap( 'publish_posts' ); |
658 $role->add_cap('edit_pages'); |
736 $role->add_cap( 'edit_pages' ); |
659 $role->add_cap('read'); |
737 $role->add_cap( 'read' ); |
660 $role->add_cap('level_10'); |
738 $role->add_cap( 'level_10' ); |
661 $role->add_cap('level_9'); |
739 $role->add_cap( 'level_9' ); |
662 $role->add_cap('level_8'); |
740 $role->add_cap( 'level_8' ); |
663 $role->add_cap('level_7'); |
741 $role->add_cap( 'level_7' ); |
664 $role->add_cap('level_6'); |
742 $role->add_cap( 'level_6' ); |
665 $role->add_cap('level_5'); |
743 $role->add_cap( 'level_5' ); |
666 $role->add_cap('level_4'); |
744 $role->add_cap( 'level_4' ); |
667 $role->add_cap('level_3'); |
745 $role->add_cap( 'level_3' ); |
668 $role->add_cap('level_2'); |
746 $role->add_cap( 'level_2' ); |
669 $role->add_cap('level_1'); |
747 $role->add_cap( 'level_1' ); |
670 $role->add_cap('level_0'); |
748 $role->add_cap( 'level_0' ); |
671 |
749 |
672 // Add caps for Editor role |
750 // Add caps for Editor role |
673 $role = get_role('editor'); |
751 $role = get_role( 'editor' ); |
674 $role->add_cap('moderate_comments'); |
752 $role->add_cap( 'moderate_comments' ); |
675 $role->add_cap('manage_categories'); |
753 $role->add_cap( 'manage_categories' ); |
676 $role->add_cap('manage_links'); |
754 $role->add_cap( 'manage_links' ); |
677 $role->add_cap('upload_files'); |
755 $role->add_cap( 'upload_files' ); |
678 $role->add_cap('unfiltered_html'); |
756 $role->add_cap( 'unfiltered_html' ); |
679 $role->add_cap('edit_posts'); |
757 $role->add_cap( 'edit_posts' ); |
680 $role->add_cap('edit_others_posts'); |
758 $role->add_cap( 'edit_others_posts' ); |
681 $role->add_cap('edit_published_posts'); |
759 $role->add_cap( 'edit_published_posts' ); |
682 $role->add_cap('publish_posts'); |
760 $role->add_cap( 'publish_posts' ); |
683 $role->add_cap('edit_pages'); |
761 $role->add_cap( 'edit_pages' ); |
684 $role->add_cap('read'); |
762 $role->add_cap( 'read' ); |
685 $role->add_cap('level_7'); |
763 $role->add_cap( 'level_7' ); |
686 $role->add_cap('level_6'); |
764 $role->add_cap( 'level_6' ); |
687 $role->add_cap('level_5'); |
765 $role->add_cap( 'level_5' ); |
688 $role->add_cap('level_4'); |
766 $role->add_cap( 'level_4' ); |
689 $role->add_cap('level_3'); |
767 $role->add_cap( 'level_3' ); |
690 $role->add_cap('level_2'); |
768 $role->add_cap( 'level_2' ); |
691 $role->add_cap('level_1'); |
769 $role->add_cap( 'level_1' ); |
692 $role->add_cap('level_0'); |
770 $role->add_cap( 'level_0' ); |
693 |
771 |
694 // Add caps for Author role |
772 // Add caps for Author role |
695 $role = get_role('author'); |
773 $role = get_role( 'author' ); |
696 $role->add_cap('upload_files'); |
774 $role->add_cap( 'upload_files' ); |
697 $role->add_cap('edit_posts'); |
775 $role->add_cap( 'edit_posts' ); |
698 $role->add_cap('edit_published_posts'); |
776 $role->add_cap( 'edit_published_posts' ); |
699 $role->add_cap('publish_posts'); |
777 $role->add_cap( 'publish_posts' ); |
700 $role->add_cap('read'); |
778 $role->add_cap( 'read' ); |
701 $role->add_cap('level_2'); |
779 $role->add_cap( 'level_2' ); |
702 $role->add_cap('level_1'); |
780 $role->add_cap( 'level_1' ); |
703 $role->add_cap('level_0'); |
781 $role->add_cap( 'level_0' ); |
704 |
782 |
705 // Add caps for Contributor role |
783 // Add caps for Contributor role |
706 $role = get_role('contributor'); |
784 $role = get_role( 'contributor' ); |
707 $role->add_cap('edit_posts'); |
785 $role->add_cap( 'edit_posts' ); |
708 $role->add_cap('read'); |
786 $role->add_cap( 'read' ); |
709 $role->add_cap('level_1'); |
787 $role->add_cap( 'level_1' ); |
710 $role->add_cap('level_0'); |
788 $role->add_cap( 'level_0' ); |
711 |
789 |
712 // Add caps for Subscriber role |
790 // Add caps for Subscriber role |
713 $role = get_role('subscriber'); |
791 $role = get_role( 'subscriber' ); |
714 $role->add_cap('read'); |
792 $role->add_cap( 'read' ); |
715 $role->add_cap('level_0'); |
793 $role->add_cap( 'level_0' ); |
716 } |
794 } |
717 |
795 |
718 /** |
796 /** |
719 * Create and modify WordPress roles for WordPress 2.1. |
797 * Create and modify WordPress roles for WordPress 2.1. |
720 * |
798 * |
721 * @since 2.1.0 |
799 * @since 2.1.0 |
722 */ |
800 */ |
723 function populate_roles_210() { |
801 function populate_roles_210() { |
724 $roles = array('administrator', 'editor'); |
802 $roles = array( 'administrator', 'editor' ); |
725 foreach ($roles as $role) { |
803 foreach ( $roles as $role ) { |
726 $role = get_role($role); |
804 $role = get_role( $role ); |
727 if ( empty($role) ) |
805 if ( empty( $role ) ) { |
728 continue; |
806 continue; |
729 |
807 } |
730 $role->add_cap('edit_others_pages'); |
808 |
731 $role->add_cap('edit_published_pages'); |
809 $role->add_cap( 'edit_others_pages' ); |
732 $role->add_cap('publish_pages'); |
810 $role->add_cap( 'edit_published_pages' ); |
733 $role->add_cap('delete_pages'); |
811 $role->add_cap( 'publish_pages' ); |
734 $role->add_cap('delete_others_pages'); |
812 $role->add_cap( 'delete_pages' ); |
735 $role->add_cap('delete_published_pages'); |
813 $role->add_cap( 'delete_others_pages' ); |
736 $role->add_cap('delete_posts'); |
814 $role->add_cap( 'delete_published_pages' ); |
737 $role->add_cap('delete_others_posts'); |
815 $role->add_cap( 'delete_posts' ); |
738 $role->add_cap('delete_published_posts'); |
816 $role->add_cap( 'delete_others_posts' ); |
739 $role->add_cap('delete_private_posts'); |
817 $role->add_cap( 'delete_published_posts' ); |
740 $role->add_cap('edit_private_posts'); |
818 $role->add_cap( 'delete_private_posts' ); |
741 $role->add_cap('read_private_posts'); |
819 $role->add_cap( 'edit_private_posts' ); |
742 $role->add_cap('delete_private_pages'); |
820 $role->add_cap( 'read_private_posts' ); |
743 $role->add_cap('edit_private_pages'); |
821 $role->add_cap( 'delete_private_pages' ); |
744 $role->add_cap('read_private_pages'); |
822 $role->add_cap( 'edit_private_pages' ); |
745 } |
823 $role->add_cap( 'read_private_pages' ); |
746 |
824 } |
747 $role = get_role('administrator'); |
825 |
748 if ( ! empty($role) ) { |
826 $role = get_role( 'administrator' ); |
749 $role->add_cap('delete_users'); |
827 if ( ! empty( $role ) ) { |
750 $role->add_cap('create_users'); |
828 $role->add_cap( 'delete_users' ); |
751 } |
829 $role->add_cap( 'create_users' ); |
752 |
830 } |
753 $role = get_role('author'); |
831 |
754 if ( ! empty($role) ) { |
832 $role = get_role( 'author' ); |
755 $role->add_cap('delete_posts'); |
833 if ( ! empty( $role ) ) { |
756 $role->add_cap('delete_published_posts'); |
834 $role->add_cap( 'delete_posts' ); |
757 } |
835 $role->add_cap( 'delete_published_posts' ); |
758 |
836 } |
759 $role = get_role('contributor'); |
837 |
760 if ( ! empty($role) ) { |
838 $role = get_role( 'contributor' ); |
761 $role->add_cap('delete_posts'); |
839 if ( ! empty( $role ) ) { |
|
840 $role->add_cap( 'delete_posts' ); |
762 } |
841 } |
763 } |
842 } |
764 |
843 |
765 /** |
844 /** |
766 * Create and modify WordPress roles for WordPress 2.3. |
845 * Create and modify WordPress roles for WordPress 2.3. |