Commit Graph

53 Commits

Author SHA1 Message Date
John Blackbourn
ffd2a5bb95 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
2023-05-30 18:48:19 +00:00
Sergey Biryukov
665719b9de Docs: Revise comments using “we” in WordPress root directory files.
This updates some inline comments to better match the guidelines and recommendations set forth in the make/core and make/docs handbooks:

> In general, use second person in your documentation. Second person depicts a friendly tone, with a perfect focus on the reader. In addition to this, directly addressing the reader helps avoid passive voice; thereby preventing unwanted confusion.
> ...
> the word “we” should be avoided (...) unless its made very clear which group is speaking.

Includes:
* Replacing first-person usage of "we" with second person point of view.
* Making small clarification adjustments where the voice is much too casual or lacks clear context, especially for non-native English speakers.

References:
* [https://make.wordpress.org/docs/style-guide/language-grammar/grammatical-person/ Style Guide: Grammatical person]
* [https://make.wordpress.org/docs/handbook/documentation-team-handbook/handbooks-style-and-formatting-guide/ Handbooks & HelpHub Style and Formatting Guide]
* [https://make.wordpress.org/core/handbook/best-practices/post-comment-guidelines/#style-and-substance Post & Comment Guidelines: Style and Substance]

Follow-up to [2176], [3430], [4676], [6009], [7991], [12688], [12762], [26008], [28978], [44488], [44962], [51979], [53131], [53132], [53156], [53131], [54200].

Props ironprogrammer, costdev, jorbin, SergeyBiryukov.
See #57052.
Built from https://develop.svn.wordpress.org/trunk@54866


git-svn-id: http://core.svn.wordpress.org/trunk@54418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-23 15:43:13 +00:00
audrasjb
84d1984866 Cron API: Add error logging and hooks to wp-cron.php.
This changeset adds error logging on `wp_reschedule_event()` and `wp_unschedule_event` in `wp-cron.php`. This allows proper error logging when random errors appear. It also introduces `cron_reschedule_event_error` and `cron_unschedule_event_error` hooks which can be used to trigger additional behaviors when an error occurs.

Props Enchiridion, johnbillion, costdev.
Fixes #56048.

Built from https://develop.svn.wordpress.org/trunk@54258


git-svn-id: http://core.svn.wordpress.org/trunk@53817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 15:44:38 +00:00
Peter Wilson
2c768f7c9d Cron API: Make wp-cron non-blocking for LiteSpeed LSAPI.
This should make cron spawning faster on LSAPI by ensuring that cron requests return immediately.

To avoid code repetition, the no caching headers are relocated and always sent. Caching plugins attempting to set these 
headers later will replace those set by WordPress Core.

Follow up to [44488].

Props maximej, johnbillion.
Fixes #54668.

Built from https://develop.svn.wordpress.org/trunk@53653


git-svn-id: http://core.svn.wordpress.org/trunk@53212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 03:14:14 +00:00
Sergey Biryukov
40fc19024f Code Modernization: Replace phpversion() function calls with PHP_VERSION constant.
`phpversion()` return value and `PHP_VERSION` constant value are identical, but the latter is several times faster because it is a direct constant value lookup compared to a function call.

Props ayeshrajans, jrf, mukesh27, costdev, hellofromTonya, SergeyBiryukov.
Fixes #55680.
Built from https://develop.svn.wordpress.org/trunk@53426


git-svn-id: http://core.svn.wordpress.org/trunk@53015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 17:38:14 +00:00
John Blackbourn
0d46464f83 Docs: Various docblock corrections.
See #54729

Built from https://develop.svn.wordpress.org/trunk@53300


git-svn-id: http://core.svn.wordpress.org/trunk@52889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 09:49:16 +00:00
desrosj
cf0f278ebe Build/Test Tools: Revert changes only included for testing purposes.
Follow up to [51535-51536].

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51537


git-svn-id: http://core.svn.wordpress.org/trunk@51148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 15:15:57 +00:00
desrosj
a748075471 Build/Test Tools: Expand Slack notifications for GitHub Actions.
This expands Slack notifications to include success, cancelled, and “fixed” GitHub Action workflow run outcomes in addition to failures.

A “fixed” outcome occurs when the previous run for a workflow failed and the current one succeeds. This matches the behavior that was native to TravisCI by setting `on_success` for notifications to `change`.

The message details and where each outcome is posted is controlled by Slack workflows.

The Slack notification logic has also been pulled into a separate workflow to prevent repeating code in every workflow.

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51535


git-svn-id: http://core.svn.wordpress.org/trunk@51146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 13:46:56 +00:00
desrosj
9d6ea69d92 Build/Test Tools: Revert the test and coding standards changes in [51511].
These were temporary for testing Slack messages when GitHub Action workflows fail.

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51512


git-svn-id: http://core.svn.wordpress.org/trunk@51123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-29 20:03:57 +00:00
desrosj
b5d09ecd99 Build/Test Tools: Post a message to #core in Slack when a workflow fails.
This adds an additional step to each GitHub Action workflow file that posts a message to #core in Slack every time a workflow run fails.

A minor test and spacing change is included in this commit in order to that messages are posted correctly and will be reverted after testing.

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51511


git-svn-id: http://core.svn.wordpress.org/trunk@51122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-29 19:48:58 +00:00
John Blackbourn
782f05d2c5 Docs: Various fixes and improvements to inline documentation.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48695


git-svn-id: http://core.svn.wordpress.org/trunk@48457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-30 19:14:03 +00:00
Sergey Biryukov
47ed56f38f Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant.
This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.

This commit also includes:

* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
 * `wp-admin/admin-header.php`
 * `wp-admin/admin-footer.php`
 * `wp-includes/version.php`

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.
Built from https://develop.svn.wordpress.org/trunk@47198


git-svn-id: http://core.svn.wordpress.org/trunk@46998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-06 06:33:11 +00:00
Sergey Biryukov
d784ebbcb4 Coding Standards: Use strict comparison and Yoda conditions in the root directory files.
Props pikamander2.
Fixes #48965.
Built from https://develop.svn.wordpress.org/trunk@47054


git-svn-id: http://core.svn.wordpress.org/trunk@46854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-09 00:55:05 +00:00
Sergey Biryukov
3a735ec87a Docs: Improve a comment about $doing_wp_cron global in wp-cron.php.
Props chinteshprajapati, subrataemfluence, nielslange.
Fixes #46104.
Built from https://develop.svn.wordpress.org/trunk@46733


git-svn-id: http://core.svn.wordpress.org/trunk@46533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-15 08:59:01 +00:00
Aaron Jorbin
742537ac3d Cron: Prevent sending headers when using ALTERNATE_WP_CRON
ALTERNATE_WP_CRON echos things which causes a "Headers already sent" warning. This adds a check to ensure headers haven't already been sent.

Previously: [45560]

See: #45560. Fixes #48283.
Props dlh.


Built from https://develop.svn.wordpress.org/trunk@46458


git-svn-id: http://core.svn.wordpress.org/trunk@46256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-10 22:52:03 +00:00
Sergey Biryukov
3daef6260b Code Modernisation: Replace call_user_func_array() in wp-cron.php with a direct function call.
Props jrf.
See #47678.
Built from https://develop.svn.wordpress.org/trunk@46142


git-svn-id: http://core.svn.wordpress.org/trunk@45954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-15 11:48:54 +00:00
Peter Wilson
bb965baeec Cron: Fix condition reversed in [45559].
In [45559] a test for not-falsey was reversed to a falsey check.

Props obenland.
Fixes #47589.

Built from https://develop.svn.wordpress.org/trunk@45562


git-svn-id: http://core.svn.wordpress.org/trunk@45373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-22 13:43:52 +00:00
Peter Wilson
b0e82d2cc4 Cron API: Prevent caching of WP Cron requests.
Add `Cache-Control` and `Expires` HTTP headers to prevent caching of requests to WP Cron on systems supporting fastcgi_finish_request(). 

The fastcgi_finish_request() call prevents the setting of further HTTP headers by caching plugins subsequently loaded.

Props kingkero.
Fixes 47396.


Built from https://develop.svn.wordpress.org/trunk@45560


git-svn-id: http://core.svn.wordpress.org/trunk@45371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-22 11:13:51 +00:00
Peter Wilson
fdb8ff4980 Code is Poetry: CS Fixes required in wp-cron.php.
See #47396, #41057.


Built from https://develop.svn.wordpress.org/trunk@45559


git-svn-id: http://core.svn.wordpress.org/trunk@45370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-22 11:12:51 +00:00
Peter Wilson
184c501d5c Cron: Fix undefined variable notice.
Restore `$gmt_time` variable removed in error from [44483].

Props afragen.
Fixes #45870.


Built from https://develop.svn.wordpress.org/trunk@44505


git-svn-id: http://core.svn.wordpress.org/trunk@44336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-09 08:37:51 +00:00
tellyworth
942f35446f Cron API: Make wp-cron.php non-blocking where possible.
This should make cron spawning faster by ensuring requests to wp-cron.php return immediately regardless of transport method. It is enabled only on recent PHP versions with fastcgi, due to historical bugs and availability of `fastcgi_finish_request()`. This needs testing on a range of platforms, to help determine if it's safe to use in other contexts also.

Props vnsavage, johnbillion, jnylen0.
See #18738, #41358

Built from https://develop.svn.wordpress.org/trunk@44488


git-svn-id: http://core.svn.wordpress.org/trunk@44319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-09 01:07:39 +00:00
Peter Wilson
bf3c97de77 Cron API: Add function and filter to return ready cron jobs.
Add the function `wp_get_ready_cron_jobs()` to return a modified version of the cron array limited to jobs ready to be run, ie with a timestamp of `time()` or earlier.

The new function includes the filter `pre_get_ready_cron_jobs` to allow for custom cron storage systems. This rounds out the functionality added in #32656.

Props Pento for code review.
Fixes #45797.


Built from https://develop.svn.wordpress.org/trunk@44483


git-svn-id: http://core.svn.wordpress.org/trunk@44314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-08 21:49:49 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Drew Jaynes
ffa7e7d4ab Docs: Improve the usefulness and accuracy of the file header for wp-cron.php.
Props stevenlinx for the initial patch.
Fixes #31401.

Built from https://develop.svn.wordpress.org/trunk@41276


git-svn-id: http://core.svn.wordpress.org/trunk@41116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-20 04:37:45 +00:00
Sergey Biryukov
37a04795b2 Docs: Add a @global entry for $wpdb in _get_cron_lock.
Props tejas5989.
Fixes #41433.
Built from https://develop.svn.wordpress.org/trunk@41146


git-svn-id: http://core.svn.wordpress.org/trunk@40986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-25 12:56:43 +00:00
Drew Jaynes
4c37f68b79 Fix inline documentation syntax in wp_xmlrpc_server.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@32591


git-svn-id: http://core.svn.wordpress.org/trunk@32561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-25 06:25:25 +00:00
Drew Jaynes
d4e9197764 Add a missing DocBlock for the core utility function _get_cron_lock().
Props mordauk, valendesigns.
Fixes #31646.

Built from https://develop.svn.wordpress.org/trunk@31804


git-svn-id: http://core.svn.wordpress.org/trunk@31786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-17 23:38:27 +00:00
Drew Jaynes
f2bc30c03f Ensure we're using the correct @ignore phpDocumentor tag to mark elements that should be skipped when parsing.
Up to this point, various core elements' DocBlocks incorrectly included an `@internal` tag as a means for skipping the parsing process. When paired with a description (inline or otherwise), `@internal` is a valid tag meant to provide internal-only context, but not necessarily to skip parsing the entire element.

See #30987.

Built from https://develop.svn.wordpress.org/trunk@31170


git-svn-id: http://core.svn.wordpress.org/trunk@31151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-13 00:51:21 +00:00
Drew Jaynes
f9f55011ba Fix a phpdoc typo and multi-line comment syntax in wp-cron.php.
Props rclations.
Fixes #28231.

Built from https://develop.svn.wordpress.org/trunk@28380


git-svn-id: http://core.svn.wordpress.org/trunk@28208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-13 04:39:14 +00:00
Drew Jaynes
058ff61dec Mark the $hook and $page_hook hooks as @internal to skip parsing.
See #26869.

Built from https://develop.svn.wordpress.org/trunk@28216


git-svn-id: http://core.svn.wordpress.org/trunk@28046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-25 07:54:21 +00:00
Andrew Nacin
fd57b239d2 Don't rely on include_path to include files.
Always use dirname() or, once available, ABSPATH.

props ketwaroo, hakre.
fixes #17092.

Built from https://develop.svn.wordpress.org/trunk@25616


git-svn-id: http://core.svn.wordpress.org/trunk@25533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-25 00:18:11 +00:00
Andrew Nacin
4079183e42 Document the event hook in wp-cron.php. see #25229.
Built from https://develop.svn.wordpress.org/trunk@25290


git-svn-id: http://core.svn.wordpress.org/trunk@25254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 20:52:10 +00:00
Scott Taylor
d7cc1f506a Introduce wp_using_ext_object_cache() - mimic wp_suspend_cache_invalidation() and discourage direct access to $_wp_using_ext_object_cache, cleaning up importing of globals in functions and provides function to modify that global. Loads the packaged object cache when an external cache hasn't been loaded or doesn't contain wp_cache_init().
Fixes #21401.


Built from https://develop.svn.wordpress.org/trunk@25289


git-svn-id: http://core.svn.wordpress.org/trunk@25253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 18:10:09 +00:00
Andrew Nacin
b45c550376 Use $gmt_time rather than $local_time in cron, since it uses GMT/UTC and not a local timestamp. see #14391.
git-svn-id: http://core.svn.wordpress.org/trunk@21954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-23 16:57:21 +00:00
ryan
2f915b5320 Use microtime() for cron locks. fixes #19700
git-svn-id: http://svn.automattic.com/wordpress/trunk@19722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-09 19:02:31 +00:00
ryan
5ebcc1d3ea Improve cron locking. Avoid multiple cron processes looping over the same events. fixes #17462
git-svn-id: http://svn.automattic.com/wordpress/trunk@18659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-09 19:59:44 +00:00
markjaquith
58d47426cc More pedantry. "Setup" is not a verb. http://notaverb.com/setup
git-svn-id: http://svn.automattic.com/wordpress/trunk@13725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-03-17 04:39:50 +00:00
azaozz
326befa4ed Increase timeout on cron-based requests when checking for upgrades, props dd32, fixes #10349
git-svn-id: http://svn.automattic.com/wordpress/trunk@11826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-08-16 04:59:38 +00:00
azaozz
a4df9a5326 Cron spawning improvement, see #9005
git-svn-id: http://svn.automattic.com/wordpress/trunk@10521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-02-07 13:32:34 +00:00
ryan
8c7d54a9dc Use transient for doing_cron. see #9048
git-svn-id: http://svn.automattic.com/wordpress/trunk@10519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-02-06 22:25:35 +00:00
ryan
0a3a725c82 Lose hash check
git-svn-id: http://svn.automattic.com/wordpress/trunk@10472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-01-30 22:32:20 +00:00
azaozz
0853ba158c Cron improvement, props hailin, fixes #7068
git-svn-id: http://svn.automattic.com/wordpress/trunk@8927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-09-18 07:09:38 +00:00
ryan
a6a1522a8d File file level phpdoc from jacobsantos. see #7037
git-svn-id: http://svn.automattic.com/wordpress/trunk@7991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-05-25 15:50:15 +00:00
ryan
5b8113578d Allow wp-config.php to exist one level up from WordPress root directory. Props sambauers. fixes #6933
git-svn-id: http://svn.automattic.com/wordpress/trunk@7971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-05-21 05:59:27 +00:00
markjaquith
5897a90fd7 Consistently include wp-config.php. fixes #3349
git-svn-id: http://svn.automattic.com/wordpress/trunk@5843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-03 00:45:06 +00:00
ryan
02cfbbe93b Use wp_hash to create cron's check hash.
git-svn-id: http://svn.automattic.com/wordpress/trunk@5274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-16 20:47:23 +00:00
ryan
68b74ef3b9 Attempt at eliminating cron contention.
git-svn-id: http://svn.automattic.com/wordpress/trunk@4509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-21 02:48:12 +00:00
ryan
287467334e Change cron arg passing. Props masquerade. fixes #3169.
git-svn-id: http://svn.automattic.com/wordpress/trunk@4362 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-08 17:50:21 +00:00
ryan
9431f91ff6 Cron unscheduling fixes.
git-svn-id: http://svn.automattic.com/wordpress/trunk@4190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-14 00:18:05 +00:00
ryan
68aa6231a2 cron and future post publishing fixes. fixes #3058
git-svn-id: http://svn.automattic.com/wordpress/trunk@4189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-13 23:54:15 +00:00