Changeset 11499
- Timestamp:
- 05/31/2009 09:08:03 PM (15 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-upgrader.php
r11450 r11499 721 721 } 722 722 function __construct($args = array()) { 723 $defaults = array( 'url' => '', 'nonce' => '', 'title' => '' );723 $defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false ); 724 724 $this->options = wp_parse_args($args, $defaults); 725 725 } … … 735 735 function request_filesystem_credentials($error = false) { 736 736 $url = $this->options['url']; 737 $context = $this->options['context']; 737 738 if ( !empty($this->options['nonce']) ) 738 739 $url = wp_nonce_url($url, $this->options['nonce']); 739 return request_filesystem_credentials($url, '', $error ); //Possible to bring inline, Leaving as0is for now.740 return request_filesystem_credentials($url, '', $error, $context); //Possible to bring inline, Leaving as is for now. 740 741 } 741 742 -
trunk/wp-admin/includes/file.php
r11495 r11499 584 584 * @return unknown 585 585 */ 586 function WP_Filesystem( $args = false ) {586 function WP_Filesystem( $args = false, $context = false ) { 587 587 global $wp_filesystem; 588 588 589 589 require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); 590 590 591 $method = get_filesystem_method($args );591 $method = get_filesystem_method($args, $context); 592 592 593 593 if ( ! $method ) … … 626 626 * 627 627 * @param unknown_type $args 628 * @return unknown 629 */ 630 function get_filesystem_method($args = array()) { 628 * @param string $context Full path to the directory that is tested for being writable. 629 * @return unknown 630 */ 631 function get_filesystem_method($args = array(), $context = false) { 631 632 $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' 632 633 633 634 if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ 634 $temp_file_name = ABSPATH . '.' . time(); 635 if ( !$context ) 636 $context = WP_CONTENT_DIR; 637 $context = trailingslashit($context); 638 $temp_file_name = $context . '.write-test-' . time(); 635 639 $temp_handle = @fopen($temp_file_name, 'w'); 636 640 if ( $temp_handle ) { … … 658 662 * @return unknown 659 663 */ 660 function request_filesystem_credentials($form_post, $type = '', $error = false ) {661 $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error );664 function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false) { 665 $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error, $context); 662 666 if ( '' !== $req_cred ) 663 667 return $req_cred; 664 668 665 669 if ( empty($type) ) 666 $type = get_filesystem_method( );670 $type = get_filesystem_method(array(), $context); 667 671 668 672 if ( 'direct' == $type ) -
trunk/wp-admin/update-core.php
r11383 r11499 143 143 $url = 'update-core.php?action=do-core-upgrade'; 144 144 $url = wp_nonce_url($url, 'upgrade-core'); 145 if ( false === ($credentials = request_filesystem_credentials($url )) )145 if ( false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH)) ) 146 146 return; 147 147 … … 153 153 154 154 155 if ( ! WP_Filesystem($credentials ) ) {156 request_filesystem_credentials($url, '', true ); //Failed to connect, Error and request again155 if ( ! WP_Filesystem($credentials, ABSPATH) ) { 156 request_filesystem_credentials($url, '', true, ABSPATH); //Failed to connect, Error and request again 157 157 return; 158 158 }
Note: See TracChangeset
for help on using the changeset viewer.