wpsc_is_preload_active()WPSCache 1.0

returns true if preload is active

Хуки из функции

Возвращает

null. Ничего (null).

Использование

wpsc_is_preload_active();

Код wpsc_is_preload_active() WPSCache 1.12.4

function wpsc_is_preload_active() {
	global $cache_path;

	// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
	if ( @file_exists( $cache_path . 'stop_preload.txt' ) ) {
		return false;
	}

	if ( file_exists( $cache_path . 'preload_mutex.tmp' ) ) {
		return true;
	}

	// check taxonomy preload loop
	$taxonomies = apply_filters(
		'wp_cache_preload_taxonomies',
		array(
			'post_tag' => 'tag',
			'category' => 'category',
		)
	);

	foreach ( $taxonomies as $taxonomy => $path ) {
		$taxonomy_filename = $cache_path . 'taxonomy_' . $taxonomy . '.txt';
		if ( file_exists( $taxonomy_filename ) ) {
			return true;
		}
	}

	// check post preload loop
	$preload_cache_counter = get_option( 'preload_cache_counter' );
	if (
		is_array( $preload_cache_counter )
		&& isset( $preload_cache_counter['c'] )
		&& $preload_cache_counter['c'] > 0
	) {
		return true;
	}

	return false;
}