Created
January 29, 2014 01:21
-
-
Save keichan34/8679936 to your computer and use it in GitHub Desktop.
A simple script, intended to be run in the context of a WordPress install -- `wp-cli`'s `eval-file` is the easiest way -- to ping the cron of all sites registered in the network.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $start_date = date_i18n('Y/m/d H:i:s'); | |
| $start_time = microtime(true); | |
| echo "Start site-wide wp-cron at $start_date\n"; | |
| $sites = wp_get_sites(); | |
| foreach ($sites as $site) { | |
| $url = "http://" . $site['domain'] . $site['path']; | |
| echo "Ping wp-cron.php for `$url` ... "; | |
| file_get_contents($url . 'wp-cron.php'); | |
| echo "OK.\n"; | |
| } | |
| $end_time = microtime(true); | |
| $end_date = date_i18n('Y/m/d H:i:s'); | |
| $time = ($end_time - $start_time); | |
| echo "Finished at $end_date ($time s)\n\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment