Code Modernization: Remove conditional use of stream_get_contents() PHP function.

The function was introduced in PHP 5.0.0. Now that the minimum version of PHP required by WordPress is 5.6.20, these conditions are no longer needed.

Props jrf.
Fixes #48091.

git-svn-id: https://develop.svn.wordpress.org/trunk@47584 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-04-15 11:52:38 +00:00
parent 72f54ba785
commit 90b0f49b1a
2 changed files with 4 additions and 15 deletions

View File

@ -6,7 +6,7 @@
*
* @contrib http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes
*
* Complie libssh2 (Note: Only 0.14 is officaly working with PHP 5.2.6+ right now, But many users have found the latest versions work)
* Compile libssh2 (Note: Only 0.14 is officaly working with PHP 5.2.6+ right now, But many users have found the latest versions work)
*
* cd /usr/src
* wget https://www.libssh2.org/download/libssh2-0.14.tar.gz
@ -26,7 +26,7 @@
* Restart Apache!
* Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp exist.
*
* Note: as of WordPress 2.8, This utilises the PHP5+ function 'stream_get_contents'
* Note: As of WordPress 2.8, this utilises the PHP5+ function `stream_get_contents()`.
*
* @since 2.7.0
*
@ -69,17 +69,6 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
$this->errors->add( 'no_ssh2_ext', __( 'The ssh2 PHP extension is not available' ) );
return;
}
if ( ! function_exists( 'stream_get_contents' ) ) {
$this->errors->add(
'ssh2_php_requirement',
sprintf(
/* translators: %s: stream_get_contents() */
__( 'The ssh2 PHP extension is available, however, we require the PHP5 function %s' ),
'<code>stream_get_contents()</code>'
)
);
return;
}
// Set defaults:
if ( empty( $opt['port'] ) ) {

View File

@ -1924,7 +1924,7 @@ function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_f
}
}
if ( ! $method && isset( $args['connection_type'] ) && 'ssh' == $args['connection_type'] && extension_loaded( 'ssh2' ) && function_exists( 'stream_get_contents' ) ) {
if ( ! $method && isset( $args['connection_type'] ) && 'ssh' == $args['connection_type'] && extension_loaded( 'ssh2' ) ) {
$method = 'ssh2';
}
if ( ! $method && extension_loaded( 'ftp' ) ) {
@ -2108,7 +2108,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
if ( extension_loaded( 'ftp' ) ) { // Only this supports FTPS.
$types['ftps'] = __( 'FTPS (SSL)' );
}
if ( extension_loaded( 'ssh2' ) && function_exists( 'stream_get_contents' ) ) {
if ( extension_loaded( 'ssh2' ) ) {
$types['ssh'] = __( 'SSH2' );
}