From cd578efcf4f21988d4f2dc51b0ba026c52683436 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Mon, 25 Mar 2024 11:12:41 +0000 Subject: [PATCH 1/2] Set the TACHYON_SERVER_VERSION This is needed to support the newer `presign` query param functionality added in https://github.com/humanmade/tachyon-plugin/releases/tag/0.11.8 --- inc/namespace.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inc/namespace.php b/inc/namespace.php index 4f781c27..e4efe7bf 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -587,6 +587,12 @@ function load_plugins() { define( 'TACHYON_URL', get_main_site_url( '/tachyon' ) ); } + // Set the Tachyon Server version if it's not already defined. This is used to flag to Tachyon that we + // have a version of Tachyon that supports the newer "presign" query parameter. + if ( defined( 'TFA_VERSION' ) && version_compare( TFA_VERSION, '4.6.0', '>=' ) && ! defined( 'TACHYON_SERVER_VERSION' ) ) { + define( 'TACHYON_SERVER_VERSION', '3.0.0' ); + } + if ( $config['s3-uploads'] ) { add_filter( 'upload_dir', __NAMESPACE__ . '\\set_s3_uploads_bucket_url_hostname', 20 ); require_once Altis\ROOT_DIR . '/vendor/humanmade/s3-uploads/s3-uploads.php'; From c5d8cbab2234898ace28c072d31bef2474c0849f Mon Sep 17 00:00:00 2001 From: Konstantin Kovshenin Date: Tue, 2 Apr 2024 12:06:29 +0100 Subject: [PATCH 2/2] Define TFA_VERSION from env vars. --- inc/namespace.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/namespace.php b/inc/namespace.php index e4efe7bf..2c240dbc 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -587,9 +587,12 @@ function load_plugins() { define( 'TACHYON_URL', get_main_site_url( '/tachyon' ) ); } + // Define TFA_VERSION from the environment variable. + defined( 'TFA_VERSION' ) || define( 'TFA_VERSION', getenv( 'TFA_VERSION' ) ?: '0' ); + // Set the Tachyon Server version if it's not already defined. This is used to flag to Tachyon that we // have a version of Tachyon that supports the newer "presign" query parameter. - if ( defined( 'TFA_VERSION' ) && version_compare( TFA_VERSION, '4.6.0', '>=' ) && ! defined( 'TACHYON_SERVER_VERSION' ) ) { + if ( version_compare( TFA_VERSION, '4.6.0', '>=' ) && ! defined( 'TACHYON_SERVER_VERSION' ) ) { define( 'TACHYON_SERVER_VERSION', '3.0.0' ); }