[wp-trac] [WordPress Trac] #57375: Add move_dir() function
WordPress Trac
noreply at wordpress.org
Sat Feb 4 03:23:14 UTC 2023
#57375: Add move_dir() function
---------------------------------------------+-----------------------------
Reporter: afragen | Owner: SergeyBiryukov
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.2
Component: Filesystem API | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests commit | Focuses: performance
---------------------------------------------+-----------------------------
Comment (by azaozz):
Replying to [comment:78 SergeyBiryukov]:
> Looking at [55219], should `$wp_filesystem->exists( $to )` be saved to a
variable...
Yep, makes sense. The two conditionals can also be wrapped in the
`$wp_filesystem->exists( $to )`. Something like:
{{{
if ( $wp_filesystem->exists( $to ) ) {
if ( ! $overwrite ) {
return new WP_Error( ....
} elseif ( ! $wp_filesystem->delete( $to, true ) ) {
return new WP_Error( ....
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57375#comment:80>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list