Example #1
0
        foreach ($all_days as $day) {
            echo date('Y-m-d', $day) . "\n";
            db_begin();
            if (process_day($day, $day + 86400)) {
                db_rollback();
            } else {
                db_commit();
            }
        }
    } else {
        $local_time = localtime();
        ## Start at midnight last night.
        $day_end = gmmktime(0, 0, 0, $local_time[4] + 1, $local_time[3], $local_time[5]);
        //	$day_end = gmmktime( 0, 0, 0, (gmtime( time() ))[3,4,5] );
        ## go until midnight yesterday.
        $day_begin = $day_end - 86400;
        //	$day_begin = timegm( 0, 0, 0, (gmtime( time() - 86400 ))[3,4,5] );
        db_begin();
        if (process_day($day_begin, $day_end)) {
            db_rollback();
        } else {
            db_commit();
        }
    }
}
if ($rollback) {
    db_rollback();
} else {
    db_commit();
}
cron_entry(14, $err);
Example #2
0
    //	$day_begin = timegm( 0, 0, 0, $ARGV[2], $ARGV[1] - 1, $ARGV[0] - 1900 );
    $day_end = $day_begin + 86400;
    $rollback = process_day($day_begin, $day_end);
} else {
    if (@$ARGV[1] == 'all' && @(!$ARGV[2]) && @(!$ARGV[3])) {
        // Do ALL the days
        debug('Processing all days');
        $rollback = process_day();
    } else {
        // Do yesterday
        $local_time = localtime();
        // Start at midnight last night.
        $day_end = gmmktime(0, 0, 0, $local_time[4] + 1, $local_time[3], $local_time[5]);
        // go until midnight yesterday.
        $day_begin = $day_end - 86400;
        $rollback = process_day($day_begin, $day_end);
    }
}
if ($rollback) {
    db_rollback();
} else {
    db_commit();
}
// lenp Not sure about this...
cron_entry(24, $err);
function process_day($day_begin = 0, $day_end = 0)
{
    global $err;
    global $pluginid;
    global $svnroot;
    global $svn_bin;