Created
May 6, 2017 10:35
-
-
Save timwhitlock/babbd588b4a49765cd2b014acb4df9f8 to your computer and use it in GitHub Desktop.
Ensures custom SSH2 class is loaded before autoloader is triggered by class_exists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Preload SSH class | |
Plugin URI: https://wordpress.org/support/topic/conflict-with-ssh-sftp-updater-support-ssh2-fs_method/ | |
Description: Ensures custom SSH2 class is loaded before autoloader is triggered by class_exists | |
Author: Tim Whitlock | |
*/ | |
function filter_filesystem_method( $method = '' ){ | |
if( 'ssh2' === $method && ! class_exists('WP_Filesystem_SSH2',false) ){ | |
if( $path = phpseclib_filesystem_method_file('','ssh2') ){ | |
require_once $path; | |
} | |
} | |
return $method; | |
}; | |
add_filter('filesystem_method','filter_filesystem_method',10,1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment