Jump to content

Maint Cron Job


TAV1702

Recommended Posts

Hello everyone.

I have the cron job setup to run once a week on my site to do all the maintenance and when it runs, it resets the flights count on pilot roster and public profiles and in pilot center to 0.

I found this in the maintenance.php file :

MainController::Run('Maintenance', 'resetpirepcount');
MainController::Run('Maintenance', 'resethours');

Is it safe to say that I can get rid of the resetpirepcount part to stop this from happening? I get LOADS of inquirys every week as to why their flight count is 0 again. I tell them it is the cron job but in their eyes we do not know what we are doing and a few have left over this already.

Personally, I see no reason why to ever reset the pirep count on a weekly basis.

Link to comment
Share on other sites

I had many times the same problem with maintenace module, pireps and hours in "0" really don't know whats is wrong in my codes but i made some code to populate the data again. Try with the code below and insert it at the end of your PilotData.class located at core/common.

public static function actualizarPagoPiloto($pilotid) {

$sql = 'SELECT p.pirepid, p.submitdate, p.modifieddate FROM ' . TABLE_PREFIX . 'pireps p WHERE p.pilotid='.$pilotid.' AND `accepted`='.PIREP_ACCEPTED;

$pireps = DB::get_results($sql);

foreach ($pireps as $pirep)

{

$sqlupdate = 'UPDATE ' . TABLE_PREFIX . 'ledger l SET l.submitdate="' . $pirep->submitdate . '", l.modifieddate="' . $pirep->modifieddate . '" WHERE l.pirepid=' . $pirep->pirepid;

DB::query($sqlupdate);

}

$total = DB::get_row('SELECT SUM(`amount`) AS `total` FROM `'.TABLE_PREFIX.'ledger` WHERE `pilotid`='.$pilotid);

return $total->total;

}

public static function actualizarConteoVuelos($pilotid) {

$sql = 'SELECT COUNT(*) as total FROM ' . TABLE_PREFIX . 'pireps p WHERE p.pilotid='.$pilotid.' AND `accepted`='.PIREP_ACCEPTED;

$vuelos = DB::get_row($sql);

$sqlupdate = 'UPDATE ' . TABLE_PREFIX . 'pilots l SET l.totalflights=' . $vuelos->total . ' WHERE l.pilotid=' . $pilotid;

DB::query($sqlupdate);

return $vuelos->total;

}

}

Regards

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...