+ // Don't poll if the interval is set negative
+ if ($poll_interval < 0)
+ return;
+
+ $poll_timeframe = intval(get_config('system','ostatus_poll_timeframe'));
+ if(! $poll_timeframe)
+ $poll_timeframe = OSTATUS_DEFAULT_POLL_TIMEFRAME;
+
+ if($last) {
+ $next = $last + ($poll_interval * 60);
+ if($next > time()) {
+ logger('complete_conversation: poll interval not reached');
+ return;
+ }
+ }
+
+ logger('complete_conversation: cron_start');
+
+ $start = date("Y-m-d H:i:s", time() - ($poll_timeframe * 60));
+ $conversations = q("SELECT * FROM `term` WHERE `type` = 7 AND `term` > '%s'",
+ dbesc($start));
+ foreach ($conversations AS $conversation) {
+ $id = $conversation['oid'];
+ $url = $conversation['url'];
+ complete_conversation($id, $url);
+ }
+
+ logger('complete_conversation: cron_end');