Skip to content

Commit 6b30e73

Browse files
Copilotswissspidy
andcommitted
Clean up code style - remove trailing whitespace and simplify logic
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 0d1bfb3 commit 6b30e73

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Core_Command.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,15 +1708,15 @@ private function get_old_files_list() {
17081708
*/
17091709
private function remove_old_files_from_list( $files ) {
17101710
$count = 0;
1711-
1711+
17121712
// Cache ABSPATH realpath for performance
17131713
$abspath_realpath = realpath( ABSPATH );
17141714
if ( false === $abspath_realpath ) {
17151715
WP_CLI::debug( 'Failed to resolve ABSPATH realpath', 'core' );
17161716
return $count;
17171717
}
17181718
$abspath_realpath_trailing = trailingslashit( $abspath_realpath );
1719-
1719+
17201720
foreach ( $files as $file ) {
17211721
// wp-content should be considered user data
17221722
if ( 0 === stripos( $file, 'wp-content' ) ) {
@@ -1727,17 +1727,17 @@ private function remove_old_files_from_list( $files ) {
17271727

17281728
// Validate the path is within ABSPATH
17291729
$file_realpath = realpath( $file_path );
1730-
if ( false !== $file_realpath ) {
1731-
if ( 0 !== strpos( $file_realpath, $abspath_realpath_trailing ) ) {
1732-
WP_CLI::debug( "Skipping file outside of ABSPATH: {$file}", 'core' );
1733-
continue;
1734-
}
1735-
} else {
1730+
if ( false === $file_realpath ) {
17361731
// Skip files with invalid paths
17371732
WP_CLI::debug( "Skipping file with invalid path: {$file}", 'core' );
17381733
continue;
17391734
}
17401735

1736+
if ( 0 !== strpos( $file_realpath, $abspath_realpath_trailing ) ) {
1737+
WP_CLI::debug( "Skipping file outside of ABSPATH: {$file}", 'core' );
1738+
continue;
1739+
}
1740+
17411741
// Handle both files and directories
17421742
if ( file_exists( $file_path ) ) {
17431743
if ( is_dir( $file_path ) ) {

0 commit comments

Comments
 (0)