Make WordPress Core


Ignore:
Timestamp:
12/07/2021 04:49:22 PM (3 years ago)
Author:
hellofromTonya
Message:

Upgrade/Install: Fix moving plugins folder in WP_Upgrader:: move_to_temp_backup_dir().

[51815] introduced the creation of a temporary backup of plugins before updating.

The move() (and later, move_dir()) call) uses a $src parameter.
For Hello Dolly, this is <path>/wp-contents/plugins/. (note the period at the end).

For users on Linux and Mac, this doesn't appear to cause any problems.
However, on Windows, the move causes the plugins folder to be moved which then causes a failure when attempting to call mkdir().

This commit skips any plugin whose slug is '.' as this slug results in the $src value ending in a period.

Follow-up to [51815].

Props costdev, boniu91, hellofromTonya.
Fixes #54543.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-upgrader.php

    r52289 r52337  
    10261026        }
    10271027
     1028        /**
     1029         * Skip any plugin that has "." as its slug.
     1030         * A slug of "." will result in a `$src` value ending in a period.
     1031         *
     1032         * On Windows, this will cause the 'plugins' folder to be moved,
     1033         * and will cause a failure when attempting to call `mkdir()`.
     1034         */
     1035        if ( '.' === $args['slug'] ) {
     1036            return false;
     1037        }
     1038
    10281039        $dest_dir = $wp_filesystem->wp_content_dir() . 'upgrade/temp-backup/';
    10291040        // Create the temp-backup directory if it doesn't exist.
Note: See TracChangeset for help on using the changeset viewer.