Our dev team made a pretty clean WPMU cron setup, but we’re not convinced it’s optimal and wondered if anyone think they can do better! :slight_smile:
There is about 100 sites.
#1 The cron job (every 30 minutes):
wget -q -O - https://www.magikweb.net/wp-cron-multisite.php >/dev/null 2>&1
#2 That PHP file loops in all active sites to trigger their individual WordPress crons:
<?php
if ( ! defined('ABSPATH') ) {
require_once( './wp-load.php' );
}
global $wpdb;
$sites = $wpdb->get_results( "SELECT domain, path FROM " . $wpdb->blogs . " WHERE archived=0 AND deleted=0;" );
foreach( $sites as $site ) {
$url = "https://" . $site->domain . ( ( ! empty( $site->path ) ) ? $site->path : '/' ) . 'wp-cron.php';
wp_remote_get( $url, array( 'blocking' => false ) );
}
#3 There are currently 3277 cron jobs according to Advanced DB Cleaner (a lot from WooCommerce and WPML):
[attachments are only viewable by logged-in members]
#4 We are having issues since MySQL 5.7 where “MySQL has gone away” during off-work hours and we can’t figure out what queries (or crons) are causing it. It’s why we’re looking into this.
Is there a considerably better (performance) way to do this?