4 * cronjob mapping to allow seamless use of scripts in background.
7 * @link https://www.open-emr.org
8 * @author MD Support <mdsupport@users.sf.net>
9 * @copyright Copyright (c) 2017 MD Support <mdsupport@users.sf.net>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 // Check if running as a cronjob
14 if (php_sapi_name() !== 'cli') {
19 * Cronjobs are expected to specify arguments as -
20 * php -f full_script_name arg1=value1 arg2=value2
22 * Code below translates $argv to $_REQUEST
24 foreach ($argv as $argk => $argval) {
28 $pair = explode("=", $argval);
29 $_REQUEST[trim($pair[0])] = (isset($pair[1]) ?
trim($pair[1]) : null);
32 // Every job must have at least one argument specifing site
33 if (!isset($_REQUEST['site'])) {
37 // Simulate $_GET and $_POST for use by scripts
44 // Since from command line, set $sessionAllowWrite since need to set site_id session and no benefit to set to false
45 $sessionAllowWrite = true;