Ticket #30121: 30121.diff
| File 30121.diff, 2.9 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/includes/ms.php
85 85 86 86 $current_site = get_current_site(); 87 87 88 // If a full blog object is not available, do not destroy anything. 89 if ( $drop && ! $blog ) { 90 $drop = false; 91 } 92 88 93 // Don't destroy the initial, main, or root blog. 89 if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_site->path && $blog->domain == $current_site->domain ) ) ) 94 if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_site->path && $blog->domain == $current_site->domain ) ) ) { 95 $drop = false; 96 } 97 98 // If ms_files_rewriting is enabled and upload_path is empty, wp_upload_dir is not reliable. 99 if ( $drop && get_site_option( 'ms_files_rewriting' ) && empty( get_option( 'upload_path' ) ) ) { 90 100 $drop = false; 101 } 91 102 92 103 if ( $drop ) { 104 $uploads = wp_upload_dir(); 105 93 106 $tables = $wpdb->tables( 'blog' ); 94 107 /** 95 108 * Filter the tables to drop when the blog is deleted. … … 107 120 108 121 $wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ) ); 109 122 110 $uploads = wp_upload_dir();111 123 /** 112 124 * Filter the upload base directory to delete when the blog is deleted. 113 125 * -
tests/phpunit/tests/multisite/site.php
274 274 $this->assertEquals( 1, get_blog_count() ); 275 275 } 276 276 277 /** 278 * When a site is deleted with wpmu_delete_blog(), only the files associated with 279 * that site should be removed. When wpmu_delete_blog() is run a second time, nothing 280 * should change with upload directories. 281 */ 282 function test_upload_directories_after_multiple_wpmu_delete_blog_with_ms_files() { 283 $filename = rand_str().'.jpg'; 284 $contents = rand_str(); 285 286 //update_site_option( 'ms_files_rewriting', 1 ); 287 //ms_upload_constants(); 288 289 // Upload a file to the main site on the network. 290 $file1 = wp_upload_bits( $filename, null, $contents ); 291 292 $blog_id = $this->factory->blog->create(); 293 294 switch_to_blog( $blog_id ); 295 $file2 = wp_upload_bits( $filename, null, $contents ); 296 restore_current_blog(); 297 298 wpmu_delete_blog( $blog_id, true ); 299 300 // The file on the main site should still exist. The file on the deleted site should not. 301 $this->assertTrue( file_exists( $file1['file'] ) ); 302 $this->assertFalse( file_exists( $file2['file'] ) ); 303 304 wpmu_delete_blog( $blog_id, true ); 305 306 // The file on the main site should still exist. The file on the deleted site should not. 307 $this->assertTrue( file_exists( $file1['file'] ) ); 308 $this->assertFalse( file_exists( $file2['file'] ) ); 309 310 //delete_site_option( 'ms_files_rewriting' ); 311 } 312 277 313 function test_wpmu_update_blogs_date() { 278 314 global $wpdb; 279 315
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)