Make WordPress Core

Ticket #55069: 0002-class-wp-filesystem-direct-remove-unnecessary-is_dir.patch

File 0002-class-wp-filesystem-direct-remove-unnecessary-is_dir.patch, 991 bytes (added by maxkellermann, 3 years ago)
  • src/wp-admin/includes/class-wp-filesystem-direct.php

    From 9a090a9a197faae36d1b5ef716e8969e8eafef67 Mon Sep 17 00:00:00 2001
    From: Max Kellermann <mk@cm4all.com>
    Date: Fri, 4 Feb 2022 13:55:17 +0100
    Subject: [PATCH 2/5] class-wp-filesystem-direct: remove unnecessary
     is_dir()/is_readable() calls
    
    If either were not true, the dir() call would just fail, which is just
    as good, but it saves two system calls.
    ---
     src/wp-admin/includes/class-wp-filesystem-direct.php | 4 ----
     1 file changed, 4 deletions(-)
    
    diff --git a/src/wp-admin/includes/class-wp-filesystem-direct.php b/src/wp-admin/includes/class-wp-filesystem-direct.php
    index 49a51b0ccd..b4b6e7f499 100644
    a b class WP_Filesystem_Direct extends WP_Filesystem_Base { 
    606606                        $limit_file = false;
    607607                }
    608608
    609                 if ( ! $this->is_dir( $path ) || ! $this->is_readable( $path ) ) {
    610                         return false;
    611                 }
    612 
    613609                $dir = dir( $path );
    614610
    615611                if ( ! $dir ) {