/** * Maintenance::resethours() * * @return */ public function resethours() { CodonModule::checkPermission(MAINTENANCE); echo '<h3>Updating Total Hours Count</h3>'; $total = 0; echo '<p>Calculating hours for all pilots: <br />'; $allpilots = PilotData::GetAllPilots(); foreach ($allpilots as $pilot) { $hours = PilotData::UpdateFlightHours($pilot->pilotid); $total = Util::AddTime($total, $hours); echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid) . " - found {$hours} flight hours for number <br />"; } echo "Pilots have a total of <strong>{$total} hours</strong><br /><br />"; echo "<strong>Now counting from PIREPS</strong><br />"; StatsData::UpdateTotalHours(); echo 'Found ' . StatsData::TotalHours() . ' total hours, updated<br /></p>'; LogData::addLog(Auth::$userinfo->pilotid, 'Reset hours'); }
if ($version < 11700) { echo '<p>Updating your database...</p>'; Installer::add_to_config('TRANSFER_HOURS_IN_RANKS', false, 'Include the transfer hours in ranks'); Installer::sql_file_update(SITE_ROOT . '/install/update_700.sql'); # Specific Checks $sql = 'SELECT * FROM ' . TABLE_PREFIX . "settings\n\t\t\t\t\tWHERE name='TOTAL_HOURS'"; $res = DB::get_row($sql); if (!$res) { $sql = "INSERT INTO `phpvms_settings` (`friendlyname`, `name`, `value`,`descrip`,`core`)\n\t\t\tVALUES ('Total Hours', 'TOTAL_HOURS', '', 'These are the total hours your VA has flown', '0')"; DB::query($sql); } echo '<strong>Updating hours</strong><br />'; $allpilots = PilotData::GetAllPilots(); foreach ($allpilots as $pilot) { $hours = PilotData::UpdateFlightHours($pilot->pilotid); $total = Util::AddTime($total, $hours); } echo "Pilots have a total of <strong>{$total} hours</strong><br /><br />"; echo "<strong>Updating PIREPS Hours</strong><br />"; StatsData::UpdateTotalHours(); echo 'Found ' . StatsData::TotalHours() . ' total hours, updated<br />'; } if ($version < 20854) { Installer::add_to_config('USERS_ONLINE_TIME', 20, 'The StatsData::UserOnline() function - how many minutes to check'); Installer::sql_file_update(SITE_ROOT . '/install/update_854.sql'); } Installer::sql_file_update(SITE_ROOT . '/install/update.sql'); OperationsData::updateAircraftRankLevels(); /* Add them to the default group */ $allpilots = PilotData::GetAllPilots();