X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fthreads.php;h=c214cf264487a6f89ddecab8248e7b81909ed5b8;hb=7a89d06465a69ad211aabdd5e2778506a7b2f81e;hp=c12f43bb81154c62256b9fac99a823d8ee144e84;hpb=6910604ffb26c6fba027bca9d347162050596fbb;p=friendica.git diff --git a/include/threads.php b/include/threads.php index c12f43bb81..c214cf2644 100644 --- a/include/threads.php +++ b/include/threads.php @@ -1,7 +1,9 @@ $data) - if (!in_array($field, array("guid", "title", "body"))) { + if (!in_array($field, array("guid", "title", "body", "rendered-html", "rendered-hash"))) { if ($sql != "") $sql .= ", "; @@ -142,9 +211,11 @@ function update_thread($itemid, $setmention = false) { if (!$items) return; - $result = q("UPDATE `item` SET `title` = '%s', `body` = '%s' WHERE `id` = %d", + $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); @@ -170,8 +241,8 @@ function delete_thread($itemid, $itemuri = "") { dbesc($itemuri), intval($item["uid"]) ); - if (!count($r)) { - $r = q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = 0)", + if (!dbm::is_result($r)) { + $r = q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = 0", dbesc($itemuri) ); logger("delete_thread: Deleted shadow for item ".$itemuri." - ".print_r($result, true), LOGGER_DEBUG); @@ -188,18 +259,18 @@ function update_threads() { logger("update_threads: fetched messages: ".count($messages)); - while ($message = $db->qfetch()) + while ($message = $db->qfetch()) { add_thread($message["id"]); + add_shadow_thread($message["id"]); + } $db->qclose(); } function update_threads_mention() { - $a = get_app(); - $users = q("SELECT `uid`, `nickname` FROM `user` ORDER BY `uid`"); foreach ($users AS $user) { - $self = normalise_link($a->get_baseurl() . '/profile/' . $user['nickname']); + $self = normalise_link(App::get_baseurl() . '/profile/' . $user['nickname']); $selfhttps = str_replace("http://", "https://", $self); $parents = q("SELECT DISTINCT(`parent`) FROM `item` WHERE `uid` = %d AND ((`owner-link` IN ('%s', '%s')) OR (`author-link` IN ('%s', '%s')))", @@ -222,7 +293,7 @@ function update_shadow_copy() { logger("fetched messages: ".count($messages)); while ($message = $db->qfetch()) - add_thread($message["iid"], true); + add_shadow_thread($message["iid"]); $db->qclose(); }