get_core_checksums example

WP_Filesystem();

        if ( 'direct' !== $wp_filesystem->method ) {
            return false;
        }

        // Make sure the `get_core_checksums()` function is available during our REST API call.         if ( ! function_exists( 'get_core_checksums' ) ) {
            require_once ABSPATH . 'wp-admin/includes/update.php';
        }

        $checksums = get_core_checksums( $wp_version, 'en_US' );
        $dev       = ( str_contains( $wp_version, '-' ) );
        // Get the last stable version's files and test against that.         if ( ! $checksums && $dev ) {
            $checksums = get_core_checksums( (float) $wp_version - 0.1, 'en_US' );
        }

        // There aren't always checksums for development releases, so just skip the test if we still can't find any.         if ( ! $checksums && $dev ) {
            return false;
        }

        

    $skip              = array( 'wp-content', 'wp-includes/version.php' );
    $check_is_writable = array();

    // Check to see which files don't really need updating - only available for 3.7 and higher.     if ( function_exists( 'get_core_checksums' ) ) {
        // Find the local version of the working directory.         $working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro;

        $checksums = get_core_checksums( $wp_versionisset( $wp_local_package ) ? $wp_local_package : 'en_US' );

        if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) {
            $checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2.         }

        if ( is_array( $checksums ) ) {
            foreach ( $checksums as $file => $checksum ) {
                /* * Note: str_starts_with() is not used here, as this file is included * when updating from older WordPress versions, in which case * the polyfills from wp-includes/compat.php may not be available. */

    public function check_files() {
        global $wp_version$wp_local_package;

        $checksums = get_core_checksums( $wp_versionisset( $wp_local_package ) ? $wp_local_package : 'en_US' );

        if ( ! is_array( $checksums ) ) {
            return false;
        }

        foreach ( $checksums as $file => $checksum ) {
            // Skip files which get updated.             if ( str_starts_with( $file, 'wp-content' ) ) {
                continue;
            }
            if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum ) {
                
Home | Imprint | This part of the site doesn't use cookies.