foreach ($children as $child) { $index++; logMessage("Compressing {$index} of {$count} - {$id}/{$child}..."); ZipDirectory("{$dir}/{$child}", "{$archiveDir}/{$id}_{$child}.zip", true); } $zipFile = "{$dir}/{$id}.zip"; if (is_file($zipFile)) { unlink($zipFile); } logMessage("Combining tests into {$zipFile}..."); ZipDirectory($archiveDir, $zipFile, true); delTree($archiveDir); if (is_file($zipFile)) { $bucket = "{$bucket_base}{$info['year']}_{$info['month']}_{$info['day']}_{$info['group']}{$suffix}"; logMessage("Uploading {$zipFile} to {$bucket}"); if (ArchiveFile($zipFile, $bucket)) { logMessage("Archiving {$id} Complete"); file_put_contents("{$dir}/archive.dat", "{$download_path}{$bucket}/{$id}.zip"); } else { logMessage("Archiving {$id} FAILED"); } unlink($zipFile); } else { logMessage("Failed to combine files"); } } else { // Nothing to process, mark the group as done file_put_contents("{$dir}/archive.dat", ""); file_put_contents("{$dir}/archive.dat.valid", ""); logMessage("{$id} - No tests to Archive"); }
$matches = array(); if (is_file("{$baseDir}/{$filename}") && preg_match('/(?:httparchive_)(?:mobile_)?(?:android_)?(?:chrome_)?(.*)_[a-z\\.]+/i', $filename, $matches) && count($matches) > 1) { $modified = filemtime("{$baseDir}/{$filename}"); $size = filesize("{$baseDir}/{$filename}"); $bucket = "httparchive_downloads_" . $matches[1]; if (array_key_exists($filename, $downloads) && $downloads[$filename]['size'] != $size) { if (array_key_exists('bucket', $downloads[$filename])) { DeleteArchive($filename, $downloads[$filename]['bucket']); } else { DeleteArchive($filename, 'httparchive_downloads'); } unset($downloads[$filename]); } if (!array_key_exists($filename, $downloads) && (!$modified || $modified < $now && $now - $modified > 86400)) { echo "{$filename} - Uploading to {$bucket}...\n"; if (ArchiveFile("{$baseDir}/{$filename}", $bucket)) { $downloads[$filename] = array('url' => "{$download_path}{$bucket}/{$filename}", 'size' => $size, 'modified' => $modified, 'verified' => false, 'bucket' => $bucket); $updated = true; } } } } if ($updated) { file_put_contents("{$baseDir}/archived.json", json_encode($downloads)); } $updated = false; foreach ($downloads as $filename => &$download) { if (!$download['verified']) { echo "{$filename} - Checking {$download['url']}..."; if (URLExists($download['url'])) { echo "exists\n";