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. Built from https://develop.svn.wordpress.org/trunk@38138 git-svn-id: http://core.svn.wordpress.org/trunk@38079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eb0ee24750
commit
3a3828c396
|
@ -22,11 +22,20 @@ class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
|
|||
protected $messages = array();
|
||||
|
||||
/**
|
||||
* Determines whether the upgrader needs FTP/SSH details in order to connect
|
||||
* to the filesystem.
|
||||
*
|
||||
* @param bool $error
|
||||
* @param string $context
|
||||
* @param bool $allow_relaxed_file_ownership
|
||||
* @return bool
|
||||
* @since 3.7.0
|
||||
* @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
|
||||
*
|
||||
* @see request_filesystem_credentials()
|
||||
*
|
||||
* @param bool $error Optional. Whether the current request has failed to connect.
|
||||
* Default false.
|
||||
* @param string $context Optional. Full path to the directory that is tested
|
||||
* for being writable. Default empty.
|
||||
* @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) {
|
||||
if ( $context ) {
|
||||
|
|
|
@ -66,13 +66,22 @@ class WP_Upgrader_Skin {
|
|||
}
|
||||
|
||||
/**
|
||||
* Displays a form to the user to request for their FTP/SSH details in order
|
||||
* to connect to the filesystem.
|
||||
*
|
||||
* @param bool $error
|
||||
* @param string $context
|
||||
* @param bool $allow_relaxed_file_ownership
|
||||
* @return type
|
||||
* @since 2.8.0
|
||||
* @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
|
||||
*
|
||||
* @see request_filesystem_credentials()
|
||||
*
|
||||
* @param bool $error Optional. Whether the current request has failed to connect.
|
||||
* Default false.
|
||||
* @param string $context Optional. Full path to the directory that is tested
|
||||
* for being writable. Default empty.
|
||||
* @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
|
||||
* @return bool False on failure, true on success.
|
||||
*/
|
||||
public function request_filesystem_credentials( $error = false, $context = false, $allow_relaxed_file_ownership = false ) {
|
||||
public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) {
|
||||
$url = $this->options['url'];
|
||||
if ( ! $context ) {
|
||||
$context = $this->options['context'];
|
||||
|
|
|
@ -957,12 +957,12 @@ function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_own
|
|||
*
|
||||
* @param array $args Optional. Connection details. Default empty array.
|
||||
* @param string $context Optional. Full path to the directory that is tested
|
||||
* for being writable. Default false.
|
||||
* for being writable. Default empty.
|
||||
* @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable.
|
||||
* Default false.
|
||||
* @return string The transport to use, see description for valid return values.
|
||||
*/
|
||||
function get_filesystem_method( $args = array(), $context = false, $allow_relaxed_file_ownership = false ) {
|
||||
function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_file_ownership = false ) {
|
||||
$method = defined('FS_METHOD') ? FS_METHOD : false; // Please ensure that this is either 'direct', 'ssh2', 'ftpext' or 'ftpsockets'
|
||||
|
||||
if ( ! $context ) {
|
||||
|
@ -1027,15 +1027,15 @@ function get_filesystem_method( $args = array(), $context = false, $allow_relaxe
|
|||
* Displays a form to the user to request for their FTP/SSH details in order
|
||||
* to connect to the filesystem.
|
||||
*
|
||||
* All chosen/entered details are saved, Excluding the Password.
|
||||
* All chosen/entered details are saved, excluding the password.
|
||||
*
|
||||
* Hostnames may be in the form of hostname:portnumber (eg: wordpress.org:2467)
|
||||
* to specify an alternate FTP/SSH port.
|
||||
*
|
||||
* Plugins may override this form by returning true|false via the
|
||||
* {@see 'request_filesystem_credentials'} filter.
|
||||
* Plugins may override this form by returning true|false via the {@see 'request_filesystem_credentials'} filter.
|
||||
*
|
||||
* @since 2.5.
|
||||
* @since 2.5.0
|
||||
* @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
|
||||
*
|
||||
* @global string $pagenow
|
||||
*
|
||||
|
@ -1043,16 +1043,15 @@ function get_filesystem_method( $args = array(), $context = false, $allow_relaxe
|
|||
* @param string $type Optional. Chosen type of filesystem. Default empty.
|
||||
* @param bool $error Optional. Whether the current request has failed to connect.
|
||||
* Default false.
|
||||
* @param string $context Optional. Full path to the directory that is tested
|
||||
* for being writable. Default false.
|
||||
* @param array $extra_fields Optional. Extra POST fields which should be checked for
|
||||
* to be included in the post. Default null.
|
||||
* @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable.
|
||||
* Default false.
|
||||
* @param string $context Optional. Full path to the directory that is tested for being
|
||||
* writable. Default empty.
|
||||
* @param array $extra_fields Optional. Extra `POST` fields to be checked for inclusion in
|
||||
* the post. Default null.
|
||||
* @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
|
||||
*
|
||||
* @return bool False on failure, true on success.
|
||||
*/
|
||||
function request_filesystem_credentials( $form_post, $type = '', $error = false, $context = false, $extra_fields = null, $allow_relaxed_file_ownership = false ) {
|
||||
function request_filesystem_credentials( $form_post, $type = '', $error = false, $context = '', $extra_fields = null, $allow_relaxed_file_ownership = false ) {
|
||||
global $pagenow;
|
||||
|
||||
/**
|
||||
|
@ -1062,6 +1061,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
|
|||
* output of the filesystem credentials form, returning that value instead.
|
||||
*
|
||||
* @since 2.5.0
|
||||
* @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
|
||||
*
|
||||
* @param mixed $output Form output to return instead. Default empty.
|
||||
* @param string $form_post The URL to post the form to.
|
||||
|
@ -1160,6 +1160,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
|
|||
* Filters the connection types to output to the filesystem credentials form.
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
|
||||
*
|
||||
* @param array $types Types of connections.
|
||||
* @param array $credentials Credentials to connect with.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-beta4-38137';
|
||||
$wp_version = '4.6-beta4-38138';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue