* The "ping" will check if the flag has been set and inform the user that the archive is ready for download. */ $queue = new DownloadQueue(); // Check for a ping then check if the download is finished $ping = isset($_POST['ping']) ? $_POST['ping'] : false; if ($ping == 'ping') { $code = $_POST['code']; $status = $queue->isDownloadAvailable($code); if ($status === false) { echo 'wait'; } else { $str = ''; // display any error messages if (!empty($status)) { $str = '<div><b>' . _kt('The following errors occurred during the download') . ': </><br />'; $str .= '<table style="padding-top: 5px;" cellspacing="0" cellpadding="5">'; foreach ($status as $msg) { $str .= '<tr><td style="border: 1px #888 solid;">' . $msg . '</td></tr>'; } $str .= '</table></div>'; } echo $str; } exit(0); } if ($queue->isLocked()) { exit(0); } // Not a ping, process the queue $queue->processQueue(); exit(0);