Make WordPress Core

Ticket #58940: 58940.diff

File 58940.diff, 1.7 KB (added by SergeyBiryukov, 2 years ago)
  • src/wp-admin/includes/class-wp-site-health.php

     
    20092009                        'test'        => 'update_temp_backup_writable',
    20102010                );
    20112011
    2012                 if ( ! $wp_filesystem ) {
     2012                if ( ! function_exists( 'WP_Filesystem' ) ) {
    20132013                        require_once ABSPATH . '/wp-admin/includes/file.php';
    2014                         WP_Filesystem();
    20152014                }
    20162015
     2016                ob_start();
     2017                $credentials = request_filesystem_credentials( '' );
     2018                ob_end_clean();
     2019
     2020                if ( false === $credentials || ! WP_Filesystem( $credentials ) ) {
     2021                        $result['status']      = 'critical';
     2022                        $result['label']       = __( 'Could not access filesystem' );
     2023                        $result['description'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' );
     2024                        return $result;
     2025                }
     2026
    20172027                $wp_content = $wp_filesystem->wp_content_dir();
    20182028
    20192029                if ( ! $wp_content ) {
  • src/wp-includes/update.php

     
    11131113function _wp_delete_all_temp_backups() {
    11141114        global $wp_filesystem;
    11151115
    1116         if ( ! $wp_filesystem ) {
     1116        if ( ! function_exists( 'WP_Filesystem' ) ) {
    11171117                require_once ABSPATH . '/wp-admin/includes/file.php';
    1118                 WP_Filesystem();
    11191118        }
    11201119
     1120        ob_start();
     1121        $credentials = request_filesystem_credentials( '' );
     1122        ob_end_clean();
     1123
     1124        if ( false === $credentials || ! WP_Filesystem( $credentials ) ) {
     1125                return new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) );
     1126        }
     1127
    11211128        if ( ! $wp_filesystem->wp_content_dir() ) {
    11221129                return new WP_Error(
    11231130                        'fs_no_content_dir',