Automattic\WooCommerce\Internal\Utilities

FilesystemUtil::get_wp_filesystem_method_or_direct()public staticWC 1.0

Get the WP filesystem method, with a fallback to 'direct' if no FS_METHOD constant exists and there are not FTP related options/credentials set.

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

Хуков нет.

Возвращает

Строку|false. The name of the WP filesystem method to use.

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

$result = FilesystemUtil::get_wp_filesystem_method_or_direct();

Код FilesystemUtil::get_wp_filesystem_method_or_direct() WC 9.7.1

public static function get_wp_filesystem_method_or_direct() {
	$proxy = wc_get_container()->get( LegacyProxy::class );
	if ( ! self::constant_exists( 'FS_METHOD' ) && false === $proxy->call_function( 'get_option', 'ftp_credentials' ) && ! self::constant_exists( 'FTP_HOST' ) ) {
		return 'direct';
	}

	$method = $proxy->call_function( 'get_filesystem_method' );
	if ( $method ) {
		return $method;
	}

	return 'direct';
}