Ticket #38491: 38491.diff
| File 38491.diff, 12.3 KB (added by , 9 years ago) |
|---|
-
src/wp-includes/class-wp-site.php
346 346 } 347 347 } 348 348 349 if ( has_filter( 'blog_details' ) ) { 350 /** This filter is documented in wp-includes/ms-blogs.php */ 351 $details = apply_filters_deprecated( 'blog_details', array( $details ), '4.7.0', 'site_details' ); 352 } 353 349 354 /** 350 355 * Filters a site's extended properties. 351 356 * -
src/wp-includes/ms-blogs.php
236 236 $details->home = get_option( 'home' ); 237 237 restore_current_blog(); 238 238 239 /** 240 * Filters a blog's details. 241 * 242 * @since MU 243 * 244 * @param object $details The blog details. 245 */ 246 $details = apply_filters( 'blog_details', $details ); 239 if ( has_filter( 'blog_details' ) ) { 240 /** 241 * Filters a blog's details. 242 * 243 * @since MU 244 * @deprecated 4.7.0 Use site_details 245 * 246 * @param object $details The blog details. 247 */ 248 $details = apply_filters_deprecated( 'blog_details', array( $details ), '4.7.0', 'site_details' ); 249 } 247 250 248 251 wp_cache_set( $blog_id . $all, $details, 'blog-details' ); 249 252 -
tests/phpunit/includes/factory/class-wp-unittest-factory-for-blog.php
31 31 function update_object( $blog_id, $fields ) {} 32 32 33 33 function get_object_by_id( $blog_id ) { 34 return get_ blog_details( $blog_id, false);34 return get_site( $blog_id ); 35 35 } 36 36 } -
tests/phpunit/tests/multisite/site.php
301 301 wpmu_update_blogs_date(); 302 302 303 303 // compare the update time with the current time, allow delta < 2 304 $blog = get_ blog_details( $wpdb->blogid );304 $blog = get_site( $wpdb->blogid ); 305 305 $current_time = time(); 306 306 $time_difference = $current_time - strtotime( $blog->last_updated ); 307 307 $this->assertLessThan( 2, $time_difference ); … … 368 368 369 369 add_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10 ); 370 370 update_blog_status( $blog_id, 'spam', 0 ); 371 $blog = get_ blog_details( $blog_id );371 $blog = get_site( $blog_id ); 372 372 373 373 $this->assertEquals( '0', $blog->spam ); 374 374 $this->assertEquals( 1, $test_action_counter ); 375 375 376 376 // The action should fire if the status of 'spam' stays the same. 377 377 update_blog_status( $blog_id, 'spam', 0 ); 378 $blog = get_ blog_details( $blog_id );378 $blog = get_site( $blog_id ); 379 379 380 380 $this->assertEquals( '0', $blog->spam ); 381 381 $this->assertEquals( 2, $test_action_counter ); … … 391 391 392 392 add_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 ); 393 393 update_blog_status( $blog_id, 'spam', 1 ); 394 $blog = get_ blog_details( $blog_id );394 $blog = get_site( $blog_id ); 395 395 396 396 $this->assertEquals( '1', $blog->spam ); 397 397 $this->assertEquals( 1, $test_action_counter ); 398 398 399 399 // The action should fire if the status of 'spam' stays the same. 400 400 update_blog_status( $blog_id, 'spam', 1 ); 401 $blog = get_ blog_details( $blog_id );401 $blog = get_site( $blog_id ); 402 402 403 403 $this->assertEquals( '1', $blog->spam ); 404 404 $this->assertEquals( 2, $test_action_counter ); … … 414 414 415 415 add_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 ); 416 416 update_blog_status( $blog_id, 'archived', 1 ); 417 $blog = get_ blog_details( $blog_id );417 $blog = get_site( $blog_id ); 418 418 419 419 $this->assertEquals( '1', $blog->archived ); 420 420 $this->assertEquals( 1, $test_action_counter ); 421 421 422 422 // The action should fire if the status of 'archived' stays the same. 423 423 update_blog_status( $blog_id, 'archived', 1 ); 424 $blog = get_ blog_details( $blog_id );424 $blog = get_site( $blog_id ); 425 425 426 426 $this->assertEquals( '1', $blog->archived ); 427 427 $this->assertEquals( 2, $test_action_counter ); … … 438 438 439 439 add_action( 'unarchive_blog', array( $this, '_action_counter_cb' ), 10 ); 440 440 update_blog_status( $blog_id, 'archived', 0 ); 441 $blog = get_ blog_details( $blog_id );441 $blog = get_site( $blog_id ); 442 442 443 443 $this->assertEquals( '0', $blog->archived ); 444 444 $this->assertEquals( 1, $test_action_counter ); 445 445 446 446 // The action should fire if the status of 'archived' stays the same. 447 447 update_blog_status( $blog_id, 'archived', 0 ); 448 $blog = get_ blog_details( $blog_id );448 $blog = get_site( $blog_id ); 449 449 $this->assertEquals( '0', $blog->archived ); 450 450 $this->assertEquals( 2, $test_action_counter ); 451 451 … … 460 460 461 461 add_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 ); 462 462 update_blog_status( $blog_id, 'deleted', 1 ); 463 $blog = get_ blog_details( $blog_id );463 $blog = get_site( $blog_id ); 464 464 465 465 $this->assertEquals( '1', $blog->deleted ); 466 466 $this->assertEquals( 1, $test_action_counter ); 467 467 468 468 // The action should fire if the status of 'deleted' stays the same. 469 469 update_blog_status( $blog_id, 'deleted', 1 ); 470 $blog = get_ blog_details( $blog_id );470 $blog = get_site( $blog_id ); 471 471 472 472 $this->assertEquals( '1', $blog->deleted ); 473 473 $this->assertEquals( 2, $test_action_counter ); … … 484 484 485 485 add_action( 'make_undelete_blog', array( $this, '_action_counter_cb' ), 10 ); 486 486 update_blog_status( $blog_id, 'deleted', 0 ); 487 $blog = get_ blog_details( $blog_id );487 $blog = get_site( $blog_id ); 488 488 489 489 $this->assertEquals( '0', $blog->deleted ); 490 490 $this->assertEquals( 1, $test_action_counter ); 491 491 492 492 // The action should fire if the status of 'deleted' stays the same. 493 493 update_blog_status( $blog_id, 'deleted', 0 ); 494 $blog = get_ blog_details( $blog_id );494 $blog = get_site( $blog_id ); 495 495 496 496 $this->assertEquals( '0', $blog->deleted ); 497 497 $this->assertEquals( 2, $test_action_counter ); … … 507 507 508 508 add_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 ); 509 509 update_blog_status( $blog_id, 'mature', 1 ); 510 $blog = get_ blog_details( $blog_id );510 $blog = get_site( $blog_id ); 511 511 512 512 $this->assertEquals( '1', $blog->mature ); 513 513 $this->assertEquals( 1, $test_action_counter ); 514 514 515 515 // The action should fire if the status of 'mature' stays the same. 516 516 update_blog_status( $blog_id, 'mature', 1 ); 517 $blog = get_ blog_details( $blog_id );517 $blog = get_site( $blog_id ); 518 518 519 519 $this->assertEquals( '1', $blog->mature ); 520 520 $this->assertEquals( 2, $test_action_counter ); … … 532 532 add_action( 'unmature_blog', array( $this, '_action_counter_cb' ), 10 ); 533 533 update_blog_status( $blog_id, 'mature', 0 ); 534 534 535 $blog = get_ blog_details( $blog_id );535 $blog = get_site( $blog_id ); 536 536 $this->assertEquals( '0', $blog->mature ); 537 537 $this->assertEquals( 1, $test_action_counter ); 538 538 539 539 // The action should fire if the status of 'mature' stays the same. 540 540 update_blog_status( $blog_id, 'mature', 0 ); 541 $blog = get_ blog_details( $blog_id );541 $blog = get_site( $blog_id ); 542 542 543 543 $this->assertEquals( '0', $blog->mature ); 544 544 $this->assertEquals( 2, $test_action_counter ); … … 555 555 add_action( 'update_blog_public', array( $this, '_action_counter_cb' ), 10 ); 556 556 update_blog_status( $blog_id, 'public', 0 ); 557 557 558 $blog = get_ blog_details( $blog_id );558 $blog = get_site( $blog_id ); 559 559 $this->assertEquals( '0', $blog->public ); 560 560 $this->assertEquals( 1, $test_action_counter ); 561 561 562 562 // The action should fire if the status of 'mature' stays the same. 563 563 update_blog_status( $blog_id, 'public', 0 ); 564 $blog = get_ blog_details( $blog_id );564 $blog = get_site( $blog_id ); 565 565 566 566 $this->assertEquals( '0', $blog->public ); 567 567 $this->assertEquals( 2, $test_action_counter ); … … 575 575 function test_posts_count() { 576 576 self::factory()->post->create(); 577 577 $post2 = self::factory()->post->create(); 578 $this->assertEquals( 2, get_ blog_details()->post_count );578 $this->assertEquals( 2, get_site()->post_count ); 579 579 580 580 wp_delete_post( $post2 ); 581 $this->assertEquals( 1, get_ blog_details()->post_count );581 $this->assertEquals( 1, get_site()->post_count ); 582 582 } 583 583 584 584 /** … … 586 586 */ 587 587 function test_blog_details_cache_invalidation() { 588 588 update_option( 'blogname', 'foo' ); 589 $details = get_ blog_details( get_current_blog_id() );589 $details = get_site( get_current_blog_id() ); 590 590 $this->assertEquals( 'foo', $details->blogname ); 591 591 592 592 update_option( 'blogname', 'bar' ); 593 $details = get_ blog_details( get_current_blog_id() );593 $details = get_site( get_current_blog_id() ); 594 594 $this->assertEquals( 'bar', $details->blogname ); 595 595 } 596 596 … … 600 600 */ 601 601 function test_get_blog_id_from_url() { 602 602 $blog_id = self::factory()->blog->create(); 603 $details = get_ blog_details( $blog_id, false);603 $details = get_site( $blog_id ); 604 604 $key = md5( $details->domain . $details->path ); 605 605 606 606 // Test the original response and cached response for the newly created site. … … 613 613 */ 614 614 function test_get_blog_id_from_url_is_case_insensitive() { 615 615 $blog_id = self::factory()->blog->create( array( 'domain' => 'example.com', 'path' => '/xyz' ) ); 616 $details = get_ blog_details( $blog_id, false);616 $details = get_site( $blog_id ); 617 617 618 618 $this->assertEquals( $blog_id, get_blog_id_from_url( strtoupper( $details->domain ), strtoupper( $details->path ) ) ); 619 619 } … … 623 623 */ 624 624 function test_get_blog_id_from_url_that_does_not_exist() { 625 625 $blog_id = self::factory()->blog->create( array( 'path' => '/xyz' ) ); 626 $details = get_ blog_details( $blog_id, false);626 $details = get_site( $blog_id ); 627 627 628 628 $this->assertEquals( 0, get_blog_id_from_url( $details->domain, 'foo' ) ); 629 629 $this->assertEquals( -1, wp_cache_get( md5( $details->domain . 'foo' ), 'blog-id-cache' ) ); … … 635 635 */ 636 636 function test_get_blog_id_from_url_with_deleted_flag() { 637 637 $blog_id = self::factory()->blog->create(); 638 $details = get_ blog_details( $blog_id, false);638 $details = get_site( $blog_id ); 639 639 $key = md5( $details->domain . $details->path ); 640 640 wpmu_delete_blog( $blog_id ); 641 641 … … 649 649 */ 650 650 function test_get_blog_id_from_url_after_dropped() { 651 651 $blog_id = self::factory()->blog->create(); 652 $details = get_ blog_details( $blog_id, false);652 $details = get_site( $blog_id ); 653 653 $key = md5( $details->domain . $details->path ); 654 654 wpmu_delete_blog( $blog_id, true ); 655 655 … … 766 766 } 767 767 768 768 function test_domain_exists_with_default_site_id() { 769 $details = get_ blog_details( 1, false);769 $details = get_site( 1 ); 770 770 771 771 $this->assertEquals( 1, domain_exists( $details->domain, $details->path ) ); 772 772 } 773 773 774 774 function test_domain_exists_with_specified_site_id() { 775 $details = get_ blog_details( 1, false);775 $details = get_site( 1 ); 776 776 777 777 $this->assertEquals( 1, domain_exists( $details->domain, $details->path, $details->site_id ) ); 778 778 } … … 782 782 * it is marked as not existing. 783 783 */ 784 784 function test_domain_does_not_exist_with_invalid_site_id() { 785 $details = get_ blog_details( 1, false);785 $details = get_site( 1 ); 786 786 787 787 $this->assertEquals( null, domain_exists( $details->domain, $details->path, 999 ) ); 788 788 } -
tests/phpunit/tests/multisite/updateBlogDetails.php
31 31 32 32 $this->assertTrue( $result ); 33 33 34 $blog = get_ blog_details( $blog_id );34 $blog = get_site( $blog_id ); 35 35 36 36 $this->assertEquals( 'example.com', $blog->domain ); 37 37 $this->assertEquals( '/my_path/', $blog->path ); … … 63 63 add_action( $hook, array( $this, '_action_counter_cb' ), 10 ); 64 64 65 65 update_blog_details( $blog_id, array( $flag => $flag_value ) ); 66 $blog = get_ blog_details( $blog_id );66 $blog = get_site( $blog_id ); 67 67 68 68 $this->assertEquals( $flag_value, $blog->{$flag} ); 69 69 … … 108 108 */ 109 109 public function test_update_blog_details_single_directory_path( $path, $expected ) { 110 110 update_blog_details( 1, array( 'path' => $path ) ); 111 $site = get_ blog_details( 1 );111 $site = get_site( 1 ); 112 112 113 113 $this->assertEquals( $expected, $site->path ); 114 114 } … … 133 133 } 134 134 135 135 } 136 endif; 137 No newline at end of file 136 endif;