| 1 | Index: src/wp-admin/includes/file.php
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | --- src/wp-admin/includes/file.php (revision 60000)
|
|---|
| 4 | +++ src/wp-admin/includes/file.php (working copy)
|
|---|
| 5 | @@
|
|---|
| 6 | function request_filesystem_credentials( $form_post, $type = '', $error = false, $context = false, $extra_fields = null ) {
|
|---|
| 7 | require_once ABSPATH . 'wp-admin/includes/template.php';
|
|---|
| 8 |
|
|---|
| 9 | if ( empty( $type ) ) {
|
|---|
| 10 | $type = get_filesystem_method( array(), $context );
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | - // Check if we can write to the context directory.
|
|---|
| 14 | - if ( 'direct' === $type && ! is_writable( $context ) ) {
|
|---|
| 15 | - $error = true;
|
|---|
| 16 | - }
|
|---|
| 17 | + // Consistent permissions check: ensure context is valid and writable for direct method.
|
|---|
| 18 | + if ( 'direct' === $type ) {
|
|---|
| 19 | + if ( empty( $context ) || ! file_exists( $context ) || ! is_dir( $context ) || ! is_writable( $context ) ) {
|
|---|
| 20 | + $error = true;
|
|---|
| 21 | + }
|
|---|
| 22 | + }
|
|---|
| 23 |
|
|---|
| 24 | $credentials = array();
|
|---|
| 25 |
|
|---|
| 26 | if ( $error ) {
|
|---|
| 27 | // Prompt for credentials.
|
|---|
| 28 | wp_admin_css( 'install', true );
|
|---|