Rename Model\Term methods

This commit is contained in:
Hypolite Petovan 2018-02-04 16:48:50 -05:00
parent ef77a772e5
commit 2a5431a59e
6 changed files with 25 additions and 25 deletions

View file

@ -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),

View file

@ -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;

View file

@ -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();

View file

@ -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);

View file

@ -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"]);
}
}
}

View file

@ -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