summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-09-01 17:05:11 -0400
committerEvan Prodromou <evan@status.net>2010-09-01 17:05:11 -0400
commitab88123373ce5f17b9e09ed2372f587e607cba20 (patch)
tree8c44690b10978e56081a53ff404839c8d7fa69d0 /plugins
parent974ac48771915406527b4f2e5670c7e7cb5aa314 (diff)
correctly return oprofile from Ostatus_profile::ensureProfileURI()
Diffstat (limited to 'plugins')
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php37
1 files changed, 23 insertions, 14 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index fe3946d24..787712874 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -1770,22 +1770,31 @@ class Ostatus_profile extends Memcached_DataObject
{
$oprofile = null;
- if (preg_match("/^(\w+)\:(.*)/", $uri, $match)) {
- $protocol = $match[1];
- switch ($protocol) {
- case 'http':
- case 'https':
- $oprofile = Ostatus_profile::ensureProfileURL($uri);
- break;
- case 'acct':
- case 'mailto':
- $rest = $match[2];
- $oprofile = Ostatus_profile::ensureWebfinger($rest);
- default:
- common_log("Unrecognized URI protocol for profile: $protocol ($uri)");
- break;
+ // First, try to query it
+
+ $oprofile = Ostatus_profile::staticGet('uri', $uri);
+
+ // If unfound, do discovery stuff
+
+ if (empty($oprofile)) {
+ if (preg_match("/^(\w+)\:(.*)/", $uri, $match)) {
+ $protocol = $match[1];
+ switch ($protocol) {
+ case 'http':
+ case 'https':
+ $oprofile = Ostatus_profile::ensureProfileURL($uri);
+ break;
+ case 'acct':
+ case 'mailto':
+ $rest = $match[2];
+ $oprofile = Ostatus_profile::ensureWebfinger($rest);
+ default:
+ common_log("Unrecognized URI protocol for profile: $protocol ($uri)");
+ break;
+ }
}
}
+ return $oprofile;
}
}