wp_cache_create_advanced_cache() WPSCache 1.0
Хуки из функции
Возвращает
Null. Ничего.
Использование
wp_cache_create_advanced_cache();
Код wp_cache_create_advanced_cache() wp cache create advanced cache WPSCache 1.7.1
function wp_cache_create_advanced_cache() {
global $wpsc_advanced_cache_filename, $wpsc_advanced_cache_dist_filename;
if ( file_exists( ABSPATH . 'wp-config.php') ) {
$global_config_file = ABSPATH . 'wp-config.php';
} else {
$global_config_file = dirname(ABSPATH) . '/wp-config.php';
}
$line = 'define( \'WPCACHEHOME\', \'' . dirname( __FILE__ ) . '/\' );';
if ( ! apply_filters( 'wpsc_enable_wp_config_edit', true ) ) {
echo '<div class="notice notice-error"><h4>' . __( 'Warning', 'wp-super-cache' ) . "! " . sprintf( __( 'Not allowed to edit %s per configuration.', 'wp-super-cache' ), $global_config_file ) . "</h4></div>";
return false;
}
if (
! strpos( file_get_contents( $global_config_file ), "WPCACHEHOME" ) ||
(
defined( 'WPCACHEHOME' ) &&
(
constant( 'WPCACHEHOME' ) == '' ||
(
constant( 'WPCACHEHOME' ) != '' &&
! file_exists( constant( 'WPCACHEHOME' ) . '/wp-cache.php' )
)
)
)
) {
if (
! is_writeable_ACLSafe( $global_config_file ) ||
! wp_cache_replace_line( 'define *\( *\'WPCACHEHOME\'', $line, $global_config_file )
) {
echo '<div class="notice notice-error"><h4>' . __( 'Warning', 'wp-super-cache' ) . "! <em>" . sprintf( __( 'Could not update %s!</em> WPCACHEHOME must be set in config file.', 'wp-super-cache' ), $global_config_file ) . "</h4></div>";
return false;
}
}
$ret = true;
if ( file_exists( $wpsc_advanced_cache_filename ) ) {
$file = file_get_contents( $wpsc_advanced_cache_filename );
if (
! strpos( $file, "WP SUPER CACHE 0.8.9.1" ) &&
! strpos( $file, "WP SUPER CACHE 1.2" )
) {
wp_die( '<div class="notice notice-error"><h4>' . __( 'Warning!', 'wp-super-cache' ) . "</h4><p>" . sprintf( __( 'The file %s already exists. Please manually delete it before using this plugin. If you continue to see this message after deleting it please contact your hosting support.', 'wp-super-cache' ), $wpsc_advanced_cache_filename ) . "</p></div>" );
}
}
$file = file_get_contents( $wpsc_advanced_cache_dist_filename );
$fp = @fopen( $wpsc_advanced_cache_filename, 'w' );
if( $fp ) {
fputs( $fp, $file );
fclose( $fp );
} else {
$ret = false;
}
return $ret;
}