Make WordPress Core

Changes between Version 3 and Version 4 of Ticket #33058, comment 19


Ignore:
Timestamp:
03/14/2023 12:01:53 AM (12 months ago)
Author:
costdev
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33058, comment 19

    v3 v4  
    22
    33Some thoughts:
    4 - The filesystem classes have a `::cwd()` method that returns the CWD (via `ftp_pwd()` and such). I'm not sure why someone would want to do an exists on an empty string as opposed to the better (IMO) `::exists( ::cwd() )`, except for the specific reason that FTP checks the working directory as a ''sort of'' "quirk".
     4- The filesystem classes have a `::cwd()` method that returns the CWD (via `ftp_pwd()` and such). I'm not sure why someone would want to do an exists on an empty string as opposed to the better (IMO) `::exists( ::cwd() )`, except for the specific reason that FTP checks the working directory as a ''sort of'' "quirk". It certainly wouldn't be a portable approach to use `::exists( '' )` if a site didn't use an FTP filesystem.
    55- Let's say I'm going to delete something. I'm going to check `if ( ::exists( $possible_empty_string ) )`. If that returns `true`, I'm going to delete it. That means potentially deleting the current working directory if I didn't realise I was passing `''`. Instead, I'd prefer a situation where if I run `if ( ::exists( $possible_empty_string ) )`, I get a "false" `false`, and when trying to create that directory, get a warning that `/your/current/working/directory/` already exists, so I know I need to check something.
    66- The `direct` filesystem is by far the most used filesystem. For consistency, the other classes should ''generally'' aim to mimic its behaviour, rather than the other way around.