include_once dirname(__FILE__) . '/framework/class.unix.inc'; include_once dirname(__FILE__) . "/framework/frame.class.inc"; include_once dirname(__FILE__) . "/ressources/class.groups.inc"; if (preg_match("#--verbose#", implode(" ", $argv))) { $GLOBALS["VERBOSE"] = true; $GLOBALS["VERBOSE"] = true; ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); ini_set('error_prepend_string', null); ini_set('error_append_string', null); } if (preg_match("#--force#", implode(" ", $argv))) { $GLOBALS["FORCE"] = true; } if ($argv[1] == '--acls') { applyAcls(); die; } if ($argv[1] == '--acls-single') { ApplySingleAcls_cmdline($argv[2]); die; } function applyAcls() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $unix = new unix(); if ($unix->process_exists(@file_get_contents("{$pidfile}"))) { echo "Already process exists\n"; return; } @file_put_contents($pidfile, getmypid());
<?php if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");} include_once(dirname(__FILE__).'/ressources/class.mysql.inc'); include_once(dirname(__FILE__).'/ressources/class.acls.inc'); include_once(dirname(__FILE__).'/framework/class.unix.inc'); include_once(dirname(__FILE__)."/framework/frame.class.inc"); if(preg_match("#--verbose#",implode(" ",$argv))){$GLOBALS["VERBOSE"]=true;} if(preg_match("#--force#",implode(" ",$argv))){$GLOBALS["FORCE"]=true;} if($argv[1]=='--acls'){applyAcls();die();} if($argv[1]=='--acls-single'){ApplySingleAcls_cmdline($argv[2]);die();} function applyAcls(){ $pidfile="/etc/artica-postfix/pids/".basename(__FILE__).".".__FUNCTION__.".pid"; $unix=new unix(); if($unix->process_exists(@file_get_contents("$pidfile"))){ echo "Already process exists\n"; return; } @file_put_contents($pidfile,getmypid()); $sql="SELECT `directory` FROM acl_directories"; $q=new mysql(); $results=$q->QUERY_SQL($sql,'artica_backup'); if(!$q->ok){if($GLOBALS["VERBOSE"]){echo $q->mysql_error."\n";return;}}