Fix memory limit detection on some systems

This commit is contained in:
Mike Jolley 2017-06-14 18:16:39 +01:00
parent 0de65b3a8d
commit 4dea3ece8a
2 changed files with 4 additions and 2 deletions

View File

@ -658,12 +658,14 @@ abstract class WC_Product_Importer implements WC_Importer_Interface {
// Sensible default. // Sensible default.
$memory_limit = '128M'; $memory_limit = '128M';
} }
if ( ! $memory_limit || -1 === $memory_limit ) {
if ( ! $memory_limit || -1 === intval( $memory_limit ) ) {
// Unlimited, set to 32GB. // Unlimited, set to 32GB.
$memory_limit = '32000M'; $memory_limit = '32000M';
} }
return intval( $memory_limit ) * 1024 * 1024; return intval( $memory_limit ) * 1024 * 1024;
} }
/** /**
* Time exceeded. * Time exceeded.
* *

View File

@ -362,7 +362,7 @@ abstract class WP_Background_Process extends WP_Async_Request {
$memory_limit = '128M'; $memory_limit = '128M';
} }
if ( ! $memory_limit || -1 === $memory_limit ) { if ( ! $memory_limit || -1 === intval( $memory_limit ) ) {
// Unlimited, set to 32GB. // Unlimited, set to 32GB.
$memory_limit = '32000M'; $memory_limit = '32000M';
} }