Automattic\WooCommerce\Internal\Api

QueryCache::get_opcache_cache_dirpublic staticWC 1.0

Resolve the directory where OPcache cache files are written.

Defaults to a versioned subdirectory under wp-uploads so it inherits the writability guarantees WordPress places on uploads. Filterable for tests and unusual hosting layouts.

Метод класса: QueryCache{}

Хуки из метода

Возвращает

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

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

$result = QueryCache::get_opcache_cache_dir(): string;

Код QueryCache::get_opcache_cache_dir() WC 11.0.1

public static function get_opcache_cache_dir(): string {
	$upload_dir = wp_get_upload_dir();
	$default    = trailingslashit( $upload_dir['basedir'] ) . self::OPCACHE_DIR_RELATIVE;

	/**
	 * Filters the directory where parsed GraphQL ASTs are written for OPcache.
	 *
	 * @since 10.9.0
	 *
	 * @param string $dir Default cache directory under wp-uploads.
	 */
	$dir = (string) apply_filters( 'woocommerce_graphql_opcache_cache_dir', $default );

	// Reject stream wrappers (e.g. phar://, http://) to keep file_put_contents,
	// rename, and include constrained to local filesystem paths.
	if ( '' === $dir || wp_is_stream( $dir ) ) {
		return '';
	}

	return $dir;
}