Commit b6856174e78 for woocommerce
commit b6856174e78c20458edf4250cd9f973053c26ba6
Author: Jorge A. Torres <jorge.torres@automattic.com>
Date: Thu Feb 26 22:17:36 2026 +0000
Minor refactor in fs util
diff --git a/plugins/woocommerce/src/Internal/Utilities/FilesystemUtil.php b/plugins/woocommerce/src/Internal/Utilities/FilesystemUtil.php
index b175f1ff0d1..74cc7790a40 100644
--- a/plugins/woocommerce/src/Internal/Utilities/FilesystemUtil.php
+++ b/plugins/woocommerce/src/Internal/Utilities/FilesystemUtil.php
@@ -123,7 +123,9 @@ class FilesystemUtil {
if ( 'direct' === $method ) {
$initialized = WP_Filesystem();
} elseif ( false !== $method ) {
- if ( get_transient( self::FTP_INIT_FAILURE_TRANSIENT ) ) {
+ $is_ftp = in_array( $method, array( 'ftpext', 'ftpsockets' ), true );
+
+ if ( $is_ftp && get_transient( self::FTP_INIT_FAILURE_TRANSIENT ) ) {
return false;
}
@@ -134,13 +136,15 @@ class FilesystemUtil {
$initialized = $credentials && WP_Filesystem( $credentials );
- if ( ! $initialized ) {
- // A fixed cooldown is used instead of exponential backoff since this handles a non-critical
- // edge case (broken FTP filesystem during logging) that most sites will never encounter.
- set_transient( self::FTP_INIT_FAILURE_TRANSIENT, true, self::FTP_INIT_COOLDOWN_MINUTES * MINUTE_IN_SECONDS );
- error_log( sprintf( 'WooCommerce: FTP filesystem connection failed. Please check your FTP credentials. Retrying in %d minutes.', self::FTP_INIT_COOLDOWN_MINUTES ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
- } else {
- delete_transient( self::FTP_INIT_FAILURE_TRANSIENT );
+ if ( $is_ftp ) {
+ if ( ! $initialized ) {
+ // A fixed cooldown is used instead of exponential backoff since this handles a non-critical
+ // edge case (broken FTP filesystem during logging) that most sites will never encounter.
+ set_transient( self::FTP_INIT_FAILURE_TRANSIENT, true, self::FTP_INIT_COOLDOWN_MINUTES * MINUTE_IN_SECONDS );
+ error_log( sprintf( 'WooCommerce: FTP filesystem connection failed. Please check your FTP credentials. Retrying in %d minutes.', self::FTP_INIT_COOLDOWN_MINUTES ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
+ } else {
+ delete_transient( self::FTP_INIT_FAILURE_TRANSIENT );
+ }
}
}