Make WordPress Core

Changeset 54712

Timestamp:
10/28/2022 03:16:29 PM (22 months ago)
Author:
antpb
Message:

Media: Reverts get_attached_file() changes for normalized Windows paths.

Based on feedback from network storage configurations there was a noticed slowdown due to the usage of the path_join() function. This needs more time to find a workaround.

Follow-up to [53934].
Props mreishus, SergeyBiryukov, desrosj, mikeschroder.
Reverts [53934].
See #56924.

Location:
trunk
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r54663 r54712  
    20802080 *
    20812081 * @since 2.5.0
    2082  * @since 6.1.0 Allows normalized Windows paths (forward slashes).
    20832082 *
    20842083 * @param string $path File path.
     
    21082107    // Windows allows absolute paths like this.
    21092108    if ( preg_match( '#^[a-zA-Z]:\\\\#', $path ) ) {
    2110         return true;
    2111     }
    2112 
    2113     // Normalized Windows paths for local filesystem and network shares (forward slashes).
    2114     if ( preg_match( '#(^[a-zA-Z]+:/|^//[\w!@\#\$%\^\(\)\-\'{}\.~]{1,15})#', $path ) ) {
    21152109        return true;
    21162110    }
  • trunk/src/wp-includes/post.php

    r54524 r54712  
    725725
    726726    // If the file is relative, prepend upload dir.
    727     if ( $file ) {
     727    if ( $file ) {
    728728        $uploads = wp_get_upload_dir();
    729 
    730729        if ( false === $uploads['error'] ) {
    731             $file = path_join( $uploads['basedir'], $file );
     730            $file = ;
    732731        }
    733732    }
  • trunk/tests/phpunit/tests/functions.php

    r54509 r54712  
    106106            'C:\\WINDOWS',
    107107            '\\\\sambashare\\foo',
    108             'c:/',
    109             'c://',
    110             '//',
    111             'c:/FOO',
    112             '//FOO',
    113             'C:/WWW/Sites/demo/htdocs/wordpress/wp-content/uploads/2016/03/example.jpg',
    114             '//ComputerName/ShareName/SubfolderName/example.txt',
    115108        );
    116109        foreach ( $absolute_paths as $path ) {
     
    127120            '../',
    128121            '../foo.bar',
    129             'foo.bar',
    130122            'foo/bar',
    131123            'foo',
    132124            'FOO',
    133125            '..\\WINDOWS',
    134             '..//WINDOWS',
    135             'c:',
    136             'C:',
    137126        );
    138127        foreach ( $relative_paths as $path ) {
Note: See TracChangeset for help on using the changeset viewer.