[wp-trac] [WordPress Trac] #57375: Add move_dir() function
WordPress Trac
noreply at wordpress.org
Thu Jan 12 00:18:00 UTC 2023
#57375: Add move_dir() function
----------------------------+--------------------------
Reporter: afragen | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 6.2
Component: Filesystem API | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses: performance
----------------------------+--------------------------
Comment (by SergeyBiryukov):
In [changeset:"55055" 55055]:
{{{
#!CommitTicketReference repository="" revision="55055"
Upgrade/Install: Revert a temporary conditional for testing the Rollbacks
feature project.
The [https://make.wordpress.org/core/2021/02/19/feature-plugin-rollback-
update-failure/ Rollback Update Failure feature project] has been split
into two plugins for testing:
* [https://github.com/afragen/faster-updates Faster Updates] speeds up
plugin or theme updates by moving files rather than copying them, thus
decreasing the memory usage and reducing the chance of timeouts or running
out of disk space during updates.
* [https://wordpress.org/plugins/rollback-update-failure/ Rollback Update
Failure] creates a temporary backup of plugins and themes before updating.
This aims to make the update process more reliable and ensure that if a
plugin or theme update fails, the previous version can be safely restored.
The current priority of the feature project is to test the new
`move_dir()` function, which offers better performance than `copy_dir()`.
Instead of copying a directory in a recursive manner file by file from one
location to another, `move_dir()` uses the `rename()` PHP function to
speed up the process, which is instrumental in updating large plugins
without a delay. If the renaming failed, it falls back to the `copy_dir()`
WP function.
The `move_dir()` function is self-contained in the Faster Updates plugin
and does not require any special hooks in core, so the conditional
previously added to `WP_Upgrader::install_package()` to facilitate testing
is no longer needed and can be removed.
Follow-up to [53578], [54484], [54643].
Props afragen, costdev, peterwilsoncc.
See #56057, #57375, #57386.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57375#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list