Changeset 56657
- Timestamp:
- 09/22/2023 12:02:28 AM (13 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/schema.php
r56414 r56657 557 557 // 5.8.0 558 558 'wp_force_deactivated_plugins' => array(), 559 560 // 6.4.0 561 'wp_attachment_pages_enabled' => 0, 559 562 ); 560 563 -
trunk/src/wp-admin/includes/upgrade.php
r56549 r56657 840 840 } 841 841 842 if ( $wp_current_db_version < 56657 ) { 843 upgrade_640(); 844 } 845 842 846 maybe_disable_link_manager(); 843 847 … … 2324 2328 2325 2329 /** 2330 * Executes changes made in WordPress 6.4.0. 2331 * 2332 * @ignore 2333 * @since 6.4.0 2334 * 2335 * @global int $wp_current_db_version The old (current) database version. 2336 */ 2337 function upgrade_640() { 2338 global $wp_current_db_version; 2339 2340 if ( $wp_current_db_version < 56657 ) { 2341 // Enable attachment pages. 2342 update_option( 'wp_media_use_attachment_pages', 1 ); 2343 } 2344 } 2345 2346 /** 2326 2347 * Executes network-level upgrade routines. 2327 2348 * -
trunk/src/wp-includes/canonical.php
r56245 r56657 543 543 wp_redirect( $redirect_url, 301 ); 544 544 die(); 545 } 546 } 547 548 $is_attachment_redirect = false; 549 550 if ( is_attachment() && ! get_option( 'wp_attachment_pages_enabled' ) ) { 551 $attachment_id = get_query_var( 'attachment_id' ); 552 553 if ( current_user_can( 'read_post', $attachment_id ) ) { 554 $redirect_url = wp_get_attachment_url( $attachment_id ); 555 556 $is_attachment_redirect = true; 545 557 } 546 558 } … … 651 663 // Trailing slashes. 652 664 if ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() 665 && ! $is_attachment_redirect 653 666 && ! is_404() && ( ! is_front_page() || is_front_page() && get_query_var( 'paged' ) > 1 ) 654 667 ) { -
trunk/src/wp-includes/version.php
r56267 r56657 24 24 * @global int $wp_db_version 25 25 */ 26 $wp_db_version = 5 5853;26 $wp_db_version = 56657; 27 27 28 28 /** -
trunk/tests/phpunit/tests/canonical.php
r56559 r56657 14 14 parent::set_up(); 15 15 wp_set_current_user( self::$author_id ); 16 17 add_filter( 'pre_option_wp_attachment_pages_enabled', '__return_true' ); 16 18 } 17 19 … … 403 405 $this->assertNull( $url ); 404 406 } 407 408 /** 409 * @ticket 57913 410 */ 411 public function test_canonical_attachment_page_redirect_with_option_disabled() { 412 add_filter( 'pre_option_wp_attachment_pages_enabled', '__return_false' ); 413 414 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 415 $contents = file_get_contents( $filename ); 416 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 417 418 $attachment_id = $this->_make_attachment( $upload ); 419 $attachment_page = get_permalink( $attachment_id ); 420 421 $this->go_to( $attachment_page ); 422 423 $url = redirect_canonical( $attachment_page, false ); 424 $expected = wp_get_attachment_url( $attachment_id ); 425 426 $this->assertSame( $expected, $url ); 427 } 405 428 } -
trunk/tests/phpunit/tests/canonical/postStatus.php
r52010 r56657 170 170 parent::set_up(); 171 171 self::setup_custom_types(); 172 173 add_filter( 'pre_option_wp_attachment_pages_enabled', '__return_true' ); 172 174 } 173 175
Note: See TracChangeset
for help on using the changeset viewer.