44use WP_CLI \Extractor ;
55use WP_CLI \Iterators \Table as TableIterator ;
66use WP_CLI \Utils ;
7+ use WP_CLI \Path ;
78use WP_CLI \Formatter ;
89use WP_CLI \Loggers ;
910use WP_CLI \WpOrgApi ;
@@ -714,8 +715,8 @@ private function set_server_url_vars( $url ) {
714715 $ _SERVER ['SCRIPT_NAME ' ] = $ path ;
715716
716717 // Set SCRIPT_FILENAME to the actual WordPress index.php if available.
717- if ( file_exists ( Utils \ trailingslashit ( ABSPATH ) . 'index.php ' ) ) {
718- $ _SERVER ['SCRIPT_FILENAME ' ] = Utils \ trailingslashit ( ABSPATH ) . 'index.php ' ;
718+ if ( file_exists ( Path:: trailingslashit ( ABSPATH ) . 'index.php ' ) ) {
719+ $ _SERVER ['SCRIPT_FILENAME ' ] = Path:: trailingslashit ( ABSPATH ) . 'index.php ' ;
719720 }
720721 }
721722
@@ -1074,7 +1075,7 @@ private static function get_wp_details( $abspath = ABSPATH ) {
10741075 * Gets the template path based on installation type.
10751076 */
10761077 private static function get_template_path ( $ template ) {
1077- $ command_root = Utils \phar_safe_path ( dirname ( __DIR__ ) );
1078+ $ command_root = Path:: phar_safe ( dirname ( __DIR__ ) );
10781079 $ template_path = "{$ command_root }/templates/ {$ template }" ;
10791080
10801081 if ( ! file_exists ( $ template_path ) ) {
@@ -2089,7 +2090,7 @@ private function remove_old_files_from_list( $files ) {
20892090 WP_CLI ::debug ( 'Failed to resolve ABSPATH realpath ' , 'core ' );
20902091 return $ count ;
20912092 }
2092- $ abspath_realpath_trailing = Utils \ trailingslashit ( $ abspath_realpath );
2093+ $ abspath_realpath_trailing = Path:: trailingslashit ( $ abspath_realpath );
20932094
20942095 foreach ( $ files as $ file ) {
20952096 $ file_path = ABSPATH . $ file ;
@@ -2103,7 +2104,7 @@ private function remove_old_files_from_list( $files ) {
21032104 if ( is_link ( $ file_path ) ) {
21042105 $ normalized_path = realpath ( dirname ( $ file_path ) );
21052106 if ( false === $ normalized_path
2106- || 0 !== strpos ( Utils \ trailingslashit ( $ normalized_path ), $ abspath_realpath_trailing )
2107+ || 0 !== strpos ( Path:: trailingslashit ( $ normalized_path ), $ abspath_realpath_trailing )
21072108 ) {
21082109 WP_CLI ::debug ( "Skipping symbolic link outside of ABSPATH: {$ file }" , 'core ' );
21092110 continue ;
@@ -2119,7 +2120,7 @@ private function remove_old_files_from_list( $files ) {
21192120
21202121 // Regular files/directories: validate real path is within ABSPATH.
21212122 $ file_realpath = realpath ( $ file_path );
2122- if ( false === $ file_realpath || 0 !== strpos ( Utils \ trailingslashit ( $ file_realpath ), $ abspath_realpath_trailing ) ) {
2123+ if ( false === $ file_realpath || 0 !== strpos ( Path:: trailingslashit ( $ file_realpath ), $ abspath_realpath_trailing ) ) {
21232124 WP_CLI ::debug ( "Skipping file outside of ABSPATH: {$ file }" , 'core ' );
21242125 continue ;
21252126 }
@@ -2155,7 +2156,7 @@ private function remove_directory( $dir, $abspath_realpath_trailing ) {
21552156 WP_CLI ::debug ( "Failed to resolve realpath for directory: {$ dir }" , 'core ' );
21562157 return false ;
21572158 }
2158- if ( 0 !== strpos ( Utils \ trailingslashit ( $ dir_realpath ), $ abspath_realpath_trailing ) ) {
2159+ if ( 0 !== strpos ( Path:: trailingslashit ( $ dir_realpath ), $ abspath_realpath_trailing ) ) {
21592160 WP_CLI ::debug ( "Attempted to remove directory outside of ABSPATH: {$ dir_realpath }" , 'core ' );
21602161 return false ;
21612162 }
0 commit comments