Skip to content

Instantly share code, notes, and snippets.

@rasmusbergpalm
Created May 30, 2012 18:42
Show Gist options
  • Save rasmusbergpalm/2838213 to your computer and use it in GitHub Desktop.
Save rasmusbergpalm/2838213 to your computer and use it in GitHub Desktop.
Place in steamapps\common\arma 2 operation arrowhead\@DayZ\addons and run. Requires php/winrar on PATH.
<?php
$url = 'http://cdn.armafiles.info/';
$filelist = trim(file_get_contents($url.'md5checksums.txt'));
$lines = explode("\n", $filelist);
$oldfiles = @unserialize(file_get_contents('files'));
foreach ($lines as $line) {
list($md5, $file) = preg_split('/\s/', $line,-1,PREG_SPLIT_NO_EMPTY);
$files[$md5] = $file;
echo "verifying $file ($md5)\n";
if(!in_array($md5, array_keys($oldfiles))){ //changed file
echo "Updating $file...\n";
file_put_contents($file, file_get_contents($url.$file));
echo "Extracting $file...\n";
system("rar e $file -o+");
unlink("$file");
}
}
echo "Done.";
file_put_contents('files', serialize($files));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment