Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-super...
File: wp-cache.php
}
[3500] Fix | Delete
$details = explode( "\n", $out );
[3501] Fix | Delete
} else {
[3502] Fix | Delete
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
[3503] Fix | Delete
$details = explode( "\n", file_get_contents( $taxonomy_filename ) );
[3504] Fix | Delete
}
[3505] Fix | Delete
if ( count( $details ) > 0 && $details[0] !== '' ) {
[3506] Fix | Delete
$rows = array_splice( $details, 0, WPSC_PRELOAD_POST_COUNT );
[3507] Fix | Delete
if ( $wp_cache_preload_email_me && $wp_cache_preload_email_volume === 'many' ) {
[3508] Fix | Delete
// translators: 1: Site URL, 2: Taxonomy name, 3: Number of posts done, 4: Number of posts to preload
[3509] Fix | Delete
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] Refreshing %2$s taxonomy from %3$d to %4$d', 'wp-super-cache' ), home_url(), $taxonomy, $c, ( $c + WPSC_PRELOAD_POST_COUNT ) ), 'Refreshing: ' . print_r( $rows, 1 ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
[3510] Fix | Delete
}
[3511] Fix | Delete
[3512] Fix | Delete
foreach ( (array) $rows as $url ) {
[3513] Fix | Delete
set_time_limit( 60 );
[3514] Fix | Delete
if ( $url === '' ) {
[3515] Fix | Delete
continue;
[3516] Fix | Delete
}
[3517] Fix | Delete
[3518] Fix | Delete
$url_info = wp_parse_url( $url );
[3519] Fix | Delete
$dir = get_supercache_dir() . $url_info['path'];
[3520] Fix | Delete
wp_cache_debug( "wp_cron_preload_cache: delete $dir" );
[3521] Fix | Delete
wpsc_delete_files( $dir );
[3522] Fix | Delete
prune_super_cache( trailingslashit( $dir ) . 'feed/', true );
[3523] Fix | Delete
prune_super_cache( trailingslashit( $dir ) . 'page/', true );
[3524] Fix | Delete
[3525] Fix | Delete
wpsc_update_active_preload( 'taxonomies', $taxonomy, $url );
[3526] Fix | Delete
[3527] Fix | Delete
wp_remote_get(
[3528] Fix | Delete
$url,
[3529] Fix | Delete
array(
[3530] Fix | Delete
'timeout' => 60,
[3531] Fix | Delete
'blocking' => true,
[3532] Fix | Delete
)
[3533] Fix | Delete
);
[3534] Fix | Delete
wp_cache_debug( "wp_cron_preload_cache: fetched $url" );
[3535] Fix | Delete
sleep( WPSC_PRELOAD_POST_INTERVAL );
[3536] Fix | Delete
[3537] Fix | Delete
if ( ! wpsc_is_preload_active() ) {
[3538] Fix | Delete
wp_cache_debug( 'wp_cron_preload_cache: cancelling preload process.' );
[3539] Fix | Delete
wpsc_reset_preload_settings();
[3540] Fix | Delete
[3541] Fix | Delete
if ( $wp_cache_preload_email_me ) {
[3542] Fix | Delete
// translators: Home URL of website
[3543] Fix | Delete
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] Cache Preload Stopped', 'wp-super-cache' ), home_url(), '' ), ' ' );
[3544] Fix | Delete
}
[3545] Fix | Delete
wpsc_update_idle_preload( time() );
[3546] Fix | Delete
return true;
[3547] Fix | Delete
}
[3548] Fix | Delete
}
[3549] Fix | Delete
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen
[3550] Fix | Delete
$fp = fopen( $taxonomy_filename, 'w' );
[3551] Fix | Delete
if ( $fp ) {
[3552] Fix | Delete
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fwrite
[3553] Fix | Delete
fwrite( $fp, implode( "\n", $details ) );
[3554] Fix | Delete
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose
[3555] Fix | Delete
fclose( $fp );
[3556] Fix | Delete
}
[3557] Fix | Delete
}
[3558] Fix | Delete
[3559] Fix | Delete
if (
[3560] Fix | Delete
$preload_more_taxonomies === false &&
[3561] Fix | Delete
count( $details ) > 0 &&
[3562] Fix | Delete
$details[0] !== ''
[3563] Fix | Delete
) {
[3564] Fix | Delete
$preload_more_taxonomies = true;
[3565] Fix | Delete
}
[3566] Fix | Delete
}
[3567] Fix | Delete
[3568] Fix | Delete
if ( $preload_more_taxonomies === true ) {
[3569] Fix | Delete
wpsc_schedule_next_preload();
[3570] Fix | Delete
sleep( WPSC_PRELOAD_LOOP_INTERVAL );
[3571] Fix | Delete
return true;
[3572] Fix | Delete
}
[3573] Fix | Delete
} elseif ( $c === 0 && $wp_cache_preload_email_me ) {
[3574] Fix | Delete
// translators: Home URL of website
[3575] Fix | Delete
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] Cache Preload Started', 'wp-super-cache' ), home_url(), '' ), ' ' );
[3576] Fix | Delete
}
[3577] Fix | Delete
[3578] Fix | Delete
/*
[3579] Fix | Delete
*
[3580] Fix | Delete
* Preload posts now.
[3581] Fix | Delete
*
[3582] Fix | Delete
* The preload_cache_counter has two values:
[3583] Fix | Delete
* c = the number of posts we've preloaded after this loop.
[3584] Fix | Delete
* t = the time we started preloading in the current loop.
[3585] Fix | Delete
*
[3586] Fix | Delete
* $c is set to the value of preload_cache_counter['c'] at the start of the function
[3587] Fix | Delete
* before it is incremented by WPSC_PRELOAD_POST_COUNT here.
[3588] Fix | Delete
* The time is used to check if preloading has stalled in check_up_on_preloading().
[3589] Fix | Delete
*/
[3590] Fix | Delete
[3591] Fix | Delete
update_option(
[3592] Fix | Delete
'preload_cache_counter',
[3593] Fix | Delete
array(
[3594] Fix | Delete
'c' => ( $c + WPSC_PRELOAD_POST_COUNT ),
[3595] Fix | Delete
't' => time(),
[3596] Fix | Delete
)
[3597] Fix | Delete
);
[3598] Fix | Delete
[3599] Fix | Delete
if ( $wp_cache_preload_posts == 'all' || $c < $wp_cache_preload_posts ) {
[3600] Fix | Delete
$types = wpsc_get_post_types();
[3601] Fix | Delete
$posts = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE ( post_type IN ( $types ) ) AND post_status = 'publish' ORDER BY ID DESC LIMIT %d," . WPSC_PRELOAD_POST_COUNT, $c ) ); // phpcs:ignore
[3602] Fix | Delete
wp_cache_debug( 'wp_cron_preload_cache: got ' . WPSC_PRELOAD_POST_COUNT . ' posts from position ' . $c );
[3603] Fix | Delete
} else {
[3604] Fix | Delete
wp_cache_debug( "wp_cron_preload_cache: no more posts to get. Limit ($wp_cache_preload_posts) reached.", 5 );
[3605] Fix | Delete
$posts = false;
[3606] Fix | Delete
}
[3607] Fix | Delete
if ( !isset( $wp_cache_preload_email_volume ) )
[3608] Fix | Delete
$wp_cache_preload_email_volume = 'medium';
[3609] Fix | Delete
[3610] Fix | Delete
if ( $posts ) {
[3611] Fix | Delete
if ( get_option( 'show_on_front' ) == 'page' ) {
[3612] Fix | Delete
$page_on_front = get_option( 'page_on_front' );
[3613] Fix | Delete
$page_for_posts = get_option( 'page_for_posts' );
[3614] Fix | Delete
} else {
[3615] Fix | Delete
$page_on_front = $page_for_posts = 0;
[3616] Fix | Delete
}
[3617] Fix | Delete
if ( $wp_cache_preload_email_me && $wp_cache_preload_email_volume === 'many' ) {
[3618] Fix | Delete
/* translators: 1: home url, 2: start post id, 3: end post id */
[3619] Fix | Delete
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] Refreshing posts from %2$d to %3$d', 'wp-super-cache' ), home_url(), $c, ( $c + WPSC_PRELOAD_POST_COUNT ) ), ' ' );
[3620] Fix | Delete
}
[3621] Fix | Delete
$msg = '';
[3622] Fix | Delete
$count = $c + 1;
[3623] Fix | Delete
[3624] Fix | Delete
foreach( $posts as $post_id ) {
[3625] Fix | Delete
set_time_limit( 60 );
[3626] Fix | Delete
if ( $page_on_front != 0 && ( $post_id == $page_on_front || $post_id == $page_for_posts ) )
[3627] Fix | Delete
continue;
[3628] Fix | Delete
$url = get_permalink( $post_id );
[3629] Fix | Delete
[3630] Fix | Delete
if ( ! is_string( $url ) ) {
[3631] Fix | Delete
wp_cache_debug( "wp_cron_preload_cache: skipped $post_id. Expected a URL, received: " . gettype( $url ) );
[3632] Fix | Delete
continue;
[3633] Fix | Delete
}
[3634] Fix | Delete
[3635] Fix | Delete
if ( wp_cache_is_rejected( $url ) ) {
[3636] Fix | Delete
wp_cache_debug( "wp_cron_preload_cache: skipped $url per rejected strings setting" );
[3637] Fix | Delete
continue;
[3638] Fix | Delete
}
[3639] Fix | Delete
clear_post_supercache( $post_id );
[3640] Fix | Delete
[3641] Fix | Delete
wpsc_update_active_preload( 'posts', $count, $url );
[3642] Fix | Delete
[3643] Fix | Delete
if ( ! wpsc_is_preload_active() ) {
[3644] Fix | Delete
wp_cache_debug( 'wp_cron_preload_cache: cancelling preload process.' );
[3645] Fix | Delete
wpsc_reset_preload_settings();
[3646] Fix | Delete
[3647] Fix | Delete
if ( $wp_cache_preload_email_me ) {
[3648] Fix | Delete
// translators: Home URL of website
[3649] Fix | Delete
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] Cache Preload Stopped', 'wp-super-cache' ), home_url(), '' ), ' ' );
[3650] Fix | Delete
}
[3651] Fix | Delete
[3652] Fix | Delete
wpsc_update_idle_preload( time() );
[3653] Fix | Delete
return true;
[3654] Fix | Delete
}
[3655] Fix | Delete
[3656] Fix | Delete
$msg .= "$url\n";
[3657] Fix | Delete
wp_remote_get( $url, array('timeout' => 60, 'blocking' => true ) );
[3658] Fix | Delete
wp_cache_debug( "wp_cron_preload_cache: fetched $url", 5 );
[3659] Fix | Delete
++$count;
[3660] Fix | Delete
sleep( WPSC_PRELOAD_POST_INTERVAL );
[3661] Fix | Delete
}
[3662] Fix | Delete
[3663] Fix | Delete
if ( $wp_cache_preload_email_me && ( $wp_cache_preload_email_volume === 'medium' || $wp_cache_preload_email_volume === 'many' ) ) {
[3664] Fix | Delete
// translators: 1: home url, 2: number of posts refreshed
[3665] Fix | Delete
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] %2$d posts refreshed', 'wp-super-cache' ), home_url(), ( $c + WPSC_PRELOAD_POST_COUNT ) ), __( 'Refreshed the following posts:', 'wp-super-cache' ) . "\n$msg" );
[3666] Fix | Delete
}
[3667] Fix | Delete
[3668] Fix | Delete
wpsc_schedule_next_preload();
[3669] Fix | Delete
wpsc_delete_files( get_supercache_dir() );
[3670] Fix | Delete
sleep( WPSC_PRELOAD_LOOP_INTERVAL );
[3671] Fix | Delete
} else {
[3672] Fix | Delete
$msg = '';
[3673] Fix | Delete
wpsc_reset_preload_counter();
[3674] Fix | Delete
if ( (int)$wp_cache_preload_interval && defined( 'DOING_CRON' ) ) {
[3675] Fix | Delete
if ( $wp_cache_preload_email_me )
[3676] Fix | Delete
$msg = sprintf( __( 'Scheduling next preload refresh in %d minutes.', 'wp-super-cache' ), (int)$wp_cache_preload_interval );
[3677] Fix | Delete
wp_cache_debug( "wp_cron_preload_cache: no more posts. scheduling next preload in $wp_cache_preload_interval minutes.", 5 );
[3678] Fix | Delete
wp_schedule_single_event( time() + ( (int)$wp_cache_preload_interval * 60 ), 'wp_cache_full_preload_hook' );
[3679] Fix | Delete
}
[3680] Fix | Delete
global $file_prefix, $cache_max_time;
[3681] Fix | Delete
if ( $wp_cache_preload_interval > 0 ) {
[3682] Fix | Delete
$cache_max_time = (int)$wp_cache_preload_interval * 60; // fool the GC into expiring really old files
[3683] Fix | Delete
} else {
[3684] Fix | Delete
$cache_max_time = 86400; // fool the GC into expiring really old files
[3685] Fix | Delete
}
[3686] Fix | Delete
if ( $wp_cache_preload_email_me )
[3687] Fix | Delete
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] Cache Preload Completed', 'wp-super-cache' ), home_url() ), __( "Cleaning up old supercache files.", 'wp-super-cache' ) . "\n" . $msg );
[3688] Fix | Delete
if ( $cache_max_time > 0 ) { // GC is NOT disabled
[3689] Fix | Delete
wp_cache_debug( "wp_cron_preload_cache: clean expired cache files older than $cache_max_time seconds.", 5 );
[3690] Fix | Delete
wp_cache_phase2_clean_expired( $file_prefix, true ); // force cleanup of old files.
[3691] Fix | Delete
}
[3692] Fix | Delete
[3693] Fix | Delete
wpsc_reset_preload_settings();
[3694] Fix | Delete
wpsc_update_idle_preload( time() );
[3695] Fix | Delete
}
[3696] Fix | Delete
@unlink( $mutex );
[3697] Fix | Delete
}
[3698] Fix | Delete
add_action( 'wp_cache_preload_hook', 'wp_cron_preload_cache' );
[3699] Fix | Delete
add_action( 'wp_cache_full_preload_hook', 'wp_cron_preload_cache' );
[3700] Fix | Delete
[3701] Fix | Delete
/*
[3702] Fix | Delete
* Schedule the next preload event without resetting the preload counter.
[3703] Fix | Delete
* This happens when the next loop of an active preload is scheduled.
[3704] Fix | Delete
*/
[3705] Fix | Delete
function wpsc_schedule_next_preload() {
[3706] Fix | Delete
global $cache_path;
[3707] Fix | Delete
[3708] Fix | Delete
/*
[3709] Fix | Delete
* Edge case: If preload is not active, don't schedule the next preload.
[3710] Fix | Delete
* This can happen if the preload is cancelled by the user right after a loop finishes.
[3711] Fix | Delete
*/
[3712] Fix | Delete
if ( ! wpsc_is_preload_active() ) {
[3713] Fix | Delete
wpsc_reset_preload_settings();
[3714] Fix | Delete
wp_cache_debug( 'wpsc_schedule_next_preload: preload is not active. not scheduling next preload.' );
[3715] Fix | Delete
return;
[3716] Fix | Delete
}
[3717] Fix | Delete
[3718] Fix | Delete
if ( defined( 'DOING_CRON' ) ) {
[3719] Fix | Delete
wp_cache_debug( 'wp_cron_preload_cache: scheduling the next preload in 3 seconds.' );
[3720] Fix | Delete
wp_schedule_single_event( time() + 3, 'wp_cache_preload_hook' );
[3721] Fix | Delete
}
[3722] Fix | Delete
[3723] Fix | Delete
// we always want to delete the mutex file, even if we're not using cron
[3724] Fix | Delete
$mutex = $cache_path . 'preload_mutex.tmp';
[3725] Fix | Delete
wp_delete_file( $mutex );
[3726] Fix | Delete
}
[3727] Fix | Delete
[3728] Fix | Delete
function option_preload_cache_counter( $value ) {
[3729] Fix | Delete
if ( false == is_array( $value ) ) {
[3730] Fix | Delete
return array(
[3731] Fix | Delete
'c' => 0,
[3732] Fix | Delete
't' => time(),
[3733] Fix | Delete
);
[3734] Fix | Delete
} else {
[3735] Fix | Delete
return $value;
[3736] Fix | Delete
}
[3737] Fix | Delete
}
[3738] Fix | Delete
add_filter( 'option_preload_cache_counter', 'option_preload_cache_counter' );
[3739] Fix | Delete
[3740] Fix | Delete
function check_up_on_preloading() {
[3741] Fix | Delete
$value = get_option( 'preload_cache_counter' );
[3742] Fix | Delete
if ( is_array( $value ) && $value['c'] > 0 && ( time() - $value['t'] ) > 3600 && false === wp_next_scheduled( 'wp_cache_preload_hook' ) ) {
[3743] Fix | Delete
wp_schedule_single_event( time() + 5, 'wp_cache_preload_hook' );
[3744] Fix | Delete
}
[3745] Fix | Delete
}
[3746] Fix | Delete
add_action( 'init', 'check_up_on_preloading' ); // sometimes preloading stops working. Kickstart it.
[3747] Fix | Delete
[3748] Fix | Delete
function wp_cache_disable_plugin( $delete_config_file = true ) {
[3749] Fix | Delete
global $wp_rewrite;
[3750] Fix | Delete
if ( file_exists( ABSPATH . 'wp-config.php') ) {
[3751] Fix | Delete
$global_config_file = ABSPATH . 'wp-config.php';
[3752] Fix | Delete
} else {
[3753] Fix | Delete
$global_config_file = dirname(ABSPATH) . '/wp-config.php';
[3754] Fix | Delete
}
[3755] Fix | Delete
[3756] Fix | Delete
if ( apply_filters( 'wpsc_enable_wp_config_edit', true ) ) {
[3757] Fix | Delete
$line = 'define(\'WP_CACHE\', true);';
[3758] Fix | Delete
if (
[3759] Fix | Delete
strpos( file_get_contents( $global_config_file ), $line ) &&
[3760] Fix | Delete
(
[3761] Fix | Delete
! is_writeable_ACLSafe( $global_config_file ) ||
[3762] Fix | Delete
! wp_cache_replace_line( 'define*\(*\'WP_CACHE\'', '', $global_config_file )
[3763] Fix | Delete
)
[3764] Fix | Delete
) {
[3765] Fix | Delete
wp_die( "Could not remove WP_CACHE define from $global_config_file. Please edit that file and remove the line containing the text 'WP_CACHE'. Then refresh this page." );
[3766] Fix | Delete
}
[3767] Fix | Delete
$line = 'define( \'WPCACHEHOME\',';
[3768] Fix | Delete
if (
[3769] Fix | Delete
strpos( file_get_contents( $global_config_file ), $line ) &&
[3770] Fix | Delete
(
[3771] Fix | Delete
! is_writeable_ACLSafe( $global_config_file ) ||
[3772] Fix | Delete
! wp_cache_replace_line( 'define *\( *\'WPCACHEHOME\'', '', $global_config_file )
[3773] Fix | Delete
)
[3774] Fix | Delete
) {
[3775] Fix | Delete
wp_die( "Could not remove WPCACHEHOME define from $global_config_file. Please edit that file and remove the line containing the text 'WPCACHEHOME'. Then refresh this page." );
[3776] Fix | Delete
}
[3777] Fix | Delete
} elseif ( function_exists( 'wp_cache_debug' ) ) {
[3778] Fix | Delete
wp_cache_debug( 'wp_cache_disable_plugin: not allowed to edit wp-config.php per configuration.' );
[3779] Fix | Delete
}
[3780] Fix | Delete
[3781] Fix | Delete
uninstall_supercache( WP_CONTENT_DIR . '/cache' );
[3782] Fix | Delete
$file_not_deleted = array();
[3783] Fix | Delete
wpsc_remove_advanced_cache();
[3784] Fix | Delete
if ( @file_exists( WP_CONTENT_DIR . "/advanced-cache.php" ) ) {
[3785] Fix | Delete
$file_not_deleted[] = WP_CONTENT_DIR . '/advanced-cache.php';
[3786] Fix | Delete
}
[3787] Fix | Delete
if ( $delete_config_file && @file_exists( WPCACHECONFIGPATH . "/wp-cache-config.php" ) ) {
[3788] Fix | Delete
if ( false == unlink( WPCACHECONFIGPATH . "/wp-cache-config.php" ) )
[3789] Fix | Delete
$file_not_deleted[] = WPCACHECONFIGPATH . '/wp-cache-config.php';
[3790] Fix | Delete
}
[3791] Fix | Delete
if ( ! empty( $file_not_deleted ) ) {
[3792] Fix | Delete
$msg = __( "Dear User,\n\nWP Super Cache was removed from your blog or deactivated but some files could\nnot be deleted.\n\n", 'wp-super-cache' );
[3793] Fix | Delete
foreach( (array)$file_not_deleted as $path ) {
[3794] Fix | Delete
$msg .= "{$path}\n";
[3795] Fix | Delete
}
[3796] Fix | Delete
$msg .= "\n";
[3797] Fix | Delete
$msg .= sprintf( __( "You should delete these files manually.\nYou may need to change the permissions of the files or parent directory.\nYou can read more about this in the Codex at\n%s\n\nThank you.", 'wp-super-cache' ), 'https://codex.wordpress.org/Changing_File_Permissions#About_Chmod' );
[3798] Fix | Delete
[3799] Fix | Delete
if ( apply_filters( 'wpsc_send_uninstall_errors', 1 ) ) {
[3800] Fix | Delete
wp_mail( get_option( 'admin_email' ), __( 'WP Super Cache: could not delete files', 'wp-super-cache' ), $msg );
[3801] Fix | Delete
}
[3802] Fix | Delete
}
[3803] Fix | Delete
extract( wpsc_get_htaccess_info() ); // $document_root, $apache_root, $home_path, $home_root, $home_root_lc, $inst_root, $wprules, $scrules, $condition_rules, $rules, $gziprules
[3804] Fix | Delete
if ( $scrules != '' && insert_with_markers( $home_path.'.htaccess', 'WPSuperCache', array() ) ) {
[3805] Fix | Delete
$wp_rewrite->flush_rules();
[3806] Fix | Delete
} elseif( $scrules != '' ) {
[3807] Fix | Delete
wp_mail( get_option( 'admin_email' ), __( 'Supercache Uninstall Problems', 'wp-super-cache' ), sprintf( __( "Dear User,\n\nWP Super Cache was removed from your blog but the mod_rewrite rules\nin your .htaccess were not.\n\nPlease edit the following file and remove the code\nbetween 'BEGIN WPSuperCache' and 'END WPSuperCache'. Please backup the file first!\n\n%s\n\nRegards,\nWP Super Cache Plugin\nhttps://wordpress.org/plugins/wp-super-cache/", 'wp-super-cache' ), ABSPATH . '/.htaccess' ) );
[3808] Fix | Delete
}
[3809] Fix | Delete
}
[3810] Fix | Delete
[3811] Fix | Delete
function uninstall_supercache( $folderPath ) { // from http://www.php.net/manual/en/function.rmdir.php
[3812] Fix | Delete
if ( trailingslashit( constant( 'ABSPATH' ) ) == trailingslashit( $folderPath ) )
[3813] Fix | Delete
return false;
[3814] Fix | Delete
if ( @is_dir ( $folderPath ) ) {
[3815] Fix | Delete
$dh = @opendir($folderPath);
[3816] Fix | Delete
while( false !== ( $value = @readdir( $dh ) ) ) {
[3817] Fix | Delete
if ( $value != "." && $value != ".." ) {
[3818] Fix | Delete
$value = $folderPath . "/" . $value;
[3819] Fix | Delete
if ( @is_dir ( $value ) ) {
[3820] Fix | Delete
uninstall_supercache( $value );
[3821] Fix | Delete
} else {
[3822] Fix | Delete
@unlink( $value );
[3823] Fix | Delete
}
[3824] Fix | Delete
}
[3825] Fix | Delete
}
[3826] Fix | Delete
return @rmdir( $folderPath );
[3827] Fix | Delete
} else {
[3828] Fix | Delete
return false;
[3829] Fix | Delete
}
[3830] Fix | Delete
}
[3831] Fix | Delete
[3832] Fix | Delete
function supercache_admin_bar_render() {
[3833] Fix | Delete
global $wp_admin_bar;
[3834] Fix | Delete
[3835] Fix | Delete
if ( function_exists( '_deprecated_function' ) ) {
[3836] Fix | Delete
_deprecated_function( __FUNCTION__, 'WP Super Cache 1.6.4' );
[3837] Fix | Delete
}
[3838] Fix | Delete
[3839] Fix | Delete
wpsc_admin_bar_render( $wp_admin_bar );
[3840] Fix | Delete
}
[3841] Fix | Delete
[3842] Fix | Delete
/*
[3843] Fix | Delete
* returns true if preload is active
[3844] Fix | Delete
*/
[3845] Fix | Delete
function wpsc_is_preload_active() {
[3846] Fix | Delete
global $cache_path;
[3847] Fix | Delete
[3848] Fix | Delete
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
[3849] Fix | Delete
if ( @file_exists( $cache_path . 'stop_preload.txt' ) ) {
[3850] Fix | Delete
return false;
[3851] Fix | Delete
}
[3852] Fix | Delete
[3853] Fix | Delete
if ( file_exists( $cache_path . 'preload_mutex.tmp' ) ) {
[3854] Fix | Delete
return true;
[3855] Fix | Delete
}
[3856] Fix | Delete
[3857] Fix | Delete
// check taxonomy preload loop
[3858] Fix | Delete
$taxonomies = apply_filters(
[3859] Fix | Delete
'wp_cache_preload_taxonomies',
[3860] Fix | Delete
array(
[3861] Fix | Delete
'post_tag' => 'tag',
[3862] Fix | Delete
'category' => 'category',
[3863] Fix | Delete
)
[3864] Fix | Delete
);
[3865] Fix | Delete
[3866] Fix | Delete
foreach ( $taxonomies as $taxonomy => $path ) {
[3867] Fix | Delete
$taxonomy_filename = $cache_path . 'taxonomy_' . $taxonomy . '.txt';
[3868] Fix | Delete
if ( file_exists( $taxonomy_filename ) ) {
[3869] Fix | Delete
return true;
[3870] Fix | Delete
}
[3871] Fix | Delete
}
[3872] Fix | Delete
[3873] Fix | Delete
// check post preload loop
[3874] Fix | Delete
$preload_cache_counter = get_option( 'preload_cache_counter' );
[3875] Fix | Delete
if (
[3876] Fix | Delete
is_array( $preload_cache_counter )
[3877] Fix | Delete
&& isset( $preload_cache_counter['c'] )
[3878] Fix | Delete
&& $preload_cache_counter['c'] > 0
[3879] Fix | Delete
) {
[3880] Fix | Delete
return true;
[3881] Fix | Delete
}
[3882] Fix | Delete
[3883] Fix | Delete
return false;
[3884] Fix | Delete
}
[3885] Fix | Delete
[3886] Fix | Delete
/*
[3887] Fix | Delete
* This function will reset the preload cache counter
[3888] Fix | Delete
*/
[3889] Fix | Delete
function wpsc_reset_preload_counter() {
[3890] Fix | Delete
update_option(
[3891] Fix | Delete
'preload_cache_counter',
[3892] Fix | Delete
array(
[3893] Fix | Delete
'c' => 0,
[3894] Fix | Delete
't' => time(),
[3895] Fix | Delete
)
[3896] Fix | Delete
);
[3897] Fix | Delete
}
[3898] Fix | Delete
[3899] Fix | Delete
/*
[3900] Fix | Delete
* This function will reset all preload settings
[3901] Fix | Delete
*/
[3902] Fix | Delete
function wpsc_reset_preload_settings() {
[3903] Fix | Delete
global $cache_path;
[3904] Fix | Delete
[3905] Fix | Delete
$mutex = $cache_path . 'preload_mutex.tmp';
[3906] Fix | Delete
wp_delete_file( $mutex );
[3907] Fix | Delete
wp_delete_file( $cache_path . 'stop_preload.txt' );
[3908] Fix | Delete
wpsc_reset_preload_counter();
[3909] Fix | Delete
[3910] Fix | Delete
$taxonomies = apply_filters(
[3911] Fix | Delete
'wp_cache_preload_taxonomies',
[3912] Fix | Delete
array(
[3913] Fix | Delete
'post_tag' => 'tag',
[3914] Fix | Delete
'category' => 'category',
[3915] Fix | Delete
)
[3916] Fix | Delete
);
[3917] Fix | Delete
[3918] Fix | Delete
foreach ( $taxonomies as $taxonomy => $path ) {
[3919] Fix | Delete
$taxonomy_filename = $cache_path . 'taxonomy_' . $taxonomy . '.txt';
[3920] Fix | Delete
wp_delete_file( $taxonomy_filename );
[3921] Fix | Delete
}
[3922] Fix | Delete
}
[3923] Fix | Delete
[3924] Fix | Delete
function wpsc_cancel_preload() {
[3925] Fix | Delete
$next_preload = wp_next_scheduled( 'wp_cache_preload_hook' );
[3926] Fix | Delete
$next_full_preload = wp_next_scheduled( 'wp_cache_full_preload_hook' );
[3927] Fix | Delete
[3928] Fix | Delete
if ( $next_preload || $next_full_preload ) {
[3929] Fix | Delete
wp_cache_debug( 'wpsc_cancel_preload: reset preload settings' );
[3930] Fix | Delete
wpsc_reset_preload_settings();
[3931] Fix | Delete
}
[3932] Fix | Delete
[3933] Fix | Delete
if ( $next_preload ) {
[3934] Fix | Delete
wp_cache_debug( 'wpsc_cancel_preload: unscheduling wp_cache_preload_hook' );
[3935] Fix | Delete
wp_unschedule_event( $next_preload, 'wp_cache_preload_hook' );
[3936] Fix | Delete
}
[3937] Fix | Delete
if ( $next_full_preload ) {
[3938] Fix | Delete
wp_cache_debug( 'wpsc_cancel_preload: unscheduling wp_cache_full_preload_hook' );
[3939] Fix | Delete
wp_unschedule_event( $next_full_preload, 'wp_cache_full_preload_hook' );
[3940] Fix | Delete
}
[3941] Fix | Delete
wp_cache_debug( 'wpsc_cancel_preload: creating stop_preload.txt' );
[3942] Fix | Delete
[3943] Fix | Delete
/*
[3944] Fix | Delete
* Reset the preload settings, but also create the stop_preload.txt file to
[3945] Fix | Delete
* prevent the preload from starting again.
[3946] Fix | Delete
* By creating the stop_preload.txt file, we can be sure the preload will cancel.
[3947] Fix | Delete
*/
[3948] Fix | Delete
wpsc_reset_preload_settings();
[3949] Fix | Delete
wpsc_create_stop_preload_flag();
[3950] Fix | Delete
wpsc_update_idle_preload( time() );
[3951] Fix | Delete
}
[3952] Fix | Delete
[3953] Fix | Delete
/*
[3954] Fix | Delete
* The preload process checks for a file called stop_preload.txt and will stop if found.
[3955] Fix | Delete
* This function creates that file.
[3956] Fix | Delete
*/
[3957] Fix | Delete
function wpsc_create_stop_preload_flag() {
[3958] Fix | Delete
global $cache_path;
[3959] Fix | Delete
// phpcs:ignore -- WordPress.WP.AlternativeFunctions.file_system_read_fopen WordPress.PHP.NoSilencedErrors.Discouraged
[3960] Fix | Delete
$fp = @fopen( $cache_path . 'stop_preload.txt', 'w' );
[3961] Fix | Delete
// phpcs:ignore -- WordPress.WP.AlternativeFunctions.file_system_operations_fclose WordPress.PHP.NoSilencedErrors.Discouraged
[3962] Fix | Delete
@fclose( $fp );
[3963] Fix | Delete
}
[3964] Fix | Delete
[3965] Fix | Delete
function wpsc_enable_preload() {
[3966] Fix | Delete
[3967] Fix | Delete
wpsc_reset_preload_settings();
[3968] Fix | Delete
wp_schedule_single_event( time() + 10, 'wp_cache_full_preload_hook' );
[3969] Fix | Delete
}
[3970] Fix | Delete
[3971] Fix | Delete
function wpsc_get_post_types() {
[3972] Fix | Delete
[3973] Fix | Delete
$preload_type_args = apply_filters( 'wpsc_preload_post_types_args', array(
[3974] Fix | Delete
'public' => true,
[3975] Fix | Delete
'publicly_queryable' => true
[3976] Fix | Delete
) );
[3977] Fix | Delete
[3978] Fix | Delete
$post_types = (array) apply_filters( 'wpsc_preload_post_types', get_post_types( $preload_type_args, 'names', 'or' ));
[3979] Fix | Delete
[3980] Fix | Delete
return "'" . implode( "', '", array_map( 'esc_sql', $post_types ) ) . "'";
[3981] Fix | Delete
}
[3982] Fix | Delete
function wpsc_post_count() {
[3983] Fix | Delete
global $wpdb;
[3984] Fix | Delete
static $count;
[3985] Fix | Delete
[3986] Fix | Delete
if ( isset( $count ) ) {
[3987] Fix | Delete
return $count;
[3988] Fix | Delete
}
[3989] Fix | Delete
[3990] Fix | Delete
$post_type_list = wpsc_get_post_types();
[3991] Fix | Delete
$count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type IN ( $post_type_list ) AND post_status = 'publish'" );
[3992] Fix | Delete
[3993] Fix | Delete
return $count;
[3994] Fix | Delete
}
[3995] Fix | Delete
[3996] Fix | Delete
/**
[3997] Fix | Delete
* Get the minimum interval in minutes between preload refreshes.
[3998] Fix | Delete
* Filter the default value of 10 minutes using the `wpsc_minimum_preload_interval` filter.
[3999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function