upgrade_all()
Functions to be called in install and upgrade scripts.
Description Description
Contains conditional checks to determine which upgrade scripts to run, based on database version and WP version being updated-to.
Source Source
File: wp-admin/includes/upgrade.php
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | 5 => 'meta-2' , ), 'array_version' => 3, ) ); if ( ! is_multisite() ) { update_user_meta( $user_id , 'show_welcome_panel' , 1 ); } elseif ( ! is_super_admin( $user_id ) && ! metadata_exists( 'user' , $user_id , 'show_welcome_panel' ) ) { update_user_meta( $user_id , 'show_welcome_panel' , 2 ); } if ( is_multisite() ) { // Flush rules to pick up the new page. $wp_rewrite ->init(); $wp_rewrite ->flush_rules(); $user = new WP_User( $user_id ); $wpdb ->update( $wpdb ->options, array ( 'option_value' => $user ->user_email ), array ( 'option_name' => 'admin_email' ) ); // Remove all perms except for the login user. $wpdb ->query( $wpdb ->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s" , $user_id , $table_prefix . 'user_level' ) ); $wpdb ->query( $wpdb ->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s" , $user_id , $table_prefix . 'capabilities' ) ); // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id. if ( ! is_super_admin( $user_id ) && $user_id != 1 ) { $wpdb -> delete ( $wpdb ->usermeta, array ( 'user_id' => $user_id , 'meta_key' => $wpdb ->base_prefix . '1_capabilities' , ) ); } } } endif ; /** * Maybe enable pretty permalinks on installation. * * If after enabling pretty permalinks don't work, fallback to query-string permalinks. * * @since 4.2.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @return bool Whether pretty permalinks are enabled. False otherwise. */ function wp_install_maybe_enable_pretty_permalinks() { global $wp_rewrite ; // Bail if a permalink structure is already enabled. if ( get_option( 'permalink_structure' ) ) { return true; } /* * The Permalink structures to attempt. * * The first is designed for mod_rewrite or nginx rewriting. * * The second is PATHINFO-based permalinks for web server configurations * without a true rewrite module enabled. */ $permalink_structures = array ( '/%year%/%monthnum%/%day%/%postname%/' , '/index.php/%year%/%monthnum%/%day%/%postname%/' , ); foreach ( ( array ) $permalink_structures as $permalink_structure ) { $wp_rewrite ->set_permalink_structure( $permalink_structure ); /* * Flush rules with the hard option to force refresh of the web-server's * rewrite config file (e.g. .htaccess or web.config). */ $wp_rewrite ->flush_rules( true ); $test_url = '' ; // Test against a real WordPress Post $first_post = get_page_by_path( sanitize_title( _x( 'hello-world' , 'Default post slug' ) ), OBJECT, 'post' ); if ( $first_post ) { $test_url = get_permalink( $first_post ->ID ); } /* * Send a request to the site, and check whether * the 'x-pingback' header is returned as expected. * * Uses wp_remote_get() instead of wp_remote_head() because web servers * can block head requests. */ $response = wp_remote_get( $test_url , array ( 'timeout' => 5 ) ); $x_pingback_header = wp_remote_retrieve_header( $response , 'x-pingback' ); $pretty_permalinks = $x_pingback_header && $x_pingback_header === get_bloginfo( 'pingback_url' ); if ( $pretty_permalinks ) { return true; } } /* |
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
1.0.1 | Introduced. |