| 1 | Index: wp-admin/includes/class-wp-upgrader.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/class-wp-upgrader.php (revision 11817) |
|---|
| 4 | +++ wp-admin/includes/class-wp-upgrader.php (working copy) |
|---|
| 5 | @@ -81,20 +81,28 @@ |
|---|
| 6 | return new WP_Error('fs_error', $this->strings['fs_error'], $wp_filesystem->errors); |
|---|
| 7 | |
|---|
| 8 | foreach ( (array)$directories as $dir ) { |
|---|
| 9 | - if ( ABSPATH == $dir && ! $wp_filesystem->abspath() ) |
|---|
| 10 | - return new WP_Error('fs_no_root_dir', $this->strings['fs_no_root_dir']); |
|---|
| 11 | - |
|---|
| 12 | - elseif ( WP_CONTENT_DIR == $dir && ! $wp_filesystem->wp_content_dir() ) |
|---|
| 13 | - return new WP_Error('fs_no_content_dir', $this->strings['fs_no_content_dir']); |
|---|
| 14 | - |
|---|
| 15 | - elseif ( WP_PLUGIN_DIR == $dir && ! $wp_filesystem->wp_plugins_dir() ) |
|---|
| 16 | - return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']); |
|---|
| 17 | - |
|---|
| 18 | - elseif ( WP_CONTENT_DIR . '/themes' == $dir && ! $wp_filesystem->find_folder(WP_CONTENT_DIR . '/themes') ) |
|---|
| 19 | - return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']); |
|---|
| 20 | - |
|---|
| 21 | - elseif ( ! $wp_filesystem->find_folder($dir) ) |
|---|
| 22 | - return new WP_Error('fs_no_folder', sprintf($strings['fs_no_folder'], $dir)); |
|---|
| 23 | + switch ( $dir ) { |
|---|
| 24 | + case ABSPATH: |
|---|
| 25 | + if ( ! $wp_filesystem->abspath() ) |
|---|
| 26 | + return new WP_Error('fs_no_root_dir', $this->strings['fs_no_root_dir']); |
|---|
| 27 | + break; |
|---|
| 28 | + case WP_CONTENT_DIR: |
|---|
| 29 | + if ( ! $wp_filesystem->wp_content_dir() ) |
|---|
| 30 | + return new WP_Error('fs_no_content_dir', $this->strings['fs_no_content_dir']); |
|---|
| 31 | + break; |
|---|
| 32 | + case WP_PLUGIN_DIR: |
|---|
| 33 | + if ( ! $wp_filesystem->wp_plugins_dir() ) |
|---|
| 34 | + return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']); |
|---|
| 35 | + break; |
|---|
| 36 | + case WP_CONTENT_DIR . '/themes': |
|---|
| 37 | + if ( ! $wp_filesystem->find_folder(WP_CONTENT_DIR . '/themes') ) |
|---|
| 38 | + return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']); |
|---|
| 39 | + break; |
|---|
| 40 | + default: |
|---|
| 41 | + if ( ! $wp_filesystem->find_folder($dir) ) |
|---|
| 42 | + return new WP_Error('fs_no_folder', sprintf($this->strings['fs_no_folder'], $dir)); |
|---|
| 43 | + break; |
|---|
| 44 | + } |
|---|
| 45 | } |
|---|
| 46 | return true; |
|---|
| 47 | } //end fs_connect(); |
|---|