Background Updates: Fix a PHP Fatal error which could be encountered on some systems when using FTP. Fixes #25817 for trunk.

Built from https://develop.svn.wordpress.org/trunk@26148


git-svn-id: http://core.svn.wordpress.org/trunk@26059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2013-11-14 02:02:09 +00:00
parent f665c7eeb1
commit 02841470a1

View File

@ -1334,8 +1334,9 @@ class Core_Upgrader extends WP_Upgrader {
return new WP_Error('up_to_date', $this->strings['up_to_date']); return new WP_Error('up_to_date', $this->strings['up_to_date']);
$res = $this->fs_connect( array(ABSPATH, WP_CONTENT_DIR) ); $res = $this->fs_connect( array(ABSPATH, WP_CONTENT_DIR) );
if ( is_wp_error($res) ) if ( ! $res || is_wp_error( $res ) ) {
return $res; return $res;
}
$wp_dir = trailingslashit($wp_filesystem->abspath()); $wp_dir = trailingslashit($wp_filesystem->abspath());
@ -1899,6 +1900,11 @@ class WP_Automatic_Updater {
'attempt_rollback' => true, /* only available for core updates */ 'attempt_rollback' => true, /* only available for core updates */
) ); ) );
// if the filesystem is unavailable, false is returned.
if ( false === $upgrade_result ) {
$upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) );
}
// Core doesn't output this, so lets append it so we don't get confused // Core doesn't output this, so lets append it so we don't get confused
if ( 'core' == $type ) { if ( 'core' == $type ) {
if ( is_wp_error( $upgrade_result ) ) { if ( is_wp_error( $upgrade_result ) ) {