Skip to content

Conversation

@afragen
Copy link
Member

@afragen afragen commented Jan 26, 2023

While working extensively on #57375 in various discussions on that ticket and on Slack it was decided to move forward with PR3909.

PR3909 does not include the needed change to WP_Upgrader::install_package() to take advantage of its new code. This ticket and PR will accomplish that. The plan is to replace copy_dir() in WP_Upgrader::install_package() with move_dir().

This change was tested extensively during the development of #57375

Related: #57375, #57386

Trac ticket: https://core.trac.wordpress.org/ticket/57557

@afragen afragen reopened this Jan 26, 2023
@afragen afragen marked this pull request as ready for review January 26, 2023 03:54
@afragen
Copy link
Member Author

afragen commented Jan 26, 2023

This PR will fail until PR3903 has been committed.

Copy link
Contributor

@costdev costdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Tested this exact change extensively in WSL2 (Ubuntu), Ubuntu (Virtual Cloud Server) and Chassis (VirtualBox 6 and 7). When move_dir() is committed, this should be good to go.

@afragen
Copy link
Member Author

afragen commented Feb 1, 2023

Tests are failing and will fail as move_dir() is not defined in core yet and it's not defined in this PR.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afragen LGTM, once #3909 has been committed.

Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a note to account for whether the working directory ought to be cleared.

During manual testing this is what happens on trunk, ie not this PR:

  • at the start of an update, the upgrade folder is emptied
  • currently updated item is extracted to that folder
  • with clear_working => false the theme/plugin is not deleted from the upgrade folder
  • with clear_working => true the theme/plugin is deleted from the upgrade folder

So when bulk updating a bunch of themes/plugins, after the upgrade process is complete only one folder is retained (per screen shot). I think the purpose of retaining the folder is to allow plugin authors to do something (I don't know what) with the working copy after the end of the update.

The inline change will have little affect as core always clears the working folder but it's best to account for it.

Screen Shot 2023-02-03 at 10 41 38 am

Copy link
Contributor

@costdev costdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@afragen afragen closed this Feb 4, 2023
@afragen
Copy link
Member Author

afragen commented Feb 4, 2023

Merged.

@afragen afragen deleted the move-dir-switch branch February 4, 2023 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants