From c81e83c5008da66a945b02ca035f6d364b827367 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Tue, 9 Jan 2018 11:23:26 -0500 Subject: [PATCH] Review changes Update update and new functions to updateFromProbe and create. Update calls to renamed functions. --- mod/contacts.php | 4 ++-- mod/follow.php | 2 +- mod/ostatus_subscribe.php | 2 +- mod/repair_ostatus.php | 2 +- mod/salmon.php | 2 +- src/Model/Contact.php | 4 ++-- src/Worker/OnePoll.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mod/contacts.php b/mod/contacts.php index ea384fbefd..a2a734f758 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -242,7 +242,7 @@ function _contact_update($contact_id) $uid = $contact["uid"]; if ($r[0]["network"] == NETWORK_OSTATUS) { - $result = Contact::new($uid, $contact["url"], false, $contact["network"]); + $result = Contact::create($uid, $contact["url"], false, $contact["network"]); if ($result['success']) { q("UPDATE `contact` SET `subhub` = 1 WHERE `id` = %d", intval($contact_id)); @@ -274,7 +274,7 @@ function _contact_update_profile($contact_id) $update = array(); if ($data["network"] == NETWORK_OSTATUS) { - $result = Contact::new($uid, $data["url"], false); + $result = Contact::create($uid, $data["url"], false); if ($result['success']) { $update["subhub"] = true; diff --git a/mod/follow.php b/mod/follow.php index 1f5abccae0..58ebdf88ed 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -30,7 +30,7 @@ function follow_post(App $a) { // This is just a precaution if maybe this page is called somewhere directly via POST $_SESSION["fastlane"] = $url; - $result = Contact::new($uid, $url, true); + $result = Contact::create($uid, $url, true); if ($result['success'] == false) { if ($result['message']) { diff --git a/mod/ostatus_subscribe.php b/mod/ostatus_subscribe.php index cae042c672..0104c3ca1b 100644 --- a/mod/ostatus_subscribe.php +++ b/mod/ostatus_subscribe.php @@ -68,7 +68,7 @@ function ostatus_subscribe_content(App $a) { $data = Probe::uri($url); if ($data["network"] == NETWORK_OSTATUS) { - $result = Contact::new($uid, $url, true, NETWORK_OSTATUS); + $result = Contact::create($uid, $url, true, NETWORK_OSTATUS); if ($result["success"]) { $o .= " - ".t("success"); } else { diff --git a/mod/repair_ostatus.php b/mod/repair_ostatus.php index b3d5a402b5..5ac08890cd 100644 --- a/mod/repair_ostatus.php +++ b/mod/repair_ostatus.php @@ -52,7 +52,7 @@ function repair_ostatus_content(App $a) { $o .= "

".t("Keep this window open until done.")."

"; - $result = Contact::new($uid,$r[0]["url"],true); + $result = Contact::create($uid,$r[0]["url"],true); $a->page['htmlhead'] = ''; diff --git a/mod/salmon.php b/mod/salmon.php index 1cb118355b..9dddc0096d 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -164,7 +164,7 @@ function salmon_post(App $a) { if (! DBM::is_result($r)) { logger('mod-salmon: Author unknown to us.'); if(PConfig::get($importer['uid'],'system','ostatus_autofriend')) { - $result = Contact::new($importer['uid'], $author_link); + $result = Contact::create($importer['uid'], $author_link); if($result['success']) { $r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s') AND `uid` = %d LIMIT 1", diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 057a06a31d..1ab6d63ce8 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1016,7 +1016,7 @@ class Contact extends BaseObject * @param integer $id contact id * @return boolean */ - public static function update($id) + public static function updateFromProbe($id) { /* Warning: Never ever fetch the public key via Probe::uri and write it into the contacts. @@ -1089,7 +1089,7 @@ class Contact extends BaseObject * @param string $network * @return boolean|string */ - public static function add($uid, $url, $interactive = false, $network = '') + public static function create($uid, $url, $interactive = false, $network = '') { $result = array('cid' => -1, 'success' => false, 'message' => ''); diff --git a/src/Worker/OnePoll.php b/src/Worker/OnePoll.php index f175c4aa5c..a527bf0da1 100644 --- a/src/Worker/OnePoll.php +++ b/src/Worker/OnePoll.php @@ -117,7 +117,7 @@ Class OnePoll return; } - if (!Contact::update($contact["id"])) { + if (!Contact::updateFromProbe($contact["id"])) { Contact::markForArchival($contact); logger('Contact is marked dead');