} $filetime=file_time_min($cachetime); if(!$GLOBALS["FORCE"]){ if($filetime<$WebCommunityUpdatePool){WriteMyLogs("{$filetime}Mn need {$WebCommunityUpdatePool}Mn, aborting...",__FUNCTION__,__FILE__,__LINE__);die();} } @mkdir(dirname($cachetime),0755,true); @unlink($cachetime); @file_put_contents($cachetime,"#"); $GLOBALS["MYPID"]=getmygid(); @file_put_contents($pidfile,$GLOBALS["MYPID"]); WriteMyLogs("-> Export()","MAIN",null,__LINE__); Export(); WriteMyLogs("-> Import()","MAIN",null,__LINE__); import(); WriteMyLogs("-> patterns()","MAIN",null,__LINE__); patterns(); WriteMyLogs("-> fillSitesInfos()","MAIN",null,__LINE__); fillSitesInfos(); function Export(){ $unix=new unix(); $sql="SELECT * FROM dansguardian_community_categories WHERE enabled=1 and sended=0 ORDER BY zDate DESC LIMIT 0,4000"; $q=new mysql(); $results=$q->QUERY_SQL($sql,"artica_backup"); if(!$q->ok){echo $q->mysql_error."\n$sql\n";return;} while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
$rootpath = dirname(dirname($scriptpath)); include "{$rootpath}/thirdparty/php-vpk-reader/VPKReader.php"; $vpk_file = isset($argv[1]) ? $argv[1] : ''; $src_path = isset($argv[2]) ? $argv[2] : ''; $dst_path = isset($argv[3]) ? $argv[3] : dirname($vpk_file) . "/" . basename($vpk_file, '.vpk'); //var_dump($vpk_file,$src_path,$dst_path); //exit; //'/home/insserver/serverfiles/insurgency/insurgency_misc_dir.vpk'; if (!file_exists($vpk_file)) { echo "ERROR: \"{$vpk_file}\" does not exist!\n"; show_usage(); exit(1); } $vpk = new \VPKReader\VPK($vpk_file); $ent_tree = $vpk->vpk_entries; Export($src_path, $dst_path); // ExportFiles - this recursively goes through the objects, when it hits an array it recurses and when it hits an object it extracts. function ExportFiles($data, $src_path, $dst_path) { global $vpk; if (!is_null($data) && count($data) > 0) { if (is_array($data)) { foreach ($data as $name => $children) { ExportFiles($children, "{$src_path}/{$name}", "{$dst_path}/{$name}"); } } else { // In case we are exporting to a directory but did not specify the file name (i.e. export maps/buhriz.txt to data/maps) if (is_dir($dst_path)) { $dst_path .= "/{$src_file}"; } $src_dir = dirname($src_path);