WP_Super_Cache_Rest_Update_Settings::set_wp_cache_location()protectedWPSCache 1.0

Method of the class: WP_Super_Cache_Rest_Update_Settings{}

No Hooks.

Return

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() code WPSCache 1.12.4

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 );
	}
}