From: Hypolite Petovan Date: Sun, 4 Feb 2018 21:48:50 +0000 (-0500) Subject: Rename Model\Term methods X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2a5431a59e5f81c797ee2f949e9ebb52b2c9105a;p=friendica.git Rename Model\Term methods --- diff --git a/include/text.php b/include/text.php index 997371db2f..6c6927a78b 100644 --- a/include/text.php +++ b/include/text.php @@ -1901,7 +1901,7 @@ function file_tag_save_file($uid, $item, $file) ); } - Term::insertFromItemFileById($item); + Term::insertFromFileFieldByItemId($item); $saved = PConfig::get($uid, 'system', 'filetags'); if (!strlen($saved) || !stristr($saved, '[' . file_tag_encode($file) . ']')) { @@ -1940,7 +1940,7 @@ function file_tag_unsave_file($uid, $item, $file, $cat = false) intval($uid) ); - Term::insertFromItemFileById($item); + Term::insertFromFileFieldByItemId($item); $r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d", dbesc($file), diff --git a/mod/photos.php b/mod/photos.php index 6c717875ad..e86c7271a0 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -295,7 +295,7 @@ function photos_post(App $a) dbesc($rr['parent-uri']), intval($page_owner_uid) ); - Term::insertFromItemUri($rr['parent-uri'], $page_owner_uid); + Term::insertFromTagFieldByItemUri($rr['parent-uri'], $page_owner_uid); delete_thread_uri($rr['parent-uri'], $page_owner_uid); $drop_id = intval($rr['id']); @@ -369,7 +369,7 @@ function photos_post(App $a) dbesc($i[0]['uri']), intval($page_owner_uid) ); - Term::insertFromItemUri($i[0]['uri'], $page_owner_uid); + Term::insertFromTagFieldByItemUri($i[0]['uri'], $page_owner_uid); delete_thread_uri($i[0]['uri'], $page_owner_uid); $url = System::baseUrl(); @@ -654,7 +654,7 @@ function photos_post(App $a) intval($item_id), intval($page_owner_uid) ); - Term::insertFromItemId($item_id); + Term::insertFromTagFieldByItemId($item_id); update_thread($item_id); $best = 0; diff --git a/mod/videos.php b/mod/videos.php index 783fbc7506..7db81f6d20 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -176,7 +176,7 @@ function videos_post(App $a) { dbesc($i[0]['uri']), intval(local_user()) ); - Term::insertFromItemUri($i[0]['uri'], local_user()); + Term::insertFromTagFieldByItemUri($i[0]['uri'], local_user()); delete_thread_uri($i[0]['uri'], local_user()); $url = System::baseUrl(); diff --git a/src/Model/Item.php b/src/Model/Item.php index 2d1bad2462..e7db218eda 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -69,8 +69,8 @@ class Item extends BaseObject continue; } - Term::insertFromItemId($item['id']); - Term::insertFromItemFileById($item['id']); + Term::insertFromTagFieldByItemId($item['id']); + Term::insertFromFileFieldByItemId($item['id']); update_thread($item['id']); Worker::add(PRIORITY_HIGH, "Notifier", 'edit_post', $item['id']); @@ -151,8 +151,8 @@ class Item extends BaseObject 'edited' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow()], ['id' => $item['id']]); - Term::insertFromItemId($item['id']); - Term::insertFromItemFileById($item['id']); + Term::insertFromTagFieldByItemId($item['id']); + Term::insertFromFileFieldByItemId($item['id']); delete_thread($item['id'], $item['parent-uri']); // If it's the parent of a comment thread, kill all the kids @@ -790,8 +790,8 @@ class Item extends BaseObject * Due to deadlock issues with the "term" table we are doing these steps after the commit. * This is not perfect - but a workable solution until we found the reason for the problem. */ - Term::insertFromItemId($current_post); - Term::insertFromItemFileById($current_post); + Term::insertFromTagFieldByItemId($current_post); + Term::insertFromFileFieldByItemId($current_post); if ($arr['parent-uri'] === $arr['uri']) { self::addShadow($current_post); diff --git a/src/Model/Term.php b/src/Model/Term.php index 4ff59596da..c730bf7449 100644 --- a/src/Model/Term.php +++ b/src/Model/Term.php @@ -13,7 +13,7 @@ require_once 'include/dba.php'; class Term { - public static function insertFromItemId($itemid) + public static function insertFromTagFieldByItemId($itemid) { $profile_base = System::baseUrl(); $profile_data = parse_url($profile_base); @@ -122,13 +122,13 @@ class Term } } - public static function insertFromItemUri($itemuri, $uid) + public static function insertFromTagFieldByItemUri($itemuri, $uid) { $messages = dba::select('item', ['id'], ['uri' => $itemuri, 'uid' => $uid]); if (DBM::is_result($messages)) { while ($message = dba::fetch($messages)) { - self::insertFromItemId($message['id']); + self::insertFromTagFieldByItemId($message['id']); } dba::close($messages); } @@ -139,7 +139,7 @@ class Term * @param integer $itemid item id * @return void */ - public static function insertFromItemFileById($itemid) + public static function insertFromFileFieldByItemId($itemid) { $message = dba::selectFirst('item', ['uid', 'deleted', 'file'], ['id' => $itemid]); if (!DBM::is_result($message)) { @@ -187,13 +187,13 @@ class Term * @param integer $uid uid * @return void */ - public static function insertFromItemFileByUri($itemuri, $uid) + public static function insertFromFileFieldByItemUri($itemuri, $uid) { $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid)); if (count($messages)) { foreach ($messages as $message) { - self::insertFromItemFileById($message["id"]); + self::insertFromFileFieldByItemId($message["id"]); } } } diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 607a81b72d..a9c5f04d3e 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -2091,7 +2091,7 @@ class DFRN $condition = ["`uri` = ? AND `uid` IN (0, ?)", $item["uri"], $importer["importer_uid"]]; dba::update('item', $fields, $condition); - Term::insertFromItemUri($item["uri"], $importer["importer_uid"]); + Term::insertFromTagFieldByItemUri($item["uri"], $importer["importer_uid"]); update_thread_uri($item["uri"], $importer["importer_uid"]); $changed = true; @@ -2335,7 +2335,7 @@ class DFRN dbesc($r[0]["tag"] . (strlen($r[0]["tag"]) ? ',' : '') . '#[url=' . $xo->id . ']'. $xo->content . '[/url]'), intval($r[0]["id"]) ); - Term::insertFromItemId($r[0]["id"]); + Term::insertFromTagFieldByItemId($r[0]["id"]); } } } @@ -2823,7 +2823,7 @@ class DFRN dbesc(implode(',', $newtags)), intval($i[0]["id"]) ); - Term::insertFromItemId($i[0]["id"]); + Term::insertFromTagFieldByItemId($i[0]["id"]); } } } @@ -2839,8 +2839,8 @@ class DFRN dbesc($uri), intval($importer["uid"]) ); - Term::insertFromItemUri($uri, $importer["uid"]); - Term::insertFromItemFileByUri($uri, $importer["uid"]); + Term::insertFromTagFieldByItemUri($uri, $importer["uid"]); + Term::insertFromFileFieldByItemUri($uri, $importer["uid"]); update_thread_uri($uri, $importer["uid"]); } else { $r = q( @@ -2852,8 +2852,8 @@ class DFRN dbesc($uri), intval($importer["uid"]) ); - Term::insertFromItemUri($uri, $importer["uid"]); - Term::insertFromItemFileByUri($uri, $importer["uid"]); + Term::insertFromTagFieldByItemUri($uri, $importer["uid"]); + Term::insertFromFileFieldByItemUri($uri, $importer["uid"]); update_thread_uri($uri, $importer["importer_uid"]); // if this is a relayed delete, propagate it to other recipients