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; }
* * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ /* This is the maintenance cron file, which can run nightly. You should either point to this file directly in your web-host's control panel Or add an entry into the crontab file. I recommend running this maybe 2-3am, */ define('ADMIN_PANEL', true); include dirname(dirname(__FILE__)) . '/core/codon.config.php'; Auth::$userinfo->pilotid = 0; error_reporting(E_ALL); ini_set('display_errors', 'on'); /* Clear expired sessions */ Auth::clearExpiredSessions(); /* Update any expenses */ FinanceData::updateAllExpenses(); if (Config::Get('PILOT_AUTO_RETIRE') == true) { /* Find any retired pilots and set them to retired */ PilotData::findRetiredPilots(); CronData::set_lastupdate('find_retired_pilots'); } if (Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === false) { SchedulesData::deleteExpiredBids(); CronData::set_lastupdate('check_expired_bids'); } MaintenanceData::optimizeTables(); MainController::Run('Maintenance', 'resetpirepcount'); MainController::Run('Maintenance', 'resethours');