Changes in trunk/wp-admin/includes/upgrade.php [19470:20704]
- File:
-
- 1 edited
-
trunk/wp-admin/includes/upgrade.php (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/upgrade.php
r19470 r20704 36 36 */ 37 37 function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) { 38 global $wp_rewrite;39 40 38 if ( !empty( $deprecated ) ) 41 39 _deprecated_argument( __FUNCTION__, '2.6' ); … … 59 57 update_option('default_pingback_flag', 0); 60 58 61 // Create default user. If the user already exists, the user tables are62 // being shared among blogs. Just set the role in that case.59 // Create default user. If the user already exists, the user tables are 60 // being shared among blogs. Just set the role in that case. 63 61 $user_id = username_exists($user_name); 64 62 $user_password = trim($user_password); … … 75 73 $user_id = wp_create_user($user_name, $user_password, $user_email); 76 74 } else { 77 $message = __('User already exists. Password inherited.');75 $message = __('User already exists. Password inherited.'); 78 76 } 79 77 … … 83 81 wp_install_defaults($user_id); 84 82 85 $wp_rewrite->flush_rules();83 flush_rewrite_rules(); 86 84 87 85 wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.') ) ); … … 148 146 // Now drop in some default links 149 147 $default_links = array(); 150 $default_links[] = array( 'link_url' => 'http://codex.wordpress.org/',151 'link_name' => 'Documentation',148 $default_links[] = array( 'link_url' => __( 'http://codex.wordpress.org/' ), 149 'link_name' => __( 'Documentation' ), 152 150 'link_rss' => '', 153 151 'link_notes' => ''); 154 152 155 $default_links[] = array( 'link_url' => 'http://wordpress.org/news/',156 'link_name' => 'WordPress Blog',157 'link_rss' => 'http://wordpress.org/news/feed/',153 $default_links[] = array( 'link_url' => __( 'http://wordpress.org/news/' ), 154 'link_name' => __( 'WordPress Blog' ), 155 'link_rss' => __( 'http://wordpress.org/news/feed/' ), 158 156 'link_notes' => ''); 159 157 160 $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/ideas/',161 'link_name' => 'Suggest Ideas',158 $default_links[] = array( 'link_url' => __( 'http://wordpress.org/support/' ), 159 'link_name' => _x( 'Support Forums', 'default link' ), 162 160 'link_rss' => '', 163 161 'link_notes' =>''); 164 162 165 $default_links[] = array( 'link_url' => 'http://wordpress.org/ support/',166 'link_name' => 'Support Forum',163 $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/plugins/', 164 'link_name' => _x( 'Plugins', 'Default link to wordpress.org/extend/plugins/' ), 167 165 'link_rss' => '', 168 166 'link_notes' =>''); 169 167 170 $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/ plugins/',171 'link_name' => 'Plugins',168 $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/themes/', 169 'link_name' => _x( 'Themes', 'Default link to wordpress.org/extend/themes/' ), 172 170 'link_rss' => '', 173 171 'link_notes' =>''); 174 172 175 $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/themes/',176 'link_name' => 'Themes',173 $default_links[] = array( 'link_url' => __( 'http://wordpress.org/support/forum/requests-and-feedback' ), 174 'link_name' => __( 'Feedback' ), 177 175 'link_rss' => '', 178 176 'link_notes' =>''); 179 177 180 $default_links[] = array( 'link_url' => 'http://planet.wordpress.org/',181 'link_name' => 'WordPress Planet',178 $default_links[] = array( 'link_url' => __( 'http://planet.wordpress.org/' ), 179 'link_name' => __( 'WordPress Planet' ), 182 180 'link_rss' => '', 183 181 'link_notes' =>''); … … 303 301 // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id. 304 302 if ( !is_super_admin( $user_id ) && $user_id != 1 ) 305 $wpdb-> query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $wpdb->base_prefix.'1_capabilities') );303 $wpdb->delete( $wpdb->usermeta, array( 'user_id' => $user_id , 'meta_key' => $wpdb->base_prefix.'1_capabilities' ) ); 306 304 } 307 305 } … … 359 357 $wp_current_db_version = __get_option('db_version'); 360 358 361 // We are up-to-date. Nothing to do.359 // We are up-to-date. Nothing to do. 362 360 if ( $wp_db_version == $wp_current_db_version ) 363 361 return; … … 392 390 */ 393 391 function upgrade_all() { 394 global $wp_current_db_version, $wp_db_version , $wp_rewrite;392 global $wp_current_db_version, $wp_db_version; 395 393 $wp_current_db_version = __get_option('db_version'); 396 394 397 // We are up-to-date. Nothing to do.395 // We are up-to-date. Nothing to do. 398 396 if ( $wp_db_version == $wp_current_db_version ) 399 397 return; … … 459 457 if ( $wp_current_db_version < 19389 ) 460 458 upgrade_330(); 459 460 if ( $wp_current_db_version < 20080 ) 461 upgrade_340(); 461 462 462 463 maybe_disable_automattic_widgets(); … … 566 567 $time_difference = $all_options->time_difference; 567 568 568 $server_time = time()+date('Z');569 $server_time = time()+date('Z'); 569 570 $weblogger_time = $server_time + $time_difference*3600; 570 571 $gmt_time = time(); … … 647 648 648 649 // If plugins are not stored in an array, they're stored in the old 649 // newline separated format. Convert to new format.650 // newline separated format. Convert to new format. 650 651 if ( !is_array( $active_plugins ) ) { 651 652 $active_plugins = explode("\n", trim($active_plugins)); … … 899 900 } 900 901 901 // < 3570 we used linkcategories. >= 3570 we used categories and link2cat.902 // < 3570 we used linkcategories. >= 3570 we used categories and link2cat. 902 903 if ( $wp_current_db_version < 3570 ) { 903 // Create link_category terms for link categories. Create a map of link cat IDs904 // Create link_category terms for link categories. Create a map of link cat IDs 904 905 // to link_category terms. 905 906 $link_cat_id_map = array(); … … 1151 1152 $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" ); 1152 1153 } 1153 1154 // 3.3-beta. Can remove before release.1155 if ( $wp_current_db_version > 18715 && $wp_current_db_version < 193891156 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) )1157 delete_metadata( 'user', 0, 'dismissed_wp_pointers', '', true );1158 1154 1159 1155 if ( $wp_current_db_version >= 11548 ) … … 1215 1211 1216 1212 /** 1213 * Execute changes made in WordPress 3.4. 1214 * 1215 * @since 3.4.0 1216 */ 1217 function upgrade_340() { 1218 global $wp_current_db_version, $wpdb; 1219 1220 if ( $wp_current_db_version < 19798 ) { 1221 $wpdb->hide_errors(); 1222 $wpdb->query( "ALTER TABLE $wpdb->options DROP COLUMN blog_id" ); 1223 $wpdb->show_errors(); 1224 } 1225 1226 if ( $wp_current_db_version < 19799 ) { 1227 $wpdb->hide_errors(); 1228 $wpdb->query("ALTER TABLE $wpdb->comments DROP INDEX comment_approved"); 1229 $wpdb->show_errors(); 1230 } 1231 1232 if ( $wp_current_db_version < 20022 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { 1233 $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 'themes_last_view'" ); 1234 } 1235 1236 if ( $wp_current_db_version < 20080 ) { 1237 if ( 'yes' == $wpdb->get_var( "SELECT autoload FROM $wpdb->options WHERE option_name = 'uninstall_plugins'" ) ) { 1238 $uninstall_plugins = get_option( 'uninstall_plugins' ); 1239 delete_option( 'uninstall_plugins' ); 1240 add_option( 'uninstall_plugins', $uninstall_plugins, null, 'no' ); 1241 } 1242 } 1243 } 1244 1245 /** 1217 1246 * Execute network level changes 1218 1247 * … … 1249 1278 } 1250 1279 } 1280 1251 1281 // 3.0 1252 1282 if ( $wp_current_db_version < 13576 ) 1253 1283 update_site_option( 'global_terms_enabled', '1' ); 1284 1254 1285 // 3.3 1255 1286 if ( $wp_current_db_version < 19390 ) 1256 1287 update_site_option( 'initial_db_version', $wp_current_db_version ); 1288 1257 1289 if ( $wp_current_db_version < 19470 ) { 1258 1290 if ( false === get_site_option( 'active_sitewide_plugins' ) ) 1259 1291 update_site_option( 'active_sitewide_plugins', array() ); 1292 } 1293 1294 // 3.4 1295 if ( $wp_current_db_version < 20148 ) { 1296 // 'allowedthemes' keys things by stylesheet. 'allowed_themes' keyed things by name. 1297 $allowedthemes = get_site_option( 'allowedthemes' ); 1298 $allowed_themes = get_site_option( 'allowed_themes' ); 1299 if ( false === $allowedthemes && is_array( $allowed_themes ) && $allowed_themes ) { 1300 $converted = array(); 1301 $themes = wp_get_themes(); 1302 foreach ( $themes as $stylesheet => $theme_data ) { 1303 if ( isset( $allowed_themes[ $theme_data->get('Name') ] ) ) 1304 $converted[ $stylesheet ] = true; 1305 } 1306 update_site_option( 'allowedthemes', $converted ); 1307 delete_site_option( 'allowed_themes' ); 1308 } 1260 1309 } 1261 1310 } … … 1336 1385 */ 1337 1386 function maybe_add_column($table_name, $column_name, $create_ddl) { 1338 global $wpdb , $debug;1387 global $wpdb; 1339 1388 foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) { 1340 if ($debug) echo("checking $column == $column_name<br />");1341 1389 if ($column == $column_name) { 1342 1390 return true; … … 1363 1411 function get_alloptions_110() { 1364 1412 global $wpdb; 1365 if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) { 1366 foreach ($options as $option) { 1367 // "When trying to design a foolproof system, 1368 // never underestimate the ingenuity of the fools :)" -- Dougal 1369 if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); 1370 if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); 1371 if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); 1372 $all_options->{$option->option_name} = stripslashes($option->option_value); 1413 $all_options = new stdClass; 1414 if ( $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ) ) { 1415 foreach ( $options as $option ) { 1416 if ( 'siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name ) 1417 $option->option_value = untrailingslashit( $option->option_value ); 1418 $all_options->{$option->option_name} = stripslashes( $option->option_value ); 1373 1419 } 1374 1420 } … … 1388 1434 global $wpdb; 1389 1435 1390 if ( $setting == 'home' && defined( 'WP_HOME' ) ) { 1391 return preg_replace( '|/+$|', '', WP_HOME ); 1392 } 1393 1394 if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) { 1395 return preg_replace( '|/+$|', '', WP_SITEURL ); 1396 } 1397 1398 $option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting) ); 1436 if ( $setting == 'home' && defined( 'WP_HOME' ) ) 1437 return untrailingslashit( WP_HOME ); 1438 1439 if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) 1440 return untrailingslashit( WP_SITEURL ); 1441 1442 $option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) ); 1399 1443 1400 1444 if ( 'home' == $setting && '' == $option ) 1401 return __get_option( 'siteurl');1402 1403 if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting )1404 $option = preg_replace('|/+$|', '', $option);1405 1406 @ $kellogs = unserialize( $option);1407 if ( $kellogs !== FALSE)1445 return __get_option( 'siteurl' ); 1446 1447 if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting || 'tag_base' == $setting ) 1448 $option = untrailingslashit( $option ); 1449 1450 @ $kellogs = unserialize( $option ); 1451 if ( $kellogs !== false ) 1408 1452 return $kellogs; 1409 1453 else … … 1458 1502 if ( !is_array($queries) ) { 1459 1503 $queries = explode( ';', $queries ); 1460 if ('' == $queries[count($queries) - 1]) array_pop($queries);1504 $queries = array_filter( $queries ); 1461 1505 } 1462 1506 $queries = apply_filters( 'dbdelta_queries', $queries ); … … 1469 1513 foreach($queries as $qry) { 1470 1514 if (preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { 1471 $cqueries[ trim( strtolower($matches[1]), '`' )] = $qry;1515 $cqueries[ trim( $matches[1], '`' ) ] = $qry; 1472 1516 $for_update[$matches[1]] = 'Created table '.$matches[1]; 1473 1517 } else if (preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) { … … 1668 1712 * @since 1.5.0 1669 1713 */ 1670 function make_db_current_silent( $tables = 'all' ) {1714 function make_db_current_silent( $tables = 'all' ) { 1671 1715 $alterations = dbDelta( $tables ); 1672 1716 } … … 1691 1735 1692 1736 // Copy files from the old locations to the site theme. 1693 // TODO: This does not copy arbitrary include dependencies. Only the1737 // TODO: This does not copy arbitrary include dependencies. Only the 1694 1738 // standard WP files are copied. 1695 1739 $files = array('index.php' => 'index.php', 'wp-layout.css' => 'style.css', 'wp-comments.php' => 'comments.php', 'wp-comments-popup.php' => 'comments-popup.php'); … … 1849 1893 if (file_exists(ABSPATH . 'wp-layout.css')) { 1850 1894 if (! make_site_theme_from_oldschool($theme_name, $template)) { 1851 // TODO: rm -rf the site theme directory.1895 // TODO: rm -rf the site theme directory. 1852 1896 return false; 1853 1897 } 1854 1898 } else { 1855 1899 if (! make_site_theme_from_default($theme_name, $template)) 1856 // TODO: rm -rf the site theme directory.1900 // TODO: rm -rf the site theme directory. 1857 1901 return false; 1858 1902 } … … 1939 1983 // Upgrade versions prior to 2.9 1940 1984 if ( $wp_current_db_version < 11557 ) { 1941 // Delete duplicate options. Keep the option with the highest option_id.1985 // Delete duplicate options. Keep the option with the highest option_id. 1942 1986 $wpdb->query("DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id"); 1943 1987 … … 1975 2019 } 1976 2020 endif; 1977 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)