Automattic\WooCommerce\Internal\Admin

WCAdminAssets::get_file_version()public staticWC 1.0

Gets the file modified time as a cache buster if we're in dev mode, or the asset version (file content hash) if exists, or the WooCommerce version.

Method of the class: WCAdminAssets{}

No Hooks.

Return

String. The cache buster value to use for the given file.

Usage

$result = WCAdminAssets::get_file_version( $ext, $asset_version );
$ext(string) (required)
File extension.
$asset_version(string|null)
The version from the asset file.
Default: null

WCAdminAssets::get_file_version() code WC 9.8.2

public static function get_file_version( $ext, $asset_version = null ) {
	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
		return filemtime( WC_ADMIN_ABSPATH . self::get_path( $ext ) );
	}

	if ( ! empty( $asset_version ) ) {
		return $asset_version;
	}

	return WC_VERSION;
}