10, 'display' => '10sec' ); $schedules['halfhour'] = array( 'interval' => 60*30, 'display' => 'harfhour' ); return $schedules; } /** * CRON */ public function cron_do() { global $attmgr, $wpdb; $preserve_day = current_time('timestamp') - ( $attmgr->option['general']['preserve_past'] *60*60*24 ); $prefix = $wpdb->prefix.ATTMGR::TABLEPREFIX; $table = $prefix.'schedule'; $query = "DELETE FROM {$table} WHERE `date`<%s"; $ret = $wpdb->query( $wpdb->prepare( $query, array( date( 'Y-m-d', $preserve_day ) ) ), ARRAY_A ); } /** * Update CRON */ public static function update() { global $attmgr; if ( ! wp_next_scheduled( ATTMGR::PLUGIN_ID.'_cron' ) ) { wp_schedule_event( time(), $attmgr->option['general']['cron_interval'], ATTMGR::PLUGIN_ID.'_cron' ); } } }