fs_connect() fixes. Props dd32. fixes #10541

git-svn-id: https://develop.svn.wordpress.org/trunk@11862 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-08-21 01:36:01 +00:00
parent 3edc03c047
commit 2183989cd8
1 changed files with 22 additions and 14 deletions

View File

@ -81,20 +81,28 @@ class WP_Upgrader {
return new WP_Error('fs_error', $this->strings['fs_error'], $wp_filesystem->errors);
foreach ( (array)$directories as $dir ) {
if ( ABSPATH == $dir && ! $wp_filesystem->abspath() )
return new WP_Error('fs_no_root_dir', $this->strings['fs_no_root_dir']);
elseif ( WP_CONTENT_DIR == $dir && ! $wp_filesystem->wp_content_dir() )
return new WP_Error('fs_no_content_dir', $this->strings['fs_no_content_dir']);
elseif ( WP_PLUGIN_DIR == $dir && ! $wp_filesystem->wp_plugins_dir() )
return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']);
elseif ( WP_CONTENT_DIR . '/themes' == $dir && ! $wp_filesystem->find_folder(WP_CONTENT_DIR . '/themes') )
return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']);
elseif ( ! $wp_filesystem->find_folder($dir) )
return new WP_Error('fs_no_folder', sprintf($this->strings['fs_no_folder'], $dir));
switch ( $dir ) {
case ABSPATH:
if ( ! $wp_filesystem->abspath() )
return new WP_Error('fs_no_root_dir', $this->strings['fs_no_root_dir']);
break;
case WP_CONTENT_DIR:
if ( ! $wp_filesystem->wp_content_dir() )
return new WP_Error('fs_no_content_dir', $this->strings['fs_no_content_dir']);
break;
case WP_PLUGIN_DIR:
if ( ! $wp_filesystem->wp_plugins_dir() )
return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']);
break;
case WP_CONTENT_DIR . '/themes':
if ( ! $wp_filesystem->find_folder(WP_CONTENT_DIR . '/themes') )
return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']);
break;
default:
if ( ! $wp_filesystem->find_folder($dir) )
return new WP_Error('fs_no_folder', sprintf($this->strings['fs_no_folder'], $dir));
break;
}
}
return true;
} //end fs_connect();