Automattic\WooCommerce\Internal\TransientFiles

TransientFilesEngine::delete_transient_file()publicWC 1.0

Delete an existing transient file.

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

Хуков нет.

Возвращает

true|false. True if the file has been deleted, false otherwise (the file didn't exist).

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

$TransientFilesEngine = new TransientFilesEngine();
$TransientFilesEngine->delete_transient_file( $filename ): bool;
$filename(строка) (обязательный)
The name of the file to delete.

Код TransientFilesEngine::delete_transient_file() WC 9.6.1

public function delete_transient_file( string $filename ): bool {
	$file_path = $this->get_transient_file_path( $filename );
	if ( is_null( $file_path ) ) {
		return false;
	}

	$dirname = dirname( $file_path );
	wp_delete_file( $file_path );
	$this->delete_directory_if_not_empty( $dirname );

	return true;
}