Skip to content

Conversation

@afragen
Copy link
Member

@afragen afragen commented Sep 30, 2021

Updates copy_dir() to try a rename() before attempting to copy file by file. On large plugins with many files a file copy will result in a timeout on a slow system. The patch should revert to a file copy if the rename() fails.

I was able to timeout the installation of WooCommerce, Yoast SEO, and MailPoet on the Docker WP test env. With this patch each plugin installs fine.

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


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@afragen afragen changed the title Copy dir Update copy_dir() to initially try rename() instead of file copy Sep 30, 2021
Copy link
Member

@aristath aristath left a comment

Choose a reason for hiding this comment

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

Brillian debugging, thank you!
Wouldn't this change the behaviour of the copy_dir() function completely, making it a move function?
Perhaps we should change

$result = copy_dir( $source, $remote_destination );
to use rename() or $wp_filesystem->move() instead of copy_dir()?

@afragen
Copy link
Member Author

afragen commented Oct 1, 2021

After some discussion with @aristath I think a new PR with a move_dir function and leave copy_dir intact.

Will close this PR once that one up.

@afragen afragen closed this Oct 1, 2021
@afragen
Copy link
Member Author

afragen commented Oct 1, 2021

New PR is at #1727

@afragen afragen deleted the copy-dir branch October 8, 2021 04:24
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.

2 participants