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.
Built from https://develop.svn.wordpress.org/trunk@47584


git-svn-id: http://core.svn.wordpress.org/trunk@47359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-04-15 11:54:08 +00:00
parent bb2c0198ab
commit 4e13efaf96
3 changed files with 5 additions and 16 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' );
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-47583';
$wp_version = '5.5-alpha-47584';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.