From af17fc0bb862a98ba1c9611173328210a883f308 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 28 Jul 2015 12:49:21 -0500 Subject: [PATCH] users: Support importing csv from stdin on the cli --- include/cli/modules/user.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/cli/modules/user.php b/include/cli/modules/user.php index 1504aacd2..00dd6af89 100644 --- a/include/cli/modules/user.php +++ b/include/cli/modules/user.php @@ -56,9 +56,9 @@ class UserManager extends Module { // Properly detect Macintosh style line endings ini_set('auto_detect_line_endings', true); - if (!$options['file']) - $this->fail('CSV file to import users from is required!'); - elseif (!($this->stream = fopen($options['file'], 'rb'))) + if (!$options['file'] || $options['file'] == '-') + $options['file'] = 'php://stdin'; + if (!($this->stream = fopen($options['file'], 'rb'))) $this->fail("Unable to open input file [{$options['file']}]"); $extras = array(); -- GitLab