| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007. |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
- | License along with this program; if not, contact CiviCRM LLC |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
* This files provides several classes for doing command line work with
return TRUE;
}
+ /**
+ * Ensure function is being run from the cli.
+ *
+ * @return bool
+ */
public function _accessing_from_cli() {
if (PHP_SAPI === 'cli') {
return TRUE;
$this->_joblog = TRUE;
}
else {
- while (list($short, $long) = each($this->_additional_arguments)) {
+ foreach ($this->_additional_arguments as $short => $long) {
if ($arg == '-' . $short || $arg == '--' . $long) {
$property = '_' . $long;
$this->$property = $value;
// that properly logs
print "$error\n";
}
+
}
/**
fclose($out);
echo "\n";
}
+
}
/**
parent::initialize();
}
+ /**
+ * Run CLI function.
+ */
public function run() {
$this->row = 1;
$handle = fopen($this->_file, "r");
$this->processLine($params);
}
fclose($handle);
- return NULL;
}
/* return a params as expected */
$params['version'] = 3;
return $params;
}
+
}
/**
echo "\nline " . $this->row . ": created " . $this->_entity . " id: " . $result['id'] . "\n";
}
}
+
}
/**
echo "\nline " . $this->row . ": deleted\n";
}
}
+
}