3 * cronjob mapping to allow seamless use of scripts in background.
6 * @link http://www.open-emr.org
7 * @author MD Support <mdsupport@users.sf.net>
8 * @copyright Copyright (c) 2017 MD Support <mdsupport@users.sf.net>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
12 // Check if running as a cronjob
13 if (php_sapi_name() !== 'cli') {
18 * Cronjobs are expected to specify arguments as -
19 * php -f full_script_name arg1=value1 arg2=value2
21 * Code below translates $argv to $_REQUEST
23 foreach ($argv as $argk => $argval) {
27 $pair = explode("=", $argval);
28 $_REQUEST[trim($pair[0])] = (isset($pair[1]) ?
trim($pair[1]) : null);
31 // Every job must have at least one argument specifing site
32 if (!isset($_REQUEST['site'])) {
36 // Simulate $_GET and $_POST for use by scripts