WordPress.org

Make WordPress Core

Changeset 47584


Ignore:
Timestamp:
04/15/2020 11:52:38 AM (18 months ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-filesystem-ssh2.php

    r47219 r47584  
    77 * @contrib http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes
    88 *
    9  * 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)
     9 * 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)
    1010 *
    1111 * cd /usr/src
     
    2727 * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp  exist.
    2828 *
    29  * Note: as of WordPress 2.8, This utilises the PHP5+ function 'stream_get_contents'
     29 * Note: As of WordPress 2.8, this utilises the PHP5+ function `stream_get_contents()`.
    3030 *
    3131 * @since 2.7.0
     
    6868        if ( ! extension_loaded( 'ssh2' ) ) {
    6969            $this->errors->add( 'no_ssh2_ext', __( 'The ssh2 PHP extension is not available' ) );
    70             return;
    71         }
    72         if ( ! function_exists( 'stream_get_contents' ) ) {
    73             $this->errors->add(
    74                 'ssh2_php_requirement',
    75                 sprintf(
    76                     /* translators: %s: stream_get_contents() */
    77                     __( 'The ssh2 PHP extension is available, however, we require the PHP5 function %s' ),
    78                     '<code>stream_get_contents()</code>'
    79                 )
    80             );
    8170            return;
    8271        }
  • trunk/src/wp-admin/includes/file.php

    r47550 r47584  
    19251925    }
    19261926
    1927     if ( ! $method && isset( $args['connection_type'] ) && 'ssh' == $args['connection_type'] && extension_loaded( 'ssh2' ) && function_exists( 'stream_get_contents' ) ) {
     1927    if ( ! $method && isset( $args['connection_type'] ) && 'ssh' == $args['connection_type'] && extension_loaded( 'ssh2' ) ) {
    19281928        $method = 'ssh2';
    19291929    }
     
    21092109        $types['ftps'] = __( 'FTPS (SSL)' );
    21102110    }
    2111     if ( extension_loaded( 'ssh2' ) && function_exists( 'stream_get_contents' ) ) {
     2111    if ( extension_loaded( 'ssh2' ) ) {
    21122112        $types['ssh'] = __( 'SSH2' );
    21132113    }
Note: See TracChangeset for help on using the changeset viewer.