Skip to content

Commit b4656a3

Browse files
committed
Add debugging messages for renames
1 parent 8981c97 commit b4656a3

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/Core_Command.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,15 +1403,17 @@ private function cleanup_extra_files( $version_from, $version_to, $locale, $inse
14031403
// We are now left with only the files that are similar from old to new except for their case.
14041404

14051405
$old_basename = basename( $old_realpath );
1406-
$expected_basename = basename( $new_filepaths[ $lowercase_old_filepath_to_check ] );
1407-
$new_realpath = realpath( ABSPATH . $new_filepaths[ $lowercase_old_filepath_to_check ] );
1406+
$new_filepath = $new_filepaths[ $lowercase_old_filepath_to_check ];
1407+
$expected_basename = basename( $new_filepath );
1408+
$new_realpath = realpath( ABSPATH . $new_filepath );
14081409
$new_basename = basename( $new_realpath );
14091410

14101411
// On Windows or Unix with only the incorrectly cased file.
14111412
if ( $new_basename !== $expected_basename ) {
1412-
// Rename the file.
1413+
WP_CLI::debug( "Renaming file '{$old_filepath_to_check}' => '{$new_filepath}'", 'core' );
1414+
14131415
rename( ABSPATH . $old_filepath_to_check, ABSPATH . $old_filepath_to_check . '.tmp' );
1414-
rename( ABSPATH . $old_filepath_to_check . '.tmp', ABSPATH . $new_filepaths[ $lowercase_old_filepath_to_check ] );
1416+
rename( ABSPATH . $old_filepath_to_check . '.tmp', ABSPATH . $new_filepath );
14151417

14161418
continue;
14171419
}
@@ -1422,7 +1424,8 @@ private function cleanup_extra_files( $version_from, $version_to, $locale, $inse
14221424
if ( fileinode( $old_realpath ) === fileinode( $new_realpath ) ) {
14231425
// Check deeper because even realpath or glob might not return the actual case.
14241426
if ( ! in_array( $expected_basename, scandir( dirname( $new_realpath ) ), true ) ) {
1425-
// Rename the file.
1427+
WP_CLI::debug( "Renaming file '{$old_filepath_to_check}' => '{$expected}'", 'core' );
1428+
14261429
rename( ABSPATH . $old_filepath_to_check, ABSPATH . $old_filepath_to_check . '.tmp' );
14271430
rename( ABSPATH . $old_filepath_to_check . '.tmp', ABSPATH . $expected );
14281431
}

0 commit comments

Comments
 (0)