Automattic\WooCommerce\Internal\TransientFiles

TransientFilesEngine::get_transient_file_path()publicWC 1.0

Get the full physical path of a transient file given its name.

Method of the class: TransientFilesEngine{}

No Hooks.

Return

String|null. The full physical path of the file, or null if the files doesn't exist.

Usage

$TransientFilesEngine = new TransientFilesEngine();
$TransientFilesEngine->get_transient_file_path( $filename ): ?string;
$filename(string) (required)
The name of the transient file to locate.

TransientFilesEngine::get_transient_file_path() code WC 9.4.2

public function get_transient_file_path( string $filename ): ?string {
	$expiration_date = self::get_expiration_date( $filename );
	if ( is_null( $expiration_date ) ) {
		return null;
	}

	$file_path = $this->get_transient_files_directory() . '/' . $expiration_date . '/' . substr( $filename, 6 );

	return is_file( $file_path ) ? $file_path : null;
}