Beispiel #1
0
function purge_latest_searches_weekly()
{
    $purge = osc_purge_latest_searches();
    if ($purge == 'week') {
        LatestSearches::newInstance()->purgeDate(date('Y-m-d H:i:s', time() - 7 * 24 * 3600));
    }
}
Beispiel #2
0
function purge_latest_searches_hourly()
{
    $purge = osc_purge_latest_searches();
    if ($purge == 'hour') {
        LatestSearches::newInstance()->purgeDate(date('Y-m-d H:i:s', time() - 3600));
    } else {
        if (!in_array($purge, array('forever', 'day', 'week'))) {
            LatestSearches::newInstance()->purgeNumber($purge);
        }
    }
}
Beispiel #3
0
function purge_latest_searches_hourly()
{
    $purge = osc_purge_latest_searches();
    if ($purge == 'day') {
        LatestSearches::newInstance()->purgeDate(date('Y-m-d H:i:s', time() - 3600));
    } else {
        if ($purge != 'forever' && $purge != 'day' && $purge != 'week') {
            LatestSearches::newInstance()->purgeNumber($purge);
        }
    }
}
Beispiel #4
0
        // update the next execution time in t_cron
        $d_next = date('Y-m-d H:i:s', $i_now + 24 * 3600);
        Cron::newInstance()->update(array('d_last_exec' => $d_now, 'd_next_exec' => $d_next), array('e_type' => 'DAILY'));
        // Run cron AFTER updating the next execution time to avoid double run of cron
        $purge = osc_purge_latest_searches();
        if ($purge == 'day') {
            LatestSearches::newInstance()->purgeDate(date('Y-m-d H:i:s', time() - 24 * 3600));
        }
        osc_runAlert('DAILY');
        osc_update_cat_stats();
        osc_run_hook('cron_daily');
    }
}
// Weekly crons
$cron = Cron::newInstance()->getCronByType('WEEKLY');
if (is_array($cron)) {
    $i_next = strtotime($cron['d_next_exec']);
    if (CLI && Params::getParam('cron-type') === 'weekly' || $i_now - $i_next >= 0 && !CLI) {
        // update the next execution time in t_cron
        $d_next = date('Y-m-d H:i:s', $i_now + 7 * 24 * 3600);
        Cron::newInstance()->update(array('d_last_exec' => $d_now, 'd_next_exec' => $d_next), array('e_type' => 'WEEKLY'));
        // Run cron AFTER updating the next execution time to avoid double run of cron
        $purge = osc_purge_latest_searches();
        if ($purge == 'week') {
            LatestSearches::newInstance()->purgeDate(date('Y-m-d H:i:s', time() - 7 * 24 * 3600));
        }
        osc_run_hook('cron_weekly');
    }
}
osc_run_hook('cron');
/* file end: ./oc-includes/osclass/cron.php */
Beispiel #5
0
                                        <div>
                                            <input type="radio" name="purge_searches" id="purge_searches" value="custom" <?php 
echo !in_array(osc_purge_latest_searches(), array('hour', 'day', 'week', 'forever', '1000')) ? 'checked="checked"' : '';
?>
 />
                                            <?php 
printf(__('Store %s queries'), '<input name="custom_queries" type="text" class="small" ' . (!in_array(osc_purge_latest_searches(), array('hour', 'day', 'week', 'forever', '1000')) ? 'value="' . osc_esc_html(osc_purge_latest_searches()) . '"' : '') . ' onkeyup="javascript:document.getElementById(\'customPurge\').value = this.value;"/>');
?>
                                            <p class="help">
                                                <?php 
_e("This feature can generate a lot of data. It's recommended to purge this data periodically.");
?>
                                            </p>
                                        </div>
                                        <input type="hidden" id="customPurge" name="customPurge" value="<?php 
echo osc_esc_html(osc_purge_latest_searches());
?>
" />
                                    </td>
                                </tr>
                                <tr class="separate">
                                    <td></td>
                                    <td><input type="submit" value="<?php 
echo osc_esc_html(__('Save changes'));
?>
" /></td>
                                </tr>
                            </table>
                        </fieldset>
                    </form>
                </div>
Beispiel #6
0
    $custom_checked = false;
}
?>
                                        <input type="radio" name="purge_searches" id="purge_searches" value="custom" <?php 
echo $custom_checked ? 'checked="checked"' : '';
?>
 />
                                        <label for="tf_custom"><?php 
_e('Number of files to keep');
?>
:</label> <input type="text" <?php 
echo $custom_checked ? 'value="' . osc_purge_latest_searches() . '"' : '';
?>
 onkeyup="javascript:document.getElementById('customPurge').value = this.value;"/>
                                        <input type="hidden" name="customPurge" id="customPurge" value="<?php 
echo osc_purge_latest_searches();
?>
" />
                                        <br/>
                                        <label><?php 
_e('Latest searches functionality could generate a lot of data. It\'s recomended you purge that data. You could delete one hour old, one day old or one week old, you could also specify the number of searches to keep or to never delete them.');
?>
</label>
                                    </div>
                                </fieldset>
                            </div>
                            
                            <div style="clear: both;"></div>
                            <input id="button_save" type="submit" value="<?php 
_e('Update');
?>