From f4fa8f085bb366c1c5a6ffffd2c5b347f6c4eac5 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Feb 2018 07:37:32 -0500 Subject: [PATCH 1/7] Functions to Item class copy functions to Item class --- src/Model/Item.php | 110 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/src/Model/Item.php b/src/Model/Item.php index e7db218ed..8f630d9bd 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1872,4 +1872,114 @@ EOT; return true; } + + function add_thread($itemid, $onlyshadow = false) { + $items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, + `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`, + `deleted`, `origin`, `forum_mode`, `mention`, `network`, `author-id`, `owner-id` + FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid)); + + if (!$items) + return; + + $item = $items[0]; + $item['iid'] = $itemid; + + if (!$onlyshadow) { + $result = dba::insert('thread', $item); + + logger("Add thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG); + } + } + + function update_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) { + update_thread($message["id"]); + } + } + } + + function update_thread($itemid, $setmention = false) { + $items = q("SELECT `uid`, `guid`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`, + `deleted`, `origin`, `forum_mode`, `network`, `rendered-html`, `rendered-hash` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid)); + + if (!DBM::is_result($items)) { + return; + } + + $item = $items[0]; + + if ($setmention) { + $item["mention"] = 1; + } + + $sql = ""; + + foreach ($item AS $field => $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); + } + } + } } From 7ffcb25321ce9b8517669c461fe58d90ad6d7ec6 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Feb 2018 07:47:06 -0500 Subject: [PATCH 2/7] Update function names and calls update function names and calls from other files --- mod/photos.php | 8 ++++---- mod/starred.php | 7 +++++-- mod/videos.php | 3 ++- src/Model/Item.php | 28 ++++++++++++++-------------- src/Protocol/DFRN.php | 6 +++--- src/Protocol/Diaspora.php | 2 +- src/Protocol/OStatus.php | 2 +- 7 files changed, 30 insertions(+), 26 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index 6742497ac..e1116c346 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -297,7 +297,7 @@ function photos_post(App $a) intval($page_owner_uid) ); Term::insertFromTagFieldByItemUri($rr['parent-uri'], $page_owner_uid); - delete_thread_uri($rr['parent-uri'], $page_owner_uid); + Item::deleteThreadFromUri($rr['parent-uri'], $page_owner_uid); $drop_id = intval($rr['id']); @@ -371,7 +371,7 @@ function photos_post(App $a) intval($page_owner_uid) ); Term::insertFromTagFieldByItemUri($i[0]['uri'], $page_owner_uid); - delete_thread_uri($i[0]['uri'], $page_owner_uid); + Item::deleteThreadFromUri($i[0]['uri'], $page_owner_uid); $url = System::baseUrl(); $drop_id = intval($i[0]['id']); @@ -656,7 +656,7 @@ function photos_post(App $a) intval($page_owner_uid) ); Term::insertFromTagFieldByItemId($item_id); - update_thread($item_id); + Item::updateThread($item_id); $best = 0; foreach ($p as $scales) { @@ -1432,7 +1432,7 @@ function photos_content(App $a) intval($link_item['parent']), intval(local_user()) ); - update_thread($link_item['parent']); + Item::updateThread($link_item['parent']); } if ($link_item['coord']) { diff --git a/mod/starred.php b/mod/starred.php index 5cd9c0fe1..364d5c595 100644 --- a/mod/starred.php +++ b/mod/starred.php @@ -1,8 +1,11 @@ PRIORITY_HIGH, 'dont_fork' => true], 'Notifier', 'tgroup', $item_id); @@ -1873,7 +1873,7 @@ EOT; return true; } - function add_thread($itemid, $onlyshadow = false) { + private static function addThread($itemid, $onlyshadow = false) { $items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`, `deleted`, `origin`, `forum_mode`, `mention`, `network`, `author-id`, `owner-id` @@ -1892,17 +1892,17 @@ EOT; } } - function update_thread_uri($itemuri, $uid) { + public static function updateThreadFromUri($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) { - update_thread($message["id"]); + self::updateThread($message["id"]); } } } - function update_thread($itemid, $setmention = false) { + public static function updateThread($itemid, $setmention = false) { $items = q("SELECT `uid`, `guid`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`, `deleted`, `origin`, `forum_mode`, `network`, `rendered-html`, `rendered-hash` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid)); @@ -1948,17 +1948,17 @@ EOT; 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) { + public static function deleteThreadFromUri($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); + self::deleteThread($message["id"], $itemuri); } } } - function delete_thread($itemid, $itemuri = "") { + public static function deleteThread($itemid, $itemuri = "") { $item = q("SELECT `uid` FROM `thread` WHERE `iid` = %d", intval($itemid)); if (!DBM::is_result($item)) { @@ -1969,7 +1969,7 @@ EOT; // 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); + logger("deleteThread: 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))", @@ -1978,7 +1978,7 @@ EOT; ); if (!DBM::is_result($r)) { dba::delete('item', ['uri' => $itemuri, 'uid' => 0]); - logger("delete_thread: Deleted shadow for item ".$itemuri, LOGGER_DEBUG); + logger("deleteThread: Deleted shadow for item ".$itemuri, LOGGER_DEBUG); } } } diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index a9c5f04d3..d4ad34562 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -2092,7 +2092,7 @@ class DFRN dba::update('item', $fields, $condition); Term::insertFromTagFieldByItemUri($item["uri"], $importer["importer_uid"]); - update_thread_uri($item["uri"], $importer["importer_uid"]); + Item::updateThreadFromUri($item["uri"], $importer["importer_uid"]); $changed = true; @@ -2841,7 +2841,7 @@ class DFRN ); Term::insertFromTagFieldByItemUri($uri, $importer["uid"]); Term::insertFromFileFieldByItemUri($uri, $importer["uid"]); - update_thread_uri($uri, $importer["uid"]); + Item::updateThreadFromUri($uri, $importer["uid"]); } else { $r = q( "UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s', @@ -2854,7 +2854,7 @@ class DFRN ); Term::insertFromTagFieldByItemUri($uri, $importer["uid"]); Term::insertFromFileFieldByItemUri($uri, $importer["uid"]); - update_thread_uri($uri, $importer["importer_uid"]); + Item::updateThreadFromUri($uri, $importer["importer_uid"]); // if this is a relayed delete, propagate it to other recipients diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index bd66f487a..2b5905c95 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -2857,7 +2857,7 @@ class Diaspora // Delete the thread - if it is a starting post and not a comment if ($target_type != 'Comment') { - delete_thread($item["id"], $item["parent-uri"]); + Item::deleteThread($item["id"], $item["parent-uri"]); } logger("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], LOGGER_DEBUG); diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index e4894cf54..d6d6bd152 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -562,7 +562,7 @@ class OStatus ['id' => $deleted["id"]] ); - delete_thread($deleted["id"], $deleted["parent-uri"]); + Item::deleteThread($deleted["id"], $deleted["parent-uri"]); logger('Deleted item with uri '.$item['uri'].' for user '.$item['uid']); } From 4be49e706b3c09566a32972c981f9d0d0aa64518 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Feb 2018 07:48:42 -0500 Subject: [PATCH 3/7] Remove requires remove require_once for old file --- include/items.php | 1 - mod/starred.php | 3 --- src/Protocol/DFRN.php | 1 - src/Protocol/OStatus.php | 1 - 4 files changed, 6 deletions(-) diff --git a/include/items.php b/include/items.php index 56c834e44..6d7391257 100644 --- a/include/items.php +++ b/include/items.php @@ -21,7 +21,6 @@ use Friendica\Util\Temporal; require_once 'include/bbcode.php'; require_once 'include/text.php'; -require_once 'include/threads.php'; require_once 'mod/share.php'; require_once 'include/enotify.php'; diff --git a/mod/starred.php b/mod/starred.php index 364d5c595..5338b6c1d 100644 --- a/mod/starred.php +++ b/mod/starred.php @@ -8,9 +8,6 @@ use Friendica\Database\DBM; use Friendica\Model\Item; function starred_init(App $a) { - - require_once("include/threads.php"); - $starred = 0; if (! local_user()) { diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index d4ad34562..423f87aa9 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -40,7 +40,6 @@ use HTMLPurifier_Config; require_once 'boot.php'; require_once 'include/dba.php'; require_once "include/enotify.php"; -require_once "include/threads.php"; require_once "include/items.php"; require_once "include/event.php"; require_once "include/text.php"; diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index d6d6bd152..8688b5a7f 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -25,7 +25,6 @@ use DOMDocument; use DOMXPath; require_once 'include/dba.php'; -require_once 'include/threads.php'; require_once 'include/html2bbcode.php'; require_once 'include/bbcode.php'; require_once 'include/items.php'; From 8906b98426aadba1e3cfe0aafba863915ad50b34 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Feb 2018 07:49:06 -0500 Subject: [PATCH 4/7] 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 61bc5292f..000000000 --- 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); - } - } -} From 992836e2615f549970b1fd65a1bdc53b8be1181f Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Feb 2018 08:09:39 -0500 Subject: [PATCH 5/7] Some standards and dba update some calls to use dba functions and some standards updates --- src/Model/Item.php | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 1e1603ef6..f971f0788 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1873,14 +1873,16 @@ EOT; return true; } - private static function addThread($itemid, $onlyshadow = false) { + private static function addThread($itemid, $onlyshadow = false) + { $items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`, `deleted`, `origin`, `forum_mode`, `mention`, `network`, `author-id`, `owner-id` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid)); - if (!$items) + if (!$items) { return; + } $item = $items[0]; $item['iid'] = $itemid; @@ -1892,8 +1894,9 @@ EOT; } } - public static function updateThreadFromUri($itemuri, $uid) { - $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid)); + public static function updateThreadFromUri($itemuri, $uid) + { + $messages = dba::select('item', ['id'], ['uri' => $itemuri, 'uid' => $uid]); if (DBM::is_result($messages)) { foreach ($messages as $message) { @@ -1902,7 +1905,8 @@ EOT; } } - public static function updateThread($itemid, $setmention = false) { + public static function updateThread($itemid, $setmention = false) + { $items = q("SELECT `uid`, `guid`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`, `deleted`, `origin`, `forum_mode`, `network`, `rendered-html`, `rendered-hash` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid)); @@ -1918,7 +1922,7 @@ EOT; $sql = ""; - foreach ($item AS $field => $data) + foreach ($item as $field => $data) if (!in_array($field, ["guid", "title", "body", "rendered-html", "rendered-hash"])) { if ($sql != "") { $sql .= ", "; @@ -1932,24 +1936,24 @@ EOT; 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"])); + $items = dba::selectFirst('item', ['id'], ['guid' => $item['guid'], 'uid' => 0]); 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); + $result = dba::update( + 'item', + ['title' => $item['title'], 'body' => $item['body'], 'rendered-html' => $item['rendered-html'], 'rendered-hash' => $item['rendered-hash']], + ['id' => $items['id']] + ); + + logger("Updating public shadow for post ".$items["id"]." - guid ".$item["guid"]." Result: ".print_r($result, true), LOGGER_DEBUG); } - public static function deleteThreadFromUri($itemuri, $uid) { - $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid)); + public static function deleteThreadFromUri($itemuri, $uid) + { + $messages = dba::select('item', ['id'], ['uri' => $itemuri, 'uid' => $uid]); if (DBM::is_result($messages)) { foreach ($messages as $message) { @@ -1958,8 +1962,9 @@ EOT; } } - public static function deleteThread($itemid, $itemuri = "") { - $item = q("SELECT `uid` FROM `thread` WHERE `iid` = %d", intval($itemid)); + public static function deleteThread($itemid, $itemuri = "") + { + $item = dba::select('thread', ['uid'], ['iid' => $itemid]); if (!DBM::is_result($item)) { logger('No thread found for id '.$itemid, LOGGER_DEBUG); From db8ef98537a004e1d5f277e26f72949f96dbf87a Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Feb 2018 12:26:28 -0500 Subject: [PATCH 6/7] Rename functions rename functions from review comments --- mod/photos.php | 4 ++-- mod/videos.php | 2 +- src/Model/Item.php | 4 ++-- src/Protocol/DFRN.php | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index e1116c346..4c86d9101 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -297,7 +297,7 @@ function photos_post(App $a) intval($page_owner_uid) ); Term::insertFromTagFieldByItemUri($rr['parent-uri'], $page_owner_uid); - Item::deleteThreadFromUri($rr['parent-uri'], $page_owner_uid); + Item::deleteThreadByUri($rr['parent-uri'], $page_owner_uid); $drop_id = intval($rr['id']); @@ -371,7 +371,7 @@ function photos_post(App $a) intval($page_owner_uid) ); Term::insertFromTagFieldByItemUri($i[0]['uri'], $page_owner_uid); - Item::deleteThreadFromUri($i[0]['uri'], $page_owner_uid); + Item::deleteThreadByUri($i[0]['uri'], $page_owner_uid); $url = System::baseUrl(); $drop_id = intval($i[0]['id']); diff --git a/mod/videos.php b/mod/videos.php index 0f029f047..26a4e4cce 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -178,7 +178,7 @@ function videos_post(App $a) { intval(local_user()) ); Term::insertFromTagFieldByItemUri($i[0]['uri'], local_user()); - Item::deleteThreadFromUri($i[0]['uri'], local_user()); + Item::deleteThreadByUri($i[0]['uri'], local_user()); $url = System::baseUrl(); $drop_id = intval($i[0]['id']); diff --git a/src/Model/Item.php b/src/Model/Item.php index f971f0788..8c8ae48af 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1894,7 +1894,7 @@ EOT; } } - public static function updateThreadFromUri($itemuri, $uid) + public static function updateThreadByUri($itemuri, $uid) { $messages = dba::select('item', ['id'], ['uri' => $itemuri, 'uid' => $uid]); @@ -1951,7 +1951,7 @@ EOT; logger("Updating public shadow for post ".$items["id"]." - guid ".$item["guid"]." Result: ".print_r($result, true), LOGGER_DEBUG); } - public static function deleteThreadFromUri($itemuri, $uid) + public static function deleteThreadByUri($itemuri, $uid) { $messages = dba::select('item', ['id'], ['uri' => $itemuri, 'uid' => $uid]); diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 423f87aa9..2b3b9b0dc 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -2091,7 +2091,7 @@ class DFRN dba::update('item', $fields, $condition); Term::insertFromTagFieldByItemUri($item["uri"], $importer["importer_uid"]); - Item::updateThreadFromUri($item["uri"], $importer["importer_uid"]); + Item::updateThreadByUri($item["uri"], $importer["importer_uid"]); $changed = true; @@ -2840,7 +2840,7 @@ class DFRN ); Term::insertFromTagFieldByItemUri($uri, $importer["uid"]); Term::insertFromFileFieldByItemUri($uri, $importer["uid"]); - Item::updateThreadFromUri($uri, $importer["uid"]); + Item::updateThreadByUri($uri, $importer["uid"]); } else { $r = q( "UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s', @@ -2853,7 +2853,7 @@ class DFRN ); Term::insertFromTagFieldByItemUri($uri, $importer["uid"]); Term::insertFromFileFieldByItemUri($uri, $importer["uid"]); - Item::updateThreadFromUri($uri, $importer["importer_uid"]); + Item::updateThreadByUri($uri, $importer["importer_uid"]); // if this is a relayed delete, propagate it to other recipients From 4c93b592a591ff4821c6fd1cb16695379dfff2db Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Feb 2018 12:49:03 -0500 Subject: [PATCH 7/7] Rebase fix from rebase --- mod/item.php | 1 - mod/photos.php | 1 - src/Model/Item.php | 1 - 3 files changed, 3 deletions(-) diff --git a/mod/item.php b/mod/item.php index 76f166624..57f83ea5e 100644 --- a/mod/item.php +++ b/mod/item.php @@ -32,7 +32,6 @@ use Friendica\Util\DateTimeFormat; use Friendica\Util\Emailer; require_once 'include/enotify.php'; -require_once 'include/threads.php'; require_once 'include/text.php'; require_once 'include/items.php'; diff --git a/mod/photos.php b/mod/photos.php index 4c86d9101..7260bae9e 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -29,7 +29,6 @@ require_once 'include/items.php'; require_once 'include/acl_selectors.php'; require_once 'include/bbcode.php'; require_once 'include/security.php'; -require_once 'include/threads.php'; function photos_init(App $a) { diff --git a/src/Model/Item.php b/src/Model/Item.php index 8c8ae48af..b0bf3fedf 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -27,7 +27,6 @@ use dba; use Text_LanguageDetect; require_once 'boot.php'; -require_once 'include/threads.php'; require_once 'include/items.php'; require_once 'include/text.php';