11<?php
22
33use WP_CLI \Utils ;
4+ use WP_CLI \Path ;
45
56/**
67 * Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
@@ -389,7 +390,7 @@ public function import( $args, $assoc_args = array() ) {
389390 } else {
390391 $ tempfile = $ this ->make_copy ( $ file );
391392 }
392- $ name = Utils \ basename ( $ file );
393+ $ name = Path:: basename ( $ file );
393394
394395 if ( Utils \get_flag_value ( $ assoc_args , 'preserve-filetime ' ) ) {
395396 $ file_time = @filemtime ( $ file );
@@ -407,7 +408,7 @@ public function import( $args, $assoc_args = array() ) {
407408 ++$ errors ;
408409 continue ;
409410 }
410- $ name = (string ) strtok ( Utils \ basename ( $ file ), '? ' );
411+ $ name = (string ) strtok ( Path:: basename ( $ file ), '? ' );
411412 }
412413
413414 if ( ! empty ( $ assoc_args ['file_name ' ] ) ) {
@@ -453,7 +454,7 @@ public function import( $args, $assoc_args = array() ) {
453454 }
454455
455456 if ( empty ( $ post_array ['post_title ' ] ) ) {
456- $ post_array ['post_title ' ] = preg_replace ( '/\.[^.]+$/ ' , '' , Utils \ basename ( $ file ) );
457+ $ post_array ['post_title ' ] = preg_replace ( '/\.[^.]+$/ ' , '' , Path:: basename ( $ file ) );
457458 }
458459
459460 if ( Utils \get_flag_value ( $ assoc_args , 'skip-copy ' ) ) {
@@ -684,7 +685,7 @@ private function gcd( $num1, $num2 ) {
684685 */
685686 private function make_copy ( $ path ) {
686687 $ dir = get_temp_dir ();
687- $ filename = Utils \ basename ( $ path );
688+ $ filename = Path:: basename ( $ path );
688689 if ( empty ( $ filename ) ) {
689690 $ filename = (string ) time ();
690691 }
0 commit comments