Ticket #43990: 43990.patch
File 43990.patch, 6.6 KB (added by , 7 years ago) |
---|
-
src/wp-admin/includes/class-file-upload-upgrader.php
124 124 wp_delete_attachment( $this->id ); 125 125 126 126 } elseif ( file_exists( $this->package ) ) { 127 return @ unlink( $this->package );127 return @wp_delete_file( $this->package ); 128 128 } 129 129 130 130 return true; -
src/wp-admin/includes/class-wp-upgrader.php
324 324 325 325 // Once extracted, delete the package if required. 326 326 if ( $delete_package ) { 327 unlink( $package );327 wp_delete_file( $package ); 328 328 } 329 329 330 330 if ( is_wp_error( $result ) ) { -
src/wp-admin/includes/file.php
610 610 611 611 /** 612 612 * Returns a filename of a Temporary unique file. 613 * Please note that the calling function must unlink() this itself.613 * Please note that the calling function must wp_delete_file() this itself. 614 614 * 615 615 * The filename is based off the passed parameter or defaults to the current unix timestamp, 616 616 * while the directory can either be passed as well, or by leaving it blank, default to a writable temporary directory. … … 848 848 if ( 'wp_handle_upload' === $action ) { 849 849 $move_new_file = @ move_uploaded_file( $file['tmp_name'], $new_file ); 850 850 } else { 851 // use copy and unlinkbecause rename breaks streams.851 // use copy and wp_delete_file because rename breaks streams. 852 852 $move_new_file = @ copy( $file['tmp_name'], $new_file ); 853 unlink( $file['tmp_name'] );853 wp_delete_file( $file['tmp_name'] ); 854 854 } 855 855 856 856 if ( false === $move_new_file ) { … … 960 960 /** 961 961 * Downloads a URL to a local temporary file using the WordPress HTTP API. 962 962 * 963 * Please note that the calling function must unlink() the file.963 * Please note that the calling function must wp_delete_file() the file. 964 964 * 965 965 * @since 2.5.0 966 966 * … … 969 969 * @return string|WP_Error Filename on success, WP_Error on failure. 970 970 */ 971 971 function download_url( $url, $timeout = 300 ) { 972 //WARNING: The file is not automatically deleted, The script must unlink() the file.972 //WARNING: The file is not automatically deleted, The script must wp_delete_file() the file. 973 973 if ( ! $url ) { 974 974 return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.' ) ); 975 975 } … … 990 990 ); 991 991 992 992 if ( is_wp_error( $response ) ) { 993 unlink( $tmpfname );993 wp_delete_file( $tmpfname ); 994 994 return $response; 995 995 } 996 996 … … 1018 1018 fclose( $tmpf ); 1019 1019 } 1020 1020 1021 unlink( $tmpfname );1021 wp_delete_file( $tmpfname ); 1022 1022 return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ), $data ); 1023 1023 } 1024 1024 … … 1026 1026 if ( $content_md5 ) { 1027 1027 $md5_check = verify_file_md5( $tmpfname, $content_md5 ); 1028 1028 if ( is_wp_error( $md5_check ) ) { 1029 unlink( $tmpfname );1029 wp_delete_file( $tmpfname ); 1030 1030 return $md5_check; 1031 1031 } 1032 1032 } … … 2158 2158 } 2159 2159 2160 2160 // And remove the HTML file. 2161 unlink( $html_report_pathname );2161 wp_delete_file( $html_report_pathname ); 2162 2162 2163 2163 if ( $error ) { 2164 2164 wp_send_json_error( $error ); … … 2346 2346 $export_path = get_post_meta( $request_id, '_export_file_path', true ); 2347 2347 if ( ! empty( $export_path ) ) { 2348 2348 delete_post_meta( $request_id, '_export_file_path' ); 2349 @ unlink( $export_path );2349 @wp_delete_file( $export_path ); 2350 2350 } 2351 2351 delete_post_meta( $request_id, '_export_file_url' ); 2352 2352 -
src/wp-includes/class-snoopy.php
1081 1081 else 1082 1082 $this->results = $results; 1083 1083 1084 unlink("$headerfile");1084 wp_delete_file("$headerfile"); 1085 1085 1086 1086 return true; 1087 1087 } -
src/wp-includes/functions.php
1896 1896 } 1897 1897 fclose( $f ); 1898 1898 if ( $should_delete_tmp_file ) { 1899 unlink( $path );1899 wp_delete_file( $path ); 1900 1900 } 1901 1901 return true; 1902 1902 } … … 6307 6307 $file_age_in_seconds = time() - filemtime( $export_file ); 6308 6308 6309 6309 if ( $expiration < $file_age_in_seconds ) { 6310 unlink( $export_file );6310 wp_delete_file( $export_file ); 6311 6311 } 6312 6312 } 6313 6313 } -
src/wp-includes/post.php
5286 5286 $thumbfile = str_replace( basename( $file ), $meta['thumb'], $file ); 5287 5287 /** This filter is documented in wp-includes/functions.php */ 5288 5288 $thumbfile = apply_filters( 'wp_delete_file', $thumbfile ); 5289 @ unlink( path_join( $uploadpath['basedir'], $thumbfile ) );5289 @ wp_delete_file( path_join( $uploadpath['basedir'], $thumbfile ) ); 5290 5290 } 5291 5291 } 5292 5292 … … 5296 5296 $intermediate_file = str_replace( basename( $file ), $sizeinfo['file'], $file ); 5297 5297 /** This filter is documented in wp-includes/functions.php */ 5298 5298 $intermediate_file = apply_filters( 'wp_delete_file', $intermediate_file ); 5299 @ unlink( path_join( $uploadpath['basedir'], $intermediate_file ) );5299 @ wp_delete_file( path_join( $uploadpath['basedir'], $intermediate_file ) ); 5300 5300 } 5301 5301 } 5302 5302 … … 5305 5305 $del_file = path_join( dirname( $meta['file'] ), $size['file'] ); 5306 5306 /** This filter is documented in wp-includes/functions.php */ 5307 5307 $del_file = apply_filters( 'wp_delete_file', $del_file ); 5308 @ unlink( path_join( $uploadpath['basedir'], $del_file ) );5308 @ wp_delete_file( path_join( $uploadpath['basedir'], $del_file ) ); 5309 5309 } 5310 5310 } 5311 5311 -
src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
565 565 $sideloaded = wp_handle_sideload( $file_data, $overrides ); 566 566 567 567 if ( isset( $sideloaded['error'] ) ) { 568 @ unlink( $tmpfname );568 @wp_delete_file( $tmpfname ); 569 569 570 570 return new WP_Error( 'rest_upload_sideload_error', $sideloaded['error'], array( 'status' => 500 ) ); 571 571 }