Update wp-background-process.php to use wp_convert_hr_to_bytes() (#30908)
Update wp-background-process.php to use wp_convert_hr_to_bytes() Currently the code is typecasting the memory limit to an int. This assumes that the memory limit is in MB, so if you set your memory limit to 4G this will return 4194304 bytes (4.19304 MB.) Instead, we should use the native WordPress function `wp_convert_hr_to_bytes` to handle the conversion into bytes correctly.
This commit is contained in:
parent
9cecce207a
commit
538403306c
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
`WP_Background_Process` updated to work nicely with memory_limits expressed in units other than 'M'.
|
|
@ -370,7 +370,7 @@ abstract class WP_Background_Process extends WP_Async_Request {
|
|||
$memory_limit = '32000M';
|
||||
}
|
||||
|
||||
return intval( $memory_limit ) * 1024 * 1024;
|
||||
return wp_convert_hr_to_bytes( $memory_limit );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue