diff --git a/inc/namespace.php b/inc/namespace.php index 4f781c27..2c240dbc 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -587,6 +587,15 @@ 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 ( 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';