Fix plugin/theme upgrade issues when using ftp extension. Fixes #9980 props DD32.
git-svn-id: http://svn.automattic.com/wordpress/trunk@11495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4120f8e0d7
commit
7a9955a64a
|
@ -58,10 +58,8 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
|||
$this->options['password'] = $opt['password'];
|
||||
|
||||
$this->options['ssl'] = false;
|
||||
if ( isset($opt['ssl']) )
|
||||
$this->options['ssl'] = ( !empty($opt['ssl']) );
|
||||
elseif ( isset( $opt['connection_type']) )
|
||||
$this->options['ssl'] = ( 'ftps' == $opt['connection_type'] );
|
||||
if ( isset($opt['connection_type']) && 'ftps' == $opt['connection_type'] )
|
||||
$this->options['ssl'] = true;
|
||||
}
|
||||
|
||||
function connect() {
|
||||
|
|
|
@ -593,11 +593,13 @@ function WP_Filesystem( $args = false ) {
|
|||
if ( ! $method )
|
||||
return false;
|
||||
|
||||
if ( ! class_exists("WP_Filesystem_$method") ) {
|
||||
$abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
|
||||
if( ! file_exists($abstraction_file) )
|
||||
return;
|
||||
|
||||
require_once($abstraction_file);
|
||||
}
|
||||
$method = "WP_Filesystem_$method";
|
||||
|
||||
$wp_filesystem = new $method($args);
|
||||
|
@ -685,11 +687,13 @@ function request_filesystem_credentials($form_post, $type = '', $error = false)
|
|||
else
|
||||
unset($credentials['port']);
|
||||
|
||||
if ( defined('FTP_SSH') || (isset($_POST['connection_type']) && 'ssh' == $_POST['connection_type']) )
|
||||
if ( defined('FTP_SSH') || (defined('FS_METHOD') && 'ssh' == FS_METHOD) )
|
||||
$credentials['connection_type'] = 'ssh';
|
||||
else if ( defined('FTP_SSL') || (isset($_POST['connection_type']) && 'ftps' == $_POST['connection_type']) )
|
||||
else if ( defined('FTP_SSL') && 'ftpext' == $type ) //Only the FTP Extension understands SSL
|
||||
$credentials['connection_type'] = 'ftps';
|
||||
else if ( !isset($credentials['connection_type']) || (isset($_POST['connection_type']) && 'ftp' == $_POST['connection_type']) )
|
||||
else if ( !empty($_POST['connection_type']) )
|
||||
$credentials['connection_type'] = $_POST['connection_type'];
|
||||
else if ( !isset($credentials['connection_type']) ) //All else fails (And its not defaulted to something else saved), Default to FTP
|
||||
$credentials['connection_type'] = 'ftp';
|
||||
|
||||
if ( ! $error &&
|
||||
|
@ -750,9 +754,10 @@ jQuery(function($){
|
|||
|
||||
<tr valign="top">
|
||||
<th scope="row"><label for="password"><?php _e('Password') ?></label></th>
|
||||
<td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( defined('FTP_PASS') && !empty($password) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td>
|
||||
<td><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php if ( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /></td>
|
||||
</tr>
|
||||
|
||||
<?php if ( extension_loaded('ssh2') ) : ?>
|
||||
<tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">
|
||||
<th scope="row"><?php _e('Authentication Keys') ?>
|
||||
<div class="key-labels textright">
|
||||
|
@ -762,14 +767,19 @@ jQuery(function($){
|
|||
<td><br /><input name="public_key" type="text" id="public_key" value="<?php echo esc_attr($public_key) ?>"<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
|
||||
<div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Connection Type') ?></th>
|
||||
<td>
|
||||
<fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend>
|
||||
<label><input id="ftp" name="connection_type" type="radio" value="ftp" <?php checked('ftp', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTP') ?></label><br />
|
||||
<label><input id="ftps" name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); if ( defined('FTP_SSH') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTPS (SSL)') ?></label><br />
|
||||
<?php if ( extension_loaded('ssh2') ) { ?><label><input id="ssh" name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('SSH') ?></label><?php } ?>
|
||||
<label><input id="ftp" name="connection_type" type="radio" value="ftp" <?php checked('ftp', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTP') ?></label>
|
||||
<?php if ( 'ftpext' == $type ) : ?>
|
||||
<br /><label><input id="ftps" name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTPS (SSL)') ?></label>
|
||||
<?php endif; ?>
|
||||
<?php if ( extension_loaded('ssh2') ) : ?>
|
||||
<br /><label><input id="ssh" name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('SSH') ?></label>
|
||||
<?php endif; ?>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue