<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.7 |
+ | CiviCRM version 5 |
+--------------------------------------------------------------------+
| Copyright Tech To The People http:tttp.eu (c) 2008 |
+--------------------------------------------------------------------+
*/
class civicrm_cli {
// required values that must be passed
- // via the command line
- var $_required_arguments = array('action', 'entity');
- var $_additional_arguments = array();
- var $_entity = NULL;
- var $_action = NULL;
- var $_output = FALSE;
- var $_joblog = FALSE;
- var $_semicolon = FALSE;
- var $_config;
-
- // optional arguments
- var $_site = 'localhost';
- var $_user = NULL;
- var $_password = NULL;
+ /**
+ * via the command line
+ * @var array
+ */
+ public $_required_arguments = array('action', 'entity');
+ public $_additional_arguments = array();
+ public $_entity = NULL;
+ public $_action = NULL;
+ public $_output = FALSE;
+ public $_joblog = FALSE;
+ public $_semicolon = FALSE;
+ public $_config;
+
+ /**
+ * optional arguments
+ * @var string
+ */
+ public $_site = 'localhost';
+ public $_user = NULL;
+ public $_password = NULL;
// all other arguments populate the parameters
- // array that is passed to civicrm_api
- var $_params = array('version' => 3);
+ /**
+ * array that is passed to civicrm_api
+ * @var array
+ */
+ public $_params = array('version' => 3);
- var $_errors = array();
+ public $_errors = array();
/**
* @return bool
public function callApi() {
require_once 'api/api.php';
+ CRM_Core_Config::setPermitCacheFlushMode(FALSE);
// CRM-9822 -'execute' action always goes thru Job api and always writes to log
if ($this->_action != 'execute' && $this->_joblog) {
require_once 'CRM/Core/JobManager.php';
$this->_params['auth'] = FALSE;
$result = civicrm_api($this->_entity, $this->_action, $this->_params);
}
+ CRM_Core_Config::setPermitCacheFlushMode(TRUE);
+ CRM_Contact_BAO_Contact_Utils::clearContactCaches();
if (!empty($result['is_error'])) {
$this->_log($result['error_message']);
// of this script
array_shift($args);
- while (list($k, $arg) = each($args)) {
+ foreach ($args as $k => $arg) {
// sanitize all user input
$arg = $this->_sanitize($arg);
* the database in a csv file format.
*/
class civicrm_cli_csv_exporter extends civicrm_cli {
- var $separator = ',';
+ public $separator = ',';
/**
*/
* passed to the script.
*/
class civicrm_cli_csv_file extends civicrm_cli {
- var $header;
- var $separator = ',';
+ public $header;
+ public $separator = ',';
/**
*/
$this->separator = ";";
rewind($handle);
$header = fgetcsv($handle, 0, $this->separator);
- if (count($header) == 1) {
- die("Invalid file format for " . $this->_file . ". It must be a valid csv with separator ',' or ';'\n");
- }
}
$this->header = $header;
}
/* return a params as expected */
+
/**
* @param $data
*
*
*/
class civicrm_cli_csv_importer extends civicrm_cli_csv_file {
+
/**
* @param array $params
*/
*
*/
class civicrm_cli_csv_deleter extends civicrm_cli_csv_file {
+
/**
* @param array $params
*/