X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=bin%2Fcli.class.php;h=dbcc5e9caf01268e28dc77b6e38b980b31863dbb;hb=dcfd8d522ab67d9715d7191cf72148dcce70d42a;hp=5340869a1cae97b5884b674c25b97c59cc3648fa;hpb=c219b4c822b7539da67f5eb9fdcde48b562720ed;p=civicrm-core.git diff --git a/bin/cli.class.php b/bin/cli.class.php index 5340869a1c..dbcc5e9caf 100644 --- a/bin/cli.class.php +++ b/bin/cli.class.php @@ -46,6 +46,7 @@ class civicrm_cli { var $_action = NULL; var $_output = FALSE; var $_joblog = FALSE; + var $_semicolon = FALSE; var $_config; // optional arguments @@ -88,7 +89,7 @@ class civicrm_cli { return TRUE; } else { - trigger_error("cli.php can only be run from command line.", E_USER_ERROR); + die("cli.php can only be run from command line."); } } @@ -185,6 +186,9 @@ class civicrm_cli { elseif ($arg == '-j' || $arg == '--joblog') { $this->_joblog = TRUE; } + elseif ($arg == '-sem' || $arg == '--semicolon') { + $this->_semicolon = TRUE; + } else { foreach ($this->_additional_arguments as $short => $long) { if ($arg == '-' . $short || $arg == '--' . $long) { @@ -265,7 +269,7 @@ class civicrm_cli { $this->_log(ts("Failed to login as %1. Wrong username or password.", array('1' => $this->_user))); return FALSE; } - if (!$cms->loadUser($this->_user)) { + if (($this->_config->userFramework == 'Joomla' && !$cms->loadUser($this->_user, $this->_password)) || !$cms->loadUser($this->_user)) { $this->_log(ts("Failed to login as %1", array('1' => $this->_user))); return FALSE; } @@ -342,7 +346,14 @@ class civicrm_cli_csv_exporter extends civicrm_cli { parent::initialize(); } + /** + * Run the script. + */ public function run() { + if ($this->_semicolon) { + $this->separator = ';'; + } + $out = fopen("php://output", 'w'); fputcsv($out, $this->columns, $this->separator, '"');