mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Cron API: Attempt to raise the PHP memory limit for cron event processing.
Since cron events often consume extra memory by nature, it makes sense to give them the full amount available by default. In practice this means the memory will be increased to `WP_MAX_MEMORY_LIMIT` (which is 256MB by default) during cron event processing if the default memory limit is lower than this value. The new `cron_memory_limit` filter can be used to adjust this value if necessary. Note that this change will not by default affect external means of processing cron events, such as the `wp cron` command in WP-CLI, server-level crontab events, or any other cron event processing mechanism that bypasses `wp-cron.php`. Props iandunn, thakkarhardik Fixes #56628 Built from https://develop.svn.wordpress.org/trunk@55871 git-svn-id: http://core.svn.wordpress.org/trunk@55383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bb9b9d17f4
commit
ffd2a5bb95
@ -46,6 +46,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
require_once __DIR__ . '/wp-load.php';
|
||||
}
|
||||
|
||||
// Attempt to raise the PHP memory limit for cron event processing.
|
||||
wp_raise_memory_limit( 'cron' );
|
||||
|
||||
/**
|
||||
* Retrieves the cron lock.
|
||||
*
|
||||
|
@ -7523,7 +7523,7 @@ function mysql_to_rfc3339( $date_string ) {
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @param string $context Optional. Context in which the function is called. Accepts either 'admin',
|
||||
* 'image', or an arbitrary other context. If an arbitrary context is passed,
|
||||
* 'image', 'cron', or an arbitrary other context. If an arbitrary context is passed,
|
||||
* the similarly arbitrary {@see '$context_memory_limit'} filter will be
|
||||
* invoked. Default 'admin'.
|
||||
* @return int|string|false The limit that was set or false on failure.
|
||||
@ -7584,6 +7584,21 @@ function wp_raise_memory_limit( $context = 'admin' ) {
|
||||
$filtered_limit = apply_filters( 'image_memory_limit', $filtered_limit );
|
||||
break;
|
||||
|
||||
case 'cron':
|
||||
/**
|
||||
* Filters the memory limit allocated for WP-Cron event processing.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param int|string $filtered_limit Maximum memory limit to allocate for WP-Cron.
|
||||
* Default `WP_MAX_MEMORY_LIMIT` or the original
|
||||
* php.ini `memory_limit`, whichever is higher.
|
||||
* Accepts an integer (bytes), or a shorthand string
|
||||
* notation, such as '256M'.
|
||||
*/
|
||||
$filtered_limit = apply_filters( 'cron_memory_limit', $filtered_limit );
|
||||
break;
|
||||
|
||||
default:
|
||||
/**
|
||||
* Filters the memory limit allocated for an arbitrary context.
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-alpha-55870';
|
||||
$wp_version = '6.3-alpha-55871';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user