Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #54582, comment 2


Ignore:
Timestamp:
12/05/2021 11:15:05 PM (5 years ago)
Author:
pbiron

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #54582, comment 2

    initial v1  
    1313        touch( $lower_case_filename );
    1414
    15         $mixed_case_stat = stat( $mixed_case_filename );
    16         $lower_case_stat = stat( $lower_case_filename );
    17 
    18         // Compare the Inodes returned by the 2 stat calls: if their the same, then filesystem is case-insensitive.
    19         $filesystem_case_insensitive = $mixed_case_stat['ino'] === $lower_case_stat['ino'];
     15        // Compare the Inodes: if they are the same, then filesystem is case-insensitive.
     16        $filesystem_case_insensitive = fileinode( $mixed_case_filename ) === fileinode( $lower_case_filename );
    2017
    2118        unlink( $mixed_case_filename );
    … …  
    2825}}}
    2926
    30 It seems to work as expected, but needs some error checking added (e.g., test that `tempnam()` and `stat()` succeed).  Not yet sure what to do if those fail, i.e., what should it return in that case.
     27It seems to work as expected, but needs some error checking added (e.g., test that `tempnam()` and `fileinode()` succeed).  Not yet sure what to do if those fail, i.e., what should it return in that case.
    3128
    3229My thought with comparing the `Inodes` is that is more foolproof than doing something like a `glob()` and counting the number of results returned...but I could certainly overthinking it.  Would love feedback on that.