Changeset 2394

Show
Ignore:
Timestamp:
08/28/08 14:37:28 (4 months ago)
Author:
MattRead
Message:

Updating cron float handling, fixes #615, thanks ayunyan. Also fixing apccache expiry type, forcing it to int.

Location:
trunk/htdocs/system/classes
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/htdocs/system/classes/apccache.php

    r2076 r2394  
    101101            return null; 
    102102        } 
    103         apc_store( "$group:$name", $value, $expiry ); 
     103        apc_store( "$group:$name", $value, intval($expiry) ); 
    104104    } 
    105105 
  • trunk/htdocs/system/classes/crontab.php

    r2136 r2394  
    1717    { 
    1818        // check if it's time to run crons, and if crons are already running. 
    19         $next_cron = doubleval( Options::get('next_cron') ); 
     19        $next_cron = intval( Options::get('next_cron') ); 
    2020        if ( ( $next_cron > time() ) 
    2121            || ( Options::get('cron_running') && Options::get('cron_running') > microtime(true) ) 
     
    2525         
    2626        // cron_running will timeout in 10 minutes 
     27        // round cron_running to 4 decimals 
    2728        $run_time = microtime(true) + 600; 
     29        $run_time = sprintf("%.4f", $run_time);  
    2830        Options::set('cron_running', $run_time); 
    2931         
     
    4446            } 
    4547             
     48            $time = time(); 
    4649            $crons = DB::get_results( 
    4750                'SELECT * FROM {crontab} WHERE start_time <= ? AND next_run <= ?', 
    48                 array( time(), time() ), 
     51                array( $time, $time ), 
    4952                'CronJob' 
    5053                ); 
     
    6770    function act_poll_cron() 
    6871    { 
    69         $time = $this->handler_vars['time']; 
     72        $time = doubleval($this->handler_vars['time']); 
    7073        if ( $time != Options::get('cron_running') ) { 
    7174            return; 
     
    7578        set_time_limit(600); 
    7679         
     80        $time = time(); 
    7781        $crons = DB::get_results( 
    7882            'SELECT * FROM {crontab} WHERE start_time <= ? AND next_run <= ?', 
    79             array( time(), time() ), 
     83            array( $time, $time ), 
    8084            'CronJob' 
    8185            ); 
     
    8892         
    8993        // set the next run time to the lowest next_run OR a max of one day. 
     94        // @todo next_cron should be the actuall next run time and update it when new crons are 
     95        // added instead of just maxing out at one day.. 
    9096        $next_cron = DB::get_value( 'SELECT next_run FROM {crontab} ORDER BY next_run ASC LIMIT 1', array() ); 
    9197        Options::set('next_cron', min( (int) $next_cron, time() + 86400 ) );