8000 Only send preload restart emails once a day. by donnchawp · Pull Request #432 · Automattic/wp-super-cache · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Only send preload restart emails once a day. #432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and 8000 contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions wp-cache.php
6576
Original file line number Diff line number Diff line change
Expand Up @@ -3580,13 +3580,27 @@ function option_preload_cache_counter( $value ) {
function check_up_on_preloading() {
$value = get_option( 'preload_cache_counter' );
if ( $value[ 'c' ] > 0 && ( time() - $value[ 't' ] ) > 3600 && false == wp_next_scheduled( 'wp_cache_preload_hook' ) ) {
if ( is_admin() )
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] Preload may have stalled.', 'wp-super-cache' ), get_bloginfo( 'url' ) ), sprintf( __( "Preload has been restarted.\n%s", 'wp-super-cache' ), admin_url( "options-general.php?page=wpsupercache" ) ) );
if ( is_admin() ) {
if ( get_option( 'wpsc_preload_restart_email' ) < ( time() - 86400 ) ) {
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] Preload may have stalled.', 'wp-super-cache' ), get_bloginfo( 'url' ) ), sprintf( __( "Preload has been restarted.\n%s", 'wp-super-cache' ), admin_url( "options-general.php?page=wpsupercache" ) ) );
update_option( 'wpsc_preload_restart_email', time() );
}
add_action( 'admin_notices', 'wpsc_preload_restart_notice' );
}
wp_schedule_single_event( time() + 30, 'wp_cache_preload_hook' );
}
}
add_action( 'init', 'check_up_on_preloading' ); // sometimes preloading stops working. Kickstart it.

function wpsc_preload_restart_notice() {

if ( false == wpsupercache_site_admin() )
return false;
if ( ! isset( $_GET[ 'page' ] ) || $_GET[ 'page' ] != 'wpsupercache' )
return false;
echo '<div class="notice notice-error"><p>' . __( 'Warning! WP Super Cache preload was interrupted but has been restarted.', 'wp-super-cache' ) . '</p></div>';
}

function wp_cache_disable_plugin( $delete_config_file = true ) {
global $wp_rewrite;
if ( file_exists( ABSPATH . 'wp-config.php') ) {
Expand Down
0