ActionScheduler_Compatibility::raise_memory_limit()
Attempts to raise the PHP memory limit for memory intensive processes.
Only allows raising the existing limit and prevents lowering it.
Wrapper for wp_raise_memory_limit(), added in WordPress v4.6.0
Method of the class: ActionScheduler_Compatibility{}
Hooks from the method
Return
true|false|Int|String
. The limit that was set or false on failure.
Usage
$result = ActionScheduler_Compatibility::raise_memory_limit();
ActionScheduler_Compatibility::raise_memory_limit() ActionScheduler Compatibility::raise memory limit code WC 9.3.3
public static function raise_memory_limit() { if ( function_exists( 'wp_raise_memory_limit' ) ) { return wp_raise_memory_limit( 'admin' ); } $current_limit = @ini_get( 'memory_limit' ); $current_limit_int = self::convert_hr_to_bytes( $current_limit ); if ( -1 === $current_limit_int ) { return false; } $wp_max_limit = WP_MAX_MEMORY_LIMIT; $wp_max_limit_int = self::convert_hr_to_bytes( $wp_max_limit ); $filtered_limit = apply_filters( 'admin_memory_limit', $wp_max_limit ); $filtered_limit_int = self::convert_hr_to_bytes( $filtered_limit ); if ( -1 === $filtered_limit_int || ( $filtered_limit_int > $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) { if ( false !== @ini_set( 'memory_limit', $filtered_limit ) ) { return $filtered_limit; } else { return false; } } elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) { if ( false !== @ini_set( 'memory_limit', $wp_max_limit ) ) { return $wp_max_limit; } else { return false; } } return false; }