quick minor path updates (#1968)
[openemr.git] / interface / main / backuplog.php
blob1598abeab36b97049d70e8dd1f44729ca702dc5d
1 <?php
2 /**
3 * backuplog.php
5 * Here /interface/globals.php is not referred, because it includes auth.inc.
6 * auth.inc verifies for user authentication information & login session variables.
7 * Pass these variables $webserver_root & $_GLOBALS[backup_log_dir] as parameters for CRON.
9 * @package OpenEMR
10 * @link http://www.open-emr.org
11 * @author ViCarePlus, Visolve <vicareplus_engg@visolve.com>
12 * @author Brady Miller <brady.g.miller@gmail.com>
13 * @copyright Copyright (c) ViCarePlus, Visolve <vicareplus_engg@visolve.com>
14 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
15 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
18 // Ensure running from command line only
19 if (php_sapi_name() !== 'cli') {
20 exit;
23 require_once("$argv[1]/library/sqlconf.php");
24 $backuptime=date("Ymd_His");
25 $BACKUP_EVENTLOG_DIR = $argv[2] . "/emr_eventlog_backup";
26 if (!file_exists($BACKUP_EVENTLOG_DIR)) {
27 mkdir($BACKUP_EVENTLOG_DIR);
28 chmod($BACKUP_EVENTLOG_DIR, 0777);
31 $BACKUP_EVENTLOG_DIR=$BACKUP_EVENTLOG_DIR.'/eventlog_'.$backuptime.'.sql';
32 $cmd = escapeshellcmd($argv[1].'/interface/main/backuplog.sh') . ' ' . escapeshellarg($sqlconf["login"]) . ' ' . escapeshellarg($sqlconf["pass"]) . ' ' . escapeshellarg($sqlconf["dbase"]) . ' ' . escapeshellarg($BACKUP_EVENTLOG_DIR) . ' ' . escapeshellarg($sqlconf["host"]) . ' ' . escapeshellarg($sqlconf["port"]);
33 system($cmd);