Upgrade/Install: Send language pack updates to `copy_dir()`.
If the `clear_working` flag in `WP_Upgrader::install_package()` is false, the source should not be removed, so `copy_dir()` should be used instead. Partial updates, like language packs, may want to retain the destination. If the destination exists or has contents, this may be a partial update, and the destination should not be removed, so `copy_dir()` should be used instead. Follow-up to [55204], [55219], [55220], [55223], [55226]. Props afragen, costdev, swissspidy. See #57557. Built from https://develop.svn.wordpress.org/trunk@55229 git-svn-id: http://core.svn.wordpress.org/trunk@54762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5c1f181c0a
commit
ba4ed5f86c
|
@ -588,15 +588,19 @@ class WP_Upgrader {
|
|||
}
|
||||
|
||||
/*
|
||||
* Partial updates may want to retain the destination.
|
||||
* move_dir() returns a WP_Error when the destination exists,
|
||||
* so copy_dir() should be used.
|
||||
* If 'clear_working' is false, the source should not be removed, so use copy_dir() instead.
|
||||
*
|
||||
* If 'clear_working' is false, the source shouldn't be removed.
|
||||
* After move_dir() runs, the source will no longer exist.
|
||||
* Therefore, copy_dir() should be used.
|
||||
* Partial updates, like language packs, may want to retain the destination.
|
||||
* If the destination exists or has contents, this may be a partial update,
|
||||
* and the destination should not be removed, so use copy_dir() instead.
|
||||
*/
|
||||
if ( $clear_destination && $args['clear_working'] ) {
|
||||
if ( $args['clear_working']
|
||||
&& (
|
||||
// Destination does not exist or has no contents.
|
||||
! $wp_filesystem->exists( $remote_destination )
|
||||
|| empty( $wp_filesystem->dirlist( $remote_destination ) )
|
||||
)
|
||||
) {
|
||||
$result = move_dir( $source, $remote_destination, true );
|
||||
} else {
|
||||
// Create destination if needed.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.2-alpha-55228';
|
||||
$wp_version = '6.2-alpha-55229';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue