function backupbuddy_jetpack_security_report() { $maxTimeWithoutBackupBeforeWarn = 60 * 60 * 24 * 32; // After this amount of time (default 32 days) we will warn the user that they have not completed a backup in too long. // Default arguments. $args = array('status' => 'ok', 'message' => ''); // Determine last completed backup. $lastRun = pb_backupbuddy::$options['last_backup_finish']; if (0 === $lastRun) { // never made a backup. $args['status'] = 'warning'; $args['message'] = __('You have not completed your first BackupBuddy backup.', 'it-l10n-backupbuddy'); } else { // have made a backup. $args['last'] = $lastRun; // If the last backup was too long ago then change status to warning. Only calculate a backup was ever made. if (time() - $lastRun > $maxTimeWithoutBackupBeforeWarn) { $args['status'] = 'warning'; $args['message'] .= ' ' . __('It has been over a month since your last BackupBuddy backup completed.', 'it-l10n-backupbuddy'); } } // Determine next run. $nextRun = 0; foreach (pb_backupbuddy::$options['schedules'] as $schedule_id => $schedule) { // Find soonest schedule to run next. $thisRun = wp_next_scheduled('backupbuddy_cron', array('run_scheduled_backup', array((int) $schedule_id))); if (false !== $thisRun) { if (0 === $nextRun || $thisRun < $nextRun) { // Set next run if $thisRun is going to run sooner than schedule in $nextRun. $nextRun = $thisRun; } } } if (0 === $nextRun) { $args['status'] = 'warning'; $args['message'] .= ' ' . __('You do not currently have any backup schedules in BackupBuddy.', 'it-l10n-backupbuddy'); } else { $args['next'] = $nextRun; } // Cleanup. $args['message'] = trim($args['message']); if ('' == $args['message']) { unset($args['message']); } // Call security report. Jetpack::submit_security_report('backup', dirname(__FILE__) . '/backupbuddy.php', $args); }