Ticket #7690: wordpress_ssh2_transfer_2.7.x.patch
| File wordpress_ssh2_transfer_2.7.x.patch, 10.5 KB (added by , 18 years ago) |
|---|
-
wp-admin/includes/class-wp-filesystem-base.php
18 18 var $method = ''; 19 19 20 20 function abspath() { 21 // @todo: Add SSH2_BASE 21 22 if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false ) 22 23 return FTP_BASE; 23 24 return $this->find_folder(ABSPATH); 24 25 } 25 26 function wp_content_dir() { 27 // @todo: Add SSH2_CONTENT_DIR 26 28 if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false ) 27 29 return FTP_CONTENT_DIR; 28 30 return $this->find_folder(WP_CONTENT_DIR); 29 31 } 30 32 function wp_plugins_dir() { 33 // @todo: Add SSH2_PLUGIN_DIR 31 34 if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false ) 32 35 return FTP_PLUGIN_DIR; 33 36 return $this->find_folder(WP_PLUGIN_DIR); -
wp-admin/includes/file.php
480 480 unlink($temp_file); 481 481 } 482 482 483 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; 483 if ( ! $method && extension_loaded("ssh2") && (get_option('transfer_protocol') == "ssh2") ) $method = 'ssh2'; 484 if ( ! $method && extension_loaded('ftp') && (get_option('transfer_protocol') == "ftp") ) $method = 'ftpext'; 484 485 if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread 486 485 487 return apply_filters('filesystem_method', $method); 486 488 } 487 489 … … 496 498 if ( 'direct' == $type ) 497 499 return true; 498 500 499 if( ! $credentials = get_option(' ftp_credentials') )501 if( ! $credentials = get_option('transfer_credentials') ) 500 502 $credentials = array(); 501 503 // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option) 502 $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']); 503 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); 504 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']); 505 $credentials['ssl'] = defined('FTP_SSL') ? FTP_SSL : ( isset($_POST['ssl']) ? $_POST['ssl'] : $credentials['ssl']); 504 505 switch ($type) 506 { 507 case 'ftp': { 508 $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']); 509 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); 510 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']); 511 $credentials['ssl'] = defined('FTP_SSL') ? FTP_SSL : ( isset($_POST['ssl']) ? $_POST['ssl'] : $credentials['ssl']); 512 break; 513 } 514 case 'ssh2': { 515 $credentials['hostname'] = defined('SSH2_HOST') ? SSH2_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']); 516 $credentials['username'] = defined('SSH2_USER') ? SSH2_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); 517 $credentials['password'] = defined('SSH2_PASS') ? SSH2_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']); 518 $credentials['ssl'] = ''; // no ssl in ssh2 519 break; 520 } 521 } 522 506 523 524 507 525 if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) { 508 526 $stored_credentials = $credentials; 509 527 unset($stored_credentials['password']); 510 update_option(' ftp_credentials', $stored_credentials);528 update_option('transfer_credentials', $stored_credentials); 511 529 return $credentials; 512 530 } 513 531 $hostname = ''; … … 521 539 ?> 522 540 <form action="<?php echo $form_post ?>" method="post"> 523 541 <div class="wrap"> 524 <h2><?php _e('FTP Connection Information') ?></h2> 525 <p><?php _e('To perform the requested action, FTP connection information is required.') ?></p> 542 <?php $connection_method = strtoupper(get_option('transfer_protocol')); ?> 543 <h2><?php _e($connection_method.' Connection Information') ?></h2> 544 <p><?php _e('To perform the requested action, '.$connection_method.' connection information is required.') ?></p> 526 545 <table class="form-table"> 527 546 <tr valign="top"> 528 547 <th scope="row"><label for="hostname"><?php _e('Hostname:') ?></label></th> 529 <td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname) ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>548 <td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname) ?>"<?php if( defined('FTP_HOST') || defined('SSH2_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td> 530 549 </tr> 531 550 <tr valign="top"> 532 551 <th scope="row"><label for="username"><?php _e('Username:') ?></label></th> 533 <td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>552 <td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') || defined('SSH2_USER') ) echo ' disabled="disabled"' ?> size="40" /></td> 534 553 </tr> 535 554 <tr valign="top"> 536 555 <th scope="row"><label for="password"><?php _e('Password:') ?></label></th> 537 <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>556 <td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') || defined('SSH2_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( (defined('FTP_PASS') || defined('SSH2_PASS')) && !empty($password) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td> 538 557 </tr> 558 <?php if (get_option('transfer_protocol') == "ftp") { ?> 539 559 <tr valign="top"> 540 560 <th scope="row"><label for="ssl"><?php _e('Use SSL:') ?></label></th> 541 561 <td> … … 549 569 </select> 550 570 </td> 551 571 </tr> 572 <?php } ?> 552 573 </table> 553 574 <p class="submit"> 554 575 <input type="submit" name="submit" value="<?php _e('Proceed'); ?>" /> -
wp-admin/includes/update-core.php
188 188 $maintenance_file = $to . '.maintenance'; 189 189 $wp_filesystem->delete($maintenance_file); 190 190 $wp_filesystem->put_contents($maintenance_file, $maintenance_string, 0644); 191 191 192 192 // Copy new versions of WP files into place. 193 193 $result = copy_dir($from . '/wordpress', $to); 194 194 if ( is_wp_error($result) ) { -
wp-admin/includes/upgrade.php
764 764 function upgrade_270() { 765 765 if ( $wp_current_db_version < 8530 ) 766 766 populate_roles_270(); 767 768 769 // @todo: change the setting... ftp_credentials to transfer_credentials in the options table. Then set it to "ftp" as default. 770 767 771 } 768 772 769 773 -
wp-admin/options-misc.php
21 21 <form method="post" action="options.php"> 22 22 <input type='hidden' name='option_page' value='misc' /> 23 23 <?php wp_nonce_field('misc-options') ?> 24 <h3><?php _e('Transfer/Upgrading Settings'); ?></h3> 25 <table class="form-table"> 26 <?php if (extension_loaded("ssh2")) { ?> 27 <tr valign="top"> 28 <th scope="row"><?php _e('Select the file transfer type your like to use') ?></th> 29 <td><fieldset><legend class="hidden"><?php _e('Select the file transfer type your like to use') ?></legend> 30 <?php 31 $transfer_protocols = array('ftp' => 'FTP', 'ssh2' => 'SSH2'); 32 foreach ($transfer_protocols as $type => $name) { ?> 33 <input type="radio" name="transfer_protocol" id="transfer_protocol_<?php echo $type; ?>" value="<?php echo $type; ?>"<?php echo (get_option('transfer_protocol') == $type ? ' checked="checked"' : ''); ?> /> 34 <label for="transfer_protocol_<?php echo $type; ?>"><?php _e($name); ?></label> 35 <?php 36 } 37 ?> 38 </fieldset></td> 39 </tr> 40 <?php } ?> 41 <!-- @todo: Add option for what the message will be when updating the core of the wordpress. --> 42 </table> 24 43 <h3><?php _e('Uploading'); ?></h3> 25 44 <table class="form-table"> 26 45 <tr valign="top"> -
wp-admin/options.php
24 24 $whitelist_options = array( 25 25 'general' => array('blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'comment_registration', 'default_role'), 26 26 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating' ), 27 'misc' => array( ' hack_file', 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'large_size_w', 'large_size_h' ),27 'misc' => array( 'transfer_protocol', 'hack_file', 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'large_size_w', 'large_size_h' ), 28 28 'privacy' => array( 'blog_public' ), 29 29 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'gzipcompression', 'show_on_front', 'page_on_front', 'page_for_posts' ), 30 30 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ),