BUG+FIX: attachments not imported due to cached filesize()
-
On my system WordPress importer correctly downloads attachments (images) and than during various filesize checks (in function fetch_remote_file) deletes them and throws an error, because PHP returns cached size equal to 0.
Quick fix, is to call
clearstatcache()
before doingfilesize()
. For prod maybe optimize it a bit, this is quick hot fix ??This problem seems to be more common, according to some posts in this forum.
--- wordpress-importer.php-old 2019-03-30 23:07:17.958996314 +0000 +++ wordpress-importer.php 2019-03-30 23:07:13.787066903 +0000 @@ -1011,6 +1011,7 @@ return new WP_Error( 'import_file_error', sprintf( __('Remote server returned error response %1$d %2$s', 'wordpress-importer'), esc_html($remote_response_code), get_status_header_desc($remote_response_code) ) ); } + clearstatcache(); $filesize = filesize( $upload['file'] ); if ( isset( $headers['content-length'] ) && $filesize != $headers['content-length'] ) {
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘BUG+FIX: attachments not imported due to cached filesize()’ is closed to new replies.