From 8906b98426aadba1e3cfe0aafba863915ad50b34 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Feb 2018 07:49:06 -0500 Subject: [PATCH] Remove old file remove old file --- include/threads.php | 113 -------------------------------------------- 1 file changed, 113 deletions(-) delete mode 100644 include/threads.php diff --git a/include/threads.php b/include/threads.php deleted file mode 100644 index 61bc5292ff..0000000000 --- a/include/threads.php +++ /dev/null @@ -1,113 +0,0 @@ - $data) - if (!in_array($field, ["guid", "title", "body", "rendered-html", "rendered-hash"])) { - if ($sql != "") { - $sql .= ", "; - } - - $sql .= "`".$field."` = '".dbesc($data)."'"; - } - - $result = q("UPDATE `thread` SET ".$sql." WHERE `iid` = %d", intval($itemid)); - - logger("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".print_r($result, true)." ".print_r($item, true), LOGGER_DEBUG); - - // Updating a shadow item entry - $items = q("SELECT `id` FROM `item` WHERE `guid` = '%s' AND `uid` = 0 LIMIT 1", dbesc($item["guid"])); - - if (!DBM::is_result($items)) { - return; - } - - $result = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s' WHERE `id` = %d", - dbesc($item["title"]), - dbesc($item["body"]), - dbesc($item["rendered-html"]), - dbesc($item["rendered-hash"]), - intval($items[0]["id"]) - ); - logger("Updating public shadow for post ".$items[0]["id"]." - guid ".$item["guid"]." Result: ".print_r($result, true), LOGGER_DEBUG); -} - -function delete_thread_uri($itemuri, $uid) { - $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid)); - - if (DBM::is_result($messages)) { - foreach ($messages as $message) { - delete_thread($message["id"], $itemuri); - } - } -} - -function delete_thread($itemid, $itemuri = "") { - $item = q("SELECT `uid` FROM `thread` WHERE `iid` = %d", intval($itemid)); - - if (!DBM::is_result($item)) { - logger('No thread found for id '.$itemid, LOGGER_DEBUG); - return; - } - - // Using dba::delete at this time could delete the associated item entries - $result = dba::e("DELETE FROM `thread` WHERE `iid` = ?", $itemid); - - logger("delete_thread: Deleted thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG); - - if ($itemuri != "") { - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND NOT `deleted` AND NOT (`uid` IN (%d, 0))", - dbesc($itemuri), - intval($item["uid"]) - ); - if (!DBM::is_result($r)) { - dba::delete('item', ['uri' => $itemuri, 'uid' => 0]); - logger("delete_thread: Deleted shadow for item ".$itemuri, LOGGER_DEBUG); - } - } -} -- 2.39.5