[wp-trac] [WordPress Trac] #31616: Splitting request_filesystem_credentials into separate functions
WordPress Trac
noreply at wordpress.org
Sat Mar 14 12:15:10 UTC 2015
#31616: Splitting request_filesystem_credentials into separate functions
---------------------------------------+------------------
Reporter: jipmoors | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.2
Component: Filesystem API | Version:
Severity: normal | Resolution:
Keywords: shiny-updates needs-patch | Focuses:
---------------------------------------+------------------
Comment (by jipmoors):
'''Update use case (since patch 3)'''
Patch 3 modifies the get_filesystem_credentials to have 'direct'
connection return a similar `$credentials` array with 'connection_type'
set to 'direct'. This allows for more unified code.
{{{
if ( 'direct' == get_filesystem_method() ) {
// no need for credential checks; though they will pass
}
$credentials = get_filesystem_credentials( $form_post );
// check if the credentials are sufficient for specified type:
if ( ! usable_filesystem_credentials( $credentials ) ) {
// more input is needed
request_filesystem_credentials_form( $form_post, $credentials, '',
$error );
} else {
// use $credentials in any way you like; spit it out to javascript or
modify files
// explicit check for $credentials['connection_type'] == 'direct' is
possible here, but not required
}
}}}
The only parameter accepted (and required) for
`usable_filesystem_credentials` is now an array. Required parameters are
checked on 'connection_type' with a fall through to 'hostname',
'username', 'password' for anything except 'direct' and 'ssh'.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31616#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list