WP_Super_Cache_Rest_Update_Settings::set_wp_cache_location
Method of the class: WP_Super_Cache_Rest_Update_Settings{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->set_wp_cache_location( $value );
- $value(mixed) (required)
- .
WP_Super_Cache_Rest_Update_Settings::set_wp_cache_location() WP Super Cache Rest Update Settings::set wp cache location code WPSCache 3.1.1
protected function set_wp_cache_location( $value ) {
global $cache_path;
if ( $value != '' && ( ! isset( $cache_path ) || $value != $cache_path ) ) {
$dir = realpath( trailingslashit( dirname( $value ) ) );
if ( $dir == false ) {
$dir = WP_CONTENT_DIR . '/cache/';
} else {
$dir = trailingslashit( $dir ) . trailingslashit( wpsc_deep_replace( array(
'..',
'\\'
), basename( $value ) ) );
}
$new_cache_path = $dir;
} else {
$new_cache_path = WP_CONTENT_DIR . '/cache/';
}
if ( $new_cache_path != $cache_path ) {
if ( file_exists( $new_cache_path ) == false ) {
rename( $cache_path, $new_cache_path );
}
$cache_path = $new_cache_path;
wp_cache_setting( 'cache_path', $cache_path );
}
}