#!/usr/bin/php -q //date/ ou les dumps de configuration sont déposées. * Deux sous dossier sont ensuite crée : html ( dump des fichiers web et de la configuration du compte ) * et un dossier sql contenant toutes les bases de données de l'utilisateur. */ require("/var/alternc/bureau/class/config_nochk.php"); global $L_VERSION; if(!chdir("/var/alternc/bureau")){ exit(1); } if($argc != 3 ){ echo "usage : export.php \n"; exit (1); } $my_id=$argv[1]; # TODO here test $my_id is numeric if((intval($my_id))==0 || (intval($myid)==1)){ echo "bad argument: expecting a 4 digit IUD"; exit (1); } $dir=$argv[2]; echo "\n === Export of account $my_id === to $dir\n\n"; # Connect in this user $admin->enabled=1; $mem->su($my_id); if(!is_dir($dir)){ if(!mkdir($dir)){ echo "creating dir : ".$dir." failed"; exit(1); } } $dir.=$mem->user["login"]."/"; if(!is_dir($dir)){ if(!mkdir($dir)){ echo "creating dir : ".$dir." failed"; exit(1); } } $timestamp=date("Y:m:d"); $dir.=$timestamp."/"; if(!is_dir($dir)){ if(!mkdir($dir)){ echo "creating dir : ".$dir." failed"; exit(1); } } # Get the conf $conf_user=Array(); $conf_user=$export->export_conf(); $file_conf=$dir."dump_conf_".date("H:i:s"); echo $file_conf; $file=fopen($file_conf."dump","ab"); fputs($file,"dump of ::".$mem->user["login"]."\n"); fputs($file,"alternc version:".$L_VERSION."\n\n"); fputs($file,""); foreach($conf_user as $string){ fputs($file,$string); } fputs($file,""); fclose($file); # Get the data $export->export_data($dir); $mem->unsu(); exit(0); ?>