From b23dd95c5eb1d6f95ac84e0aee33c93002694d36 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 16 Mar 2014 18:09:42 +0100 Subject: [PATCH] OStatus auto completion: option to completely disable the auto completion. --- include/ostatus_conversation.php | 7 +++++-- mod/admin.php | 11 ++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/ostatus_conversation.php b/include/ostatus_conversation.php index ad90e3d311..2fa7d7a544 100644 --- a/include/ostatus_conversation.php +++ b/include/ostatus_conversation.php @@ -28,7 +28,7 @@ function check_conversations() { 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'", + $conversations = q("SELECT * FROM `term` WHERE `type` = 7 AND `term` > '%s'", dbesc($start)); foreach ($conversations AS $conversation) { $id = $conversation['oid']; @@ -44,6 +44,9 @@ function check_conversations() { function complete_conversation($itemid, $conversation_url, $only_add_conversation = false) { global $a; + if (intval(get_config('system','ostatus_poll_interval')) == -2) + return; + if ($a->last_ostatus_conversation_url == $conversation_url) return; @@ -141,7 +144,7 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio if ($message_exists) { if ($parent["id"] != 0) { $existing_message = $message_exists[0]; - $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `thr-parent` = '%s' WHERE `id` = %d LIMIT 1", + $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `thr-parent` = '%s' WHERE `id` = %d", intval($parent["id"]), dbesc($parent["uri"]), dbesc($parent_uri), diff --git a/mod/admin.php b/mod/admin.php index 32a4ab531c..7ddd17ebe7 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -526,11 +526,12 @@ function admin_page_site(&$a) { /* OStatus conversation poll choices */ $ostatus_poll_choices = array( - "-1" => t("Never"), - "0" => t("Frequently"), - "60" => t("Hourly"), - "720" => t("Twice daily"), - "1440" => t("Daily") + "-2" => t("Never"), + "-1" => t("At post arrival"), + "0" => t("Frequently"), + "60" => t("Hourly"), + "720" => t("Twice daily"), + "1440" => t("Daily") ); /* get user names to make the install a personal install of X */