OSDN Git Service

Check for existing file when trying to import CSV
authormpeshev <mario@peshev.net>
Thu, 8 Aug 2013 14:19:45 +0000 (17:19 +0300)
committermpeshev <mario@peshev.net>
Thu, 8 Aug 2013 14:19:45 +0000 (17:19 +0300)
php/commands/user.php

index 269a38d..d7a8a0c 100644 (file)
@@ -582,6 +582,10 @@ class User_Command extends \WP_CLI\CommandWithDBObject {
                $blog_users = get_users();
 
                $filename = $args[0];
+               
+               if (! file_exists( $filename ) ) {
+                       WP_CLI::warning( "{$new_user['user_login']} has an invalid role" );
+               }
 
                foreach ( new \WP_CLI\Iterators\CSV( $filename ) as $i => $new_user ) {
                        $defaults = array(