Make WordPress Core

Changeset 38138


Ignore:
Timestamp:
07/22/2016 12:09:55 PM (8 years ago)
Author:
ocean90
Message:

Filesystem API: Change the default value for the $context parameter of get_filesystem_method() and request_filesystem_credentials() to an empty string.

$context is a full path to the directory that is tested for being writable. A path shouldn't be a boolean value.
This also updates WP_Upgrader_Skin::request_filesystem_credentials() and Automatic_Upgrader_Skin::request_filesystem_credentials() and adds missing docs.

Props DrewAPicture, ocean90.
Fixes #37412.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-automatic-upgrader-skin.php

    r38023 r38138  
    2323
    2424    /**
     25     * Determines whether the upgrader needs FTP/SSH details in order to connect
     26     * to the filesystem.
    2527     *
    26      * @param bool   $error
    27      * @param string $context
    28      * @param bool   $allow_relaxed_file_ownership
    29      * @return bool
     28     * @since 3.7.0
     29     * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
     30     *
     31     * @see request_filesystem_credentials()
     32     *
     33     * @param bool   $error                        Optional. Whether the current request has failed to connect.
     34     *                                             Default false.
     35     * @param string $context                      Optional. Full path to the directory that is tested
     36     *                                             for being writable. Default empty.
     37     * @param bool   $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
     38     * @return bool True on success, false on failure.
    3039     */
    3140    public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) {
  • trunk/src/wp-admin/includes/class-wp-upgrader-skin.php

    r38134 r38138  
    6767
    6868    /**
    69      *
    70      * @param bool   $error
    71      * @param string $context
    72      * @param bool   $allow_relaxed_file_ownership
    73      * @return type
    74      */
    75     public function request_filesystem_credentials( $error = false, $context = false, $allow_relaxed_file_ownership = false ) {
     69     * Displays a form to the user to request for their FTP/SSH details in order
     70     * to connect to the filesystem.
     71     *
     72     * @since 2.8.0
     73     * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
     74     *
     75     * @see request_filesystem_credentials()
     76     *
     77     * @param bool   $error                        Optional. Whether the current request has failed to connect.
     78     *                                             Default false.
     79     * @param string $context                      Optional. Full path to the directory that is tested
     80     *                                             for being writable. Default empty.
     81     * @param bool   $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
     82     * @return bool False on failure, true on success.
     83     */
     84    public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) {
    7685        $url = $this->options['url'];
    7786        if ( ! $context ) {
  • trunk/src/wp-admin/includes/file.php

    r38015 r38138  
    958958 * @param array  $args                         Optional. Connection details. Default empty array.
    959959 * @param string $context                      Optional. Full path to the directory that is tested
    960  *                                             for being writable. Default false.
     960 *                                             for being writable. Default empty.
    961961 * @param bool   $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable.
    962962 *                                             Default false.
    963963 * @return string The transport to use, see description for valid return values.
    964964 */
    965 function get_filesystem_method( $args = array(), $context = false, $allow_relaxed_file_ownership = false ) {
     965function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_file_ownership = false ) {
    966966    $method = defined('FS_METHOD') ? FS_METHOD : false; // Please ensure that this is either 'direct', 'ssh2', 'ftpext' or 'ftpsockets'
    967967
     
    10281028 * to connect to the filesystem.
    10291029 *
    1030  * All chosen/entered details are saved, Excluding the Password.
     1030 * All chosen/entered details are saved, excluding the password.
    10311031 *
    10321032 * Hostnames may be in the form of hostname:portnumber (eg: wordpress.org:2467)
    10331033 * to specify an alternate FTP/SSH port.
    10341034 *
    1035  * Plugins may override this form by returning true|false via the
    1036  * {@see 'request_filesystem_credentials'} filter.
    1037  *
    1038  * @since 2.5.
     1035 * Plugins may override this form by returning true|false via the {@see 'request_filesystem_credentials'} filter.
     1036 *
     1037 * @since 2.5.0
     1038 * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
    10391039 *
    10401040 * @global string $pagenow
     
    10441044 * @param bool   $error                        Optional. Whether the current request has failed to connect.
    10451045 *                                             Default false.
    1046  * @param string $context                      Optional. Full path to the directory that is tested
    1047  *                                             for being writable. Default false.
    1048  * @param array  $extra_fields                 Optional. Extra POST fields which should be checked for
    1049  *                                             to be included in the post. Default null.
    1050  * @param bool   $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable.
    1051  *                                             Default false.
     1046 * @param string $context                      Optional. Full path to the directory that is tested for being
     1047 *                                             writable. Default empty.
     1048 * @param array  $extra_fields                 Optional. Extra `POST` fields to be checked for inclusion in
     1049 *                                             the post. Default null.
     1050 * @param bool   $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
    10521051 *
    10531052 * @return bool False on failure, true on success.
    10541053 */
    1055 function request_filesystem_credentials( $form_post, $type = '', $error = false, $context = false, $extra_fields = null, $allow_relaxed_file_ownership = false ) {
     1054function request_filesystem_credentials( $form_post, $type = '', $error = false, $context = '', $extra_fields = null, $allow_relaxed_file_ownership = false ) {
    10561055    global $pagenow;
    10571056
     
    10631062     *
    10641063     * @since 2.5.0
     1064     * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
    10651065     *
    10661066     * @param mixed  $output                       Form output to return instead. Default empty.
     
    11611161     *
    11621162     * @since 2.9.0
     1163     * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
    11631164     *
    11641165     * @param array  $types       Types of connections.
Note: See TracChangeset for help on using the changeset viewer.