Ticket #12619: wordpress.php.patch
File wordpress.php.patch, 3.0 KB (added by , 15 years ago) |
---|
-
Sites/wordpress-trunk/wp-admin/import/wordpress.php
168 168 169 169 // this will populate $this->author_ids with a list of author_names => user_ids 170 170 171 foreach ( $_POST['author_in'] as $i => $in_author_name ) {171 foreach ( (array) $_POST['author_in'] as $i => $in_author_name ) { 172 172 173 173 if ( !empty($_POST['user_select'][$i]) ) { 174 174 // an existing user was selected in the dropdown list … … 319 319 320 320 $catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name', 'category_description'); 321 321 322 print "<em>" . __( "Importing category $cat_name" ) . "</em><br />\n"; 322 323 $cat_ID = wp_insert_category($catarr); 323 324 } 324 325 } … … 340 341 341 342 $tagarr = compact('slug', 'description'); 342 343 344 print "<em>" . __( "Importing tag $tag_name" ) . "</em><br />\n"; 343 345 $tag_ID = wp_insert_term($tag_name, 'post_tag', $tagarr); 344 346 } 345 347 } … … 377 379 378 380 $termarr = compact('slug', 'description'); 379 381 382 print "<em>" . __( "Importing $term_name" ) . "</em><br />\n"; 380 383 $term_ID = wp_insert_term($term_name, $this->get_tag( $c, 'wp:term_taxonomy' ), $termarr); 381 384 } 382 385 } … … 494 497 return $post_id; 495 498 } 496 499 else { 497 printf(__('Importing post <em>%s</em>...') , stripslashes($post_title));500 printf(__('Importing post <em>%s</em>...') . "\n", stripslashes($post_title)); 498 501 $comment_post_ID = $post_id = wp_insert_post($postdata); 499 502 if ( $post_id && $is_sticky == 1 ) 500 503 stick_post( $post_id ); … … 636 639 print '('.size_format(filesize($upload['file'])).')'; 637 640 } 638 641 642 if ( 0 == filesize( $upload['file'] ) ) { 643 print __( "Zero length file, deleting" ) . "\n"; 644 unlink( $upload['file'] ); 645 return; 646 } 647 639 648 if ( $info = wp_check_filetype($upload['file']) ) { 640 649 $postdata['post_mime_type'] = $info['type']; 641 650 } … … 665 674 } 666 675 } 667 676 668 function fetch_remote_file($post, $url) { 677 function fetch_remote_file( $post, $url ) { 678 add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) ); 679 669 680 $upload = wp_upload_dir($post['post_date']); 670 681 671 682 // extract the file name and extension from the url … … 705 716 706 717 // keep track of the old and new urls so we can substitute them later 707 718 $this->url_remap[$url] = $upload['url']; 719 $this->url_remap[$post['guid']] = $upload['url']; 708 720 // if the remote url is redirected somewhere else, keep track of the destination too 709 721 if ( $headers['x-final-location'] != $url ) 710 722 $this->url_remap[$headers['x-final-location']] = $upload['url']; … … 713 725 714 726 } 715 727 728 /** 729 * Bump up the request timeout for http requests 730 * 731 * @param int $val 732 * @return int 733 */ 734 public function bump_request_timeout( $val ) { 735 return 60; 736 } 737 716 738 // sort by strlen, longest string first 717 739 function cmpr_strlen($a, $b) { 718 740 return strlen($b) - strlen($a);