Ticket #17301: 17301.diff
File 17301.diff, 3.0 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/file.php
588 588 if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it 589 589 continue; 590 590 591 do_action( 'keepalive_tick' ); 592 591 593 $parent_folder = dirname($dir); 592 594 while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) { 593 595 $needed_dirs[] = $parent_folder; … … 613 615 if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files 614 616 continue; 615 617 618 do_action( 'keepalive_tick' ); 619 616 620 $contents = $z->getFromIndex($i); 617 621 if ( false === $contents ) 618 622 return new WP_Error('extract_failed', __('Could not extract file from archive.'), $info['name']); … … 690 694 691 695 // Create those directories if need be: 692 696 foreach ( $needed_dirs as $_dir ) { 697 do_action( 'keepalive_tick' ); 693 698 if ( ! $wp_filesystem->mkdir($_dir, FS_CHMOD_DIR) && ! $wp_filesystem->is_dir($_dir) ) // Only check to see if the dir exists upon creation failure. Less I/O this way. 694 699 return new WP_Error('mkdir_failed', __('Could not create directory.'), $_dir); 695 700 } … … 703 708 if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files 704 709 continue; 705 710 711 do_action( 'keepalive_tick' ); 712 706 713 if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) ) 707 714 return new WP_Error('copy_failed', __('Could not copy file.'), $to . $file['filename']); 708 715 } … … 740 747 if ( preg_match($skip_regex, $from . $filename) ) 741 748 continue; 742 749 750 do_action( 'keepalive_tick' ); 751 743 752 if ( 'f' == $fileinfo['type'] ) { 744 753 if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) { 745 754 // If copy failed, chmod file to 0644 and try again. … … 1046 1055 <?php 1047 1056 return false; 1048 1057 } 1058 1059 function connection_keepalive() { 1060 if ( ! headers_sent() ) 1061 return; 1062 1063 static $last_sent; 1064 1065 if ( ! isset( $last_sent ) ) 1066 $last_sent = time(); 1067 1068 // Only send every 10 seconds 1069 if ( $last_sent + 10 > time() ) 1070 return; 1071 1072 $last_sent = time(); 1073 1074 if ( DOING_AJAX ) 1075 echo ' '; // It might be JSON, which doesn't allow comments 1076 else 1077 echo "<!-- $last_sent -->"; 1078 } 1079 add_action( 'keepalive_tick', 'connection_keepalive' ); -
wp-admin/includes/update-core.php
839 839 if ( preg_match($skip_regex, $from . $filename) ) 840 840 continue; 841 841 842 do_action( 'keepalive_tick' ); 843 842 844 if ( 'f' == $fileinfo['type'] ) { 843 845 if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) { 844 846 // If copy failed, chmod file to 0644 and try again.