'type' => 'mention',
'text' => $target,
'position' => $pos,
- 'url' => $profile->profileurl);
+ 'url' => $profile->getUrl());
}
} catch (Exception $e) {
$this->log(LOG_ERR, "Webfinger check failed: " . $e->getMessage());
'type' => 'mention',
'text' => $target,
'position' => $pos,
- 'url' => $profile->profileurl);
+ 'url' => $profile->getUrl());
break;
}
} catch (Exception $e) {
}
// If we got a feed URL, try that
+ $feedUrl = null;
if (array_key_exists('feedurl', $hints)) {
+ $feedUrl = $hints['feedurl'];
try {
common_log(LOG_INFO, "Discovery on acct:$addr with feed URL " . $hints['feedurl']);
$oprofile = self::ensureFeedURL($hints['feedurl'], $hints);
}
// If we got a profile page, try that!
+ $profileUrl = null;
if (array_key_exists('profileurl', $hints)) {
+ $profileUrl = $hints['profileurl'];
try {
common_log(LOG_INFO, "Discovery on acct:$addr with profile URL $profileUrl");
$oprofile = self::ensureProfileURL($hints['profileurl'], $hints);
$profile->nickname = self::nicknameFromUri($uri);
$profile->created = common_sql_now();
- if (isset($profileUrl)) {
+ if (!is_null($profileUrl)) {
$profile->profileurl = $profileUrl;
}
$oprofile->profile_id = $profile_id;
$oprofile->created = common_sql_now();
- if (isset($feedUrl)) {
- $profile->feeduri = $feedUrl;
+ if (!is_null($feedUrl)) {
+ $oprofile->feeduri = $feedUrl;
}
$result = $oprofile->insert();
if ($result === false) {
+ $profile->delete();
common_log_db_error($oprofile, 'INSERT', __FILE__);
// TRANS: Exception. %s is a webfinger address.
throw new Exception(sprintf(_m('Could not save OStatus profile for "%s".'),$addr));