Automattic\WooCommerce\Internal\TransientFiles
TransientFilesEngine::get_transient_file_path
Get the full physical path of a transient file given its name.
Method of the class: TransientFilesEngine{}
No Hooks.
Returns
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() TransientFilesEngine::get transient file path code WC 10.7.0
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;
}