public function sendpireps() { echo '<h3>Sending all PIREPS</h3>'; $within_timelimit = CronData::check_hoursdiff('update_pireps', CentralData::$limits['update_pireps']); if ($within_timelimit == true) { echo '<p>You can only export PIREPs every ' . CentralData::$limits['update_pireps'] . ' hours</p>'; return false; } $ret = CentralData::send_all_pireps(); $this->parse_response($ret); LogData::addLog(Auth::$userinfo->pilotid, 'vaCentral - PIREPS sent'); }
function post_module_load() { /* Misc tasks which need to get done */ /* If the setting to auto-retired pilots is on, then do that and only check every 24 hours */ if (Config::Get('USE_CRON') == false) { if (Config::Get('PILOT_AUTO_RETIRE') == true) { $within_timelimit = CronData::check_hoursdiff('find_retired_pilots', '24'); if ($within_timelimit === false) { PilotData::findRetiredPilots(); CronData::set_lastupdate('find_retired_pilots'); } } if (Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === false) { $within_timelimit = CronData::check_hoursdiff('check_expired_bids', '24'); if ($within_timelimit === false) { SchedulesData::deleteExpiredBids(); CronData::set_lastupdate('check_expired_bids'); } } /* Expenses, make sure they're all populated */ $within_timelimit = CronData::check_hoursdiff('populate_expenses', 18); if ($within_timelimit === false) { FinanceData::updateAllExpenses(); CronData::set_lastupdate('populate_expenses'); } /* And finally, clear expired sessions */ Auth::clearExpiredSessions(); } if (Config::Get('TWITTER_AIRLINE_ACCOUNT') != '') { $within_timelimit = CronData::check_hoursdiff('twitter_update', '3'); if ($within_timelimit === false) { ActivityData::readTwitter(); CronData::set_lastupdate('twitter_update'); } } // @TODO: Clean ACARS records older than one month if (Config::Get('MAINTENANCE_MODE') == true && !Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) { Template::Show('maintenance.tpl'); die; } return true; }
function post_module_load() { /* Misc tasks which need to get done */ /* If the setting to auto-retired pilots is on, then do that and only check every 24 hours */ if (Config::Get('USE_CRON') === true) { if (Config::Get('PILOT_AUTO_RETIRE') == true) { $within_timelimit = CronData::check_hoursdiff('find_retired_pilots', '24'); if ($within_timelimit == false) { PilotData::findRetiredPilots(); CronData::set_lastupdate('find_retired_pilots'); } } if (Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === false) { $within_timelimit = CronData::check_hoursdiff('check_expired_bids', '24'); if ($within_timelimit == false) { SchedulesData::deleteExpiredBids(); CronData::set_lastupdate('check_expired_bids'); } } /* Expenses, make sure they're all populated */ $within_timelimit = CronData::check_hoursdiff('populate_expenses', '18'); if ($within_timelimit == false) { FinanceData::updateAllExpenses(); CronData::set_lastupdate('populate_expenses'); } /* And finally, clear expired sessions */ Auth::clearExpiredSessions(); } // @TODO: Clean ACARS records older than one month if (Config::Get('MAINTENANCE_MODE') == true && !Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) { echo '<html><head><title>Down for maintenance - ' . SITE_NAME . '</title></head><body>'; Debug::showCritical(Config::Get('MAINTENANCE_MESSAGE'), 'Down for maintenance'); echo '</body></html>'; die; } return true; }
public static function send_all_pireps() { if (!self::central_enabled()) { return false; } if (self::$debug === false) { $within_timelimit = CronData::check_hoursdiff('update_pireps', self::$limits['update_pireps']); if ($within_timelimit == true) { return false; } } self::set_xml('update_pireps'); //$allpireps = PIREPData::GetAllReports(); $params = array('DATE_SUB(CURDATE(), INTERVAL 6 MONTH) <= p.submitdate'); $allpireps = PIREPData::findPIREPS($params); if (!$allpireps) { return false; } // Set them all to have not been exported PIREPData::setAllExportStatus(false); self::$xml->addChild('total', count($allpireps)); foreach ($allpireps as $pirep) { # Skip erronious entries if ($pirep->aircraft == '') { continue; } self::get_pirep_xml($pirep); } CronData::set_lastupdate('update_pireps'); $resp = self::send_xml(); // Only if we get a valid response, set the PIREPs to exported if ($resp === true) { PIREPData::setAllExportStatus(true); return true; } }
/** * CentralData::send_all_pireps() * * @return */ public static function send_all_pireps() { if (!self::central_enabled()) { return false; } if (self::$debug === false) { $within_timelimit = CronData::check_hoursdiff('update_pireps', self::$limits['update_pireps']); if ($within_timelimit == true) { return false; } } $allpireps = PIREPData::findPIREPS(array()); if (!$allpireps) { return false; } // Set them all to have not been exported PIREPData::setAllExportStatus(false); self::startBody('update_pireps'); self::addElement(null, 'total', count($allpireps)); foreach ($allpireps as $pirep) { # Skip erronious entries if ($pirep->aircraft == '') { continue; } self::get_pirep_xml($pirep); } CronData::set_lastupdate('update_pireps'); $resp = self::sendToCentral(); // Only if we get a valid response, set the PIREPs to exported if ($resp === true) { PIREPData::setAllExportStatus(true); return true; } }