The overloaded DB_DataObject function staticGet is now called getKV

I used this hacky sed-command (run it from your GNU Social root, or change the first grep's path to where it actually lies) to do a rough fix on all ::staticGet calls and rename them to ::getKV

   sed -i -s -e '/DataObject::staticGet/I!s/::staticGet/::getKV/Ig' $(grep -R ::staticGet `pwd`/* | grep -v -e '^extlib' | grep -v DataObject:: |grep -v "function staticGet"|cut -d: -f1 |sort |uniq)

If you're applying this, remember to change the Managed_DataObject and Memcached_DataObject function definitions of staticGet to getKV!

This might of course take some getting used to, or modification fo StatusNet plugins, but the result is that all the static calls (to staticGet) are now properly made without breaking PHP Strict Standards. Standards are there to be followed (and they caused some very bad confusion when used with get_called_class)

Reasonably any plugin or code that tests for the definition of 'GNUSOCIAL' or similar will take this change into consideration.
This commit is contained in:
Mikael Nordfeldth
2013-08-18 13:04:58 +02:00
parent e95f77d34c
commit 2a4dc77a63
346 changed files with 898 additions and 897 deletions

View File

@@ -600,7 +600,7 @@ class OStatusPlugin extends Plugin
*/
function onStartFeedSubReceive($feedsub, $feed)
{
$oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
$oprofile = Ostatus_profile::getKV('feeduri', $feedsub->uri);
if ($oprofile) {
$oprofile->processFeed($feed, 'push');
} else {
@@ -619,7 +619,7 @@ class OStatusPlugin extends Plugin
*/
function onFeedSubSubscriberCount($feedsub, &$count)
{
$oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
$oprofile = Ostatus_profile::getKV('feeduri', $feedsub->uri);
if ($oprofile) {
$count += $oprofile->subscriberCount();
}
@@ -642,13 +642,13 @@ class OStatusPlugin extends Plugin
*/
function onStartSubscribe($subscriber, $other)
{
$user = User::staticGet('id', $subscriber->id);
$user = User::getKV('id', $subscriber->id);
if (empty($user)) {
return true;
}
$oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
$oprofile = Ostatus_profile::getKV('profile_id', $other->id);
if (empty($oprofile)) {
return true;
@@ -673,13 +673,13 @@ class OStatusPlugin extends Plugin
*/
function onEndSubscribe($subscriber, $other)
{
$user = User::staticGet('id', $subscriber->id);
$user = User::getKV('id', $subscriber->id);
if (empty($user)) {
return true;
}
$oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
$oprofile = Ostatus_profile::getKV('profile_id', $other->id);
if (empty($oprofile)) {
return true;
@@ -705,13 +705,13 @@ class OStatusPlugin extends Plugin
*/
function onEndUnsubscribe($profile, $other)
{
$user = User::staticGet('id', $profile->id);
$user = User::getKV('id', $profile->id);
if (empty($user)) {
return true;
}
$oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
$oprofile = Ostatus_profile::getKV('profile_id', $other->id);
if (empty($oprofile)) {
return true;
@@ -758,7 +758,7 @@ class OStatusPlugin extends Plugin
*/
function onStartJoinGroup($group, $profile)
{
$oprofile = Ostatus_profile::staticGet('group_id', $group->id);
$oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
if (!$oprofile->subscribe()) {
// TRANS: Exception thrown when setup of remote group membership fails.
@@ -813,7 +813,7 @@ class OStatusPlugin extends Plugin
*/
function onEndLeaveGroup($group, $profile)
{
$oprofile = Ostatus_profile::staticGet('group_id', $group->id);
$oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
// Drop the PuSH subscription if there are no other subscribers.
$oprofile->garbageCollect();
@@ -856,7 +856,7 @@ class OStatusPlugin extends Plugin
function onStartSubscribePeopletag($peopletag, $user)
{
$oprofile = Ostatus_profile::staticGet('peopletag_id', $peopletag->id);
$oprofile = Ostatus_profile::getKV('peopletag_id', $peopletag->id);
if ($oprofile) {
if (!$oprofile->subscribe()) {
// TRANS: Exception thrown when setup of remote list subscription fails.
@@ -864,7 +864,7 @@ class OStatusPlugin extends Plugin
}
$sub = $user->getProfile();
$tagger = Profile::staticGet($peopletag->tagger);
$tagger = Profile::getKV($peopletag->tagger);
$act = new Activity();
$act->id = TagURI::mint('subscribe_peopletag:%d:%d:%s',
@@ -908,13 +908,13 @@ class OStatusPlugin extends Plugin
function onEndUnsubscribePeopletag($peopletag, $user)
{
$oprofile = Ostatus_profile::staticGet('peopletag_id', $peopletag->id);
$oprofile = Ostatus_profile::getKV('peopletag_id', $peopletag->id);
if ($oprofile) {
// Drop the PuSH subscription if there are no other subscribers.
$oprofile->garbageCollect();
$sub = Profile::staticGet($user->id);
$tagger = Profile::staticGet($peopletag->tagger);
$sub = Profile::getKV($user->id);
$tagger = Profile::getKV($peopletag->tagger);
$act = new Activity();
$act->id = TagURI::mint('unsubscribe_peopletag:%d:%d:%s',
@@ -949,13 +949,13 @@ class OStatusPlugin extends Plugin
*/
function onEndFavorNotice(Profile $profile, Notice $notice)
{
$user = User::staticGet('id', $profile->id);
$user = User::getKV('id', $profile->id);
if (empty($user)) {
return true;
}
$oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
$oprofile = Ostatus_profile::getKV('profile_id', $notice->profile_id);
if (empty($oprofile)) {
return true;
@@ -986,7 +986,7 @@ class OStatusPlugin extends Plugin
*/
function onEndTagProfile($ptag)
{
$oprofile = Ostatus_profile::staticGet('profile_id', $ptag->tagged);
$oprofile = Ostatus_profile::getKV('profile_id', $ptag->tagged);
if (empty($oprofile)) {
return true;
@@ -1000,7 +1000,7 @@ class OStatusPlugin extends Plugin
$act = new Activity();
$tagger = $plist->getTagger();
$tagged = Profile::staticGet('id', $ptag->tagged);
$tagged = Profile::getKV('id', $ptag->tagged);
$act->verb = ActivityVerb::TAG;
$act->id = TagURI::mint('tag_profile:%d:%d:%s',
@@ -1043,7 +1043,7 @@ class OStatusPlugin extends Plugin
*/
function onEndUntagProfile($ptag)
{
$oprofile = Ostatus_profile::staticGet('profile_id', $ptag->tagged);
$oprofile = Ostatus_profile::getKV('profile_id', $ptag->tagged);
if (empty($oprofile)) {
return true;
@@ -1057,7 +1057,7 @@ class OStatusPlugin extends Plugin
$act = new Activity();
$tagger = $plist->getTagger();
$tagged = Profile::staticGet('id', $ptag->tagged);
$tagged = Profile::getKV('id', $ptag->tagged);
$act->verb = ActivityVerb::UNTAG;
$act->id = TagURI::mint('untag_profile:%d:%d:%s',
@@ -1095,13 +1095,13 @@ class OStatusPlugin extends Plugin
*/
function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
$user = User::staticGet('id', $profile->id);
$user = User::getKV('id', $profile->id);
if (empty($user)) {
return true;
}
$oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
$oprofile = Ostatus_profile::getKV('profile_id', $notice->profile_id);
if (empty($oprofile)) {
return true;
@@ -1133,7 +1133,7 @@ class OStatusPlugin extends Plugin
function onStartGetProfileUri($profile, &$uri)
{
$oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
$oprofile = Ostatus_profile::getKV('profile_id', $profile->id);
if (!empty($oprofile)) {
$uri = $oprofile->uri;
return false;
@@ -1148,7 +1148,7 @@ class OStatusPlugin extends Plugin
function onStartUserGroupPermalink($group, &$url)
{
$oprofile = Ostatus_profile::staticGet('group_id', $group->id);
$oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
// @fixme this should probably be in the user_group table
// @fixme this uri not guaranteed to be a profile page
@@ -1207,7 +1207,7 @@ class OStatusPlugin extends Plugin
*/
function onEndBroadcastProfile(Profile $profile)
{
$user = User::staticGet('id', $profile->id);
$user = User::getKV('id', $profile->id);
// Find foreign accounts I'm subscribed to that support Salmon pings.
//
@@ -1255,7 +1255,7 @@ class OStatusPlugin extends Plugin
{
if (!common_logged_in()) {
$profileUser = User::staticGet('id', $item->profile->id);
$profileUser = User::getKV('id', $item->profile->id);
if (!empty($profileUser)) {
@@ -1312,9 +1312,9 @@ class OStatusPlugin extends Plugin
*/
public static function localGroupFromUrl($url)
{
$group = User_group::staticGet('uri', $url);
$group = User_group::getKV('uri', $url);
if ($group) {
$local = Local_group::staticGet('group_id', $group->id);
$local = Local_group::getKV('group_id', $group->id);
if ($local) {
return $group->id;
}
@@ -1334,7 +1334,7 @@ class OStatusPlugin extends Plugin
public function onStartProfileGetAtomFeed($profile, &$feed)
{
$oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
$oprofile = Ostatus_profile::getKV('profile_id', $profile->id);
if (empty($oprofile)) {
return true;
@@ -1349,7 +1349,7 @@ class OStatusPlugin extends Plugin
// Don't want to do Web-based discovery on our own server,
// so we check locally first.
$user = User::staticGet('uri', $uri);
$user = User::getKV('uri', $uri);
if (!empty($user)) {
$profile = $user->getProfile();
@@ -1392,7 +1392,7 @@ class OStatusPlugin extends Plugin
'href' => $salmon_url);
// Get this user's keypair
$magickey = Magicsig::staticGet('user_id', $user->id);
$magickey = Magicsig::getKV('user_id', $user->id);
if (!$magickey) {
// No keypair yet, let's generate one.
$magickey = new Magicsig();

View File

@@ -40,7 +40,7 @@ class GroupsalmonAction extends SalmonAction
$this->clientError(_m('No ID.'));
}
$this->group = User_group::staticGet('id', $id);
$this->group = User_group::getKV('id', $id);
if (empty($this->group)) {
// TRANS: Client error.
@@ -50,7 +50,7 @@ class GroupsalmonAction extends SalmonAction
$this->target = $this->group;
$oprofile = Ostatus_profile::staticGet('group_id', $id);
$oprofile = Ostatus_profile::getKV('group_id', $id);
if ($oprofile) {
// TRANS: Client error.
$this->clientError(_m('Cannot accept remote posts for a remote group.'));

View File

@@ -214,7 +214,7 @@ class OStatusInitAction extends Action
function targetProfile()
{
if ($this->nickname) {
$user = User::staticGet('nickname', $this->nickname);
$user = User::getKV('nickname', $this->nickname);
if ($user) {
return common_local_url('userbyid', array('id' => $user->id));
} else {
@@ -222,7 +222,7 @@ class OStatusInitAction extends Action
$this->clientError(_m('No such user.'));
}
} else if ($this->group) {
$group = Local_group::staticGet('nickname', $this->group);
$group = Local_group::getKV('nickname', $this->group);
if ($group) {
return common_local_url('groupbyid', array('id' => $group->group_id));
} else {
@@ -230,7 +230,7 @@ class OStatusInitAction extends Action
$this->clientError(_m('No such group.'));
}
} else if ($this->peopletag && $this->tagger) {
$user = User::staticGet('nickname', $this->tagger);
$user = User::getKV('nickname', $this->tagger);
if (empty($user)) {
// TRANS: Client error.
$this->clientError(_m('No such user.'));

View File

@@ -40,14 +40,14 @@ class PeopletagsalmonAction extends SalmonAction
$this->clientError(_m('No ID.'));
}
$this->peopletag = Profile_list::staticGet('id', $id);
$this->peopletag = Profile_list::getKV('id', $id);
if (empty($this->peopletag)) {
// TRANS: Client error displayed when referring to a non-existing list.
$this->clientError(_m('No such list.'));
}
$oprofile = Ostatus_profile::staticGet('peopletag_id', $id);
$oprofile = Ostatus_profile::getKV('peopletag_id', $id);
if (!empty($oprofile)) {
// TRANS: Client error displayed when trying to send a message to a remote list.

View File

@@ -51,7 +51,7 @@ class PushCallbackAction extends Action
throw new ServerException(_m('Empty or invalid feed id.'), 400);
}
$feedsub = FeedSub::staticGet('id', $feedid);
$feedsub = FeedSub::getKV('id', $feedid);
if (!$feedsub) {
// TRANS: Server exception. %s is a feed ID.
throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400);
@@ -91,7 +91,7 @@ class PushCallbackAction extends Action
throw new ClientException(sprintf(_m('Bad hub.mode "$s".',$mode)), 404);
}
$feedsub = FeedSub::staticGet('uri', $topic);
$feedsub = FeedSub::getKV('uri', $topic);
if (!$feedsub) {
// TRANS: Client exception. %s is an invalid feed name.
throw new ClientException(sprintf(_m('Bad hub.topic feed "%s".'),$topic), 404);

View File

@@ -109,7 +109,7 @@ class PushHubAction extends Action
throw new ClientException(sprintf(_m('Invalid hub.secret "%s". It must be under 200 bytes.'),$secret));
}
$sub = HubSub::staticGet($topic, $callback);
$sub = HubSub::getKV($topic, $callback);
if (!$sub) {
// Creating a new one!
$sub = new HubSub();
@@ -155,7 +155,7 @@ class PushHubAction extends Action
$groupFeed = common_local_url('ApiTimelineGroup', $params);
if ($feed == $userFeed) {
$user = User::staticGet('id', $id);
$user = User::getKV('id', $id);
if (!$user) {
// TRANS: Client exception. %s is a feed URL.
throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User does not exist.'),$feed));
@@ -164,7 +164,7 @@ class PushHubAction extends Action
}
}
if ($feed == $groupFeed) {
$user = User_group::staticGet('id', $id);
$user = User_group::getKV('id', $id);
if (!$user) {
// TRANS: Client exception. %s is a feed URL.
throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group does not exist.'),$feed));
@@ -179,8 +179,8 @@ class PushHubAction extends Action
$listFeed = common_local_url('ApiTimelineList', $params);
if ($feed == $listFeed) {
$list = Profile_list::staticGet('id', $id);
$user = User::staticGet('id', $user);
$list = Profile_list::getKV('id', $id);
$user = User::getKV('id', $user);
if (!$list || !$user || $list->tagger != $user->id) {
// TRANS: Client exception. %s is a feed URL.
throw new ClientException(sprintf(_m('Invalid hub.topic %s; list does not exist.'),$feed));
@@ -221,6 +221,6 @@ class PushHubAction extends Action
*/
protected function getSub($feed, $callback)
{
return HubSub::staticGet($feed, $callback);
return HubSub::getKV($feed, $callback);
}
}

View File

@@ -38,7 +38,7 @@ class UsersalmonAction extends SalmonAction
$this->clientError(_m('No ID.'));
}
$this->user = User::staticGet('id', $id);
$this->user = User::getKV('id', $id);
if (empty($this->user)) {
// TRANS: Client error displayed when referring to a non-existing user.
@@ -80,7 +80,7 @@ class UsersalmonAction extends SalmonAction
$context = $this->activity->context;
if (!empty($context->replyToID)) {
$notice = Notice::staticGet('uri', $context->replyToID);
$notice = Notice::getKV('uri', $context->replyToID);
if (empty($notice)) {
// TRANS: Client exception.
throw new ClientException(_m('In reply to unknown notice.'));
@@ -102,7 +102,7 @@ class UsersalmonAction extends SalmonAction
throw new ClientException(_m('Not to anyone in reply to anything.'));
}
$existing = Notice::staticGet('uri', $this->activity->objects[0]->id);
$existing = Notice::getKV('uri', $this->activity->objects[0]->id);
if (!empty($existing)) {
common_log(LOG_ERR, "Not saving notice '{$existing->uri}'; already exists.");
@@ -197,7 +197,7 @@ class UsersalmonAction extends SalmonAction
return false;
}
// this is a peopletag
$tagged = User::staticGet('uri', $this->activity->objects[0]->id);
$tagged = User::getKV('uri', $this->activity->objects[0]->id);
if (empty($tagged)) {
// TRANS: Client exception.
@@ -231,7 +231,7 @@ class UsersalmonAction extends SalmonAction
return false;
}
// this is a peopletag
$tagged = User::staticGet('uri', $this->activity->objects[0]->id);
$tagged = User::getKV('uri', $this->activity->objects[0]->id);
if (empty($tagged)) {
// TRANS: Client exception.
@@ -281,7 +281,7 @@ class UsersalmonAction extends SalmonAction
throw new ClientException(_m('Cannot handle that kind of object for liking/faving.'));
}
$notice = Notice::staticGet('uri', $object->id);
$notice = Notice::getKV('uri', $object->id);
if (empty($notice)) {
// TRANS: Client exception. %s is an object ID.

View File

@@ -170,7 +170,7 @@ class FeedSub extends Managed_DataObject
public function localProfile()
{
if ($this->profile_id) {
return Profile::staticGet('id', $this->profile_id);
return Profile::getKV('id', $this->profile_id);
}
return null;
}
@@ -182,7 +182,7 @@ class FeedSub extends Managed_DataObject
public function localGroup()
{
if ($this->group_id) {
return User_group::staticGet('id', $this->group_id);
return User_group::getKV('id', $this->group_id);
}
return null;
}
@@ -194,7 +194,7 @@ class FeedSub extends Managed_DataObject
*/
public static function ensureFeed($feeduri)
{
$current = self::staticGet('uri', $feeduri);
$current = self::getKV('uri', $feeduri);
if ($current) {
return $current;
}

View File

@@ -207,7 +207,7 @@ class HubSub extends Managed_DataObject
throw new ClientException(sprintf(_m('Hub subscriber verification returned HTTP %s.'),$status));
}
$old = HubSub::staticGet($this->topic, $this->callback);
$old = HubSub::getKV($this->topic, $this->callback);
if ($mode == 'subscribe') {
if ($old) {
$this->update($old);
@@ -293,7 +293,7 @@ class HubSub extends Managed_DataObject
// destroy the result data for the parent query.
// @fixme use clone() again when it's safe to copy an
// individual item from a multi-item query again.
$sub = HubSub::staticGet($this->topic, $this->callback);
$sub = HubSub::getKV($this->topic, $this->callback);
$data = array('sub' => $sub,
'atom' => $atom,
'retries' => $retries);

View File

@@ -83,7 +83,7 @@ class Ostatus_profile extends Managed_DataObject
public function localProfile()
{
if ($this->profile_id) {
return Profile::staticGet('id', $this->profile_id);
return Profile::getKV('id', $this->profile_id);
}
return null;
}
@@ -95,7 +95,7 @@ class Ostatus_profile extends Managed_DataObject
public function localGroup()
{
if ($this->group_id) {
return User_group::staticGet('id', $this->group_id);
return User_group::getKV('id', $this->group_id);
}
return null;
}
@@ -107,7 +107,7 @@ class Ostatus_profile extends Managed_DataObject
public function localPeopletag()
{
if ($this->peopletag_id) {
return Profile_list::staticGet('id', $this->peopletag_id);
return Profile_list::getKV('id', $this->peopletag_id);
}
return null;
}
@@ -228,7 +228,7 @@ class Ostatus_profile extends Managed_DataObject
*/
public function garbageCollect()
{
$feedsub = FeedSub::staticGet('uri', $this->feeduri);
$feedsub = FeedSub::getKV('uri', $this->feeduri);
return $feedsub->garbageCollect();
}
@@ -549,7 +549,7 @@ class Ostatus_profile extends Managed_DataObject
$sourceUri = $activity->id;
$dupe = Notice::staticGet('uri', $sourceUri);
$dupe = Notice::getKV('uri', $sourceUri);
if ($dupe) {
common_log(LOG_INFO, "OStatus: ignoring duplicate post: $sourceUri");
return $dupe;
@@ -651,7 +651,7 @@ class Ostatus_profile extends Managed_DataObject
// Maintain direct reply associations
// @todo FIXME: What about conversation ID?
if (!empty($activity->context->replyToID)) {
$orig = Notice::staticGet('uri',
$orig = Notice::getKV('uri',
$activity->context->replyToID);
if (!empty($orig)) {
$options['reply_to'] = $orig->id;
@@ -722,7 +722,7 @@ class Ostatus_profile extends Managed_DataObject
// protecting against duplicate saves. It isn't required to be a URL;
// tag: URIs for instance are found in Google Buzz feeds.
$sourceUri = $note->id;
$dupe = Notice::staticGet('uri', $sourceUri);
$dupe = Notice::getKV('uri', $sourceUri);
if ($dupe) {
common_log(LOG_INFO, "OStatus: ignoring duplicate post: $sourceUri");
return $dupe;
@@ -821,7 +821,7 @@ class Ostatus_profile extends Managed_DataObject
// Maintain direct reply associations
// @todo FIXME: What about conversation ID?
if (!empty($activity->context->replyToID)) {
$orig = Notice::staticGet('uri',
$orig = Notice::getKV('uri',
$activity->context->replyToID);
if (!empty($orig)) {
$options['reply_to'] = $orig->id;
@@ -902,7 +902,7 @@ class Ostatus_profile extends Managed_DataObject
$replies = array();
foreach (array_unique($attention_uris) as $recipient) {
// Is the recipient a local user?
$user = User::staticGet('uri', $recipient);
$user = User::getKV('uri', $recipient);
if ($user) {
// @todo FIXME: Sender verification, spam etc?
$replies[] = $recipient;
@@ -910,10 +910,10 @@ class Ostatus_profile extends Managed_DataObject
}
// Is the recipient a local group?
// $group = User_group::staticGet('uri', $recipient);
// $group = User_group::getKV('uri', $recipient);
$id = OStatusPlugin::localGroupFromUrl($recipient);
if ($id) {
$group = User_group::staticGet('id', $id);
$group = User_group::getKV('id', $id);
if ($group) {
// Deliver to all members of this local group if allowed.
$profile = $sender->localProfile();
@@ -1052,7 +1052,7 @@ class Ostatus_profile extends Managed_DataObject
*/
static function getFromProfileURL($profile_url)
{
$profile = Profile::staticGet('profileurl', $profile_url);
$profile = Profile::getKV('profileurl', $profile_url);
if (empty($profile)) {
return null;
@@ -1060,7 +1060,7 @@ class Ostatus_profile extends Managed_DataObject
// Is it a known Ostatus profile?
$oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
$oprofile = Ostatus_profile::getKV('profile_id', $profile->id);
if (!empty($oprofile)) {
return $oprofile;
@@ -1068,7 +1068,7 @@ class Ostatus_profile extends Managed_DataObject
// Is it a local user?
$user = User::staticGet('id', $profile->id);
$user = User::getKV('id', $profile->id);
if (!empty($user)) {
// @todo i18n FIXME: use sprintf and add i18n (?)
@@ -1392,7 +1392,7 @@ class Ostatus_profile extends Managed_DataObject
protected static function getActivityObjectProfile($object)
{
$uri = self::getActivityObjectProfileURI($object);
return Ostatus_profile::staticGet('uri', $uri);
return Ostatus_profile::getKV('uri', $uri);
}
/**
@@ -1448,7 +1448,7 @@ class Ostatus_profile extends Managed_DataObject
throw new Exception(_m('No profile URI.'));
}
$user = User::staticGet('uri', $homeuri);
$user = User::getKV('uri', $homeuri);
if ($user) {
// TRANS: Exception.
throw new Exception(_m('Local user cannot be referenced as remote.'));
@@ -1459,9 +1459,9 @@ class Ostatus_profile extends Managed_DataObject
throw new Exception(_m('Local group cannot be referenced as remote.'));
}
$ptag = Profile_list::staticGet('uri', $homeuri);
$ptag = Profile_list::getKV('uri', $homeuri);
if ($ptag) {
$local_user = User::staticGet('id', $ptag->tagger);
$local_user = User::getKV('id', $ptag->tagger);
if (!empty($local_user)) {
// TRANS: Exception.
throw new Exception(_m('Local list cannot be referenced as remote.'));
@@ -1862,14 +1862,14 @@ class Ostatus_profile extends Managed_DataObject
// TRANS: Exception.
throw new Exception(_m('Not a valid webfinger address.'));
}
$oprofile = Ostatus_profile::staticGet('uri', $uri);
$oprofile = Ostatus_profile::getKV('uri', $uri);
if (!empty($oprofile)) {
return $oprofile;
}
}
// Try looking it up
$oprofile = Ostatus_profile::staticGet('uri', 'acct:'.$addr);
$oprofile = Ostatus_profile::getKV('uri', 'acct:'.$addr);
if (!empty($oprofile)) {
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri);
@@ -2047,7 +2047,7 @@ class Ostatus_profile extends Managed_DataObject
// First, try to query it
$oprofile = Ostatus_profile::staticGet('uri', $uri);
$oprofile = Ostatus_profile::getKV('uri', $uri);
// If unfound, do discovery stuff

View File

@@ -65,7 +65,7 @@ class HubPrepQueueHandler extends QueueHandler
while (count($pushCallbacks) && $n < self::ROLLING_BATCH) {
$n++;
$callback = array_shift($pushCallbacks);
$sub = HubSub::staticGet($topic, $callback);
$sub = HubSub::getKV($topic, $callback);
if (!$sub) {
common_log(LOG_ERR, "Skipping PuSH delivery for deleted(?) consumer $callback on $topic");
continue;

View File

@@ -51,7 +51,7 @@ class OStatusQueueHandler extends QueueHandler
assert($notice instanceof Notice);
$this->notice = $notice;
$this->user = User::staticGet('id', $notice->profile_id);
$this->user = User::getKV('id', $notice->profile_id);
try {
$profile = $this->notice->getProfile();
@@ -63,7 +63,7 @@ class OStatusQueueHandler extends QueueHandler
$this->pushUser();
foreach ($notice->getGroups() as $group) {
$oprofile = Ostatus_profile::staticGet('group_id', $group->id);
$oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
$this->pingReply($oprofile);
} else {
@@ -72,17 +72,17 @@ class OStatusQueueHandler extends QueueHandler
}
foreach ($notice->getReplies() as $profile_id) {
$oprofile = Ostatus_profile::staticGet('profile_id', $profile_id);
$oprofile = Ostatus_profile::getKV('profile_id', $profile_id);
if ($oprofile) {
$this->pingReply($oprofile);
}
}
if (!empty($this->notice->reply_to)) {
$replyTo = Notice::staticGet('id', $this->notice->reply_to);
$replyTo = Notice::getKV('id', $this->notice->reply_to);
if (!empty($replyTo)) {
foreach($replyTo->getReplies() as $profile_id) {
$oprofile = Ostatus_profile::staticGet('profile_id', $profile_id);
$oprofile = Ostatus_profile::getKV('profile_id', $profile_id);
if ($oprofile) {
$this->pingReply($oprofile);
}
@@ -91,7 +91,7 @@ class OStatusQueueHandler extends QueueHandler
}
foreach ($notice->getProfileTags() as $ptag) {
$oprofile = Ostatus_profile::staticGet('peopletag_id', $ptag->id);
$oprofile = Ostatus_profile::getKV('peopletag_id', $ptag->id);
if (!$oprofile) {
$this->pushPeopletag($ptag);
}
@@ -243,7 +243,7 @@ class OStatusQueueHandler extends QueueHandler
function groupFeedForNotice($group_id)
{
$group = User_group::staticGet('id', $group_id);
$group = User_group::getKV('id', $group_id);
$atom = new AtomGroupNoticeFeed($group);
$atom->addEntryFromNotice($this->notice);

View File

@@ -41,7 +41,7 @@ class PushInQueueHandler extends QueueHandler
$post = $data['post'];
$hmac = $data['hmac'];
$feedsub = FeedSub::staticGet('id', $feedsub_id);
$feedsub = FeedSub::getKV('id', $feedsub_id);
if ($feedsub) {
try {
$feedsub->receive($post, $hmac);

View File

@@ -112,10 +112,10 @@ class Salmon
{
$magic_env = new $class();
$user = User::staticGet('id', $actor->id);
$user = User::getKV('id', $actor->id);
if ($user->id) {
// Use local key
$magickey = Magicsig::staticGet('user_id', $user->id);
$magickey = Magicsig::getKV('user_id', $user->id);
if (!$magickey) {
// No keypair yet, let's generate one.
$magickey = new Magicsig();

View File

@@ -39,7 +39,7 @@ class SalmonQueueHandler extends QueueHandler
assert(is_string($data['salmonuri']));
assert(is_string($data['entry']));
$actor = Profile::staticGet($data['actor']);
$actor = Profile::getKV($data['actor']);
$salmon = new Salmon();
$salmon->post($data['salmonuri'], $data['entry'], $actor);

View File

@@ -101,7 +101,7 @@ class XrdAction extends Action
'href' => $salmon_url);
// Get this user's keypair
$magickey = Magicsig::staticGet('user_id', $this->user->id);
$magickey = Magicsig::getKV('user_id', $this->user->id);
if (!$magickey) {
// No keypair yet, let's generate one.
$magickey = new Magicsig();

View File

@@ -53,7 +53,7 @@ while ($user->fetch()) {
echo " - skipping\n";
} else {
echo " - removing bogus ostatus_profile entry...";
$evil = Ostatus_profile::staticGet('uri', $uri);
$evil = Ostatus_profile::getKV('uri', $uri);
$evil->delete();
echo " ok\n";
}
@@ -77,7 +77,7 @@ while ($group->fetch()) {
echo " - skipping\n";
} else {
echo " - removing bogus ostatus_profile entry...";
$evil = Ostatus_profile::staticGet('uri', $uri);
$evil = Ostatus_profile::getKV('uri', $uri);
$evil->delete();
echo " ok\n";
}
@@ -109,7 +109,7 @@ while ($group->fetch()) {
$uri = $group->uri;
if (preg_match('!/group/(\d+)/id!', $uri, $matches)) {
$id = intval($matches[1]);
$local = Local_group::staticGet('group_id', $id);
$local = Local_group::getKV('group_id', $id);
if ($local) {
$nick = $local->nickname;
} else {
@@ -120,7 +120,7 @@ while ($group->fetch()) {
echo " - skipping\n";
} else {
echo " - removing bogus user_group entry...";
$evil = User_group::staticGet('id', $group->id);
$evil = User_group::getKV('id', $group->id);
$evil->delete();
echo " ok\n";
}
@@ -155,7 +155,7 @@ while ($oprofile->fetch()) {
$uri = $oprofile->uri;
if (preg_match('!/group/(\d+)/id!', $oprofile->uri, $matches)) {
$id = intval($matches[1]);
$group = Local_group::staticGet('group_id', $id);
$group = Local_group::getKV('group_id', $id);
if ($group) {
$nick = $group->nickname;
} else {
@@ -164,7 +164,7 @@ while ($oprofile->fetch()) {
echo "group $id ($nick) hidden by $uri";
} else if (preg_match('!/user/(\d+)!', $uri, $matches)) {
$id = intval($matches[1]);
$user = User::staticGet('id', $id);
$user = User::getKV('id', $id);
if ($user) {
$nick = $user->nickname;
} else {

View File

@@ -44,7 +44,7 @@ if (empty($args[0]) || !Validate::uri($args[0])) {
$feedurl = $args[0];
$sub = FeedSub::staticGet('uri', $feedurl);
$sub = FeedSub::getKV('uri', $feedurl);
if (!$sub) {
print "Feed $feedurl is not subscribed.\n";
exit(1);
@@ -69,7 +69,7 @@ if ($ok) {
print "Could not confirm.\n";
}
$sub2 = FeedSub::staticGet('uri', $feedurl);
$sub2 = FeedSub::getKV('uri', $feedurl);
print "\n";
print "New state:\n";

View File

@@ -45,7 +45,7 @@ $skip = have_option('skip') ? intval(get_option_value('skip')) : 0;
$count = have_option('count') ? intval(get_option_value('count')) : 0;
$sub = FeedSub::staticGet('uri', $feedurl);
$sub = FeedSub::getKV('uri', $feedurl);
if (!$sub) {
print "Feed $feedurl is not subscribed.\n";
exit(1);

View File

@@ -51,7 +51,7 @@ function showProfileInfo($oprofile) {
}
function fixProfile($uri) {
$oprofile = Ostatus_profile::staticGet('uri', $uri);
$oprofile = Ostatus_profile::getKV('uri', $uri);
if (!$oprofile) {
print "No OStatus remote profile known for URI $uri\n";

View File

@@ -40,7 +40,7 @@ if (empty($args[0]) || !Validate::uri($args[0])) {
$uri = $args[0];
$oprofile = Ostatus_profile::staticGet('uri', $uri);
$oprofile = Ostatus_profile::getKV('uri', $uri);
if (!$oprofile) {
print "No OStatus remote profile known for URI $uri\n";
@@ -114,7 +114,7 @@ if ($ok) {
print "Could not confirm.\n";
}
$o2 = Ostatus_profile::staticGet('uri', $uri);
$o2 = Ostatus_profile::getKV('uri', $uri);
print "\n";
print "New profile state:\n";

View File

@@ -40,14 +40,14 @@ try {
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
$user = User::staticGet('id', $id);
$user = User::getKV('id', $id);
if (empty($user)) {
throw new Exception("Can't find user with id '$id'.");
}
updateOStatus($user);
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
$user = User::staticGet('nickname', $nickname);
$user = User::getKV('nickname', $nickname);
if (empty($user)) {
throw new Exception("Can't find user with nickname '$nickname'.");
}
@@ -86,7 +86,7 @@ function updateOStatus($user)
$rps = array();
while ($sp->fetch()) {
$remote = Remote_profile::staticGet('id', $sp->id);
$remote = Remote_profile::getKV('id', $sp->id);
if (!empty($remote)) {
$rps[] = clone($sp);

View File

@@ -43,7 +43,7 @@ if (!have_option('--notice')) {
$notice_id = get_option_value('--notice');
$notice = Notice::staticGet('id', $notice_id);
$notice = Notice::getKV('id', $notice_id);
$profile = $notice->getProfile();
$entry = $notice->asAtomEntry(true);