echo "Fetching predb_dump list from GitHub\n"; } $result = Misc::getUrl(['url' => $url, 'requestheaders' => ['Content-Type: application/json', 'User-Agent: nZEDb']]); if ($result === false) { exit('Error connecting to GitHub, try again later?' . PHP_EOL); } if (nZEDb_DEBUG) { echo "Extracting filenames from list.\n"; } $data = json_decode($result, true); if (is_null($data)) { exit("Error: {$result}"); } $total = count($data); $predb = new PreDb(); $progress = $predb->progress(settings_array()); foreach ($data as $file) { if (preg_match("#^https://raw\\.githubusercontent\\.com/nZEDb/nZEDbPre_Dumps/master/dumps/{$filePattern}\$#", $file['download_url'])) { if (preg_match("#^{$filePattern}\$#", $file['name'], $match)) { $timematch = $progress['last']; // Skip patches the user does not want. if ($match[1] < $timematch) { echo 'Skipping dump ' . $match[2] . ', as your minimum unix time argument is ' . $timematch . PHP_EOL; --$total; continue; } // Download the dump. $dump = Misc::getUrl(['url' => $file['download_url']]); echo "Downloading: {$file['download_url']}\n"; if (!$dump) { echo "Error downloading dump {$match[2]} you can try manually importing it." . PHP_EOL;