From ecdaecc5a0e8c99802959fe61e426f190bebb147 Mon Sep 17 00:00:00 2001 From: Forkless Date: Sun, 10 May 2026 18:27:24 +0200 Subject: [PATCH] Fix: FFmpeg path detection uses is_executable instead of is_dir to work under open_basedir --- includes/class-cache-manager.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/includes/class-cache-manager.php b/includes/class-cache-manager.php index 07f6ba6..6f63320 100644 --- a/includes/class-cache-manager.php +++ b/includes/class-cache-manager.php @@ -436,19 +436,24 @@ class Cache_Manager { $custom = $settings['piper_ffmpeg_binary'] ?? ''; if ( '' !== $custom ) { - // Support both full binary path and directory-only path. - if ( @is_dir( $custom ) ) { - $custom = rtrim( $custom, '/' ) . '/ffmpeg'; + // Support both full binary path AND directory-only path. + // `@is_dir` can return false under open_basedir, so we also + // try appending /ffmpeg if the raw path is not executable. + if ( ! @is_executable( $custom ) ) { + $candidate = rtrim( $custom, '/' ) . '/ffmpeg'; + if ( @is_executable( $candidate ) ) { + $custom = $candidate; + $this->logger->info( 'FFmpeg path is a directory, resolved to: {path}', [ 'path' => $custom ] ); + } } - if ( @file_exists( $custom ) && @is_executable( $custom ) ) { + if ( @is_executable( $custom ) ) { $cached = true; $resolved_path = $custom; + $this->logger->info( 'Found ffmpeg at configured path: {path}', [ 'path' => $custom ] ); return $resolved_path; } - $this->logger->warning( - 'Configured ffmpeg binary not found or not executable: {path}. Trying auto-detection.', - [ 'path' => $custom ] - ); + $this->logger->warning( 'ffmpeg not found or not executable at configured path: {path}', [ 'path' => $original ] ); + $this->logger->warning( 'Trying auto-detection.' ); } $candidates = apply_filters(