Timur Gogolev
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] WP 5.0.1 breaks WooCommerce csv import?@killua99 I think that problem not in WP Core, but in fileinfo PHP extension.
Do you think that we need to modify WP Core to fix this?
Forum: Plugins
In reply to: [WooCommerce] WP 5.0.1 breaks WooCommerce csv import?Hi everyone!
There is another one cause and a solution for it.
Usingdefine(‘ALLOW_UNFILTERED_UPLOADS’, true);isn’t a good practice so we need to look deeper.I’ve found out that, in some cases, php extension
fileinfoworks not good enough and cannot determine MIME of csv files properly.In that case I use next recipe:
1. Go towordpress/wp-includes/functions.php
2. Findfinfo_open( FILEINFO_MIME_TYPE );
3. Enrich it with a path to a magic database (details) and get something like$finfo = finfo_open( FILEINFO_MIME_TYPE, '/usr/share/misc/magic' );
4. Add if blockif ( false === $real_mime ) $real_mime = 'text/plain';afterfinfo_close( $finfo );This solution works only if php extension on your hosting works improperly.
If you have another cause of issue, it won’t workAnd also because it is a core hack you need to add it again after each update.
- This reply was modified 7 years, 3 months ago by Timur Gogolev.
- This reply was modified 7 years, 3 months ago by Timur Gogolev.
- This reply was modified 7 years, 3 months ago by Timur Gogolev.
- This reply was modified 7 years, 3 months ago by Timur Gogolev.