Commit Graph

149 Commits

Author SHA1 Message Date
hellofromTonya
d30fe43245 Docs: Replace "sanity" with "confidence" for inclusive language.
The phrase "sanity check" unnecessarily references mental health. It's an old phrase used to denote an extra step in verifying code works as expected.

“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

While "sanity check" is a well-known phrase with a specific meaning, "confidence check" is a direct replacement that is more clear of its intent while being more inclusive.

Words matter.

Follow-up to [49216], [46271], [40583], [38832], [38637], [37409], [33359], [32162], [30346], [30345], [30238], [30055], [29902], [28763], [26141], [25002], [22227], [13428], [12148], [11025], [8927].

Props dartiss, hellofromTonya.
Fixes #60187.
Built from https://develop.svn.wordpress.org/trunk@57239


git-svn-id: http://core.svn.wordpress.org/trunk@56745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-03 21:59:19 +00:00
Sergey Biryukov
5896701b31 Docs: Include 'weekly' as a valid value in wp_schedule_event() description.
Follow-up to [47062].

Props crstauf, pacicio.
Fixes #59888.
Built from https://develop.svn.wordpress.org/trunk@57106


git-svn-id: http://core.svn.wordpress.org/trunk@56617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-11 09:28:30 +00:00
Peter Wilson
e41f176a63 Cron: Cast doing_cron transient to a float.
Cast the `doing_cron` transient value to a float to prevent type errors if the transient is not set (in which case it returns `false`) or another unexpected type.

Props fzhantw, ankitmaru.
Fixes #58471.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-11 05:27:22 +00:00
John Blackbourn
4667b9323f Docs: Miscellaneous docblock corrections and improvements.
See #58833

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


git-svn-id: http://core.svn.wordpress.org/trunk@55926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 17:29:20 +00:00
Sergey Biryukov
22f80e9382 Coding Standards: Use strict comparison in wp-includes/cron.php.
Includes minor code layout fixes for better readability.

Follow-up to [3634], [4189].

Props aristath, poena, afercia, SergeyBiryukov.
See #58831.
Built from https://develop.svn.wordpress.org/trunk@56394


git-svn-id: http://core.svn.wordpress.org/trunk@55906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-12 12:02:24 +00:00
audrasjb
8c76c6d58c Docs: Replace multiple single line comments with multi-line comments.
This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Follow-up to [56174], [56175], [56176], [56177], [56178], [56179].

Props costdev, audrasjb.
See #58459.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-09 21:48:22 +00:00
Sergey Biryukov
1ce5dc7444 Code Modernization: Replace usage of strpos() with str_contains().
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).

WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.

Follow-up to [52039], [52040], [52326], [55703], [55710], [55987].

Props Soean, spacedmonkey, costdev, dingo_d, azaozz, mikeschroder, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes #58206.
Built from https://develop.svn.wordpress.org/trunk@55988


git-svn-id: http://core.svn.wordpress.org/trunk@55500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 14:36:26 +00:00
Sergey Biryukov
0008d8df06 Coding Standards: Replace include_once with require_once for required files.
Per [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#writing-include-require-statements WordPress PHP coding standards], it is ''strongly recommended'' to use `require[_once]` for unconditional includes. When using `include[_once]`, PHP will throw a warning when the file is not found but will continue execution, which will almost certainly lead to other errors/warnings/notices being thrown if your application depends on the file loaded, potentially leading to security leaks. For that reason, `require[_once]` is generally the better choice as it will throw a `Fatal Error` if the file cannot be found.

Follow-up to [1674], [1812], [1964], [6779], [8540], [10521], [11005], [11911], [16065], [16149], [25421], [25466], [25823], [37714], [42981], [45448], [47198], [54276], [55633].

Props kausaralm, SergeyBiryukov.
See #57839.
Built from https://develop.svn.wordpress.org/trunk@55641


git-svn-id: http://core.svn.wordpress.org/trunk@55153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-09 11:57:22 +00:00
John Blackbourn
270a3d009d Docs: Miscellaneous improvements and corrections to docblocks.
See #56792

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


git-svn-id: http://core.svn.wordpress.org/trunk@54826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 21:21:18 +00:00
John Blackbourn
e6cc65d39e Cron API: Improve the docs for some cron event and cron schedule related functions.
See #56792

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


git-svn-id: http://core.svn.wordpress.org/trunk@54703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-31 17:50:12 +00:00
Sergey Biryukov
8eed7d4dc5 Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/cron.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$null` parameter to `$result` in `Tests_Cron::filter_pre_schedule_event_filter()`.
* Amends the `$pre` parameter of the `pre_schedule_event` filter for consistency.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55038


git-svn-id: http://core.svn.wordpress.org/trunk@54571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-09 00:42:15 +00:00
Sergey Biryukov
6b06c73cd7 Docs: Fix typo in a @since note for _get_cron_array().
Follow-up to [53791].

Props kebbet.
See #55646, #56792.
Built from https://develop.svn.wordpress.org/trunk@54504


git-svn-id: http://core.svn.wordpress.org/trunk@54063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-12 11:53:15 +00:00
John Blackbourn
f9db66d504 Docs: Various improvements to inline docblocks.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@54029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 09:02:14 +00:00
John Blackbourn
c117e5ae74 Docs: Various improvements and corrections to inline docs.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 20:32:09 +00:00
desrosj
1966addc05 Coding Standards: Various alignment fixes from composer format.
Follow up to [53874], [54097], [54110], [54155], [54162], [54184].

See #39210, #55443, #56288, #56092, #56408, #56467, #55881.
Built from https://develop.svn.wordpress.org/trunk@54210


git-svn-id: http://core.svn.wordpress.org/trunk@53769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 19:51:09 +00:00
Peter Wilson
b8f713ab09 Cron API: Remove unnecessary optimization getting ready events.
Remove the check for future events prior iterating the array of crons in `wp_get_ready_cron_jobs()`. If there are no ready events, the `foreach` loop will break on the first iteration so the optimization is not required.

As WordPress Core adds a number of events by default, accounting for an empty array is not required in most instances.

Props lev0, jrf, SergeyBiryukov.
Fixes #56092.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 01:53:11 +00:00
John Blackbourn
77bf28a1b7 Docs: Miscellaneous inline documentation improvements.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 14:11:08 +00:00
Peter Wilson
839d20f9c5 Cron API: Modify _get_cron_array() to always return an array.
Change the return type of `_get_cron_array()` to an empty array if the `cron` option is either missing or of an 
unexpected type.

This change ensures the return value for no registered events is consistently an empty array. Previously the return 
value could be either an empty array or `false`.

Props thakkarhardik, jrf, costdev.
Fixes #53940.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 03:34:13 +00:00
John Blackbourn
92f0b0cb48 Docs: Various docblock corrections and improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-23 21:37:01 +00:00
John Blackbourn
6babc3833b Docs: Miscellaneous docblock improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-29 23:13:05 +00:00
hellofromTonya
248c36d748 Cron: Fix malformed cron array in wp_schedule_single_event() when _get_cron_array() returns false.
In `wp_schedule_single_event()`, the cron info array is retrieved via a call to `_get_cron_array()` and straight away cast to an array. But as the documentation for that function (correctly) states, the return type of that function is `array|false`, where `false` is returned for a site where no cron jobs have been scheduled (yet).

In the case that `_get_cron_array()` would return `false`, this would now unintentionally create an array with a single entry with key `0` and as the value `false`.

This is a bug. Fixed now by adding validation to the output of `_get_cron_array()` and initializing `$crons` to an empty array if `false` was returned.

Tests added first to prove the bug (a) was introduced in #44818 [44917] and (b) is now fixed.

Follow-up to [44917].

Props jrf, peterwilsoncc.
Fixes #53950.
Built from https://develop.svn.wordpress.org/trunk@51916


git-svn-id: http://core.svn.wordpress.org/trunk@51509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-18 12:51:58 +00:00
hellofromTonya
6b2eccb0e3 Code Modernization: Add input validation to _set_cron_array().
The private `_set_cron_array()` function expects a cron array as the first parameter, but will often be passed the - potentially updated - output of a call to `_get_cron_array()`.

When the `_get_cron_array()` function returns `false`, a "Deprecated: Automatic conversion of false to array is deprecated" warning will be thrown on PHP 8.1.

The input validation resolves the deprecation warning by setting the cron value to an empty array when not given an `array` data type.

Adds a full set of `_set_cron_array()` tests.

Follow-up to [4189], [50152].

Props jrf, hellofromTonya, peterwilsoncc.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51695


git-svn-id: http://core.svn.wordpress.org/trunk@51301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-30 15:20:56 +00:00
Sergey Biryukov
2ac9f0814d Code Modernization: Check the return type of _get_cron_array() in wp_schedule_event().
This fixes a "Deprecated: Automatic conversion of false to array is deprecated" warning on PHP 8.1.

In `wp_schedule_event()`, the cron info array is retrieved via a call to `_get_cron_array()`, but as the documentation (correctly) states, the return type of that function is `array|false`, where `false` is returned for a virgin site, with no cron jobs scheduled yet.

However, no type check is done on the return value, and the `wp_schedule_event()` function just blindly continues by assigning a value to a subkey of the `$crons` "array".

Fixed by adding validation for the returned value from `_get_cron_array()` and initializing an empty array if `false` was returned.

Reference: [https://developer.wordpress.org/reference/functions/_get_cron_array/ WordPress Developer Resources: _get_cron_array()]

Props jrf, hellofromTonya, lucatume, pbearne, iluy, pedromendonca, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51619


git-svn-id: http://core.svn.wordpress.org/trunk@51225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-16 15:23:57 +00:00
John Blackbourn
8b7f965364 Cron API: Add a missing $wp_error parameter to the pre_reschedule_event filter.
Props tmatsuur, mukesh27

Fixes #52572
See #49961

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


git-svn-id: http://core.svn.wordpress.org/trunk@50005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-20 12:11:03 +00:00
Sergey Biryukov
21457d76d8 Docs: Consistently document the default value for $args parameter in various cron functions.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@50175


git-svn-id: http://core.svn.wordpress.org/trunk@49854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-03 11:08:04 +00:00
Sergey Biryukov
a47580b247 Docs: Add a @since note to wp_clear_scheduled_hook() for the $wp_error parameter.
Follow-up to [50143].

See #49961.
Built from https://develop.svn.wordpress.org/trunk@50174


git-svn-id: http://core.svn.wordpress.org/trunk@49853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-03 10:58:07 +00:00
desrosj
230c1c5c8a Coding Standards: Fix several minor coding standards issues.
These are made by running `composer format`.

Follow up to [50124], [50129], [50143].

See #49961, #52192, #34281.
Built from https://develop.svn.wordpress.org/trunk@50152


git-svn-id: http://core.svn.wordpress.org/trunk@49831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 18:04:03 +00:00
John Blackbourn
06c4b334fa Cron API: Introduce a $wp_error parameter to functions that write to the cron array.
This allows the functions to return a `WP_Error` object containing more information in case of a problem, instead of just boolean false.

The various `pre_` filters in these functions are also updated so they can return or be passed a `WP_Error` object.

Fixes #49961

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


git-svn-id: http://core.svn.wordpress.org/trunk@49822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 13:49:03 +00:00
Peter Wilson
7a8a7fdcd4 Cron API: Run alternative wp-cron later, do not run on archived blogs.
Runs cron jobs later on sites using alternative cron, ie the `ALTERNATE_WP_CRON` constant is true, to more closely match when standard cron jobs are run. Jobs now run on the `wp_loaded` hook at priority `20`. Prior to this change they would run on the `init` hook. This ensures custom post types and taxonomies are registered prior to the jobs running.

This change also prevents alternative wp-cron from running on archived or suspended multisite blogs as these are shut down prior to the `wp_loaded` hook from running.

Moves the existing functionality of `wp_cron()` in to a new private function `_wp_cron()`.

Props flixos90, jeremyfelt, johnbillion, jrf, kurtpayne, nacin, peterwilsoncc, prettyboymp, r-a-y, ryan, stevenkword, swissspidy.
Fixes #20537, #24160.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 03:10:08 +00:00
Sergey Biryukov
5c663524c2 Docs: In various @return tags, list the expected type first, instead of false.
Follow-up to [46696], [47060], [49926], [49927], [49929].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49963


git-svn-id: http://core.svn.wordpress.org/trunk@49664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-15 20:08:07 +00:00
Sergey Biryukov
37662df05e Docs: In various @return tags, list the expected type first, instead of false or WP_Error.
Follow-up to [46696], [47060], [49926], [49927].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49929


git-svn-id: http://core.svn.wordpress.org/trunk@49628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-04 17:18:04 +00:00
John Blackbourn
dfe1f9b322 Docs: Promote many bool types to true or false where only that value is used.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 22:04:04 +00:00
John Blackbourn
1aafbf6c6f Cron API: Improve the inline documentation for the args passed to the cron event scheduling functions.
Props chadreitsma, peterwilsoncc

Fixes #51605

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


git-svn-id: http://core.svn.wordpress.org/trunk@49117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-28 18:37:07 +00:00
Sergey Biryukov
1f85e7484f Docs: Consistently use third-person singular verbs for various filter descriptions, per the documentation standards.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48782


git-svn-id: http://core.svn.wordpress.org/trunk@48544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-11 00:34:08 +00:00
John Blackbourn
9bc7d0a776 Docs: Another pass at some inline docs fixes mostly made by PHPCBF.
See #49572, #50744
Built from https://develop.svn.wordpress.org/trunk@48590


git-svn-id: http://core.svn.wordpress.org/trunk@48352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 21:11:05 +00:00
desrosj
27485fd7aa General: Continuing to work towards a passing PHP Compatibility scan.
This is a final pass to fix PHP compatibiilty issues in the codebase with code changes or adding `phpcs:ignore` comments.

With this change, all PHP compatibility warnings and errors without specific tickets have been addressed (see #49810 and #41750).

Props desrosj, johnbillion, jrf.
See #49922.
Built from https://develop.svn.wordpress.org/trunk@47902


git-svn-id: http://core.svn.wordpress.org/trunk@47676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-03 17:40:12 +00:00
John Blackbourn
717f0d0a3e Docs: Misc docblock corrections and improvements.
See #49572
Built from https://develop.svn.wordpress.org/trunk@47754


git-svn-id: http://core.svn.wordpress.org/trunk@47530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-03 19:38:08 +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
001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov
2900bb8ea7 Docs: Update links to https://secure.php.net/, they now redirect to https://www.php.net/.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47088


git-svn-id: http://core.svn.wordpress.org/trunk@46888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-20 03:14:06 +00:00
Sergey Biryukov
4a9c0e35e1 Cron API: Use WEEK_IN_SECONDS constant for the weekly schedule added in [47062].
Props afercia.
See #47606.
Built from https://develop.svn.wordpress.org/trunk@47068


git-svn-id: http://core.svn.wordpress.org/trunk@46868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-13 17:05:07 +00:00
Sergey Biryukov
26ce3c9f19 Cron API: Add a new cron schedule for weekly events.
Props Clorith.
See #47606.
Built from https://develop.svn.wordpress.org/trunk@47062


git-svn-id: http://core.svn.wordpress.org/trunk@46862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-12 11:20:04 +00:00
Sergey Biryukov
dd4d98a368 Docs: In various @return tags, list the expected type first, instead of false.
Follow-up to [46696].

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47060


git-svn-id: http://core.svn.wordpress.org/trunk@46860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-11 18:32:05 +00:00
John Blackbourn
e36d1bcbd8 Docs: Docblock corrections and improvements, mostly related to various pre_* filters.
See #47110

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


git-svn-id: http://core.svn.wordpress.org/trunk@46044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-21 17:41:57 +00:00
Sergey Biryukov
8e85299a00 General: First pass at replacing Codex URLs with a corresponding HelpHub or DevHub article.
Props ianbelanger, tobifjellner, SergeyBiryukov.
See #47771.
Built from https://develop.svn.wordpress.org/trunk@45674


git-svn-id: http://core.svn.wordpress.org/trunk@45485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 22:45:57 +00:00
Gary Pendergast
abcbee954f Coding Standards: Fix instances of WordPress.PHP.NoSilencedErrors.Discouraged.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-09 05:45:58 +00:00
Peter Wilson
fff2440ba5 Cron: Ensure identical single events aren't scheduled less than 10min apart.
Improves the logic in `wp_schedule_single_event()` to ensure an identical event is not scheduled within ten minutes.

This moves the logic for checking for identical events to be self contained rather than relying on `wp_next_scheduled()` as this fails to account for events with a past timestamp when wp-cron fails to trigger or for multiple identical events being scheduled already.

Props bodohugobarwich.
Fixes #44818.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-16 06:42:50 +00:00
Peter Wilson
2a19ad39db Docs: Correct documentation for the schedule_event filter.
The filter runs for both recurring and single events.

See #42505.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-23 23:23:52 +00:00
Peter Wilson
6f337d1195 Cron: Move logic for finding the next event's timestamp.
Moves the logic for determining when an event will next run from `wp_next_scheduled()` to `wp_get_scheduled_event()`.

This improves the performance of `wp_get_scheduled_event()` by avoiding duplicate function calls and object cache hits.

Props peterwilsoncc.
Fixes #45976.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-23 23:08:51 +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