diff --git a/actions/addpeopletag.php b/actions/addpeopletag.php index a661104d5c..e5e52b83f0 100644 --- a/actions/addpeopletag.php +++ b/actions/addpeopletag.php @@ -94,7 +94,7 @@ class AddpeopletagAction extends Action $tagged_id = $this->arg('tagged'); - $this->tagged = Profile::staticGet('id', $tagged_id); + $this->tagged = Profile::getKV('id', $tagged_id); if (empty($this->tagged)) { // TRANS: Client error displayed trying to perform an action related to a non-existing profile. @@ -103,7 +103,7 @@ class AddpeopletagAction extends Action } $id = $this->arg('peopletag_id'); - $this->peopletag = Profile_list::staticGet('id', $id); + $this->peopletag = Profile_list::getKV('id', $id); if (empty($this->peopletag)) { // TRANS: Client error displayed trying to reference a non-existing list. @@ -130,7 +130,7 @@ class AddpeopletagAction extends Action $this->peopletag->tag); if (!$ptag) { - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if ($user) { $this->clientError( // TRANS: Client error displayed when an unknown error occurs when adding a user to a list. diff --git a/actions/allrss.php b/actions/allrss.php index 6d82e551e7..90e6f7a86a 100644 --- a/actions/allrss.php +++ b/actions/allrss.php @@ -62,7 +62,7 @@ class AllrssAction extends Rss10Action { parent::prepare($args); $nickname = $this->trimmed('nickname'); - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error when user not found for an rss related action. diff --git a/actions/apiconversation.php b/actions/apiconversation.php index 504787b9a2..23ddf02c5d 100644 --- a/actions/apiconversation.php +++ b/actions/apiconversation.php @@ -69,7 +69,7 @@ class ApiconversationAction extends ApiAuthAction throw new ClientException(_('No conversation ID.')); } - $this->conversation = Conversation::staticGet('id', $convId); + $this->conversation = Conversation::getKV('id', $convId); if (empty($this->conversation)) { // TRANS: Client exception thrown when referring to a non-existing conversation ID (%d). diff --git a/actions/apifavoritecreate.php b/actions/apifavoritecreate.php index 3f639159cc..26e4325e65 100644 --- a/actions/apifavoritecreate.php +++ b/actions/apifavoritecreate.php @@ -64,12 +64,12 @@ class ApiFavoriteCreateAction extends ApiAuthAction parent::prepare($args); $this->user = $this->auth_user; - $this->notice = Notice::staticGet($this->arg('id')); + $this->notice = Notice::getKV($this->arg('id')); if ($this->notice->repeat_of != '' ) { common_log(LOG_DEBUG, 'Trying to Fave '.$this->notice->id.', repeat of '.$this->notice->repeat_of); common_log(LOG_DEBUG, 'Will Fave '.$this->notice->repeat_of.' instead'); $real_notice_id = $this->notice->repeat_of; - $this->notice = Notice::staticGet($real_notice_id); + $this->notice = Notice::getKV($real_notice_id); } return true; @@ -163,7 +163,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction */ function notify($fave, $notice, $user) { - $other = User::staticGet('id', $notice->profile_id); + $other = User::getKV('id', $notice->profile_id); if ($other && $other->id != $user->id) { if ($other->email && $other->emailnotifyfav) { mail_notify_fave($other, $user, $notice); diff --git a/actions/apifavoritedestroy.php b/actions/apifavoritedestroy.php index 59ca5c96df..af1b4075f6 100644 --- a/actions/apifavoritedestroy.php +++ b/actions/apifavoritedestroy.php @@ -64,12 +64,12 @@ class ApiFavoriteDestroyAction extends ApiAuthAction parent::prepare($args); $this->user = $this->auth_user; - $this->notice = Notice::staticGet($this->arg('id')); + $this->notice = Notice::getKV($this->arg('id')); if ($this->notice->repeat_of != '' ) { common_log(LOG_DEBUG, 'Trying to unFave '.$this->notice->id); common_log(LOG_DEBUG, 'Will unFave '.$this->notice->repeat_of.' instead'); $real_notice_id = $this->notice->repeat_of; - $this->notice = Notice::staticGet($real_notice_id); + $this->notice = Notice::getKV($real_notice_id); } return true; diff --git a/actions/apifriendshipsshow.php b/actions/apifriendshipsshow.php index 1eaca49f0e..bf7e7daf62 100644 --- a/actions/apifriendshipsshow.php +++ b/actions/apifriendshipsshow.php @@ -68,17 +68,17 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction $target_screen_name = $this->trimmed('target_screen_name'); if (!empty($source_id)) { - $this->source = User::staticGet($source_id); + $this->source = User::getKV($source_id); } elseif (!empty($source_screen_name)) { - $this->source = User::staticGet('nickname', $source_screen_name); + $this->source = User::getKV('nickname', $source_screen_name); } else { $this->source = $this->auth_user; } if (!empty($target_id)) { - $this->target = User::staticGet($target_id); + $this->target = User::getKV($target_id); } elseif (!empty($target_screen_name)) { - $this->target = User::staticGet('nickname', $target_screen_name); + $this->target = User::getKV('nickname', $target_screen_name); } return true; diff --git a/actions/apigroupcreate.php b/actions/apigroupcreate.php index 8615bcff7e..295962896d 100644 --- a/actions/apigroupcreate.php +++ b/actions/apigroupcreate.php @@ -297,13 +297,13 @@ class ApiGroupCreateAction extends ApiAuthAction */ function groupNicknameExists($nickname) { - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!empty($local)) { return true; } - $alias = Group_alias::staticGet('alias', $nickname); + $alias = Group_alias::getKV('alias', $nickname); if (!empty($alias)) { return true; diff --git a/actions/apigroupprofileupdate.php b/actions/apigroupprofileupdate.php index 379e01a428..eb47fa2512 100644 --- a/actions/apigroupprofileupdate.php +++ b/actions/apigroupprofileupdate.php @@ -198,7 +198,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction if (!empty($this->nickname) && ($this->nickname != $orig->nickname)) { common_log(LOG_INFO, "Saving local group info."); - $local = Local_group::staticGet('group_id', $this->group->id); + $local = Local_group::getKV('group_id', $this->group->id); $local->setNickname($this->nickname); } @@ -220,14 +220,14 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction function nicknameExists($nickname) { - $group = Local_group::staticGet('nickname', $nickname); + $group = Local_group::getKV('nickname', $nickname); if (!empty($group) && $group->group_id != $this->group->id) { return true; } - $alias = Group_alias::staticGet('alias', $nickname); + $alias = Group_alias::getKV('alias', $nickname); if (!empty($alias) && $alias->group_id != $this->group->id) { diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index a7385ffaaf..e99777e32c 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -68,7 +68,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction $this->group = $this->getTargetGroup($this->arg('id')); if (empty($this->group)) { - $alias = Group_alias::staticGet( + $alias = Group_alias::getKV( 'alias', common_canonical_nickname($this->arg('id')) ); diff --git a/actions/apisearchjson.php b/actions/apisearchjson.php index 612dbdda5c..710ccdcccf 100644 --- a/actions/apisearchjson.php +++ b/actions/apisearchjson.php @@ -126,7 +126,7 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction $stream = new TagNoticeStream(substr($q, 1), $this->auth_profile); } else if ($this->isAnURL($q)) { $canon = File_redirection::_canonUrl($q); - $file = File::staticGet('url', $canon); + $file = File::getKV('url', $canon); if (!empty($file)) { $stream = new FileNoticeStream($file, $this->auth_profile); } diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php index b4a8870faa..1f97b1a9de 100644 --- a/actions/apistatusesdestroy.php +++ b/actions/apistatusesdestroy.php @@ -77,7 +77,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction $this->notice_id = (int)$this->arg('id'); } - $this->notice = Notice::staticGet((int)$this->notice_id); + $this->notice = Notice::getKV((int)$this->notice_id); return true; } diff --git a/actions/apistatusesretweet.php b/actions/apistatusesretweet.php index 4832da1823..feed505fb2 100644 --- a/actions/apistatusesretweet.php +++ b/actions/apistatusesretweet.php @@ -67,7 +67,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction $id = $this->trimmed('id'); - $this->original = Notice::staticGet('id', $id); + $this->original = Notice::getKV('id', $id); if (empty($this->original)) { // TRANS: Client error displayed trying to repeat a non-existing notice through the API. diff --git a/actions/apistatusesretweets.php b/actions/apistatusesretweets.php index 7220196836..3a1a43bc63 100644 --- a/actions/apistatusesretweets.php +++ b/actions/apistatusesretweets.php @@ -63,7 +63,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction $id = $this->trimmed('id'); - $this->original = Notice::staticGet('id', $id); + $this->original = Notice::getKV('id', $id); if (empty($this->original)) { // TRANS: Client error displayed trying to display redents of a non-exiting notice. diff --git a/actions/apistatusesshow.php b/actions/apistatusesshow.php index 13cc88c2c7..9ab3c46e4c 100644 --- a/actions/apistatusesshow.php +++ b/actions/apistatusesshow.php @@ -82,7 +82,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction $this->notice_id = (int)$this->arg('id'); } - $this->notice = Notice::staticGet((int)$this->notice_id); + $this->notice = Notice::getKV((int)$this->notice_id); return true; } @@ -147,7 +147,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction // XXX: Twitter just sets a 404 header and doens't bother // to return an err msg - $deleted = Deleted_notice::staticGet($this->notice_id); + $deleted = Deleted_notice::getKV($this->notice_id); if (!empty($deleted)) { $this->clientError( diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index c772f96afc..9144f09002 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -254,7 +254,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction if (!empty($this->in_reply_to_status_id)) { // Check whether notice actually exists - $reply = Notice::staticGet($this->in_reply_to_status_id); + $reply = Notice::getKV($this->in_reply_to_status_id); if ($reply) { $reply_to = $this->in_reply_to_status_id; diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index 62d0a5e0d5..19e1a52d15 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -414,7 +414,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction common_debug("Note ID is {$note->id}"); if (!empty($note->id)) { - $notice = Notice::staticGet('uri', trim($note->id)); + $notice = Notice::getKV('uri', trim($note->id)); if (!empty($notice)) { // TRANS: Client error displayed when using another format than AtomPub. @@ -445,7 +445,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction if (!empty($profile)) { $options['replies'][] = $uri; } else { - $group = User_group::staticGet('uri', $uri); + $group = User_group::getKV('uri', $uri); if (!empty($group)) { $options['groups'][] = $group->id; } else { @@ -459,7 +459,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction // @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; diff --git a/actions/apiuserprofileimage.php b/actions/apiuserprofileimage.php index 2d26e5c4ea..08af1789c6 100644 --- a/actions/apiuserprofileimage.php +++ b/actions/apiuserprofileimage.php @@ -56,7 +56,7 @@ class ApiUserProfileImageAction extends ApiPrivateAuthAction function prepare($args) { parent::prepare($args); - $this->user = User::staticGet('nickname', $this->arg('screen_name')); + $this->user = User::getKV('nickname', $this->arg('screen_name')); $this->size = $this->arg('size'); return true; diff --git a/actions/apiusershow.php b/actions/apiusershow.php index 11638954db..0ea0b2e72f 100644 --- a/actions/apiusershow.php +++ b/actions/apiusershow.php @@ -68,7 +68,7 @@ class ApiUserShowAction extends ApiPrivateAuthAction // XXX: email field deprecated in Twitter's API if (!empty($email)) { - $this->user = User::staticGet('email', $email); + $this->user = User::getKV('email', $email); } else { $this->user = $this->getTargetUser($this->arg('id')); } diff --git a/actions/approvegroup.php b/actions/approvegroup.php index d46a4451c4..c87d743a7b 100644 --- a/actions/approvegroup.php +++ b/actions/approvegroup.php @@ -63,7 +63,7 @@ class ApprovegroupAction extends Action $nickname_arg = $this->trimmed('nickname'); $id = intval($this->arg('id')); if ($id) { - $this->group = User_group::staticGet('id', $id); + $this->group = User_group::getKV('id', $id); } else if ($nickname_arg) { $nickname = common_canonical_nickname($nickname_arg); @@ -75,7 +75,7 @@ class ApprovegroupAction extends Action return false; } - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!$local) { // TRANS: Client error displayed when trying to leave a non-local group. @@ -83,7 +83,7 @@ class ApprovegroupAction extends Action return false; } - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); } else { // TRANS: Client error displayed when trying to leave a group without providing a group name or group ID. $this->clientError(_('No nickname or ID.'), 404); @@ -104,7 +104,7 @@ class ApprovegroupAction extends Action } if ($this->arg('profile_id')) { if ($cur->isAdmin($this->group)) { - $this->profile = Profile::staticGet('id', $this->arg('profile_id')); + $this->profile = Profile::getKV('id', $this->arg('profile_id')); } else { // TRANS: Client error displayed trying to approve group membership while not a group administrator. $this->clientError(_('Only group admin can approve or cancel join requests.'), 403); diff --git a/actions/approvesub.php b/actions/approvesub.php index 5fbb2149bd..89368686a9 100644 --- a/actions/approvesub.php +++ b/actions/approvesub.php @@ -61,7 +61,7 @@ class ApprovesubAction extends Action return false; } if ($this->arg('profile_id')) { - $this->profile = Profile::staticGet('id', $this->arg('profile_id')); + $this->profile = Profile::getKV('id', $this->arg('profile_id')); } else { // TRANS: Client error displayed trying to approve subscriptionswithout specifying a profile to approve. $this->clientError(_('Must specify a profile.')); diff --git a/actions/atompubfavoritefeed.php b/actions/atompubfavoritefeed.php index 634bb22457..8d5fde8150 100644 --- a/actions/atompubfavoritefeed.php +++ b/actions/atompubfavoritefeed.php @@ -62,7 +62,7 @@ class AtompubfavoritefeedAction extends ApiAuthAction { parent::prepare($argarray); - $this->_profile = Profile::staticGet('id', $this->trimmed('profile')); + $this->_profile = Profile::getKV('id', $this->trimmed('profile')); if (empty($this->_profile)) { // TRANS: Client exception thrown when requesting a favorite feed for a non-existing profile. @@ -251,7 +251,7 @@ class AtompubfavoritefeedAction extends ApiAuthAction return; } - $notice = Notice::staticGet('uri', $note->id); + $notice = Notice::getKV('uri', $note->id); if (empty($notice)) { // XXX: import from listed URL or something @@ -362,7 +362,7 @@ class AtompubfavoritefeedAction extends ApiAuthAction */ function notify($fave, $notice, $user) { - $other = User::staticGet('id', $notice->profile_id); + $other = User::getKV('id', $notice->profile_id); if ($other && $other->id != $user->id) { if ($other->email && $other->emailnotifyfav) { mail_notify_fave($other, $user, $notice); diff --git a/actions/atompubmembershipfeed.php b/actions/atompubmembershipfeed.php index 37e4a386a2..57d7317eef 100644 --- a/actions/atompubmembershipfeed.php +++ b/actions/atompubmembershipfeed.php @@ -64,7 +64,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction $profileId = $this->trimmed('profile'); - $this->_profile = Profile::staticGet('id', $profileId); + $this->_profile = Profile::getKV('id', $profileId); if (empty($this->_profile)) { // TRANS: Client exception. @@ -250,7 +250,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction return; } - $group = User_group::staticGet('uri', $groupObj->id); + $group = User_group::getKV('uri', $groupObj->id); if (empty($group)) { // XXX: import from listed URL or something diff --git a/actions/atompubshowfavorite.php b/actions/atompubshowfavorite.php index 1727e0c3cf..d8f371a39c 100644 --- a/actions/atompubshowfavorite.php +++ b/actions/atompubshowfavorite.php @@ -68,14 +68,14 @@ class AtompubshowfavoriteAction extends ApiAuthAction $profileId = $this->trimmed('profile'); $noticeId = $this->trimmed('notice'); - $this->_profile = Profile::staticGet('id', $profileId); + $this->_profile = Profile::getKV('id', $profileId); if (empty($this->_profile)) { // TRANS: Client exception. throw new ClientException(_('No such profile.'), 404); } - $this->_notice = Notice::staticGet('id', $noticeId); + $this->_notice = Notice::getKV('id', $noticeId); if (empty($this->_notice)) { // TRANS: Client exception thrown when referencing a non-existing notice. diff --git a/actions/atompubshowmembership.php b/actions/atompubshowmembership.php index 8bf62912f5..025e2cb83e 100644 --- a/actions/atompubshowmembership.php +++ b/actions/atompubshowmembership.php @@ -65,7 +65,7 @@ class AtompubshowmembershipAction extends ApiAuthAction $profileId = $this->trimmed('profile'); - $this->_profile = Profile::staticGet('id', $profileId); + $this->_profile = Profile::getKV('id', $profileId); if (empty($this->_profile)) { // TRANS: Client exception. @@ -74,7 +74,7 @@ class AtompubshowmembershipAction extends ApiAuthAction $groupId = $this->trimmed('group'); - $this->_group = User_group::staticGet('id', $groupId); + $this->_group = User_group::getKV('id', $groupId); if (empty($this->_group)) { // TRANS: Client exception thrown when referencing a non-existing group. diff --git a/actions/atompubshowsubscription.php b/actions/atompubshowsubscription.php index aeff0cbf2a..4dbb2af2e0 100644 --- a/actions/atompubshowsubscription.php +++ b/actions/atompubshowsubscription.php @@ -64,7 +64,7 @@ class AtompubshowsubscriptionAction extends ApiAuthAction parent::prepare($argarray); $subscriberId = $this->trimmed('subscriber'); - $this->_subscriber = Profile::staticGet('id', $subscriberId); + $this->_subscriber = Profile::getKV('id', $subscriberId); if (empty($this->_subscriber)) { // TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID. @@ -75,7 +75,7 @@ class AtompubshowsubscriptionAction extends ApiAuthAction $subscribedId = $this->trimmed('subscribed'); - $this->_subscribed = Profile::staticGet('id', $subscribedId); + $this->_subscribed = Profile::getKV('id', $subscribedId); if (empty($this->_subscribed)) { // TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID. diff --git a/actions/atompubsubscriptionfeed.php b/actions/atompubsubscriptionfeed.php index 26740da835..744a970d60 100644 --- a/actions/atompubsubscriptionfeed.php +++ b/actions/atompubsubscriptionfeed.php @@ -66,7 +66,7 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction $subscriber = $this->trimmed('subscriber'); - $this->_profile = Profile::staticGet('id', $subscriber); + $this->_profile = Profile::getKV('id', $subscriber); if (empty($this->_profile)) { // TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID. diff --git a/actions/attachment.php b/actions/attachment.php index f149ca19d9..321525a55f 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -65,7 +65,7 @@ class AttachmentAction extends Action parent::prepare($args); if ($id = $this->trimmed('attachment')) { - $this->attachment = File::staticGet($id); + $this->attachment = File::getKV($id); } if (empty($this->attachment)) { diff --git a/actions/attachment_thumbnail.php b/actions/attachment_thumbnail.php index 38648b8bef..a90f8fd5f8 100644 --- a/actions/attachment_thumbnail.php +++ b/actions/attachment_thumbnail.php @@ -71,7 +71,7 @@ class Attachment_thumbnailAction extends AttachmentAction */ function showCore() { - $file_thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id); + $file_thumbnail = File_thumbnail::getKV('file_id', $this->attachment->id); if (empty($file_thumbnail->url)) { return; } diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php index a581d5ae35..487f66644e 100644 --- a/actions/avatarbynickname.php +++ b/actions/avatarbynickname.php @@ -73,7 +73,7 @@ class AvatarbynicknameAction extends Action return; } - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); if (!$user) { // TRANS: Client error displayed trying to get an avatar for a non-existing user. $this->clientError(_('No such user.')); diff --git a/actions/blockedfromgroup.php b/actions/blockedfromgroup.php index caf3911d7d..685d6dd068 100644 --- a/actions/blockedfromgroup.php +++ b/actions/blockedfromgroup.php @@ -74,7 +74,7 @@ class BlockedfromgroupAction extends GroupAction return false; } - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!$local) { // TRANS: Client error displayed when requesting a list of blocked users for a non-local group. @@ -82,7 +82,7 @@ class BlockedfromgroupAction extends GroupAction return false; } - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); if (!$this->group) { // TRANS: Client error displayed when requesting a list of blocked users for a non-existing group. diff --git a/actions/cancelgroup.php b/actions/cancelgroup.php index 3074e3ffa3..66ae6b3695 100644 --- a/actions/cancelgroup.php +++ b/actions/cancelgroup.php @@ -63,7 +63,7 @@ class CancelgroupAction extends Action $nickname_arg = $this->trimmed('nickname'); $id = intval($this->arg('id')); if ($id) { - $this->group = User_group::staticGet('id', $id); + $this->group = User_group::getKV('id', $id); } else if ($nickname_arg) { $nickname = common_canonical_nickname($nickname_arg); @@ -74,7 +74,7 @@ class CancelgroupAction extends Action return false; } - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!$local) { // TRANS: Client error displayed when trying to leave a non-local group. @@ -82,7 +82,7 @@ class CancelgroupAction extends Action return false; } - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); } else { // TRANS: Client error displayed when trying to leave a group without providing a group name or group ID. $this->clientError(_('No nickname or ID.'), 404); @@ -103,7 +103,7 @@ class CancelgroupAction extends Action } if ($this->arg('profile_id')) { if ($cur->isAdmin($this->group)) { - $this->profile = Profile::staticGet('id', $this->arg('profile_id')); + $this->profile = Profile::getKV('id', $this->arg('profile_id')); } else { // TRANS: Client error displayed when trying to approve or cancel a group join request without // TRANS: being a group administrator. diff --git a/actions/cancelsubscription.php b/actions/cancelsubscription.php index 226fd0822e..2baecbd226 100644 --- a/actions/cancelsubscription.php +++ b/actions/cancelsubscription.php @@ -85,7 +85,7 @@ class CancelsubscriptionAction extends Action return; } - $other = Profile::staticGet('id', $other_id); + $other = Profile::getKV('id', $other_id); if (!$other) { // TRANS: Client error displayed when trying to leave a non-existing group. diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php index ef4cd7cb0d..4aae0675a2 100644 --- a/actions/confirmaddress.php +++ b/actions/confirmaddress.php @@ -74,7 +74,7 @@ class ConfirmaddressAction extends Action $this->clientError(_('No confirmation code.')); return; } - $confirm = Confirm_address::staticGet('code', $code); + $confirm = Confirm_address::getKV('code', $code); if (!$confirm) { // TRANS: Client error displayed when providing a non-existing confirmation code in the contact address confirmation action. $this->clientError(_('Confirmation code not found.')); @@ -110,7 +110,7 @@ class ConfirmaddressAction extends Action if ($type == 'sms') { $cur->carrier = ($confirm->address_extra)+0; - $carrier = Sms_carrier::staticGet($cur->carrier); + $carrier = Sms_carrier::getKV($cur->carrier); $cur->smsemail = $carrier->toEmailAddress($cur->sms); } diff --git a/actions/deleteapplication.php b/actions/deleteapplication.php index 8c3b8e0ba7..763d58c762 100644 --- a/actions/deleteapplication.php +++ b/actions/deleteapplication.php @@ -64,7 +64,7 @@ class DeleteapplicationAction extends Action } $id = (int)$this->arg('id'); - $this->app = Oauth_application::staticGet('id', $id); + $this->app = Oauth_application::getKV('id', $id); if (empty($this->app)) { // TRANS: Client error displayed trying to delete an application that does not exist. diff --git a/actions/deletegroup.php b/actions/deletegroup.php index 637a7cba73..0a0baf887c 100644 --- a/actions/deletegroup.php +++ b/actions/deletegroup.php @@ -68,7 +68,7 @@ class DeletegroupAction extends RedirectingAction $nickname_arg = $this->trimmed('nickname'); $id = intval($this->arg('id')); if ($id) { - $this->group = User_group::staticGet('id', $id); + $this->group = User_group::getKV('id', $id); } else if ($nickname_arg) { $nickname = common_canonical_nickname($nickname_arg); @@ -80,7 +80,7 @@ class DeletegroupAction extends RedirectingAction return false; } - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!$local) { // TRANS: Client error when trying to delete a non-local group. @@ -88,7 +88,7 @@ class DeletegroupAction extends RedirectingAction return false; } - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); } else { // TRANS: Client error when trying to delete a group without providing a nickname or ID for the group. $this->clientError(_('No nickname or ID.'), 404); diff --git a/actions/deletenotice.php b/actions/deletenotice.php index e3690c51d4..eb84b4f3ae 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -54,7 +54,7 @@ class DeletenoticeAction extends Action } $notice_id = $this->trimmed('notice'); - $this->notice = Notice::staticGet($notice_id); + $this->notice = Notice::getKV($notice_id); if (!$this->notice) { // TRANS: Error message displayed trying to delete a non-existing notice. diff --git a/actions/deleteuser.php b/actions/deleteuser.php index 19b1e20e83..9f13468dc4 100644 --- a/actions/deleteuser.php +++ b/actions/deleteuser.php @@ -67,7 +67,7 @@ class DeleteuserAction extends ProfileFormAction return false; } - $this->user = User::staticGet('id', $this->profile->id); + $this->user = User::getKV('id', $this->profile->id); if (empty($this->user)) { // TRANS: Client error displayed when trying to delete a non-local user. diff --git a/actions/disfavor.php b/actions/disfavor.php index e9fc17c5b7..aa4f59857d 100644 --- a/actions/disfavor.php +++ b/actions/disfavor.php @@ -68,7 +68,7 @@ class DisfavorAction extends Action return; } $id = $this->trimmed('notice'); - $notice = Notice::staticGet($id); + $notice = Notice::getKV($id); $token = $this->trimmed('token-'.$notice->id); if (!$token || $token != common_session_token()) { // TRANS: Client error displayed when the session token does not match or is not given. diff --git a/actions/editapplication.php b/actions/editapplication.php index 2ba5f6b313..8c24540c13 100644 --- a/actions/editapplication.php +++ b/actions/editapplication.php @@ -69,8 +69,8 @@ class EditApplicationAction extends Action $id = (int)$this->arg('id'); - $this->app = Oauth_application::staticGet($id); - $this->owner = User::staticGet($this->app->owner); + $this->app = Oauth_application::getKV($id); + $this->owner = User::getKV($this->app->owner); $cur = common_current_user(); if ($cur->id != $this->owner->id) { @@ -302,7 +302,7 @@ class EditApplicationAction extends Action */ function nameExists($name) { - $newapp = Oauth_application::staticGet('name', $name); + $newapp = Oauth_application::getKV('name', $name); if (empty($newapp)) { return false; } else { diff --git a/actions/editgroup.php b/actions/editgroup.php index 7439b9d030..9febab618d 100644 --- a/actions/editgroup.php +++ b/actions/editgroup.php @@ -89,11 +89,11 @@ class EditgroupAction extends GroupAction $groupid = $this->trimmed('groupid'); if ($groupid) { - $this->group = User_group::staticGet('id', $groupid); + $this->group = User_group::getKV('id', $groupid); } else { - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if ($local) { - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); } } @@ -288,7 +288,7 @@ class EditgroupAction extends GroupAction if ($nickname != $orig->nickname) { common_log(LOG_INFO, "Saving local group info."); - $local = Local_group::staticGet('group_id', $this->group->id); + $local = Local_group::getKV('group_id', $this->group->id); $local->setNickname($nickname); } @@ -309,14 +309,14 @@ class EditgroupAction extends GroupAction function nicknameExists($nickname) { - $group = Local_group::staticGet('nickname', $nickname); + $group = Local_group::getKV('nickname', $nickname); if (!empty($group) && $group->group_id != $this->group->id) { return true; } - $alias = Group_alias::staticGet('alias', $nickname); + $alias = Group_alias::getKV('alias', $nickname); if (!empty($alias) && $alias->group_id != $this->group->id) { diff --git a/actions/editpeopletag.php b/actions/editpeopletag.php index 546d9910ba..72dcc0df72 100644 --- a/actions/editpeopletag.php +++ b/actions/editpeopletag.php @@ -93,9 +93,9 @@ class EditpeopletagAction extends Action $user = null; if ($id) { - $this->peopletag = Profile_list::staticGet('id', $id); + $this->peopletag = Profile_list::getKV('id', $id); if (!empty($this->peopletag)) { - $user = User::staticGet('id', $this->peopletag->tagger); + $user = User::getKV('id', $this->peopletag->tagger); } } else { if (!$tagger) { @@ -104,7 +104,7 @@ class EditpeopletagAction extends Action return false; } - $user = User::staticGet('nickname', $tagger); + $user = User::getKV('nickname', $tagger); $this->peopletag = Profile_list::pkeyGet(array('tagger' => $user->id, 'tag' => $tag)); } diff --git a/actions/emailsettings.php b/actions/emailsettings.php index 9493be80aa..f12aecd57d 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -578,7 +578,7 @@ class EmailsettingsAction extends SettingsAction { $user = common_current_user(); - $other = User::staticGet('email', $email); + $other = User::getKV('email', $email); if (!$other) { return false; diff --git a/actions/favor.php b/actions/favor.php index 39d7735d00..777fec5737 100644 --- a/actions/favor.php +++ b/actions/favor.php @@ -69,7 +69,7 @@ class FavorAction extends Action return; } $id = $this->trimmed('notice'); - $notice = Notice::staticGet($id); + $notice = Notice::getKV($id); $token = $this->trimmed('token-'.$notice->id); if (!$token || $token != common_session_token()) { // TRANS: Client error displayed when the session token does not match or is not given. @@ -117,7 +117,7 @@ class FavorAction extends Action */ function notify($notice, $user) { - $other = User::staticGet('id', $notice->profile_id); + $other = User::getKV('id', $notice->profile_id); if ($other && $other->id != $user->id) { if ($other->email && $other->emailnotifyfav) { mail_notify_fave($other, $user, $notice); diff --git a/actions/favoritesrss.php b/actions/favoritesrss.php index 494327674d..8b5ea548be 100644 --- a/actions/favoritesrss.php +++ b/actions/favoritesrss.php @@ -65,7 +65,7 @@ class FavoritesrssAction extends Rss10Action parent::prepare($args); $nickname = $this->trimmed('nickname'); - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed when trying to get the RSS feed with favorites of a user that does not exist. diff --git a/actions/file.php b/actions/file.php index 49ed8af1d6..018f03f53a 100644 --- a/actions/file.php +++ b/actions/file.php @@ -35,7 +35,7 @@ class FileAction extends Action // TRANS: Client error displayed when no notice ID was given trying do display a file. $this->clientError(_('No notice ID.')); } - $notice = Notice::staticGet('id', $this->id); + $notice = Notice::getKV('id', $this->id); if (empty($notice)) { // TRANS: Client error displayed when an invalid notice ID was given trying do display a file. $this->clientError(_('No notice.')); diff --git a/actions/foaf.php b/actions/foaf.php index fa6efde6e4..de03c33788 100644 --- a/actions/foaf.php +++ b/actions/foaf.php @@ -54,7 +54,7 @@ class FoafAction extends Action return false; } - $this->user = User::staticGet('nickname', $this->nickname); + $this->user = User::getKV('nickname', $this->nickname); if (!$this->user) { // TRANS: Client error displayed when requesting Friends of a Friend feed for an object that is not a user. @@ -170,7 +170,7 @@ class FoafAction extends Action if ($sub->find()) { while ($sub->fetch()) { - $profile = Profile::staticGet('id', $sub->subscriber); + $profile = Profile::getKV('id', $sub->subscriber); if (empty($profile)) { common_debug('Got a bad subscription: '.print_r($sub,true)); continue; @@ -207,7 +207,7 @@ class FoafAction extends Action if ($local == 'local') { $foaf_url = common_local_url('foaf', array('nickname' => $nickname)); } - $profile = Profile::staticGet($id); + $profile = Profile::getKV($id); $this->elementStart('Agent', array('rdf:about' => $uri)); if ($type == BOTH) { $this->element('knows', array('rdf:resource' => $this->user->uri)); @@ -284,7 +284,7 @@ class FoafAction extends Action if ($sub->find()) { while ($sub->fetch()) { - $profile = Profile::staticGet('id', $sub->subscribed); + $profile = Profile::getKV('id', $sub->subscribed); if (empty($profile)) { common_debug('Got a bad subscription: '.print_r($sub,true)); continue; diff --git a/actions/foafgroup.php b/actions/foafgroup.php index 9638ea0f34..34332c7e29 100644 --- a/actions/foafgroup.php +++ b/actions/foafgroup.php @@ -58,7 +58,7 @@ class FoafGroupAction extends Action return false; } - $local = Local_group::staticGet('nickname', $this->nickname); + $local = Local_group::getKV('nickname', $this->nickname); if (!$local) { // TRANS: Client error displayed when requesting Friends of a Friend feed for a non-local group. @@ -66,7 +66,7 @@ class FoafGroupAction extends Action return false; } - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); if (!$this->group) { // TRANS: Client error displayed when requesting Friends of a Friend feed for a nickname that is not a group. diff --git a/actions/groupblock.php b/actions/groupblock.php index a597d47c29..2dbb897514 100644 --- a/actions/groupblock.php +++ b/actions/groupblock.php @@ -72,7 +72,7 @@ class GroupblockAction extends RedirectingAction $this->clientError(_('No profile specified.')); return false; } - $this->profile = Profile::staticGet('id', $id); + $this->profile = Profile::getKV('id', $id); if (empty($this->profile)) { // TRANS: Client error displayed trying to block a user from a group while specifying a non-existing profile. $this->clientError(_('No profile with that ID.')); @@ -84,7 +84,7 @@ class GroupblockAction extends RedirectingAction $this->clientError(_('No group specified.')); return false; } - $this->group = User_group::staticGet('id', $group_id); + $this->group = User_group::getKV('id', $group_id); if (empty($this->group)) { // TRANS: Client error displayed trying to block a user from a group while specifying a non-existing group. $this->clientError(_('No such group.')); diff --git a/actions/groupbyid.php b/actions/groupbyid.php index f18e4540c0..5baaab5e6d 100644 --- a/actions/groupbyid.php +++ b/actions/groupbyid.php @@ -76,7 +76,7 @@ class GroupbyidAction extends Action common_debug("Got ID $id"); - $this->group = User_group::staticGet('id', $id); + $this->group = User_group::getKV('id', $id); if (!$this->group) { // TRANS: Client error displayed referring to a group's permalink for a non-existing group ID. diff --git a/actions/grouplogo.php b/actions/grouplogo.php index 46ce274274..529cc69301 100644 --- a/actions/grouplogo.php +++ b/actions/grouplogo.php @@ -90,11 +90,11 @@ class GrouplogoAction extends GroupAction $groupid = $this->trimmed('groupid'); if ($groupid) { - $this->group = User_group::staticGet('id', $groupid); + $this->group = User_group::getKV('id', $groupid); } else { - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if ($local) { - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); } } diff --git a/actions/groupqueue.php b/actions/groupqueue.php index 4bbf5dcb02..1d5a3cd134 100644 --- a/actions/groupqueue.php +++ b/actions/groupqueue.php @@ -78,7 +78,7 @@ class GroupqueueAction extends GroupAction return false; } - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!$local) { // TRANS: Client error displayed when trying to view group members for a non-existing group. @@ -86,7 +86,7 @@ class GroupqueueAction extends GroupAction return false; } - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); if (!$this->group) { // TRANS: Client error displayed when trying to view group members for an object that is not a group. diff --git a/actions/grouprss.php b/actions/grouprss.php index 0f54fc435b..4728f429f4 100644 --- a/actions/grouprss.php +++ b/actions/grouprss.php @@ -90,7 +90,7 @@ class groupRssAction extends Rss10Action return false; } - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!$local) { // TRANS: Client error displayed when requesting a group RSS feed for group that does not exist. @@ -98,7 +98,7 @@ class groupRssAction extends Rss10Action return false; } - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); if (!$this->group) { // TRANS: Client error displayed when requesting a group RSS feed for an object that is not a group. diff --git a/actions/groupunblock.php b/actions/groupunblock.php index c14ec04adc..6f26108155 100644 --- a/actions/groupunblock.php +++ b/actions/groupunblock.php @@ -72,7 +72,7 @@ class GroupunblockAction extends Action $this->clientError(_('No profile specified.')); return false; } - $this->profile = Profile::staticGet('id', $id); + $this->profile = Profile::getKV('id', $id); if (empty($this->profile)) { // TRANS: Client error displayed when trying to unblock a user from a group without providing an existing profile. $this->clientError(_('No profile with that ID.')); @@ -84,7 +84,7 @@ class GroupunblockAction extends Action $this->clientError(_('No group specified.')); return false; } - $this->group = User_group::staticGet('id', $group_id); + $this->group = User_group::getKV('id', $group_id); if (empty($this->group)) { // TRANS: Client error displayed when trying to unblock a user from a non-existing group. $this->clientError(_('No such group.')); diff --git a/actions/invite.php b/actions/invite.php index 75800aa858..6d2605d054 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -111,7 +111,7 @@ class InviteAction extends Action foreach ($addresses as $email) { $email = common_canonical_email($email); - $other = User::staticGet('email', $email); + $other = User::getKV('email', $email); if ($other) { if ($user->isSubscribed($other)) { $this->already[] = $other; diff --git a/actions/joingroup.php b/actions/joingroup.php index fa5968a2c4..da61086b68 100644 --- a/actions/joingroup.php +++ b/actions/joingroup.php @@ -63,7 +63,7 @@ class JoingroupAction extends Action $nickname_arg = $this->trimmed('nickname'); $id = intval($this->arg('id')); if ($id) { - $this->group = User_group::staticGet('id', $id); + $this->group = User_group::getKV('id', $id); } else if ($nickname_arg) { $nickname = common_canonical_nickname($nickname_arg); @@ -75,7 +75,7 @@ class JoingroupAction extends Action return false; } - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!$local) { // TRANS: Client error displayed when trying to join a non-local group. @@ -83,7 +83,7 @@ class JoingroupAction extends Action return false; } - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); } else { // TRANS: Client error displayed when trying to join a group without providing a group name or group ID. $this->clientError(_('No nickname or ID.'), 404); diff --git a/actions/leavegroup.php b/actions/leavegroup.php index b8aaf83d20..0d635ed0e2 100644 --- a/actions/leavegroup.php +++ b/actions/leavegroup.php @@ -63,7 +63,7 @@ class LeavegroupAction extends Action $nickname_arg = $this->trimmed('nickname'); $id = intval($this->arg('id')); if ($id) { - $this->group = User_group::staticGet('id', $id); + $this->group = User_group::getKV('id', $id); } else if ($nickname_arg) { $nickname = common_canonical_nickname($nickname_arg); @@ -75,7 +75,7 @@ class LeavegroupAction extends Action return false; } - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!$local) { // TRANS: Client error displayed when trying to leave a non-local group. @@ -83,7 +83,7 @@ class LeavegroupAction extends Action return false; } - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); } else { // TRANS: Client error displayed when trying to leave a group without providing a group name or group ID. $this->clientError(_('No nickname or ID.'), 404); diff --git a/actions/makeadmin.php b/actions/makeadmin.php index 8ec8a7ce0c..5cc27032ef 100644 --- a/actions/makeadmin.php +++ b/actions/makeadmin.php @@ -74,7 +74,7 @@ class MakeadminAction extends RedirectingAction $this->clientError(_('No profile specified.')); return false; } - $this->profile = Profile::staticGet('id', $id); + $this->profile = Profile::getKV('id', $id); if (empty($this->profile)) { // TRANS: Client error displayed when specifying an invalid profile ID on the Make Admin page. $this->clientError(_('No profile with that ID.')); @@ -86,7 +86,7 @@ class MakeadminAction extends RedirectingAction $this->clientError(_('No group specified.')); return false; } - $this->group = User_group::staticGet('id', $group_id); + $this->group = User_group::getKV('id', $group_id); if (empty($this->group)) { // TRANS: Client error displayed when providing an invalid group ID on the Make Admin page. $this->clientError(_('No such group.')); diff --git a/actions/microsummary.php b/actions/microsummary.php index 6d47e85c68..14c626ac51 100644 --- a/actions/microsummary.php +++ b/actions/microsummary.php @@ -56,7 +56,7 @@ class MicrosummaryAction extends Action parent::handle($args); $nickname = common_canonical_nickname($this->arg('nickname')); - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); if (!$user) { // TRANS: Client error displayed trying to make a micro summary without providing a valid user. diff --git a/actions/newapplication.php b/actions/newapplication.php index 23525ef321..63fca13f48 100644 --- a/actions/newapplication.php +++ b/actions/newapplication.php @@ -317,7 +317,7 @@ class NewApplicationAction extends Action */ function nameExists($name) { - $app = Oauth_application::staticGet('name', $name); + $app = Oauth_application::getKV('name', $name); return !empty($app); } } diff --git a/actions/newgroup.php b/actions/newgroup.php index 8e02adaba1..3d5e8c7f0d 100644 --- a/actions/newgroup.php +++ b/actions/newgroup.php @@ -239,13 +239,13 @@ class NewgroupAction extends Action function nicknameExists($nickname) { - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!empty($local)) { return true; } - $alias = Group_alias::staticGet('alias', $nickname); + $alias = Group_alias::getKV('alias', $nickname); if (!empty($alias)) { return true; diff --git a/actions/newmessage.php b/actions/newmessage.php index fa1922c4a0..6882da4f18 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -112,7 +112,7 @@ class NewmessageAction extends Action if ($this->to) { - $this->other = User::staticGet('id', $this->to); + $this->other = User::getKV('id', $this->to); if (!$this->other) { // TRANS: Client error displayed trying to send a direct message to a non-existing user. diff --git a/actions/newnotice.php b/actions/newnotice.php index 0aafcd41c6..938be69b0f 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -345,7 +345,7 @@ class NewnoticeAction extends Action if (!$content) { $replyto = $this->trimmed('replyto'); $inreplyto = $this->trimmed('inreplyto'); - $profile = Profile::staticGet('nickname', $replyto); + $profile = Profile::getKV('nickname', $replyto); if ($profile) { $content = '@' . $profile->nickname . ' '; } diff --git a/actions/nudge.php b/actions/nudge.php index a44915a2d6..3287711dee 100644 --- a/actions/nudge.php +++ b/actions/nudge.php @@ -66,7 +66,7 @@ class NudgeAction extends Action } $user = common_current_user(); - $other = User::staticGet('nickname', $this->arg('nickname')); + $other = User::getKV('nickname', $this->arg('nickname')); if ($_SERVER['REQUEST_METHOD'] != 'POST') { common_redirect(common_local_url('showstream', diff --git a/actions/oauthconnectionssettings.php b/actions/oauthconnectionssettings.php index 80fac0d509..1ad4a6f60d 100644 --- a/actions/oauthconnectionssettings.php +++ b/actions/oauthconnectionssettings.php @@ -167,7 +167,7 @@ class OauthconnectionssettingsAction extends SettingsAction return false; } - $app = Oauth_application::staticGet('id', $appUser->application_id); + $app = Oauth_application::getKV('id', $appUser->application_id); $datastore = new ApiStatusNetOAuthDataStore(); $datastore->revoke_token($appUser->token, 1); diff --git a/actions/oembed.php b/actions/oembed.php index e293e4d27d..3265763990 100644 --- a/actions/oembed.php +++ b/actions/oembed.php @@ -73,7 +73,7 @@ class OembedAction extends Action case 'shownotice': $oembed['type']='link'; $id = $proxy_args['notice']; - $notice = Notice::staticGet($id); + $notice = Notice::getKV($id); if(empty($notice)){ // TRANS: Server error displayed in oEmbed action when notice not found. // TRANS: %s is a notice. @@ -96,13 +96,13 @@ class OembedAction extends Action break; case 'attachment': $id = $proxy_args['attachment']; - $attachment = File::staticGet($id); + $attachment = File::getKV($id); if(empty($attachment)){ // TRANS: Server error displayed in oEmbed action when attachment not found. // TRANS: %d is an attachment ID. $this->serverError(sprintf(_('Attachment %s not found.'),$id), 404); } - if(empty($attachment->filename) && $file_oembed = File_oembed::staticGet('file_id', $attachment->id)){ + if(empty($attachment->filename) && $file_oembed = File_oembed::getKV('file_id', $attachment->id)){ // Proxy the existing oembed information $oembed['type']=$file_oembed->type; $oembed['provider']=$file_oembed->provider; diff --git a/actions/oldschoolsettings.php b/actions/oldschoolsettings.php index 74c6c05cda..8c4ff9be27 100644 --- a/actions/oldschoolsettings.php +++ b/actions/oldschoolsettings.php @@ -98,7 +98,7 @@ class OldschoolsettingsAction extends SettingsAction { $user = common_current_user(); - $osp = Old_school_prefs::staticGet('user_id', $user->id); + $osp = Old_school_prefs::getKV('user_id', $user->id); $orig = null; if (!empty($osp)) { diff --git a/actions/otp.php b/actions/otp.php index c26965bd6a..f14bba9a2b 100644 --- a/actions/otp.php +++ b/actions/otp.php @@ -71,7 +71,7 @@ class OtpAction extends Action return false; } - $this->user = User::staticGet('id', $id); + $this->user = User::getKV('id', $id); if (empty($this->user)) { // TRANS: Client error displayed trying to use "one time password login" without using an existing user. @@ -87,7 +87,7 @@ class OtpAction extends Action return false; } - $this->lt = Login_token::staticGet('user_id', $id); + $this->lt = Login_token::getKV('user_id', $id); if (empty($this->lt)) { // TRANS: Client error displayed trying to use "one time password login" without requesting a login token. diff --git a/actions/peopletagged.php b/actions/peopletagged.php index 6f9748c234..92bfce6405 100644 --- a/actions/peopletagged.php +++ b/actions/peopletagged.php @@ -85,7 +85,7 @@ class PeopletaggedAction extends Action return false; } - $user = User::staticGet('nickname', $tagger); + $user = User::getKV('nickname', $tagger); if (!$user) { // TRANS: Client error displayed when referring to non-existing user. diff --git a/actions/peopletagsbyuser.php b/actions/peopletagsbyuser.php index 8ef1a56ee1..8a5a53eca4 100644 --- a/actions/peopletagsbyuser.php +++ b/actions/peopletagsbyuser.php @@ -95,7 +95,7 @@ class PeopletagsbyuserAction extends Action return false; } - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed trying to perform an action related to a non-existing user. diff --git a/actions/peopletagsforuser.php b/actions/peopletagsforuser.php index d30f7321c1..83122e4105 100644 --- a/actions/peopletagsforuser.php +++ b/actions/peopletagsforuser.php @@ -77,7 +77,7 @@ class PeopletagsforuserAction extends Action return false; } - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed trying to perform an action related to a non-existing user. diff --git a/actions/peopletagsubscribers.php b/actions/peopletagsubscribers.php index 1834a7e4ad..123b168596 100644 --- a/actions/peopletagsubscribers.php +++ b/actions/peopletagsubscribers.php @@ -85,7 +85,7 @@ class PeopletagsubscribersAction extends Action return false; } - $user = User::staticGet('nickname', $tagger); + $user = User::getKV('nickname', $tagger); if (!$user) { // TRANS: Client error displayed trying to perform an action related to a non-existing user. diff --git a/actions/peopletagsubscriptions.php b/actions/peopletagsubscriptions.php index c497842969..f6baed416f 100644 --- a/actions/peopletagsubscriptions.php +++ b/actions/peopletagsubscriptions.php @@ -79,7 +79,7 @@ class PeopletagsubscriptionsAction extends Action return false; } - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); if (!$user) { // TRANS: Client error displayed trying to perform an action related to a non-existing user. diff --git a/actions/profilecompletion.php b/actions/profilecompletion.php index 00dbe9d29d..9f3f2c9acc 100644 --- a/actions/profilecompletion.php +++ b/actions/profilecompletion.php @@ -94,7 +94,7 @@ class ProfilecompletionAction extends Action } $id = $this->arg('peopletag_id'); - $this->peopletag = Profile_list::staticGet('id', $id); + $this->peopletag = Profile_list::getKV('id', $id); if (empty($this->peopletag)) { // TRANS: Client error displayed trying to reference a non-existing list. diff --git a/actions/profilesettings.php b/actions/profilesettings.php index 38424ab7af..f588462967 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -409,7 +409,7 @@ class ProfilesettingsAction extends SettingsAction $exists = false; - $prefs = User_location_prefs::staticGet('user_id', $user->id); + $prefs = User_location_prefs::getKV('user_id', $user->id); if (empty($prefs)) { $prefs = new User_location_prefs(); @@ -471,7 +471,7 @@ class ProfilesettingsAction extends SettingsAction function nicknameExists($nickname) { $user = common_current_user(); - $other = User::staticGet('nickname', $nickname); + $other = User::getKV('nickname', $nickname); if (!$other) { return false; } else { diff --git a/actions/profiletagbyid.php b/actions/profiletagbyid.php index 396e634aba..f20f1bde4f 100644 --- a/actions/profiletagbyid.php +++ b/actions/profiletagbyid.php @@ -60,7 +60,7 @@ class ProfiletagbyidAction extends Action common_debug("Peopletag id $id by user id $tagger_id"); - $this->peopletag = Profile_list::staticGet('id', $id); + $this->peopletag = Profile_list::getKV('id', $id); if (!$this->peopletag) { // TRANS: Client error displayed trying to reference a non-existing list. @@ -68,7 +68,7 @@ class ProfiletagbyidAction extends Action return false; } - $user = User::staticGet('id', $tagger_id); + $user = User::getKV('id', $tagger_id); if (!$user) { // remote peopletag, permanently redirect common_redirect($this->peopletag->permalink(), 301); diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php index d8f95b24c3..1565ac9bf3 100644 --- a/actions/recoverpassword.php +++ b/actions/recoverpassword.php @@ -57,7 +57,7 @@ class RecoverpasswordAction extends Action function checkCode() { $code = $this->trimmed('code'); - $confirm = Confirm_address::staticGet('code', $code); + $confirm = Confirm_address::getKV('code', $code); if (!$confirm) { // TRANS: Client error displayed when password recovery code is not correct. @@ -70,7 +70,7 @@ class RecoverpasswordAction extends Action return; } - $user = User::staticGet($confirm->user_id); + $user = User::getKV($confirm->user_id); if (!$user) { // TRANS: Server error displayed trying to recover password without providing a user. @@ -137,7 +137,7 @@ class RecoverpasswordAction extends Action common_ensure_session(); $user_id = $_SESSION['tempuser']; if ($user_id) { - $user = User::staticGet($user_id); + $user = User::getKV($user_id); } return $user; } diff --git a/actions/redirecturl.php b/actions/redirecturl.php index 2aca4fe02b..5c559a8b7e 100644 --- a/actions/redirecturl.php +++ b/actions/redirecturl.php @@ -70,7 +70,7 @@ class RedirecturlAction extends Action throw new ClientException(_('No id parameter.')); } - $this->file = File::staticGet('id', $this->id); + $this->file = File::getKV('id', $this->id); if (empty($this->file)) { // TRANS: Client exception thrown when an invalid ID parameter was provided for a file. diff --git a/actions/register.php b/actions/register.php index 3fe5e20a13..7a64d3ae58 100644 --- a/actions/register.php +++ b/actions/register.php @@ -83,7 +83,7 @@ class RegisterAction extends Action } if (!empty($this->code)) { - $this->invite = Invitation::staticGet('code', $this->code); + $this->invite = Invitation::getKV('code', $this->code); if (empty($this->invite)) { // TRANS: Client error displayed when trying to register to an invite-only site without a valid invitation. $this->clientError(_('Sorry, invalid invitation code.')); @@ -181,7 +181,7 @@ class RegisterAction extends Action $code = $this->trimmed('code'); if ($code) { - $invite = Invitation::staticGet($code); + $invite = Invitation::getKV($code); } if (common_config('site', 'inviteonly') && !($code && $invite)) { @@ -294,7 +294,7 @@ class RegisterAction extends Action */ function nicknameExists($nickname) { - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); return is_object($user); } @@ -313,7 +313,7 @@ class RegisterAction extends Action if (!$email || strlen($email) == 0) { return false; } - $user = User::staticGet('email', $email); + $user = User::getKV('email', $email); return is_object($user); } @@ -409,7 +409,7 @@ class RegisterAction extends Action $invite = null; if ($code) { - $invite = Invitation::staticGet($code); + $invite = Invitation::getKV($code); } if (common_config('site', 'inviteonly') && !($code && $invite)) { diff --git a/actions/removepeopletag.php b/actions/removepeopletag.php index d27175f566..360d1c4c61 100644 --- a/actions/removepeopletag.php +++ b/actions/removepeopletag.php @@ -95,7 +95,7 @@ class RemovepeopletagAction extends Action $tagged_id = $this->arg('tagged'); - $this->tagged = Profile::staticGet('id', $tagged_id); + $this->tagged = Profile::getKV('id', $tagged_id); if (empty($this->tagged)) { // TRANS: Client error displayed when referring to a non-existing profile. @@ -104,7 +104,7 @@ class RemovepeopletagAction extends Action } $id = $this->arg('peopletag_id'); - $this->peopletag = Profile_list::staticGet('id', $id); + $this->peopletag = Profile_list::getKV('id', $id); if (empty($this->peopletag)) { // TRANS: Client error displayed trying to reference a non-existing list. @@ -132,7 +132,7 @@ class RemovepeopletagAction extends Action $this->peopletag->tag); if (!$ptag) { - $user = User::staticGet('id', $this->tagged->id); + $user = User::getKV('id', $this->tagged->id); if ($user) { $this->clientError( // TRANS: Client error displayed when an unknown error occurs while delisting a user. diff --git a/actions/repeat.php b/actions/repeat.php index 333e1cd02e..7433cf4b73 100644 --- a/actions/repeat.php +++ b/actions/repeat.php @@ -65,7 +65,7 @@ class RepeatAction extends Action return false; } - $this->notice = Notice::staticGet('id', $id); + $this->notice = Notice::getKV('id', $id); if (empty($this->notice)) { // TRANS: Client error displayed when trying to repeat a non-existing notice. diff --git a/actions/replies.php b/actions/replies.php index 86042557dc..4c6fba9ece 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -65,7 +65,7 @@ class RepliesAction extends Action $nickname = common_canonical_nickname($this->arg('nickname')); - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed when trying to reply to a non-exsting user. diff --git a/actions/repliesrss.php b/actions/repliesrss.php index 86cd173d3c..0c71130718 100644 --- a/actions/repliesrss.php +++ b/actions/repliesrss.php @@ -31,7 +31,7 @@ class RepliesrssAction extends Rss10Action { parent::prepare($args); $nickname = $this->trimmed('nickname'); - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed when providing a non-existing nickname in a RSS 1.0 action. diff --git a/actions/rsd.php b/actions/rsd.php index f99b86e1a4..921e7584c9 100644 --- a/actions/rsd.php +++ b/actions/rsd.php @@ -107,7 +107,7 @@ class RsdAction extends Action return false; } - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (empty($this->user)) { // TRANS: Client error. diff --git a/actions/showapplication.php b/actions/showapplication.php index adfd17a06c..b15c830ad8 100644 --- a/actions/showapplication.php +++ b/actions/showapplication.php @@ -71,8 +71,8 @@ class ShowApplicationAction extends Action $id = (int)$this->arg('id'); - $this->application = Oauth_application::staticGet($id); - $this->owner = User::staticGet($this->application->owner); + $this->application = Oauth_application::getKV($id); + $this->owner = User::getKV($this->application->owner); if (!common_logged_in()) { // TRANS: Client error displayed trying to display an OAuth application while not logged in. @@ -174,7 +174,7 @@ class ShowApplicationAction extends Action $this->elementStart('div', 'entity_statistics'); $defaultAccess = ($this->application->access_type & Oauth_application::$writeAccess) ? 'read-write' : 'read-only'; - $profile = Profile::staticGet($this->application->owner); + $profile = Profile::getKV($this->application->owner); $appUsers = new Oauth_application_user(); $appUsers->application_id = $this->application->id; diff --git a/actions/showfavorites.php b/actions/showfavorites.php index 64fa14bc82..a1a2dabb38 100644 --- a/actions/showfavorites.php +++ b/actions/showfavorites.php @@ -99,7 +99,7 @@ class ShowfavoritesAction extends Action $nickname = common_canonical_nickname($this->arg('nickname')); - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed when trying to display favourite notices for a non-existing user. diff --git a/actions/showmessage.php b/actions/showmessage.php index 1c867af119..24c7db1d50 100644 --- a/actions/showmessage.php +++ b/actions/showmessage.php @@ -69,7 +69,7 @@ class ShowmessageAction extends Action $this->page = 1; $id = $this->trimmed('message'); - $this->message = Message::staticGet('id', $id); + $this->message = Message::getKV('id', $id); if (!$this->message) { // TRANS: Client error displayed requesting a single message that does not exist. diff --git a/actions/shownotice.php b/actions/shownotice.php index 6055184fcd..d892e51409 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -100,7 +100,7 @@ class ShownoticeAction extends Action return false; } - $this->user = User::staticGet('id', $this->profile->id); + $this->user = User::getKV('id', $this->profile->id); $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); @@ -117,11 +117,11 @@ class ShownoticeAction extends Action { $id = $this->arg('notice'); - $notice = Notice::staticGet('id', $id); + $notice = Notice::getKV('id', $id); if (empty($notice)) { // Did we used to have it, and it got deleted? - $deleted = Deleted_notice::staticGet($id); + $deleted = Deleted_notice::getKV($id); if (!empty($deleted)) { // TRANS: Client error displayed trying to show a deleted notice. $this->clientError(_('Notice deleted.'), 410); @@ -290,7 +290,7 @@ class ShownoticeAction extends Action */ function extraHead() { - $user = User::staticGet($this->profile->id); + $user = User::getKV($this->profile->id); if (!$user) { return; diff --git a/actions/showprofiletag.php b/actions/showprofiletag.php index ec1837f835..e7152c0046 100644 --- a/actions/showprofiletag.php +++ b/actions/showprofiletag.php @@ -70,7 +70,7 @@ class ShowprofiletagAction extends Action return false; } - $user = User::staticGet('nickname', $tagger); + $user = User::getKV('nickname', $tagger); if (!$user) { // TRANS: Client error displayed trying to perform an action related to a non-existing user. diff --git a/actions/smssettings.php b/actions/smssettings.php index d151ff45d6..a39eb2cf57 100644 --- a/actions/smssettings.php +++ b/actions/smssettings.php @@ -120,7 +120,7 @@ class SmssettingsAction extends SettingsAction } else { $confirm = $this->getConfirmation(); if ($confirm) { - $carrier = Sms_carrier::staticGet($confirm->address_extra); + $carrier = Sms_carrier::getKV($confirm->address_extra); $this->element('p', 'form_unconfirmed', $confirm->address . ' (' . $carrier->name . ')'); $this->element('p', 'form_guide', @@ -366,7 +366,7 @@ class SmssettingsAction extends SettingsAction return; } - $carrier = Sms_carrier::staticGet($carrier_id); + $carrier = Sms_carrier::getKV($carrier_id); mail_confirm_sms($confirm->code, $user->nickname, @@ -473,7 +473,7 @@ class SmssettingsAction extends SettingsAction { $user = common_current_user(); - $other = User::staticGet('sms', $sms); + $other = User::getKV('sms', $sms); if (!$other) { return false; diff --git a/actions/subedit.php b/actions/subedit.php index 7439904af0..062c4167cd 100644 --- a/actions/subedit.php +++ b/actions/subedit.php @@ -51,7 +51,7 @@ class SubeditAction extends Action return false; } - $this->profile = Profile::staticGet('id', $id); + $this->profile = Profile::getKV('id', $id); if (!$this->profile) { // TRANS: Client error displayed trying a change a subscription for a non-existant profile ID. diff --git a/actions/subscribe.php b/actions/subscribe.php index ce1d367cf8..faa833ade3 100644 --- a/actions/subscribe.php +++ b/actions/subscribe.php @@ -103,7 +103,7 @@ class SubscribeAction extends Action $other_id = $this->arg('subscribeto'); - $this->other = Profile::staticGet('id', $other_id); + $this->other = Profile::getKV('id', $other_id); if (empty($this->other)) { // TRANS: Client error displayed trying to subscribe to a non-existing profile. diff --git a/actions/subscribepeopletag.php b/actions/subscribepeopletag.php index dee0384c5d..9a85e38ef6 100644 --- a/actions/subscribepeopletag.php +++ b/actions/subscribepeopletag.php @@ -83,7 +83,7 @@ class SubscribepeopletagAction extends Action $id = intval($this->arg('id')); if ($id) { - $this->peopletag = Profile_list::staticGet('id', $id); + $this->peopletag = Profile_list::getKV('id', $id); } else { // TRANS: Client error displayed when trying to perform an action without providing an ID. $this->clientError(_('No ID given.'), 404); @@ -96,7 +96,7 @@ class SubscribepeopletagAction extends Action return false; } - $this->tagger = Profile::staticGet('id', $this->peopletag->tagger); + $this->tagger = Profile::getKV('id', $this->peopletag->tagger); return true; } diff --git a/actions/tagprofile.php b/actions/tagprofile.php index 4305f4bc88..b4312ad459 100644 --- a/actions/tagprofile.php +++ b/actions/tagprofile.php @@ -41,7 +41,7 @@ class TagprofileAction extends Action if (!$id) { $this->profile = false; } else { - $this->profile = Profile::staticGet('id', $id); + $this->profile = Profile::getKV('id', $id); if (!$this->profile) { // TRANS: Client error displayed when referring to non-existing profile ID. diff --git a/actions/tagrss.php b/actions/tagrss.php index 5f4831d221..091e383b39 100644 --- a/actions/tagrss.php +++ b/actions/tagrss.php @@ -29,7 +29,7 @@ class TagrssAction extends Rss10Action function prepare($args) { parent::prepare($args); $tag = common_canonical_tag($this->trimmed('tag')); - $this->tag = Notice_tag::staticGet('tag', $tag); + $this->tag = Notice_tag::getKV('tag', $tag); if (!$this->tag) { // TRANS: Client error when requesting a tag feed for a non-existing tag. $this->clientError(_('No such tag.')); diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php index ba9ecd8f00..8adfff9cf6 100644 --- a/actions/unsubscribe.php +++ b/actions/unsubscribe.php @@ -80,7 +80,7 @@ class UnsubscribeAction extends Action return; } - $other = Profile::staticGet('id', $other_id); + $other = Profile::getKV('id', $other_id); if (!$other) { // TRANS: Client error displayed when trying to unsubscribe while providing a non-existing profile ID. diff --git a/actions/unsubscribepeopletag.php b/actions/unsubscribepeopletag.php index bb53766cc1..5e144ab886 100644 --- a/actions/unsubscribepeopletag.php +++ b/actions/unsubscribepeopletag.php @@ -84,7 +84,7 @@ class UnsubscribepeopletagAction extends Action $id = intval($this->arg('id')); if ($id) { - $this->peopletag = Profile_list::staticGet('id', $id); + $this->peopletag = Profile_list::getKV('id', $id); } else { // TRANS: Client error displayed when trying to perform an action without providing an ID. $this->clientError(_('No ID given.'), 404); @@ -97,7 +97,7 @@ class UnsubscribepeopletagAction extends Action return false; } - $this->tagger = Profile::staticGet('id', $this->peopletag->tagger); + $this->tagger = Profile::getKV('id', $this->peopletag->tagger); return true; } diff --git a/actions/useradminpanel.php b/actions/useradminpanel.php index 1eda1c0c82..7c21b91a5e 100644 --- a/actions/useradminpanel.php +++ b/actions/useradminpanel.php @@ -157,7 +157,7 @@ class UseradminpanelAction extends AdminPanelAction // Validate default subscription if (!empty($values['newuser']['default'])) { - $defuser = User::staticGet('nickname', trim($values['newuser']['default'])); + $defuser = User::getKV('nickname', trim($values['newuser']['default'])); if (empty($defuser)) { $this->clientError( sprintf( diff --git a/actions/userbyid.php b/actions/userbyid.php index b8ccd0108e..aa96993e6f 100644 --- a/actions/userbyid.php +++ b/actions/userbyid.php @@ -69,7 +69,7 @@ class UserbyidAction extends Action // TRANS: Client error displayed trying to find a user by ID without providing an ID. $this->clientError(_('No ID.')); } - $user = User::staticGet($id); + $user = User::getKV($id); if (!$user) { // TRANS: Client error displayed trying to find a user by ID for a non-existing ID. $this->clientError(_('No such user.')); diff --git a/actions/usergroups.php b/actions/usergroups.php index 9d5946b484..9ffc8e0ab3 100644 --- a/actions/usergroups.php +++ b/actions/usergroups.php @@ -88,7 +88,7 @@ class UsergroupsAction extends ProfileAction return false; } - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed requesting groups for a non-existing user. diff --git a/actions/userrss.php b/actions/userrss.php index 99330af57f..a688cbf371 100644 --- a/actions/userrss.php +++ b/actions/userrss.php @@ -31,7 +31,7 @@ class UserrssAction extends Rss10Action { parent::prepare($args); $nickname = $this->trimmed('nickname'); - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); $this->tag = $this->trimmed('tag'); if (!$this->user) { diff --git a/actions/userxrd.php b/actions/userxrd.php index 6fa738a5c9..98195d1e33 100644 --- a/actions/userxrd.php +++ b/actions/userxrd.php @@ -43,15 +43,15 @@ class UserxrdAction extends XrdAction // @fixme if domain checking is added, ensure that it will not // cause problems with sites that have changed domains! $nick = common_canonical_nickname($nick); - $this->user = User::staticGet('nickname', $nick); + $this->user = User::getKV('nickname', $nick); } } else { - $this->user = User::staticGet('uri', $this->uri); + $this->user = User::getKV('uri', $this->uri); if (empty($this->user)) { // try and get it by profile url - $profile = Profile::staticGet('profileurl', $this->uri); + $profile = Profile::getKV('profileurl', $this->uri); if (!empty($profile)) { - $this->user = User::staticGet('id', $profile->id); + $this->user = User::getKV('id', $profile->id); } } } diff --git a/classes/Fave.php b/classes/Fave.php index 9a14036cae..7eb3a89e5a 100644 --- a/classes/Fave.php +++ b/classes/Fave.php @@ -80,8 +80,8 @@ class Fave extends Managed_DataObject function delete() { - $profile = Profile::staticGet('id', $this->user_id); - $notice = Notice::staticGet('id', $this->notice_id); + $profile = Profile::getKV('id', $this->user_id); + $notice = Notice::getKV('id', $this->notice_id); $result = null; @@ -120,13 +120,13 @@ class Fave extends Managed_DataObject function asActivity() { - $notice = Notice::staticGet('id', $this->notice_id); + $notice = Notice::getKV('id', $this->notice_id); if (!$notice) { throw new Exception("Fave for non-existent notice: " . $this->notice_id); } - $profile = Profile::staticGet('id', $this->user_id); + $profile = Profile::getKV('id', $this->user_id); if (!$profile) { throw new Exception("Fave by non-existent profile: " . $this->user_id); diff --git a/classes/File.php b/classes/File.php index 0f65fdb0a6..995927ba1a 100644 --- a/classes/File.php +++ b/classes/File.php @@ -86,7 +86,7 @@ class File extends Managed_DataObject // I don't know why we have to keep doing this but I'm adding this last check to avoid // uniqueness bugs. - $x = File::staticGet('url', $given_url); + $x = File::getKV('url', $given_url); if (empty($x)) { $x = new File; @@ -119,7 +119,7 @@ class File extends Managed_DataObject && (('text/html' === substr($redir_data['type'], 0, 9) || 'application/xhtml+xml' === substr($redir_data['type'], 0, 21))) && ($oembed_data = File_oembed::_getOembed($given_url))) { - $fo = File_oembed::staticGet('file_id', $this->id); + $fo = File_oembed::getKV('file_id', $this->id); if (empty($fo)) { File_oembed::saveNew($oembed_data, $this->id); @@ -153,9 +153,9 @@ class File extends Managed_DataObject if (empty($given_url)) return -1; // error, no url to process $given_url = File_redirection::_canonUrl($given_url); if (empty($given_url)) return -1; // error, no url to process - $file = File::staticGet('url', $given_url); + $file = File::getKV('url', $given_url); if (empty($file)) { - $file_redir = File_redirection::staticGet('url', $given_url); + $file_redir = File_redirection::getKV('url', $given_url); if (empty($file_redir)) { // @fixme for new URLs this also looks up non-redirect data // such as target content type, size, etc, which we need @@ -197,7 +197,7 @@ class File extends Managed_DataObject } if (empty($x)) { - $x = File::staticGet('id', $file_id); + $x = File::getKV('id', $file_id); if (empty($x)) { // @todo FIXME: This could possibly be a clearer message :) // TRANS: Server exception thrown when... Robin thinks something is impossible! @@ -391,7 +391,7 @@ class File extends Managed_DataObject if(in_array($mimetype,$notEnclosureMimeTypes)){ // Never treat generic HTML links as an enclosure type! // But if we have oEmbed info, we'll consider it golden. - $oembed = File_oembed::staticGet('file_id',$this->id); + $oembed = File_oembed::getKV('file_id',$this->id); if($oembed && in_array($oembed->type, array('photo', 'video'))){ $mimetype = strtolower($oembed->mimetype); $semicolon = strpos($mimetype,';'); @@ -433,7 +433,7 @@ class File extends Managed_DataObject */ function getThumbnail() { - return File_thumbnail::staticGet('file_id', $this->id); + return File_thumbnail::getKV('file_id', $this->id); } /** diff --git a/classes/File_oembed.php b/classes/File_oembed.php index 7ef1b7cde6..551d12cafb 100644 --- a/classes/File_oembed.php +++ b/classes/File_oembed.php @@ -113,9 +113,9 @@ class File_oembed extends Managed_DataObject $file_oembed->url = $data->url; $given_url = File_redirection::_canonUrl($file_oembed->url); if (! empty($given_url)){ - $file = File::staticGet('url', $given_url); + $file = File::getKV('url', $given_url); if (empty($file)) { - $file_redir = File_redirection::staticGet('url', $given_url); + $file_redir = File_redirection::getKV('url', $given_url); if (empty($file_redir)) { $redir_data = File_redirection::where($given_url); $file_oembed->mimetype = $redir_data['type']; @@ -129,7 +129,7 @@ class File_oembed extends Managed_DataObject } $file_oembed->insert(); if (!empty($data->thumbnail_url) || ($data->type == 'photo')) { - $ft = File_thumbnail::staticGet('file_id', $file_id); + $ft = File_thumbnail::getKV('file_id', $file_id); if (!empty($ft)) { common_log(LOG_WARNING, "Strangely, a File_thumbnail object exists for new file $file_id", __FILE__); diff --git a/classes/File_redirection.php b/classes/File_redirection.php index 321a0b751f..00a5216505 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -165,16 +165,16 @@ class File_redirection extends Managed_DataObject */ public function where($in_url, $discover=true) { // let's see if we know this... - $a = File::staticGet('url', $in_url); + $a = File::getKV('url', $in_url); if (!empty($a)) { // this is a direct link to $a->url return $a->url; } else { - $b = File_redirection::staticGet('url', $in_url); + $b = File_redirection::getKV('url', $in_url); if (!empty($b)) { // this is a redirect to $b->file_id - $a = File::staticGet('id', $b->file_id); + $a = File::getKV('id', $b->file_id); return $a->url; } } @@ -250,7 +250,7 @@ class File_redirection extends Managed_DataObject if (!empty($short_url) && $short_url != $long_url) { $short_url = (string)$short_url; // store it - $file = File::staticGet('url', $long_url); + $file = File::getKV('url', $long_url); if (empty($file)) { // Check if the target URL is itself a redirect... $redir_data = File_redirection::where($long_url); @@ -264,7 +264,7 @@ class File_redirection extends Managed_DataObject } } else if (is_string($redir_data)) { // The file is a known redirect target. - $file = File::staticGet('url', $redir_data); + $file = File::getKV('url', $redir_data); if (empty($file)) { // @fixme should we save a new one? // this case was triggering sometimes for redirects @@ -278,7 +278,7 @@ class File_redirection extends Managed_DataObject } else { $file_id = $file->id; } - $file_redir = File_redirection::staticGet('url', $short_url); + $file_redir = File_redirection::getKV('url', $short_url); if (empty($file_redir)) { $file_redir = new File_redirection; $file_redir->url = $short_url; diff --git a/classes/File_to_post.php b/classes/File_to_post.php index 35d1a0dd54..95ac660f47 100644 --- a/classes/File_to_post.php +++ b/classes/File_to_post.php @@ -69,7 +69,7 @@ class File_to_post extends Managed_DataObject $f2p->post_id = $notice_id; $f2p->insert(); - $f = File::staticGet($file_id); + $f = File::getKV($file_id); if (!empty($f)) { $f->blowCache(); @@ -91,7 +91,7 @@ class File_to_post extends Managed_DataObject function delete() { - $f = File::staticGet('id', $this->file_id); + $f = File::getKV('id', $this->file_id); if (!empty($f)) { $f->blowCache(); } diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php index 44ccd63ae4..39bd5f862a 100644 --- a/classes/Foreign_link.php +++ b/classes/Foreign_link.php @@ -133,7 +133,7 @@ class Foreign_link extends Managed_DataObject function getUser() { - return User::staticGet($this->user_id); + return User::getKV($this->user_id); } // Make sure we only ever delete one record at a time diff --git a/classes/Group_join_queue.php b/classes/Group_join_queue.php index 66137523f1..55467d0dd8 100644 --- a/classes/Group_join_queue.php +++ b/classes/Group_join_queue.php @@ -54,7 +54,7 @@ class Group_join_queue extends Managed_DataObject function getMember() { - $member = Profile::staticGet('id', $this->profile_id); + $member = Profile::getKV('id', $this->profile_id); if (empty($member)) { // TRANS: Exception thrown providing an invalid profile ID. @@ -67,7 +67,7 @@ class Group_join_queue extends Managed_DataObject function getGroup() { - $group = User_group::staticGet('id', $this->group_id); + $group = User_group::getKV('id', $this->group_id); if (empty($group)) { // TRANS: Exception thrown providing an invalid group ID. @@ -123,8 +123,8 @@ class Group_join_queue extends Managed_DataObject */ public function notify() { - $joiner = Profile::staticGet('id', $this->profile_id); - $group = User_group::staticGet('id', $this->group_id); + $joiner = Profile::getKV('id', $this->profile_id); + $group = User_group::getKV('id', $this->group_id); mail_notify_group_join_pending($group, $joiner); } } diff --git a/classes/Group_member.php b/classes/Group_member.php index 390651e901..1c37abab14 100644 --- a/classes/Group_member.php +++ b/classes/Group_member.php @@ -106,7 +106,7 @@ class Group_member extends Managed_DataObject function getMember() { - $member = Profile::staticGet('id', $this->profile_id); + $member = Profile::getKV('id', $this->profile_id); if (empty($member)) { // TRANS: Exception thrown providing an invalid profile ID. @@ -119,7 +119,7 @@ class Group_member extends Managed_DataObject function getGroup() { - $group = User_group::staticGet('id', $this->group_id); + $group = User_group::getKV('id', $this->group_id); if (empty($group)) { // TRANS: Exception thrown providing an invalid group ID. diff --git a/classes/Login_token.php b/classes/Login_token.php index 77558c786c..599f21475a 100644 --- a/classes/Login_token.php +++ b/classes/Login_token.php @@ -57,7 +57,7 @@ class Login_token extends Managed_DataObject function makeNew($user) { - $login_token = Login_token::staticGet('user_id', $user->id); + $login_token = Login_token::getKV('user_id', $user->id); if (!empty($login_token)) { $login_token->delete(); diff --git a/classes/Managed_DataObject.php b/classes/Managed_DataObject.php index 4886e79724..cc982cf63c 100644 --- a/classes/Managed_DataObject.php +++ b/classes/Managed_DataObject.php @@ -39,9 +39,9 @@ abstract class Managed_DataObject extends Memcached_DataObject * @return get_called_class() object if found, or null for no hits * */ - static function staticGet($k,$v=NULL) + static function getKV($k,$v=NULL) { - return parent::staticGet(get_called_class(),$k,$v); + return parent::getKV(get_called_class(),$k,$v); } diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 16ef7e4516..8ff175db0d 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -30,7 +30,7 @@ class Memcached_DataObject extends Safe_DataObject * @param mixed $v key field value, or leave out for primary key lookup * @return mixed Memcached_DataObject subtype or false */ - static function staticGet($cls, $k, $v=null) + static function getKV($cls, $k, $v=null) { if (is_null($v)) { $v = $k; @@ -350,7 +350,7 @@ class Memcached_DataObject extends Safe_DataObject } /** - * @todo FIXME: Should this return false on lookup fail to match staticGet? + * @todo FIXME: Should this return false on lookup fail to match getKV? */ function pkeyGet($cls, $kv) { @@ -680,7 +680,7 @@ class Memcached_DataObject extends Safe_DataObject 'delete', 'update', 'find'); - $ignoreStatic = array('staticGet', + $ignoreStatic = array('getKV', 'pkeyGet', 'cachedQuery'); $here = get_class($this); // if we get confused diff --git a/classes/Message.php b/classes/Message.php index 3986836836..7e8cd6245d 100644 --- a/classes/Message.php +++ b/classes/Message.php @@ -59,23 +59,23 @@ class Message extends Managed_DataObject function getFrom() { - return Profile::staticGet('id', $this->from_profile); + return Profile::getKV('id', $this->from_profile); } function getTo() { - return Profile::staticGet('id', $this->to_profile); + return Profile::getKV('id', $this->to_profile); } static function saveNew($from, $to, $content, $source) { - $sender = Profile::staticGet('id', $from); + $sender = Profile::getKV('id', $from); if (!$sender->hasRight(Right::NEWMESSAGE)) { // TRANS: Client exception thrown when a user tries to send a direct message while being banned from sending them. throw new ClientException(_('You are banned from sending direct messages.')); } - $user = User::staticGet('id', $sender->id); + $user = User::getKV('id', $sender->id); $msg = new Message(); @@ -131,8 +131,8 @@ class Message extends Managed_DataObject function notify() { - $from = User::staticGet('id', $this->from_profile); - $to = User::staticGet('id', $this->to_profile); + $from = User::getKV('id', $this->from_profile); + $to = User::getKV('id', $this->to_profile); mail_notify_message($this, $from, $to); } @@ -151,11 +151,11 @@ class Message extends Managed_DataObject $ns->code = $this->source; break; default: - $ns = Notice_source::staticGet($this->source); + $ns = Notice_source::getKV($this->source); if (!$ns) { $ns = new Notice_source(); $ns->code = $this->source; - $app = Oauth_application::staticGet('name', $this->source); + $app = Oauth_application::getKV('name', $this->source); if ($app) { $ns->name = $app->name; $ns->url = $app->source_url; @@ -177,7 +177,7 @@ class Message extends Managed_DataObject $act->time = strtotime($this->created); $act->link = $this->url; - $profile = Profile::staticGet('id', $this->from_profile); + $profile = Profile::getKV('id', $this->from_profile); if (empty($profile)) { throw new Exception(sprintf("Sender profile not found: %d", $this->from_profile)); @@ -192,7 +192,7 @@ class Message extends Managed_DataObject $ctx = new ActivityContext(); - $rprofile = Profile::staticGet('id', $this->to_profile); + $rprofile = Profile::getKV('id', $this->to_profile); if (empty($rprofile)) { throw new Exception(sprintf("Receiver profile not found: %d", $this->to_profile)); diff --git a/classes/Notice.php b/classes/Notice.php index 0200601a9d..743eba12bf 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -153,7 +153,7 @@ class Notice extends Managed_DataObject function getProfile() { if (is_int($this->_profile) && $this->_profile == -1) { - $this->_setProfile(Profile::staticGet('id', $this->profile_id)); + $this->_setProfile(Profile::getKV('id', $this->profile_id)); if (empty($this->_profile)) { // TRANS: Server exception thrown when a user profile for a notice cannot be found. @@ -177,10 +177,10 @@ class Notice extends Managed_DataObject // @fixme we have some cases where things get re-run and so the // insert fails. - $deleted = Deleted_notice::staticGet('id', $this->id); + $deleted = Deleted_notice::getKV('id', $this->id); if (!$deleted) { - $deleted = Deleted_notice::staticGet('uri', $this->uri); + $deleted = Deleted_notice::getKV('uri', $this->uri); } if (!$deleted) { @@ -340,8 +340,8 @@ class Notice extends Managed_DataObject $is_local = Notice::LOCAL_PUBLIC; } - $profile = Profile::staticGet('id', $profile_id); - $user = User::staticGet('id', $profile_id); + $profile = Profile::getKV('id', $profile_id); + $user = User::getKV('id', $profile_id); if ($user) { // Use the local user's shortening preferences, if applicable. $final = $user->shortenLinks($content); @@ -420,7 +420,7 @@ class Notice extends Managed_DataObject // Check for a private one - $repeat = Notice::staticGet('id', $repeat_of); + $repeat = Notice::getKV('id', $repeat_of); if (empty($repeat)) { // TRANS: Client exception thrown in notice when trying to repeat a missing or deleted notice. @@ -540,7 +540,7 @@ class Notice extends Managed_DataObject // Force the scope for private groups foreach ($groups as $groupId) { - $group = User_group::staticGet('id', $groupId); + $group = User_group::getKV('id', $groupId); if (!empty($group)) { if ($group->force_scope) { $notice->scope |= Notice::GROUP_SCOPE; @@ -647,16 +647,16 @@ class Notice extends Managed_DataObject self::blow('notice:list-ids:repeat_of:%d', $this->repeat_of); } - $original = Notice::staticGet('id', $this->repeat_of); + $original = Notice::getKV('id', $this->repeat_of); if (!empty($original)) { - $originalUser = User::staticGet('id', $original->profile_id); + $originalUser = User::getKV('id', $original->profile_id); if (!empty($originalUser)) { $this->blowStream('user:repeats_of_me:%d', $originalUser->id); } } - $profile = Profile::staticGet($this->profile_id); + $profile = Profile::getKV($this->profile_id); if (!empty($profile)) { $profile->blowNoticeCount(); @@ -723,7 +723,7 @@ class Notice extends Managed_DataObject if ($lastStr !== false) { $window = explode(',', $lastStr); $lastID = $window[0]; - $lastNotice = Notice::staticGet('id', $lastID); + $lastNotice = Notice::getKV('id', $lastID); if (empty($lastNotice) // just weird || strtotime($lastNotice->created) >= strtotime($this->created)) { $c->delete($lastKey); @@ -770,7 +770,7 @@ class Notice extends Managed_DataObject } static function checkDupes($profile_id, $content) { - $profile = Profile::staticGet($profile_id); + $profile = Profile::getKV($profile_id); if (empty($profile)) { return false; } @@ -798,7 +798,7 @@ class Notice extends Managed_DataObject } static function checkEditThrottle($profile_id) { - $profile = Profile::staticGet($profile_id); + $profile = Profile::getKV($profile_id); if (empty($profile)) { return false; } @@ -1018,7 +1018,7 @@ class Notice extends Managed_DataObject $originalProfile = null; if ($this->repeat_of) { // Check blocks against the original notice's poster as well. - $original = Notice::staticGet('id', $this->repeat_of); + $original = Notice::getKV('id', $this->repeat_of); if ($original) { $originalProfile = $original->getProfile(); } @@ -1026,7 +1026,7 @@ class Notice extends Managed_DataObject foreach ($ni as $id => $source) { try { - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if (empty($user) || $user->hasBlocked($profile) || ($originalProfile && $user->hasBlocked($originalProfile))) { @@ -1145,7 +1145,7 @@ class Notice extends Managed_DataObject $groups = array(); foreach (array_unique($group_ids) as $id) { - $group = User_group::staticGet('id', $id); + $group = User_group::getKV('id', $id); if ($group) { common_log(LOG_ERR, "Local delivery to group id $id, $group->nickname"); $result = $this->addToGroupInbox($group); @@ -1259,7 +1259,7 @@ class Notice extends Managed_DataObject return; } - $sender = Profile::staticGet($this->profile_id); + $sender = Profile::getKV($this->profile_id); foreach (array_unique($uris) as $uri) { @@ -1300,7 +1300,7 @@ class Notice extends Managed_DataObject return array(); } - $sender = Profile::staticGet($this->profile_id); + $sender = Profile::getKV($this->profile_id); $replied = array(); @@ -1338,7 +1338,7 @@ class Notice extends Managed_DataObject // Don't save replies from blocked profile to local user - $mentioned_user = User::staticGet('id', $mentioned->id); + $mentioned_user = User::getKV('id', $mentioned->id); if (!empty($mentioned_user) && $mentioned_user->hasBlocked($sender)) { continue; } @@ -1429,7 +1429,7 @@ class Notice extends Managed_DataObject $recipientIds = $this->getReplies(); foreach ($recipientIds as $recipientId) { - $user = User::staticGet('id', $recipientId); + $user = User::getKV('id', $recipientId); if (!empty($user)) { mail_notify_attn($user, $this); } @@ -1510,7 +1510,7 @@ class Notice extends Managed_DataObject $act->verb = $this->verb; if ($this->repeat_of) { - $repeated = Notice::staticGet('id', $this->repeat_of); + $repeated = Notice::getKV('id', $this->repeat_of); if (!empty($repeated)) { $act->objects[] = $repeated->asActivity($cur); } @@ -1546,7 +1546,7 @@ class Notice extends Managed_DataObject $ctx = new ActivityContext(); if (!empty($this->reply_to)) { - $reply = Notice::staticGet('id', $this->reply_to); + $reply = Notice::getKV('id', $this->reply_to); if (!empty($reply)) { $ctx->replyToID = $reply->uri; $ctx->replyToUrl = $reply->bestUrl(); @@ -1558,7 +1558,7 @@ class Notice extends Managed_DataObject $conv = null; if (!empty($this->conversation)) { - $conv = Conversation::staticGet('id', $this->conversation); + $conv = Conversation::getKV('id', $this->conversation); if (!empty($conv)) { $ctx->conversation = $conv->uri; } @@ -1567,7 +1567,7 @@ class Notice extends Managed_DataObject $reply_ids = $this->getReplies(); foreach ($reply_ids as $id) { - $rprofile = Profile::staticGet('id', $id); + $rprofile = Profile::getKV('id', $id); if (!empty($rprofile)) { $ctx->attention[] = $rprofile->getUri(); $ctx->attentionType[$rprofile->getUri()] = ActivityObject::PERSON; @@ -1598,7 +1598,7 @@ class Notice extends Managed_DataObject $repeat = null; if (!empty($this->repeat_of)) { - $repeat = Notice::staticGet('id', $this->repeat_of); + $repeat = Notice::getKV('id', $this->repeat_of); if (!empty($repeat)) { $ctx->forwardID = $repeat->uri; $ctx->forwardUrl = $repeat->bestUrl(); @@ -1640,7 +1640,7 @@ class Notice extends Managed_DataObject $act->source->updated = self::utcDate($notice->created); } - $user = User::staticGet('id', $profile->id); + $user = User::getKV('id', $profile->id); if (!empty($user)) { $act->source->links['license'] = common_config('license', 'url'); @@ -1784,7 +1784,7 @@ class Notice extends Managed_DataObject // return it if it does if (!empty($reply_to)) { - $reply_notice = Notice::staticGet('id', $reply_to); + $reply_notice = Notice::getKV('id', $reply_to); if (!empty($reply_notice)) { return $reply_notice; } @@ -1809,7 +1809,7 @@ class Notice extends Managed_DataObject // Figure out who that is. - $sender = Profile::staticGet('id', $profile_id); + $sender = Profile::getKV('id', $profile_id); if (empty($sender)) { return null; } @@ -1875,7 +1875,7 @@ class Notice extends Managed_DataObject */ function repeat($repeater_id, $source) { - $author = Profile::staticGet('id', $this->profile_id); + $author = Profile::getKV('id', $this->profile_id); // TRANS: Message used to repeat a notice. RT is the abbreviation of 'retweet'. // TRANS: %1$s is the repeated user's name, %2$s is the repeated notice. @@ -2109,7 +2109,7 @@ class Notice extends Managed_DataObject // have to wait Event::handle('StartNoticeDistribute', array($this)); - $user = User::staticGet('id', $this->profile_id); + $user = User::getKV('id', $this->profile_id); if (!empty($user)) { Inbox::insertNotice($user->id, $this->id); } @@ -2180,11 +2180,11 @@ class Notice extends Managed_DataObject $ns->code = $this->source; break; default: - $ns = Notice_source::staticGet($this->source); + $ns = Notice_source::getKV($this->source); if (!$ns) { $ns = new Notice_source(); $ns->code = $this->source; - $app = Oauth_application::staticGet('name', $this->source); + $app = Oauth_application::getKV('name', $this->source); if ($app) { $ns->name = $app->name; $ns->url = $app->source_url; @@ -2257,12 +2257,12 @@ class Notice extends Managed_DataObject return false; } - $notice = Notice::staticGet('id', $id); + $notice = Notice::getKV('id', $id); if ($notice) { return $notice->created; } - $deleted = Deleted_notice::staticGet('id', $id); + $deleted = Deleted_notice::getKV('id', $id); if ($deleted) { return $deleted->created; } @@ -2542,7 +2542,7 @@ class Notice extends Managed_DataObject if (empty($this->reply_to)) { $this->_original = null; } else { - $this->_original = Notice::staticGet('id', $this->reply_to); + $this->_original = Notice::getKV('id', $this->reply_to); } } return $this->_original; diff --git a/classes/Oauth_application.php b/classes/Oauth_application.php index 3bc66f0e28..90218e93cb 100644 --- a/classes/Oauth_application.php +++ b/classes/Oauth_application.php @@ -37,7 +37,7 @@ class Oauth_application extends Managed_DataObject function getConsumer() { - return Consumer::staticGet('consumer_key', $this->consumer_key); + return Consumer::getKV('consumer_key', $this->consumer_key); } static function maxDesc() diff --git a/classes/Profile.php b/classes/Profile.php index 4f631acf40..bee05981d2 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -92,7 +92,7 @@ class Profile extends Managed_DataObject function getUser() { if (is_int($this->_user) && $this->_user == -1) { - $this->_user = User::staticGet('id', $this->id); + $this->_user = User::getKV('id', $this->id); } return $this->_user; @@ -440,7 +440,7 @@ class Profile extends Managed_DataObject $lists = array(); foreach ($ids as $id) { - $list = Profile_list::staticGet('id', $id); + $list = Profile_list::getKV('id', $id); if (!empty($list) && ($showPrivate || !$list->private)) { @@ -637,7 +637,7 @@ class Profile extends Managed_DataObject $profiles = array(); while ($subs->fetch()) { - $profile = Profile::staticGet($subs->subscribed); + $profile = Profile::getKV($subs->subscribed); if ($profile) { $profiles[] = $profile; } @@ -655,7 +655,7 @@ class Profile extends Managed_DataObject $profiles = array(); while ($subs->fetch()) { - $profile = Profile::staticGet($subs->subscriber); + $profile = Profile::getKV($subs->subscriber); if ($profile) { $profiles[] = $profile; } @@ -958,7 +958,7 @@ class Profile extends Managed_DataObject $sub->find(); while ($sub->fetch()) { - $other = Profile::staticGet('id', $sub->subscribed); + $other = Profile::getKV('id', $sub->subscribed); if (empty($other)) { continue; } @@ -973,7 +973,7 @@ class Profile extends Managed_DataObject $subd->find(); while ($subd->fetch()) { - $other = Profile::staticGet('id', $subd->subscriber); + $other = Profile::getKV('id', $subd->subscriber); if (empty($other)) { continue; } @@ -1345,7 +1345,7 @@ class Profile extends Managed_DataObject if (Event::handle('StartGetProfileUri', array($this, &$uri))) { // check for a local user first - $user = User::staticGet('id', $this->id); + $user = User::getKV('id', $this->id); if (!empty($user)) { $uri = $user->uri; @@ -1375,7 +1375,7 @@ class Profile extends Managed_DataObject $feed = null; if (Event::handle('StartProfileGetAtomFeed', array($this, &$feed))) { - $user = User::staticGet('id', $this->id); + $user = User::getKV('id', $this->id); if (!empty($user)) { $feed = common_local_url('ApiTimelineUser', array('id' => $user->id, 'format' => 'atom')); @@ -1392,7 +1392,7 @@ class Profile extends Managed_DataObject if (Event::handle('StartGetProfileFromURI', array($uri, &$profile))) { // Get a local user or remote (OMB 0.1) profile - $user = User::staticGet('uri', $uri); + $user = User::getKV('uri', $uri); if (!empty($user)) { $profile = $user->getProfile(); } diff --git a/classes/Profile_list.php b/classes/Profile_list.php index 9bf66745c2..749d98d5fc 100644 --- a/classes/Profile_list.php +++ b/classes/Profile_list.php @@ -107,7 +107,7 @@ class Profile_list extends Managed_DataObject function getTagger() { - return Profile::staticGet('id', $this->tagger); + return Profile::getKV('id', $this->tagger); } /** @@ -683,7 +683,7 @@ class Profile_list extends Managed_DataObject if (!isset($mainpage) || empty($mainpage)) { $orig = clone($ptag); - $user = User::staticGet('id', $ptag->tagger); + $user = User::getKV('id', $ptag->tagger); if(!empty($user)) { $ptag->mainpage = common_local_url('showprofiletag', array('tag' => $ptag->tag, 'tagger' => $user->nickname)); } else { diff --git a/classes/Profile_tag.php b/classes/Profile_tag.php index 9970f14fc7..4e0900aa63 100644 --- a/classes/Profile_tag.php +++ b/classes/Profile_tag.php @@ -157,8 +157,8 @@ class Profile_tag extends Managed_DataObject return $ptag; } - $tagger_profile = Profile::staticGet('id', $tagger); - $tagged_profile = Profile::staticGet('id', $tagged); + $tagger_profile = Profile::getKV('id', $tagger); + $tagged_profile = Profile::getKV('id', $tagged); if (Event::handle('StartTagProfile', array($tagger_profile, $tagged_profile, $tag))) { diff --git a/classes/Profile_tag_subscription.php b/classes/Profile_tag_subscription.php index ab2ceed73b..28b37940a7 100644 --- a/classes/Profile_tag_subscription.php +++ b/classes/Profile_tag_subscription.php @@ -73,7 +73,7 @@ class Profile_tag_subscription extends Managed_DataObject throw new Exception(_('Adding list subscription failed.')); } - $ptag = Profile_list::staticGet('id', $peopletag->id); + $ptag = Profile_list::getKV('id', $peopletag->id); $ptag->subscriberCount(true); Event::handle('EndSubscribePeopletag', array($peopletag, $profile)); @@ -114,7 +114,7 @@ class Profile_tag_subscription extends Managed_DataObject $subs->find(); while($subs->fetch()) { - $profile = Profile::staticGet('id', $subs->profile_id); + $profile = Profile::getKV('id', $subs->profile_id); Event::handle('StartUnsubscribePeopletag', array($profile_list, $profile)); // Delete anyway $subs->delete(); diff --git a/classes/Remote_profile.php b/classes/Remote_profile.php index 9e30d8b907..46a187f25b 100644 --- a/classes/Remote_profile.php +++ b/classes/Remote_profile.php @@ -42,7 +42,7 @@ class Remote_profile extends Managed_DataObject function hasRight($right) { - $profile = Profile::staticGet($this->id); + $profile = Profile::getKV($this->id); if ($profile) { return $profile->hasright($right); } else { diff --git a/classes/Session.php b/classes/Session.php index 8323ef89f5..a54151c2df 100644 --- a/classes/Session.php +++ b/classes/Session.php @@ -74,7 +74,7 @@ class Session extends Managed_DataObject { self::logdeb("Fetching session '$id'"); - $session = Session::staticGet('id', $id); + $session = Session::getKV('id', $id); if (empty($session)) { self::logdeb("Couldn't find '$id'"); @@ -91,7 +91,7 @@ class Session extends Managed_DataObject { self::logdeb("Writing session '$id'"); - $session = Session::staticGet('id', $id); + $session = Session::getKV('id', $id); if (empty($session)) { self::logdeb("'$id' doesn't yet exist; inserting."); @@ -140,7 +140,7 @@ class Session extends Managed_DataObject { self::logdeb("Deleting session $id"); - $session = Session::staticGet('id', $id); + $session = Session::getKV('id', $id); if (empty($session)) { self::logdeb("Can't find '$id' to delete."); diff --git a/classes/Status_network.php b/classes/Status_network.php index 5a683c04d2..0376f1e69d 100644 --- a/classes/Status_network.php +++ b/classes/Status_network.php @@ -42,7 +42,8 @@ class Status_network extends Safe_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - static function staticGet($k,$v=NULL) { + static function getKV($k,$v=NULL) { + // TODO: This must probably be turned into a non-static call $i = DB_DataObject::staticGet('Status_network',$k,$v); // Don't use local process cache; if we're fetching multiple @@ -118,7 +119,7 @@ class Status_network extends Safe_DataObject static function memGet($k, $v) { if (!self::$cache) { - return self::staticGet($k, $v); + return self::getKV($k, $v); } $ck = self::cacheKey($k, $v); @@ -126,7 +127,7 @@ class Status_network extends Safe_DataObject $sn = self::$cache->get($ck); if (empty($sn)) { - $sn = self::staticGet($k, $v); + $sn = self::getKV($k, $v); if (!empty($sn)) { self::$cache->set($ck, clone($sn)); } diff --git a/classes/Status_network_tag.php b/classes/Status_network_tag.php index 4a7c3b51ff..ba0e7d90f2 100644 --- a/classes/Status_network_tag.php +++ b/classes/Status_network_tag.php @@ -43,9 +43,13 @@ class Status_network_tag extends Safe_DataObject $this->_connect(); } + /* the code above is auto generated do not remove the tag below */ + ###END_AUTOCODE + /* Static get */ - function staticGet($k,$v=null) + static function getKV($k,$v=null) { + // TODO: This probably has to be converted to a non-static call $i = DB_DataObject::staticGet('Status_network_tag',$k,$v); // Don't use local process cache; if we're fetching multiple @@ -56,10 +60,6 @@ class Status_network_tag extends Safe_DataObject return $i; } - /* the code above is auto generated do not remove the tag below */ - ###END_AUTOCODE - - function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Status_network_tag', $kv); diff --git a/classes/Subscription.php b/classes/Subscription.php index 7ab0136fa7..41d31f962f 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -113,7 +113,7 @@ class Subscription extends Managed_DataObject } if (Event::handle('StartSubscribe', array($subscriber, $other))) { - $otherUser = User::staticGet('id', $other->id); + $otherUser = User::getKV('id', $other->id); if ($otherUser && $otherUser->subscribe_policy == User::SUBSCRIBE_POLICY_MODERATE && !$force) { $sub = Subscription_queue::saveNew($subscriber, $other); $sub->notify(); @@ -187,11 +187,11 @@ class Subscription extends Managed_DataObject function notifyEmail() { - $subscribedUser = User::staticGet('id', $this->subscribed); + $subscribedUser = User::getKV('id', $this->subscribed); if (!empty($subscribedUser)) { - $subscriber = Profile::staticGet('id', $this->subscriber); + $subscriber = Profile::getKV('id', $this->subscriber); mail_subscribe_notify_profile($subscribedUser, $subscriber); } @@ -255,8 +255,8 @@ class Subscription extends Managed_DataObject function asActivity() { - $subscriber = Profile::staticGet('id', $this->subscriber); - $subscribed = Profile::staticGet('id', $this->subscribed); + $subscriber = Profile::getKV('id', $this->subscriber); + $subscribed = Profile::getKV('id', $this->subscribed); if (empty($subscriber)) { throw new Exception(sprintf(_('No profile for the subscriber: %d'), $this->subscriber)); diff --git a/classes/Subscription_queue.php b/classes/Subscription_queue.php index 8626f0674b..2711883539 100644 --- a/classes/Subscription_queue.php +++ b/classes/Subscription_queue.php @@ -66,8 +66,8 @@ class Subscription_queue extends Managed_DataObject */ public function complete() { - $subscriber = Profile::staticGet('id', $this->subscriber); - $subscribed = Profile::staticGet('id', $this->subscribed); + $subscriber = Profile::getKV('id', $this->subscriber); + $subscribed = Profile::getKV('id', $this->subscribed); $sub = Subscription::start($subscriber, $subscribed, Subscription::FORCE); if ($sub) { $this->delete(); @@ -80,8 +80,8 @@ class Subscription_queue extends Managed_DataObject */ public function abort() { - $subscriber = Profile::staticGet('id', $this->subscriber); - $subscribed = Profile::staticGet('id', $this->subscribed); + $subscriber = Profile::getKV('id', $this->subscriber); + $subscribed = Profile::getKV('id', $this->subscribed); if (Event::handle('StartCancelSubscription', array($subscriber, $subscribed))) { $this->delete(); Event::handle('EndCancelSubscription', array($subscriber, $subscribed)); @@ -94,8 +94,8 @@ class Subscription_queue extends Managed_DataObject */ public function notify() { - $other = Profile::staticGet('id', $this->subscriber); - $listenee = User::staticGet('id', $this->subscribed); + $other = Profile::getKV('id', $this->subscriber); + $listenee = User::getKV('id', $this->subscribed); mail_subscribe_pending_notify_profile($listenee, $other); } } diff --git a/classes/User.php b/classes/User.php index 2bc8c88b2e..c4a2288444 100644 --- a/classes/User.php +++ b/classes/User.php @@ -128,7 +128,7 @@ class User extends Managed_DataObject function getProfile() { if (is_int($this->_profile) && $this->_profile == -1) { // invalid but distinct from null - $this->_profile = Profile::staticGet('id', $this->id); + $this->_profile = Profile::getKV('id', $this->id); if (empty($this->_profile)) { throw new UserNoProfileException($this); } @@ -222,7 +222,7 @@ class User extends Managed_DataObject function getCarrier() { - return Sms_carrier::staticGet('id', $this->carrier); + return Sms_carrier::getKV('id', $this->carrier); } /** @@ -315,7 +315,7 @@ class User extends Managed_DataObject // Users who respond to invite email have proven their ownership of that address if (!empty($code)) { - $invite = Invitation::staticGet($code); + $invite = Invitation::getKV($code); if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) { $user->email = $invite->address; } @@ -432,7 +432,7 @@ class User extends Managed_DataObject $defnick = common_config('newuser', 'default'); if (!empty($defnick)) { - $defuser = User::staticGet('nickname', $defnick); + $defuser = User::getKV('nickname', $defnick); if (empty($defuser)) { common_log(LOG_WARNING, sprintf("Default user %s does not exist.", $defnick), __FILE__); @@ -452,7 +452,7 @@ class User extends Managed_DataObject $welcome = common_config('newuser', 'welcome'); if (!empty($welcome)) { - $welcomeuser = User::staticGet('nickname', $welcome); + $welcomeuser = User::getKV('nickname', $welcome); if (empty($welcomeuser)) { common_log(LOG_WARNING, sprintf("Welcome user %s does not exist.", $defnick), __FILE__); @@ -483,7 +483,7 @@ class User extends Managed_DataObject if ($invites->find()) { while ($invites->fetch()) { - $other = User::staticGet($invites->user_id); + $other = User::getKV($invites->user_id); subs_subscribe_to($other, $this); } } @@ -874,7 +874,7 @@ class User extends Managed_DataObject $share = common_config('location', 'sharedefault'); // Check if user has a personal setting for this - $prefs = User_location_prefs::staticGet('user_id', $this->id); + $prefs = User_location_prefs::getKV('user_id', $this->id); if (!empty($prefs)) { $share = $prefs->share_location; @@ -900,7 +900,7 @@ class User extends Managed_DataObject $pr->limit(1); if ($pr->find(true)) { - $owner = User::staticGet('id', $pr->profile_id); + $owner = User::getKV('id', $pr->profile_id); } else { $owner = null; } @@ -930,7 +930,7 @@ class User extends Managed_DataObject $nickname = common_config('singleuser', 'nickname'); if (!empty($nickname)) { - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); } // if there was no nickname or no user by that nickname, @@ -1051,11 +1051,11 @@ class User extends Managed_DataObject static function recoverPassword($nore) { - $user = User::staticGet('email', common_canonical_email($nore)); + $user = User::getKV('email', common_canonical_email($nore)); if (!$user) { try { - $user = User::staticGet('nickname', common_canonical_nickname($nore)); + $user = User::getKV('nickname', common_canonical_nickname($nore)); } catch (NicknameException $e) { // invalid } @@ -1072,7 +1072,7 @@ class User extends Managed_DataObject $confirm_email->address_type = 'email'; $confirm_email->find(); if ($confirm_email->fetch()) { - $user = User::staticGet($confirm_email->user_id); + $user = User::getKV($confirm_email->user_id); } else { $confirm_email = null; } @@ -1145,7 +1145,7 @@ class User extends Managed_DataObject function streamModeOnly() { if (common_config('oldschool', 'enabled')) { - $osp = Old_school_prefs::staticGet('user_id', $this->id); + $osp = Old_school_prefs::getKV('user_id', $this->id); if (!empty($osp)) { return $osp->stream_mode_only; } @@ -1157,7 +1157,7 @@ class User extends Managed_DataObject function conversationTree() { if (common_config('oldschool', 'enabled')) { - $osp = Old_school_prefs::staticGet('user_id', $this->id); + $osp = Old_school_prefs::getKV('user_id', $this->id); if (!empty($osp)) { return $osp->conversation_tree; } @@ -1169,7 +1169,7 @@ class User extends Managed_DataObject function streamNicknames() { if (common_config('oldschool', 'enabled')) { - $osp = Old_school_prefs::staticGet('user_id', $this->id); + $osp = Old_school_prefs::getKV('user_id', $this->id); if (!empty($osp)) { return $osp->stream_nicknames; } diff --git a/classes/User_group.php b/classes/User_group.php index 447dbded45..8f7a0d7b58 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -415,13 +415,13 @@ class User_group extends Managed_DataObject // If not, check local groups. - $group = Local_group::staticGet('nickname', $nickname); + $group = Local_group::getKV('nickname', $nickname); if (!empty($group)) { - return User_group::staticGet('id', $group->group_id); + return User_group::getKV('id', $group->group_id); } - $alias = Group_alias::staticGet('alias', $nickname); + $alias = Group_alias::getKV('alias', $nickname); if (!empty($alias)) { - return User_group::staticGet('id', $alias->group_id); + return User_group::getKV('id', $alias->group_id); } return null; } @@ -565,7 +565,7 @@ class User_group extends Managed_DataObject static function register($fields) { if (!empty($fields['userid'])) { - $profile = Profile::staticGet('id', $fields['userid']); + $profile = Profile::getKV('id', $fields['userid']); if ($profile && !$profile->hasRight(Right::CREATEGROUP)) { common_log(LOG_WARNING, "Attempted group creation from banned user: " . $profile->nickname); @@ -736,7 +736,7 @@ class User_group extends Managed_DataObject // or we'll miss clearing some cache keys; that can make it hard // to create a new group with one of those names or aliases. $this->setAliases(array()); - $local = Local_group::staticGet('group_id', $this->id); + $local = Local_group::getKV('group_id', $this->id); if ($local) { $local->delete(); } diff --git a/classes/User_urlshortener_prefs.php b/classes/User_urlshortener_prefs.php index 600e4e1ac2..9cb5a4cb0e 100755 --- a/classes/User_urlshortener_prefs.php +++ b/classes/User_urlshortener_prefs.php @@ -109,7 +109,7 @@ class User_urlshortener_prefs extends Managed_DataObject return null; } - $prefs = User_urlshortener_prefs::staticGet('user_id', $user->id); + $prefs = User_urlshortener_prefs::getKV('user_id', $user->id); return $prefs; } diff --git a/lib/accountprofileblock.php b/lib/accountprofileblock.php index f49c73aeab..c63bded46a 100644 --- a/lib/accountprofileblock.php +++ b/lib/accountprofileblock.php @@ -55,7 +55,7 @@ class AccountProfileBlock extends ProfileBlock { parent::__construct($out); $this->profile = $profile; - $this->user = User::staticGet('id', $profile->id); + $this->user = User::getKV('id', $profile->id); } function avatar() diff --git a/lib/action.php b/lib/action.php index 71fd7407e2..8e0f7be94a 100644 --- a/lib/action.php +++ b/lib/action.php @@ -545,7 +545,7 @@ class Action extends HTMLOutputter // lawsuit // if logo is an uploaded file, try to fall back to HTTPS file URL $httpUrl = common_config('site', 'logo'); if (!empty($httpUrl)) { - $f = File::staticGet('url', $httpUrl); + $f = File::getKV('url', $httpUrl); if (!empty($f) && !empty($f->filename)) { // this will handle the HTTPS case $logoUrl = File::url($f->filename); diff --git a/lib/activityimporter.php b/lib/activityimporter.php index 096eb9ba43..c2bdc447b5 100644 --- a/lib/activityimporter.php +++ b/lib/activityimporter.php @@ -102,7 +102,7 @@ class ActivityImporter extends QueueHandler } $other = $activity->actor; - $otherUser = User::staticGet('uri', $other->id); + $otherUser = User::getKV('uri', $other->id); if (!empty($otherUser)) { $otherProfile = $otherUser->getProfile(); @@ -139,7 +139,7 @@ class ActivityImporter extends QueueHandler $uri = $activity->objects[0]->id; - $group = User_group::staticGet('uri', $uri); + $group = User_group::getKV('uri', $uri); if (empty($group)) { $oprofile = Ostatus_profile::ensureActivityObjectProfile($activity->objects[0]); @@ -168,7 +168,7 @@ class ActivityImporter extends QueueHandler $sourceUri = $note->id; - $notice = Notice::staticGet('uri', $sourceUri); + $notice = Notice::getKV('uri', $sourceUri); if (!empty($notice)) { @@ -244,7 +244,7 @@ class ActivityImporter extends QueueHandler // Maintain direct reply associations // @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; @@ -299,7 +299,7 @@ class ActivityImporter extends QueueHandler // Is the recipient a local user? - $user = User::staticGet('uri', $recipient); + $user = User::getKV('uri', $recipient); if ($user) { // @fixme sender verification, spam etc? @@ -320,11 +320,11 @@ class ActivityImporter extends QueueHandler // Is the recipient a local group? // @fixme uri on user_group isn't reliable yet - // $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(); diff --git a/lib/activitymover.php b/lib/activitymover.php index 6d9d77b215..d5edab5caa 100644 --- a/lib/activitymover.php +++ b/lib/activitymover.php @@ -55,7 +55,7 @@ class ActivityMover extends QueueHandler { list ($act, $sink, $userURI, $remoteURI) = $data; - $user = User::staticGet('uri', $userURI); + $user = User::getKV('uri', $userURI); $remote = Profile::fromURI($remoteURI); try { @@ -92,7 +92,7 @@ class ActivityMover extends QueueHandler "{$act->actor->id} to {$remote->nickname}."); // push it, then delete local $sink->postActivity($act); - $notice = Notice::staticGet('uri', $act->objects[0]->id); + $notice = Notice::getKV('uri', $act->objects[0]->id); if (!empty($notice)) { $fave = Fave::pkeyGet(array('user_id' => $user->id, 'notice_id' => $notice->id)); @@ -105,7 +105,7 @@ class ActivityMover extends QueueHandler "{$act->actor->id} to {$remote->nickname}."); // XXX: send a reshare, not a post $sink->postActivity($act); - $notice = Notice::staticGet('uri', $act->objects[0]->id); + $notice = Notice::getKV('uri', $act->objects[0]->id); if (!empty($notice)) { $notice->delete(); } @@ -115,7 +115,7 @@ class ActivityMover extends QueueHandler "Moving group join of {$act->objects[0]->id} by ". "{$act->actor->id} to {$remote->nickname}."); $sink->postActivity($act); - $group = User_group::staticGet('uri', $act->objects[0]->id); + $group = User_group::getKV('uri', $act->objects[0]->id); if (!empty($group)) { $user->leaveGroup($group); } @@ -131,7 +131,7 @@ class ActivityMover extends QueueHandler Subscription::cancel($user->getProfile(), $other); } } else { - $otherUser = User::staticGet('uri', $act->actor->id); + $otherUser = User::getKV('uri', $act->actor->id); if (!empty($otherUser)) { $this->log(LOG_INFO, "Changing sub to {$act->objects[0]->id}". diff --git a/lib/activityobject.php b/lib/activityobject.php index 5a42a1dfb3..ee69e1c762 100644 --- a/lib/activityobject.php +++ b/lib/activityobject.php @@ -553,7 +553,7 @@ class ActivityObject $object->title = $ptag->tag; $object->summary = $ptag->description; $object->link = $ptag->homeUrl(); - $object->owner = Profile::staticGet('id', $ptag->tagger); + $object->owner = Profile::getKV('id', $ptag->tagger); $object->poco = PoCo::fromProfile($object->owner); Event::handle('EndActivityObjectFromPeopletag', array($ptag, &$object)); } diff --git a/lib/apiaction.php b/lib/apiaction.php index 14e21ae4fd..edd184934f 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -279,7 +279,7 @@ class ApiAction extends Action $base = $this->twitterSimpleStatusArray($notice, $include_user); if (!empty($notice->repeat_of)) { - $original = Notice::staticGet('id', $notice->repeat_of); + $original = Notice::getKV('id', $notice->repeat_of); if (!empty($original)) { $original_array = $this->twitterSimpleStatusArray($original, $include_user); $base['retweeted_status'] = $original_array; @@ -321,7 +321,7 @@ class ApiAction extends Action $replier_profile = null; if ($notice->reply_to) { - $reply = Notice::staticGet(intval($notice->reply_to)); + $reply = Notice::getKV(intval($notice->reply_to)); if ($reply) { $replier_profile = $reply->getProfile(); } @@ -431,7 +431,7 @@ class ApiAction extends Action function twitterListArray($list) { - $profile = Profile::staticGet('id', $list->tagger); + $profile = Profile::getKV('id', $list->tagger); $twitter_list = array(); $twitter_list['id'] = $list->id; @@ -1468,29 +1468,29 @@ class ApiAction extends Action if (empty($id)) { // Twitter supports these other ways of passing the user ID if (self::is_decimal($this->arg('id'))) { - return User::staticGet($this->arg('id')); + return User::getKV($this->arg('id')); } else if ($this->arg('id')) { $nickname = common_canonical_nickname($this->arg('id')); - return User::staticGet('nickname', $nickname); + return User::getKV('nickname', $nickname); } else if ($this->arg('user_id')) { // This is to ensure that a non-numeric user_id still // overrides screen_name even if it doesn't get used if (self::is_decimal($this->arg('user_id'))) { - return User::staticGet('id', $this->arg('user_id')); + return User::getKV('id', $this->arg('user_id')); } } else if ($this->arg('screen_name')) { $nickname = common_canonical_nickname($this->arg('screen_name')); - return User::staticGet('nickname', $nickname); + return User::getKV('nickname', $nickname); } else { // Fall back to trying the currently authenticated user return $this->auth_user; } } else if (self::is_decimal($id)) { - return User::staticGet($id); + return User::getKV($id); } else { $nickname = common_canonical_nickname($id); - return User::staticGet('nickname', $nickname); + return User::getKV('nickname', $nickname); } } @@ -1500,28 +1500,28 @@ class ApiAction extends Action // Twitter supports these other ways of passing the user ID if (self::is_decimal($this->arg('id'))) { - return Profile::staticGet($this->arg('id')); + return Profile::getKV($this->arg('id')); } else if ($this->arg('id')) { // Screen names currently can only uniquely identify a local user. $nickname = common_canonical_nickname($this->arg('id')); - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); return $user ? $user->getProfile() : null; } else if ($this->arg('user_id')) { // This is to ensure that a non-numeric user_id still // overrides screen_name even if it doesn't get used if (self::is_decimal($this->arg('user_id'))) { - return Profile::staticGet('id', $this->arg('user_id')); + return Profile::getKV('id', $this->arg('user_id')); } } else if ($this->arg('screen_name')) { $nickname = common_canonical_nickname($this->arg('screen_name')); - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); return $user ? $user->getProfile() : null; } } else if (self::is_decimal($id)) { - return Profile::staticGet($id); + return Profile::getKV($id); } else { $nickname = common_canonical_nickname($id); - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); return $user ? $user->getProfile() : null; } } @@ -1530,21 +1530,21 @@ class ApiAction extends Action { if (empty($id)) { if (self::is_decimal($this->arg('id'))) { - return User_group::staticGet('id', $this->arg('id')); + return User_group::getKV('id', $this->arg('id')); } else if ($this->arg('id')) { return User_group::getForNickname($this->arg('id')); } else if ($this->arg('group_id')) { // This is to ensure that a non-numeric group_id still // overrides group_name even if it doesn't get used if (self::is_decimal($this->arg('group_id'))) { - return User_group::staticGet('id', $this->arg('group_id')); + return User_group::getKV('id', $this->arg('group_id')); } } else if ($this->arg('group_name')) { return User_group::getForNickname($this->arg('group_name')); } } else if (self::is_decimal($id)) { - return User_group::staticGet('id', $id); + return User_group::getKV('id', $id); } else { return User_group::getForNickname($id); } @@ -1561,7 +1561,7 @@ class ApiAction extends Action if($id) { if (is_numeric($id)) { - $list = Profile_list::staticGet('id', $id); + $list = Profile_list::getKV('id', $id); // only if the list with the id belongs to the tagger if(empty($list) || $list->tagger != $tagger->id) { diff --git a/lib/apiauth.php b/lib/apiauth.php index 1061e6b68c..ecb206bab1 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -183,7 +183,7 @@ class ApiAuthAction extends ApiAction } - $appUser = Oauth_application_user::staticGet('token', $access_token); + $appUser = Oauth_application_user::getKV('token', $access_token); if (!empty($appUser)) { // If access_type == 0 we have either a request token @@ -196,7 +196,7 @@ class ApiAuthAction extends ApiAction // Set the auth user if (Event::handle('StartSetApiUser', array(&$user))) { - $user = User::staticGet('id', $appUser->profile_id); + $user = User::getKV('id', $appUser->profile_id); if (!empty($user)) { if (!$user->hasRight(Right::API)) { // TRANS: Authorization exception thrown when a user without API access tries to access the API. diff --git a/lib/applicationlist.php b/lib/applicationlist.php index ca7dce8328..ee968590e8 100644 --- a/lib/applicationlist.php +++ b/lib/applicationlist.php @@ -202,7 +202,7 @@ class ConnectedAppsList extends Widget function showConnection() { - $app = Oauth_application::staticGet('id', $this->connection->application_id); + $app = Oauth_application::getKV('id', $this->connection->application_id); $this->out->elementStart( 'li', diff --git a/lib/atomlistnoticefeed.php b/lib/atomlistnoticefeed.php index ee4f01cad4..601e83294f 100644 --- a/lib/atomlistnoticefeed.php +++ b/lib/atomlistnoticefeed.php @@ -59,7 +59,7 @@ class AtomListNoticeFeed extends AtomNoticeFeed function __construct($list, $cur = null, $indent = true) { parent::__construct($cur, $indent); $this->list = $list; - $this->tagger = Profile::staticGet('id', $list->tagger); + $this->tagger = Profile::getKV('id', $list->tagger); // TRANS: Title in atom list notice feed. %1$s is a list name, %2$s is a tagger's nickname. $title = sprintf(_('Timeline for people in list %1$s by %2$s'), $list->tag, $this->tagger->nickname); diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index a93a6842bb..1d5be73714 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -152,7 +152,7 @@ class AttachmentListItem extends Widget { parent::__construct($out); $this->attachment = $attachment; - $this->oembed = File_oembed::staticGet('file_id', $this->attachment->id); + $this->oembed = File_oembed::getKV('file_id', $this->attachment->id); } function title() { @@ -222,7 +222,7 @@ class AttachmentListItem extends Widget */ function getThumbInfo() { - $thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id); + $thumbnail = File_thumbnail::getKV('file_id', $this->attachment->id); if ($thumbnail) { $maxWidth = common_config('attachments', 'thumb_width'); $maxHeight = common_config('attachments', 'thumb_height'); diff --git a/lib/authenticationplugin.php b/lib/authenticationplugin.php index 5e878c155b..ad031e7852 100644 --- a/lib/authenticationplugin.php +++ b/lib/authenticationplugin.php @@ -128,12 +128,12 @@ abstract class AuthenticationPlugin extends Plugin { if($provider_name == $this->provider_name && $this->autoregistration){ $suggested_nickname = $this->suggestNicknameForUsername($nickname); - $test_user = User::staticGet('nickname', $suggested_nickname); + $test_user = User::getKV('nickname', $suggested_nickname); if($test_user) { //someone already exists with the suggested nickname, so used the passed nickname $suggested_nickname = common_nicknamize($nickname); } - $test_user = User::staticGet('nickname', $suggested_nickname); + $test_user = User::getKV('nickname', $suggested_nickname); if($test_user) { //someone already exists with the suggested nickname //not much else we can do @@ -155,14 +155,14 @@ abstract class AuthenticationPlugin extends Plugin if($user_username->find() && $user_username->fetch()){ $authenticated = $this->checkPassword($user_username->username, $password); if($authenticated){ - $authenticatedUser = User::staticGet('id', $user_username->user_id); + $authenticatedUser = User::getKV('id', $user_username->user_id); return false; } }else{ //$nickname is the username used to login //$suggested_nickname is the nickname the auth provider suggests for that username $suggested_nickname = $this->suggestNicknameForUsername($nickname); - $user = User::staticGet('nickname', $suggested_nickname); + $user = User::getKV('nickname', $suggested_nickname); if($user){ //make sure this user isn't claimed $user_username = new User_username(); diff --git a/lib/command.php b/lib/command.php index f51cbbb5f7..ae97b9facd 100644 --- a/lib/command.php +++ b/lib/command.php @@ -76,7 +76,7 @@ class Command if(substr($this->other,0,1)=='#'){ // A specific notice_id #123 - $notice = Notice::staticGet(substr($arg,1)); + $notice = Notice::getKV(substr($arg,1)); if (!$notice) { // TRANS: Command exception text shown when a notice ID is requested that does not exist. throw new CommandException(_('Notice with that id does not exist.')); @@ -85,7 +85,7 @@ class Command if (Validate::uri($this->other)) { // A specific notice by URI lookup - $notice = Notice::staticGet('uri', $arg); + $notice = Notice::getKV('uri', $arg); } if (!$notice) { @@ -139,7 +139,7 @@ class Command { $user = null; if (Event::handle('StartCommandGetUser', array($this, $arg, &$user))) { - $user = User::staticGet('nickname', Nickname::normalize($arg)); + $user = User::getKV('nickname', Nickname::normalize($arg)); } Event::handle('EndCommandGetUser', array($this, $arg, &$user)); if (!$user){ @@ -310,7 +310,7 @@ class FavCommand extends Command // @fixme favorite notification should be triggered // at a lower level - $other = User::staticGet('id', $notice->profile_id); + $other = User::getKV('id', $notice->profile_id); if ($other && $other->id != $this->user->id) { if ($other->email && $other->emailnotifyfav) { @@ -770,7 +770,7 @@ class SubCommand extends Command $target = $this->getProfile($this->other); - $remote = Remote_profile::staticGet('id', $target->id); + $remote = Remote_profile::getKV('id', $target->id); if ($remote) { // TRANS: Command exception text shown when trying to subscribe to an OMB profile using the subscribe command. throw new CommandException(_("Can't subscribe to OMB profiles by command.")); diff --git a/lib/deluserqueuehandler.php b/lib/deluserqueuehandler.php index 7103039382..1baaf9331f 100644 --- a/lib/deluserqueuehandler.php +++ b/lib/deluserqueuehandler.php @@ -43,7 +43,7 @@ class DelUserQueueHandler extends QueueHandler return true; } - $user = User::staticGet('id', $user->id); + $user = User::getKV('id', $user->id); if (!$user) { common_log(LOG_INFO, "User {$user->nickname} was deleted before we got here."); return true; diff --git a/lib/feedimporter.php b/lib/feedimporter.php index 466093534e..b5807ee8b4 100644 --- a/lib/feedimporter.php +++ b/lib/feedimporter.php @@ -142,7 +142,7 @@ class FeedImporter extends QueueHandler function userFromAuthor($author) { - $user = User::staticGet('uri', $author->id); + $user = User::getKV('uri', $author->id); if (empty($user)) { $attrs = diff --git a/lib/galleryaction.php b/lib/galleryaction.php index 51bb9e3e1a..85e3f0de3e 100644 --- a/lib/galleryaction.php +++ b/lib/galleryaction.php @@ -54,7 +54,7 @@ class GalleryAction extends ProfileAction return false; } - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed when trying to perform a gallery action with an unknown user. diff --git a/lib/groupaction.php b/lib/groupaction.php index a5e62a2a5a..6e33cb321b 100644 --- a/lib/groupaction.php +++ b/lib/groupaction.php @@ -70,10 +70,10 @@ class GroupAction extends Action return false; } - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (!$local) { - $alias = Group_alias::staticGet('alias', $nickname); + $alias = Group_alias::getKV('alias', $nickname); if ($alias) { $args = array('id' => $alias->group_id); if ($this->page != 1) { @@ -89,7 +89,7 @@ class GroupAction extends Action } } - $this->group = User_group::staticGet('id', $local->group_id); + $this->group = User_group::getKV('id', $local->group_id); if (!$this->group) { // TRANS: Client error displayed if no local group with a given name was found requesting group page. diff --git a/lib/implugin.php b/lib/implugin.php index a037860391..3eba3469fd 100644 --- a/lib/implugin.php +++ b/lib/implugin.php @@ -170,7 +170,7 @@ abstract class ImPlugin extends Plugin { $user_im_prefs = $this->getUserImPrefsFromScreenname($screenname); if($user_im_prefs){ - $user = User::staticGet('id', $user_im_prefs->user_id); + $user = User::getKV('id', $user_im_prefs->user_id); $user_im_prefs->free(); return $user; }else{ @@ -321,7 +321,7 @@ abstract class ImPlugin extends Plugin $ni = $notice->whoGets(); foreach ($ni as $user_id => $reason) { - $user = User::staticGet($user_id); + $user = User::getKV($user_id); if (empty($user)) { // either not a local user, or just not found continue; @@ -535,7 +535,7 @@ abstract class ImPlugin extends Plugin function onStartEnqueueNotice($notice, &$transports) { - $profile = Profile::staticGet($notice->profile_id); + $profile = Profile::getKV($notice->profile_id); if (!$profile) { common_log(LOG_WARNING, 'Refusing to broadcast notice with ' . diff --git a/lib/inboxnoticestream.php b/lib/inboxnoticestream.php index 58b0075050..fee0e8a096 100644 --- a/lib/inboxnoticestream.php +++ b/lib/inboxnoticestream.php @@ -57,7 +57,7 @@ class InboxNoticeStream extends ScopingNoticeStream $profile = Profile::current(); } // Note: we don't use CachingNoticeStream since RawInboxNoticeStream - // uses Inbox::staticGet(), which is cached. + // uses Inbox::getKV(), which is cached. parent::__construct(new RawInboxNoticeStream($user), $profile); } } @@ -85,7 +85,7 @@ class RawInboxNoticeStream extends NoticeStream function __construct($user) { $this->user = $user; - $this->inbox = Inbox::staticGet('user_id', $user->id); + $this->inbox = Inbox::getKV('user_id', $user->id); } /** diff --git a/lib/jsonsearchresultslist.php b/lib/jsonsearchresultslist.php index c9b2705991..7ae2b9953c 100644 --- a/lib/jsonsearchresultslist.php +++ b/lib/jsonsearchresultslist.php @@ -217,7 +217,7 @@ class ResultItem $replier_profile = null; if ($this->notice->reply_to) { - $reply = Notice::staticGet(intval($this->notice->reply_to)); + $reply = Notice::getKV(intval($this->notice->reply_to)); if ($reply) { $replier_profile = $reply->getProfile(); } @@ -273,7 +273,7 @@ class ResultItem case 'api': break; default: - $ns = Notice_source::staticGet($source); + $ns = Notice_source::getKV($source); if ($ns) { $source_name = '' . $ns->name . ''; } diff --git a/lib/mail.php b/lib/mail.php index 223721a345..9ba4b0311c 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -609,11 +609,11 @@ function mail_notify_nudge($from, $to) function mail_notify_message($message, $from=null, $to=null) { if (is_null($from)) { - $from = User::staticGet('id', $message->from_profile); + $from = User::getKV('id', $message->from_profile); } if (is_null($to)) { - $to = User::staticGet('id', $message->to_profile); + $to = User::getKV('id', $message->to_profile); } if (is_null($to->email) || !$to->emailnotifymsg) { @@ -824,7 +824,7 @@ function mail_notify_group_join($group, $joiner) $admin = $group->getAdmins(); while ($admin->fetch()) { // We need a local user for email notifications... - $adminUser = User::staticGet('id', $admin->id); + $adminUser = User::getKV('id', $admin->id); // @fixme check for email preference? if ($adminUser && $adminUser->email) { // use the recipient's localization @@ -871,7 +871,7 @@ function mail_notify_group_join_pending($group, $joiner) $admin = $group->getAdmins(); while ($admin->fetch()) { // We need a local user for email notifications... - $adminUser = User::staticGet('id', $admin->id); + $adminUser = User::getKV('id', $admin->id); // @fixme check for email preference? if ($adminUser && $adminUser->email) { // use the recipient's localization diff --git a/lib/mailbox.php b/lib/mailbox.php index db686a255a..b1720fc824 100644 --- a/lib/mailbox.php +++ b/lib/mailbox.php @@ -51,7 +51,7 @@ class MailboxAction extends Action parent::prepare($args); $nickname = common_canonical_nickname($this->arg('nickname')); - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); $this->page = $this->trimmed('page'); if (!$this->page) { diff --git a/lib/mailhandler.php b/lib/mailhandler.php index 65c5622de3..75e4e1c1e4 100644 --- a/lib/mailhandler.php +++ b/lib/mailhandler.php @@ -109,9 +109,9 @@ class MailHandler } $from = $froms[0]; $addr = common_canonical_email($from['address']); - $user = User::staticGet('email', $addr); + $user = User::getKV('email', $addr); if (!$user) { - $user = User::staticGet('smsemail', $addr); + $user = User::getKV('smsemail', $addr); } return $user; } diff --git a/lib/mediafile.php b/lib/mediafile.php index caa902de5d..e5d699b5d2 100644 --- a/lib/mediafile.php +++ b/lib/mediafile.php @@ -158,7 +158,7 @@ class MediaFile function maybeAddRedir($file_id, $url) { - $file_redir = File_redirection::staticGet('url', $url); + $file_redir = File_redirection::getKV('url', $url); if (empty($file_redir)) { diff --git a/lib/messagelistitem.php b/lib/messagelistitem.php index ba8cf834af..9c9a0335c6 100644 --- a/lib/messagelistitem.php +++ b/lib/messagelistitem.php @@ -175,7 +175,7 @@ abstract class MessageListItem extends Widget $this->out->element('span', 'device', $source_name); break; default: - $ns = Notice_source::staticGet($source); + $ns = Notice_source::getKV($source); if ($ns) { $this->out->elementStart('span', 'device'); $this->out->element('a', array('href' => $ns->url, diff --git a/lib/microappplugin.php b/lib/microappplugin.php index 11058ad1ac..30542ffa73 100644 --- a/lib/microappplugin.php +++ b/lib/microappplugin.php @@ -399,7 +399,7 @@ abstract class MicroAppPlugin extends Plugin $uri = $target->uri; $original = null; if (!empty($activity->context->replyToID)) { - $original = Notice::staticGet('uri', + $original = Notice::getKV('uri', $activity->context->replyToID); } if (!in_array($uri, $activity->context->attention) && diff --git a/lib/noticeform.php b/lib/noticeform.php index bc47dd1bd3..6a0720821d 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -131,7 +131,7 @@ class NoticeForm extends Form if (empty($this->to_profile) && !empty($this->inreplyto)) { - $notice = Notice::staticGet('id', $this->inreplyto); + $notice = Notice::getKV('id', $this->inreplyto); if (!empty($notice)) { $this->to_profile = $notice->getProfile(); } diff --git a/lib/noticelistitem.php b/lib/noticelistitem.php index 08053bceb6..f829f963ee 100644 --- a/lib/noticelistitem.php +++ b/lib/noticelistitem.php @@ -73,7 +73,7 @@ class NoticeListItem extends Widget { parent::__construct($out); if (!empty($notice->repeat_of)) { - $original = Notice::staticGet('id', $notice->repeat_of); + $original = Notice::getKV('id', $notice->repeat_of); if (empty($original)) { // could have been deleted $this->notice = $notice; } else { @@ -571,7 +571,7 @@ class NoticeListItem extends Widget function showContext() { if ($this->notice->hasConversation()) { - $conv = Conversation::staticGet( + $conv = Conversation::getKV( 'id', $this->notice->conversation ); @@ -607,7 +607,7 @@ class NoticeListItem extends Widget { if (!empty($this->repeat)) { - $repeater = Profile::staticGet('id', $this->repeat->profile_id); + $repeater = Profile::getKV('id', $this->repeat->profile_id); $attrs = array('href' => $repeater->profileurl, 'class' => 'url'); diff --git a/lib/peopletageditform.php b/lib/peopletageditform.php index 3dd8dafedd..c984880e2a 100644 --- a/lib/peopletageditform.php +++ b/lib/peopletageditform.php @@ -64,7 +64,7 @@ class PeopletagEditForm extends Form parent::__construct($out); $this->peopletag = $peopletag; - $this->tagger = Profile::staticGet('id', $peopletag->tagger); + $this->tagger = Profile::getKV('id', $peopletag->tagger); } /** diff --git a/lib/peopletaggroupnav.php b/lib/peopletaggroupnav.php index 70f7f5a425..bbfe4eca7e 100644 --- a/lib/peopletaggroupnav.php +++ b/lib/peopletaggroupnav.php @@ -89,7 +89,7 @@ class PeopletagGroupNav extends Widget $tag = $this->action->trimmed('tag'); if ($nickname) { - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); $user_profile = $user->getProfile(); if ($tag) { diff --git a/lib/peopletaglist.php b/lib/peopletaglist.php index 986712f51d..2d0797f856 100644 --- a/lib/peopletaglist.php +++ b/lib/peopletaglist.php @@ -107,7 +107,7 @@ class PeopletagListItem extends Widget parent::__construct($out); $this->peopletag = $peopletag; $this->current = $current; - $this->profile = Profile::staticGet('id', $this->peopletag->tagger); + $this->profile = Profile::getKV('id', $this->peopletag->tagger); } /** diff --git a/lib/profileaction.php b/lib/profileaction.php index 45866b52f9..7197121815 100644 --- a/lib/profileaction.php +++ b/lib/profileaction.php @@ -70,7 +70,7 @@ class ProfileAction extends Action return false; } - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed when calling a profile action without specifying a user. diff --git a/lib/profileformaction.php b/lib/profileformaction.php index b5f2e5d2a3..4c738523a4 100644 --- a/lib/profileformaction.php +++ b/lib/profileformaction.php @@ -80,7 +80,7 @@ class ProfileFormAction extends RedirectingAction return false; } - $this->profile = Profile::staticGet('id', $id); + $this->profile = Profile::getKV('id', $id); if (!$this->profile) { // TRANS: Client error displayed when trying to change user options without specifying an existing user to work on. diff --git a/lib/profilenoticestream.php b/lib/profilenoticestream.php index 0cf088a702..e299fccaf4 100644 --- a/lib/profilenoticestream.php +++ b/lib/profilenoticestream.php @@ -82,7 +82,7 @@ class ProfileNoticeStream extends ScopingNoticeStream function impossibleStream() { - $user = User::staticGet('id', $this->streamProfile->id); + $user = User::getKV('id', $this->streamProfile->id); // If it's a private stream, and no user or not a subscriber diff --git a/lib/statusnet.php b/lib/statusnet.php index cd78516528..6a40daa65a 100644 --- a/lib/statusnet.php +++ b/lib/statusnet.php @@ -148,7 +148,7 @@ class StatusNet return true; } - $sn = Status_network::staticGet('nickname', $nickname); + $sn = Status_network::getKV('nickname', $nickname); if (empty($sn)) { return false; throw new Exception("No such site nickname '$nickname'"); diff --git a/lib/statusnetoauthstore.php b/lib/statusnetoauthstore.php index 341e32d857..bcf6a180aa 100644 --- a/lib/statusnetoauthstore.php +++ b/lib/statusnetoauthstore.php @@ -28,7 +28,7 @@ class ApiStatusNetOAuthDataStore extends OAuthDataStore { function lookup_consumer($consumerKey) { - $con = Consumer::staticGet('consumer_key', $consumerKey); + $con = Consumer::getKV('consumer_key', $consumerKey); if (!$con) { @@ -146,7 +146,7 @@ class ApiStatusNetOAuthDataStore extends OAuthDataStore common_debug('Request token found.', __FILE__); // find the app and profile associated with this token - $tokenAssoc = Oauth_token_association::staticGet('token', $rt->tok); + $tokenAssoc = Oauth_token_association::getKV('token', $rt->tok); if (!$tokenAssoc) { throw new Exception( diff --git a/lib/stompqueuemanager.php b/lib/stompqueuemanager.php index 7dd3e6961e..5b1f8f3d91 100644 --- a/lib/stompqueuemanager.php +++ b/lib/stompqueuemanager.php @@ -656,7 +656,7 @@ class StompQueueManager extends QueueManager */ protected function updateSiteConfig($nickname) { - $sn = Status_network::staticGet('nickname', $nickname); + $sn = Status_network::getKV('nickname', $nickname); if ($sn) { $this->switchSite($nickname); if (!in_array($nickname, $this->sites)) { diff --git a/lib/threadednoticelist.php b/lib/threadednoticelist.php index f0854767d6..8621590ad6 100644 --- a/lib/threadednoticelist.php +++ b/lib/threadednoticelist.php @@ -89,7 +89,7 @@ class ThreadedNoticeList extends NoticeList // Collapse repeats into their originals... if ($notice->repeat_of) { - $orig = Notice::staticGet('id', $notice->repeat_of); + $orig = Notice::getKV('id', $notice->repeat_of); if ($orig) { $notice = $orig; } @@ -436,7 +436,7 @@ abstract class NoticeListActorsItem extends NoticeListItem // TRANS: Reference to the logged in user in favourite list. array_unshift($links, _m('FAVELIST', 'You')); } else { - $profile = Profile::staticGet('id', $id); + $profile = Profile::getKV('id', $id); if ($profile) { $links[] = sprintf('%s', htmlspecialchars($profile->profileurl), diff --git a/lib/toselector.php b/lib/toselector.php index ba9593f0b3..b01948ed62 100644 --- a/lib/toselector.php +++ b/lib/toselector.php @@ -145,7 +145,7 @@ class ToSelector extends Widget } break; case 'profile': - $profile = Profile::staticGet('id', $value); + $profile = Profile::getKV('id', $value); $options['replies'] = array($profile->getUri()); if ($private) { $options['scope'] = Notice::ADDRESSEE_SCOPE; diff --git a/lib/util.php b/lib/util.php index 4a87f9a217..bda78afe13 100644 --- a/lib/util.php +++ b/lib/util.php @@ -235,9 +235,9 @@ function common_check_user($nickname, $password) if (Event::handle('StartCheckPassword', array($nickname, $password, &$authenticatedUser))) { if (common_is_email($nickname)) { - $user = User::staticGet('email', common_canonical_email($nickname)); + $user = User::getKV('email', common_canonical_email($nickname)); } else { - $user = User::staticGet('nickname', common_canonical_nickname($nickname)); + $user = User::getKV('nickname', common_canonical_nickname($nickname)); } if (!empty($user)) { @@ -315,7 +315,7 @@ function common_set_user($user) return true; } else if (is_string($user)) { $nickname = $user; - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); } else if (!($user instanceof User)) { return false; } @@ -413,7 +413,7 @@ function common_remembered_user() return null; } - $rm = Remember_me::staticGet('code', $code); + $rm = Remember_me::getKV('code', $code); if (!$rm) { common_log(LOG_WARNING, 'No such remember code: ' . $code); @@ -427,7 +427,7 @@ function common_remembered_user() return null; } - $user = User::staticGet('id', $rm->user_id); + $user = User::getKV('id', $rm->user_id); if (!$user) { common_log(LOG_WARNING, 'No such user for rememberme: ' . $rm->user_id); @@ -484,7 +484,7 @@ function common_current_user() common_ensure_session(); $id = isset($_SESSION['userid']) ? $_SESSION['userid'] : false; if ($id) { - $user = User::staticGet($id); + $user = User::getKV($id); if ($user) { $_cur = $user; return $_cur; @@ -675,7 +675,7 @@ function common_find_mentions($text, $notice) { $mentions = array(); - $sender = Profile::staticGet('id', $notice->profile_id); + $sender = Profile::getKV('id', $notice->profile_id); if (empty($sender)) { return $mentions; @@ -690,14 +690,14 @@ function common_find_mentions($text, $notice) // Is it a reply? if (!empty($notice) && !empty($notice->reply_to)) { - $originalNotice = Notice::staticGet('id', $notice->reply_to); + $originalNotice = Notice::getKV('id', $notice->reply_to); if (!empty($originalNotice)) { - $originalAuthor = Profile::staticGet('id', $originalNotice->profile_id); + $originalAuthor = Profile::getKV('id', $originalNotice->profile_id); $ids = $originalNotice->getReplies(); foreach ($ids as $id) { - $repliedTo = Profile::staticGet('id', $id); + $repliedTo = Profile::getKV('id', $id); if (!empty($repliedTo)) { $originalMentions[$repliedTo->nickname] = $repliedTo; } @@ -729,7 +729,7 @@ function common_find_mentions($text, $notice) } if (!empty($mentioned)) { - $user = User::staticGet('id', $mentioned->id); + $user = User::getKV('id', $mentioned->id); if ($user) { $url = common_local_url('userbyid', array('id' => $user->id)); @@ -979,7 +979,7 @@ function common_linkify($url) { // Check to see whether this is a known "attachment" URL. - $f = File::staticGet('url', $longurl); + $f = File::getKV('url', $longurl); if (empty($f)) { if (common_config('attachments', 'process_links')) { @@ -993,7 +993,7 @@ function common_linkify($url) { $is_attachment = true; $attachment_id = $f->id; - $thumb = File_thumbnail::staticGet('file_id', $f->id); + $thumb = File_thumbnail::getKV('file_id', $f->id); if (!empty($thumb)) { $has_thumb = true; } @@ -1150,7 +1150,7 @@ function common_valid_profile_tag($str) */ function common_group_link($sender_id, $nickname) { - $sender = Profile::staticGet($sender_id); + $sender = Profile::getKV($sender_id); $group = User_group::getForNickname($nickname, $sender); if ($sender && $group && $sender->isMember($group)) { $attrs = array('href' => $group->permalink(), @@ -1217,9 +1217,9 @@ function common_relative_profile($sender, $nickname, $dt=null) return $recipient; } // If this is a local user, try to find a local user with that nickname. - $sender = User::staticGet($sender->id); + $sender = User::getKV($sender->id); if ($sender) { - $recipient_user = User::staticGet('nickname', $nickname); + $recipient_user = User::getKV('nickname', $nickname); if ($recipient_user) { return $recipient_user->getProfile(); } @@ -2020,7 +2020,7 @@ function common_profile_uri($profile) if (!empty($profile)) { if (Event::handle('StartCommonProfileURI', array($profile, &$uri))) { - $user = User::staticGet($profile->id); + $user = User::getKV($profile->id); if (!empty($user)) { $uri = $user->uri; } diff --git a/plugins/Activity/ActivityPlugin.php b/plugins/Activity/ActivityPlugin.php index aa718d079e..ff95360281 100644 --- a/plugins/Activity/ActivityPlugin.php +++ b/plugins/Activity/ActivityPlugin.php @@ -202,10 +202,10 @@ class ActivityPlugin extends Plugin { // Only do this if config is enabled if(!$this->StopLike) return true; - $user = User::staticGet('id', $profile->id); + $user = User::getKV('id', $profile->id); if (!empty($user)) { - $author = Profile::staticGet('id', $notice->profile_id); + $author = Profile::getKV('id', $notice->profile_id); // TRANS: Text for "stopped liking" item in activity plugin. // TRANS: %1$s is a profile URL, %2$s is a profile name, // TRANS: %3$s is a notice URL, %4$s is an author name. @@ -370,9 +370,9 @@ class ActivityPlugin extends Plugin { switch ($notice->verb) { case ActivityVerb::FAVORITE: - $fave = Fave::staticGet('uri', $notice->uri); + $fave = Fave::getKV('uri', $notice->uri); if (!empty($fave)) { - $notice = Notice::staticGet('id', $fave->notice_id); + $notice = Notice::getKV('id', $fave->notice_id); if (!empty($notice)) { $cur = common_current_user(); $target = $notice->asActivity($cur); @@ -390,7 +390,7 @@ class ActivityPlugin extends Plugin // FIXME: do something here break; case ActivityVerb::JOIN: - $mem = Group_member::staticGet('uri', $notice->uri); + $mem = Group_member::getKV('uri', $notice->uri); if (!empty($mem)) { $group = $mem->getGroup(); $activity->objects = array(ActivityObject::fromGroup($group)); @@ -400,9 +400,9 @@ class ActivityPlugin extends Plugin // FIXME: ???? break; case ActivityVerb::FOLLOW: - $sub = Subscription::staticGet('uri', $notice->uri); + $sub = Subscription::getKV('uri', $notice->uri); if (!empty($sub)) { - $profile = Profile::staticGet('id', $sub->subscribed); + $profile = Profile::getKV('id', $sub->subscribed); if (!empty($profile)) { $activity->objects = array(ActivityObject::fromProfile($profile)); } diff --git a/plugins/Activity/joinlistitem.php b/plugins/Activity/joinlistitem.php index c795225ef8..6e3dbcf62a 100644 --- a/plugins/Activity/joinlistitem.php +++ b/plugins/Activity/joinlistitem.php @@ -51,7 +51,7 @@ class JoinListItem extends SystemListItem $notice = $this->nli->notice; $out = $this->nli->out; - $mem = Group_member::staticGet('uri', $notice->uri); + $mem = Group_member::getKV('uri', $notice->uri); if (!empty($mem)) { $out->elementStart('div', 'join-activity'); diff --git a/plugins/ActivitySpam/ActivitySpamPlugin.php b/plugins/ActivitySpam/ActivitySpamPlugin.php index 978f8b4cf8..975fc6885c 100644 --- a/plugins/ActivitySpam/ActivitySpamPlugin.php +++ b/plugins/ActivitySpam/ActivitySpamPlugin.php @@ -151,7 +151,7 @@ class ActivitySpamPlugin extends Plugin } function onNoticeDeleteRelated($notice) { - $score = Spam_score::staticGet('notice_id', $notice->id); + $score = Spam_score::getKV('notice_id', $notice->id); if (!empty($score)) { $score->delete(); } @@ -185,7 +185,7 @@ class ActivitySpamPlugin extends Plugin if (!empty($notice)) { - $score = Spam_score::staticGet('notice_id', $notice->id); + $score = Spam_score::getKV('notice_id', $notice->id); if (empty($score)) { // If it's empty, we can train it. @@ -263,7 +263,7 @@ class ActivitySpamPlugin extends Plugin if ($this->hideSpam) { if ($bResult) { - $score = Spam_score::staticGet('notice_id', $notice->id); + $score = Spam_score::getKV('notice_id', $notice->id); if (!empty($score) && $score->is_spam) { if (empty($profile) || diff --git a/plugins/ActivitySpam/Spam_score.php b/plugins/ActivitySpam/Spam_score.php index dd7209f594..2ae32fbfaa 100644 --- a/plugins/ActivitySpam/Spam_score.php +++ b/plugins/ActivitySpam/Spam_score.php @@ -74,7 +74,7 @@ class Spam_score extends Managed_DataObject function save($notice, $result) { $orig = null; - $score = Spam_score::staticGet('notice_id', $notice->id); + $score = Spam_score::getKV('notice_id', $notice->id); if (empty($score)) { $score = new Spam_score(); @@ -184,7 +184,7 @@ class Spam_score extends Managed_DataObject if ($score->find()) { while ($score->fetch()) { - $notice = Notice::staticGet('id', $score->notice_id); + $notice = Notice::getKV('id', $score->notice_id); if (!empty($notice)) { $orig = clone($score); $score->notice_created = $notice->created; diff --git a/plugins/ActivitySpam/scripts/silencespammer.php b/plugins/ActivitySpam/scripts/silencespammer.php index fde299e982..3a5e585fd5 100644 --- a/plugins/ActivitySpam/scripts/silencespammer.php +++ b/plugins/ActivitySpam/scripts/silencespammer.php @@ -64,7 +64,7 @@ function silencespammer($filter, $user, $minimum, $percent) { printfnq("Testing user %s\n", $user->nickname); - $profile = Profile::staticGet('id', $user->id); + $profile = Profile::getKV('id', $user->id); if ($profile->isSilenced()) { printfnq("Already silenced %s\n", $user->nickname); diff --git a/plugins/ActivitySpam/scripts/testuser.php b/plugins/ActivitySpam/scripts/testuser.php index 0b776bd42b..0eee9324bf 100644 --- a/plugins/ActivitySpam/scripts/testuser.php +++ b/plugins/ActivitySpam/scripts/testuser.php @@ -64,7 +64,7 @@ function testUser($filter, $user) { printfnq("Testing user %s\n", $user->nickname); - $profile = Profile::staticGet('id', $user->id); + $profile = Profile::getKV('id', $user->id); $str = new ProfileNoticeStream($profile, $profile); diff --git a/plugins/ActivitySpam/scripts/trainuser.php b/plugins/ActivitySpam/scripts/trainuser.php index f3739ac7b8..974048b4c9 100644 --- a/plugins/ActivitySpam/scripts/trainuser.php +++ b/plugins/ActivitySpam/scripts/trainuser.php @@ -38,7 +38,7 @@ function trainUser($filter, $user, $category) { printfnq("Training user %s\n", $user->nickname); - $profile = Profile::staticGet('id', $user->id); + $profile = Profile::getKV('id', $user->id); $str = new ProfileNoticeStream($profile, $profile); diff --git a/plugins/ActivitySpam/train.php b/plugins/ActivitySpam/train.php index f5c82361cc..69124b0dcc 100644 --- a/plugins/ActivitySpam/train.php +++ b/plugins/ActivitySpam/train.php @@ -79,7 +79,7 @@ class TrainAction extends Action $id = $this->trimmed('notice'); - $this->notice = Notice::staticGet('id', $id); + $this->notice = Notice::getKV('id', $id); if (empty($this->notice)) { throw new ClientException(_("No such notice.")); diff --git a/plugins/AnonymousFave/AnonymousFavePlugin.php b/plugins/AnonymousFave/AnonymousFavePlugin.php index af6ea20bd3..c3f810d6ee 100644 --- a/plugins/AnonymousFave/AnonymousFavePlugin.php +++ b/plugins/AnonymousFave/AnonymousFavePlugin.php @@ -272,7 +272,7 @@ class AnonymousFavePlugin extends Plugin $parts = explode('-', $anon); $id = $parts[1]; // Do Profile lookup by ID instead of nickname for safety/performance - $profile = Profile::staticGet('id', $id); + $profile = Profile::getKV('id', $id); } else { $profile = AnonymousFavePlugin::createAnonProfile(); // Obfuscate so it's hard to figure out the Profile ID @@ -294,7 +294,7 @@ class AnonymousFavePlugin extends Plugin */ function hasAnonFaving($item) { - $profile = Profile::staticGet('id', $item->notice->profile_id); + $profile = Profile::getKV('id', $item->notice->profile_id); if (in_array($profile->nickname, $this->restricted)) { return false; } diff --git a/plugins/AnonymousFave/Fave_tally.php b/plugins/AnonymousFave/Fave_tally.php index 7a610fb5f5..5962e5ad87 100644 --- a/plugins/AnonymousFave/Fave_tally.php +++ b/plugins/AnonymousFave/Fave_tally.php @@ -198,7 +198,7 @@ class Fave_tally extends Managed_DataObject */ static function ensureTally($noticeID) { - $tally = Fave_tally::staticGet('notice_id', $noticeID); + $tally = Fave_tally::getKV('notice_id', $noticeID); if (!$tally) { $tally = new Fave_tally(); diff --git a/plugins/AnonymousFave/anondisfavor.php b/plugins/AnonymousFave/anondisfavor.php index 859e4bd427..e5ae09679d 100644 --- a/plugins/AnonymousFave/anondisfavor.php +++ b/plugins/AnonymousFave/anondisfavor.php @@ -64,7 +64,7 @@ class AnonDisfavorAction extends RedirectingAction } $id = $this->trimmed('notice'); - $notice = Notice::staticGet($id); + $notice = Notice::getKV($id); $token = $this->trimmed('token-' . $notice->id); if (!$token || $token != common_session_token()) { diff --git a/plugins/AnonymousFave/anonfavor.php b/plugins/AnonymousFave/anonfavor.php index f20d55a863..401b6a855b 100644 --- a/plugins/AnonymousFave/anonfavor.php +++ b/plugins/AnonymousFave/anonfavor.php @@ -63,7 +63,7 @@ class AnonFavorAction extends RedirectingAction } $id = $this->trimmed('notice'); - $notice = Notice::staticGet($id); + $notice = Notice::getKV($id); $token = $this->trimmed('token-' . $notice->id); if (empty($token) || $token != common_session_token()) { diff --git a/plugins/AuthCrypt/AuthCryptPlugin.php b/plugins/AuthCrypt/AuthCryptPlugin.php index 7a077eb290..83885ab799 100644 --- a/plugins/AuthCrypt/AuthCryptPlugin.php +++ b/plugins/AuthCrypt/AuthCryptPlugin.php @@ -54,7 +54,7 @@ class AuthCryptPlugin extends AuthenticationPlugin */ function checkPassword($username, $password) { - $user = User::staticGet('nickname', common_canonical_nickname($username)); + $user = User::getKV('nickname', common_canonical_nickname($username)); // crypt cuts the second parameter to its appropriate length based on hash scheme if (!empty($user) && $user->password === crypt($password, $user->password)) { @@ -76,7 +76,7 @@ class AuthCryptPlugin extends AuthenticationPlugin return false; } - $user = User::staticGet('nickname', $username); + $user = User::getKV('nickname', $username); if (empty($user)) { return false; } diff --git a/plugins/AutoSandbox/AutoSandboxPlugin.php b/plugins/AutoSandbox/AutoSandboxPlugin.php index ebdc613243..e197254f7f 100644 --- a/plugins/AutoSandbox/AutoSandboxPlugin.php +++ b/plugins/AutoSandbox/AutoSandboxPlugin.php @@ -74,7 +74,7 @@ class AutoSandboxPlugin extends Plugin $instr = _m('Note you will initially be "sandboxed" so your posts will not appear in the public timeline.'); if (isset($this->contact)) { - $contactuser = User::staticGet('nickname', $this->contact); + $contactuser = User::getKV('nickname', $this->contact); if (!empty($contactuser)) { $contactlink = "@uri\">$contactuser->nickname"; // TRANS: User instructions after registration. diff --git a/plugins/Blacklist/Homepage_blacklist.php b/plugins/Blacklist/Homepage_blacklist.php index 99a6786de4..440084702c 100644 --- a/plugins/Blacklist/Homepage_blacklist.php +++ b/plugins/Blacklist/Homepage_blacklist.php @@ -133,7 +133,7 @@ class Homepage_blacklist extends Managed_DataObject $toInsert = array_diff($newPatterns, $oldPatterns); foreach ($toDelete as $pattern) { - $nb = Homepage_blacklist::staticGet('pattern', $pattern); + $nb = Homepage_blacklist::getKV('pattern', $pattern); if (!empty($nb)) { $nb->delete(); } @@ -151,7 +151,7 @@ class Homepage_blacklist extends Managed_DataObject static function ensurePattern($pattern) { - $hb = Homepage_blacklist::staticGet('pattern', $pattern); + $hb = Homepage_blacklist::getKV('pattern', $pattern); if (empty($nb)) { $hb = new Homepage_blacklist(); diff --git a/plugins/Blacklist/Nickname_blacklist.php b/plugins/Blacklist/Nickname_blacklist.php index bc466f879d..bf1d1e5ab7 100644 --- a/plugins/Blacklist/Nickname_blacklist.php +++ b/plugins/Blacklist/Nickname_blacklist.php @@ -124,7 +124,7 @@ class Nickname_blacklist extends Managed_DataObject $toInsert = array_diff($newPatterns, $oldPatterns); foreach ($toDelete as $pattern) { - $nb = Nickname_blacklist::staticGet('pattern', $pattern); + $nb = Nickname_blacklist::getKV('pattern', $pattern); if (!empty($nb)) { $nb->delete(); } @@ -142,7 +142,7 @@ class Nickname_blacklist extends Managed_DataObject static function ensurePattern($pattern) { - $nb = Nickname_blacklist::staticGet('pattern', $pattern); + $nb = Nickname_blacklist::getKV('pattern', $pattern); if (empty($nb)) { $nb = new Nickname_blacklist(); diff --git a/plugins/Blog/Blog_entry.php b/plugins/Blog/Blog_entry.php index 4d1820936f..b7de821d92 100644 --- a/plugins/Blog/Blog_entry.php +++ b/plugins/Blog/Blog_entry.php @@ -218,12 +218,12 @@ class Blog_entry extends Managed_DataObject static function fromNotice($notice) { - return Blog_entry::staticGet('uri', $notice->uri); + return Blog_entry::getKV('uri', $notice->uri); } function getNotice() { - return Notice::staticGet('uri', $this->uri); + return Notice::getKV('uri', $this->uri); } function asActivityObject() diff --git a/plugins/Blog/showblogentry.php b/plugins/Blog/showblogentry.php index 288527b42a..b46a65e5ff 100644 --- a/plugins/Blog/showblogentry.php +++ b/plugins/Blog/showblogentry.php @@ -53,7 +53,7 @@ class ShowblogentryAction extends ShownoticeAction { $this->id = $this->trimmed('id'); - $this->entry = Blog_entry::staticGet('id', $this->id); + $this->entry = Blog_entry::getKV('id', $this->id); if (empty($this->entry)) { // TRANS: Client exception thrown when referring to a non-existing blog entry. diff --git a/plugins/Bookmark/Bookmark.php b/plugins/Bookmark/Bookmark.php index f9bc71447e..f58276433f 100644 --- a/plugins/Bookmark/Bookmark.php +++ b/plugins/Bookmark/Bookmark.php @@ -130,7 +130,7 @@ class Bookmark extends Managed_DataObject */ static function getByNotice($notice) { - return self::staticGet('uri', $notice->uri); + return self::getKV('uri', $notice->uri); } /** @@ -182,7 +182,7 @@ class Bookmark extends Managed_DataObject } if (array_key_exists('uri', $options)) { - $other = Bookmark::staticGet('uri', $options['uri']); + $other = Bookmark::getKV('uri', $options['uri']); if (!empty($other)) { // TRANS: Client exception thrown when trying to save a new bookmark that already exists. throw new ClientException(_m('Bookmark already exists.')); @@ -270,7 +270,7 @@ class Bookmark extends Managed_DataObject // Use user's preferences for short URLs, if possible try { - $user = User::staticGet('id', $profile->id); + $user = User::getKV('id', $profile->id); $shortUrl = File_redirection::makeShort($url, empty($user) ? null : $user); diff --git a/plugins/Bookmark/BookmarkPlugin.php b/plugins/Bookmark/BookmarkPlugin.php index f644289ed4..c8408cf971 100644 --- a/plugins/Bookmark/BookmarkPlugin.php +++ b/plugins/Bookmark/BookmarkPlugin.php @@ -498,7 +498,7 @@ class BookmarkPlugin extends MicroAppPlugin if (!empty($other)) { $options['replies'][] = $replyURI; } else { - $group = User_group::staticGet('uri', $replyURI); + $group = User_group::getKV('uri', $replyURI); if (!empty($group)) { $options['groups'][] = $replyURI; } @@ -509,7 +509,7 @@ class BookmarkPlugin extends MicroAppPlugin // @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; @@ -637,7 +637,7 @@ class BookmarkPlugin extends MicroAppPlugin { assert($obj->type == ActivityObject::BOOKMARK); - $bm = Bookmark::staticGet('uri', $obj->id); + $bm = Bookmark::getKV('uri', $obj->id); if (empty($bm)) { throw new ServerException("Unknown bookmark: " . $obj->id); diff --git a/plugins/Bookmark/bookmarkforurl.php b/plugins/Bookmark/bookmarkforurl.php index e4dedf4a48..4e6de9bffa 100644 --- a/plugins/Bookmark/bookmarkforurl.php +++ b/plugins/Bookmark/bookmarkforurl.php @@ -78,7 +78,7 @@ class BookmarkforurlAction extends Action throw new ClientException(_('Invalid URL.'), 400); } - $f = File::staticGet('url', $this->url); + $f = File::getKV('url', $this->url); if (empty($url)) { $f = File::processNew($this->url); @@ -87,11 +87,11 @@ class BookmarkforurlAction extends Action // How about now? if (!empty($f)) { - $this->oembed = File_oembed::staticGet('file_id', $f->id); + $this->oembed = File_oembed::getKV('file_id', $f->id); if (!empty($this->oembed)) { $this->title = $this->oembed->title; } - $this->thumbnail = File_thumbnail::staticGet('file_id', $f->id); + $this->thumbnail = File_thumbnail::getKV('file_id', $f->id); } return true; diff --git a/plugins/Bookmark/bookmarklistitem.php b/plugins/Bookmark/bookmarklistitem.php index a2dbf8156d..f9613fbd6e 100644 --- a/plugins/Bookmark/bookmarklistitem.php +++ b/plugins/Bookmark/bookmarklistitem.php @@ -105,7 +105,7 @@ class BookmarkListItem extends NoticeListItemAdapter $out->elementStart('ul', array('class' => 'bookmark-tags')); foreach ($replies as $reply) { - $other = Profile::staticGet('id', $reply); + $other = Profile::getKV('id', $reply); if (!empty($other)) { $out->elementStart('li'); $out->element('a', array('rel' => 'tag', diff --git a/plugins/Bookmark/bookmarks.php b/plugins/Bookmark/bookmarks.php index 6faf99929c..8c786d6fb0 100644 --- a/plugins/Bookmark/bookmarks.php +++ b/plugins/Bookmark/bookmarks.php @@ -77,7 +77,7 @@ class BookmarksAction extends Action $nickname = $nickname[1]['nickname']; } - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed when trying to display bookmarks for a non-existing user. diff --git a/plugins/Bookmark/bookmarksrss.php b/plugins/Bookmark/bookmarksrss.php index 63534cac79..a52a0b7f43 100644 --- a/plugins/Bookmark/bookmarksrss.php +++ b/plugins/Bookmark/bookmarksrss.php @@ -67,7 +67,7 @@ class BookmarksrssAction extends Rss10Action parent::prepare($args); $nickname = $this->trimmed('nickname'); - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed when trying to get the RSS feed with bookmarks of a user that does not exist. diff --git a/plugins/Bookmark/deliciousbookmarkimporter.php b/plugins/Bookmark/deliciousbookmarkimporter.php index 4065fc3085..eca9e96060 100644 --- a/plugins/Bookmark/deliciousbookmarkimporter.php +++ b/plugins/Bookmark/deliciousbookmarkimporter.php @@ -65,7 +65,7 @@ class DeliciousBookmarkImporter extends QueueHandler */ function handle($data) { - $profile = Profile::staticGet('id', $data['profile_id']); + $profile = Profile::getKV('id', $data['profile_id']); try { $saved = Bookmark::saveNew($profile, diff --git a/plugins/Bookmark/noticebyurl.php b/plugins/Bookmark/noticebyurl.php index 0f40db8fcc..d5f9940805 100644 --- a/plugins/Bookmark/noticebyurl.php +++ b/plugins/Bookmark/noticebyurl.php @@ -62,7 +62,7 @@ class NoticebyurlAction extends Action { parent::prepare($argarray); - $this->file = File::staticGet('id', $this->trimmed('id')); + $this->file = File::getKV('id', $this->trimmed('id')); if (empty($this->file)) { // TRANS: Client exception thrown when an unknown URL is provided. diff --git a/plugins/Bookmark/showbookmark.php b/plugins/Bookmark/showbookmark.php index 9220afffff..1c562d52a8 100644 --- a/plugins/Bookmark/showbookmark.php +++ b/plugins/Bookmark/showbookmark.php @@ -52,14 +52,14 @@ class ShowbookmarkAction extends ShownoticeAction { $this->id = $this->trimmed('id'); - $this->bookmark = Bookmark::staticGet('id', $this->id); + $this->bookmark = Bookmark::getKV('id', $this->id); if (empty($this->bookmark)) { // TRANS: Client exception thrown when referring to a non-existing bookmark. throw new ClientException(_m('No such bookmark.'), 404); } - $notice = Notice::staticGet('uri', $this->bookmark->uri); + $notice = Notice::getKV('uri', $this->bookmark->uri); if (empty($notice)) { // Did we used to have it, and it got deleted? diff --git a/plugins/Disqus/DisqusPlugin.php b/plugins/Disqus/DisqusPlugin.php index ad9435b7f9..d6e29264d9 100644 --- a/plugins/Disqus/DisqusPlugin.php +++ b/plugins/Disqus/DisqusPlugin.php @@ -104,7 +104,7 @@ class DisqusPlugin extends Plugin { if (get_class($action) == 'ShownoticeAction') { - $profile = Profile::staticGet('id', $action->notice->profile_id); + $profile = Profile::getKV('id', $action->notice->profile_id); if ($this->isAllowedRichEdit($profile)) { @@ -192,7 +192,7 @@ ENDOFSCRIPT; return; } - $profile = Profile::staticGet('id', $noticeListItem->notice->profile_id); + $profile = Profile::getKV('id', $noticeListItem->notice->profile_id); if ($this->isAllowedRichEdit($profile)) { $noticeUrl = $noticeListItem->notice->bestUrl(); @@ -221,7 +221,7 @@ ENDOFSCRIPT; private function isAllowedRichEdit($profile) { if ($this->restricted) { - $user = User::staticGet($profile->id); + $user = User::getKV($profile->id); return !empty($user) && $user->hasRole('richedit'); } else { return true; diff --git a/plugins/DomainStatusNetwork/DomainStatusNetworkPlugin.php b/plugins/DomainStatusNetwork/DomainStatusNetworkPlugin.php index 10208cfbe7..3364c8ae5c 100644 --- a/plugins/DomainStatusNetwork/DomainStatusNetworkPlugin.php +++ b/plugins/DomainStatusNetwork/DomainStatusNetworkPlugin.php @@ -74,7 +74,7 @@ class DomainStatusNetworkPlugin extends Plugin } try { - $sn = Status_network::staticGet('nickname', $nickname); + $sn = Status_network::getKV('nickname', $nickname); } catch (Exception $e) { $this->log(LOG_ERR, $e->getMessage()); return; @@ -134,11 +134,11 @@ class DomainStatusNetworkPlugin extends Plugin static function nicknameAvailable($nickname) { - $sn = Status_network::staticGet('nickname', $nickname); + $sn = Status_network::getKV('nickname', $nickname); if (!empty($sn)) { return false; } - $usn = Unavailable_status_network::staticGet('nickname', $nickname); + $usn = Unavailable_status_network::getKV('nickname', $nickname); if (!empty($usn)) { return false; } @@ -203,7 +203,7 @@ class DomainStatusNetworkPlugin extends Plugin $snt = Status_network_tag::withTag('domain='.$domain); while ($snt->fetch()) { - $sn = Status_network::staticGet('site_id', $snt->site_id); + $sn = Status_network::getKV('site_id', $snt->site_id); if (!empty($sn)) { return $sn; } @@ -235,7 +235,7 @@ class DomainStatusNetworkPlugin extends Plugin StatusNet::switchSite($sn->nickname); - $user = User::staticGet('email', $email); + $user = User::getKV('email', $email); return !empty($user); } @@ -317,7 +317,7 @@ class DomainStatusNetworkPlugin extends Plugin StatusNet::switchSite($sn->nickname); - $user = User::staticGet('email', $email); + $user = User::getKV('email', $email); if (empty($user)) { throw new ClientException(_('No such user.')); diff --git a/plugins/DomainStatusNetwork/lib/domainstatusnetworkinstaller.php b/plugins/DomainStatusNetwork/lib/domainstatusnetworkinstaller.php index dd93a51153..ad57e134d1 100644 --- a/plugins/DomainStatusNetwork/lib/domainstatusnetworkinstaller.php +++ b/plugins/DomainStatusNetwork/lib/domainstatusnetworkinstaller.php @@ -188,7 +188,7 @@ class DomainStatusNetworkInstaller extends Installer // Re-fetch; stupid auto-increment integer isn't working - $sn = Status_network::staticGet('nickname', $sn->nickname); + $sn = Status_network::getKV('nickname', $sn->nickname); if (empty($sn)) { throw new ServerException("Created {$this->nickname} status_network and could not find it again."); diff --git a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php index e55614ea43..ba131945c1 100644 --- a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php +++ b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php @@ -38,7 +38,7 @@ class EmailAuthenticationPlugin extends Plugin { if(strpos($nickname, '@')) { - $user = User::staticGet('email',$nickname); + $user = User::getKV('email',$nickname); if($user && isset($user->email)) { if(common_check_user($user->nickname,$password)) diff --git a/plugins/EmailRegistration/EmailRegistrationPlugin.php b/plugins/EmailRegistration/EmailRegistrationPlugin.php index 8759614129..2f1116ba0c 100644 --- a/plugins/EmailRegistration/EmailRegistrationPlugin.php +++ b/plugins/EmailRegistration/EmailRegistrationPlugin.php @@ -102,7 +102,7 @@ class EmailRegistrationPlugin extends Plugin static function registerEmail($email) { - $old = User::staticGet('email', $email); + $old = User::getKV('email', $email); if (!empty($old)) { // TRANS: Error text when trying to register with an already registered e-mail address. @@ -147,7 +147,7 @@ class EmailRegistrationPlugin extends Plugin $n = 0; - while (User::staticGet('nickname', $nickname)) { + while (User::getKV('nickname', $nickname)) { $n++; $nickname = $original . $n; } diff --git a/plugins/EmailRegistration/emailregister.php b/plugins/EmailRegistration/emailregister.php index e5c7d8a56c..5eaf84ad54 100644 --- a/plugins/EmailRegistration/emailregister.php +++ b/plugins/EmailRegistration/emailregister.php @@ -107,7 +107,7 @@ class EmailregisterAction extends Action throw new ClientException(_m('No confirmation code.')); } - $this->invitation = Invitation::staticGet('code', $this->code); + $this->invitation = Invitation::getKV('code', $this->code); if (!empty($this->invitation)) { if (!empty($this->invitation->registered_user_id)) { @@ -116,7 +116,7 @@ class EmailregisterAction extends Action } } else { - $this->confirmation = Confirm_address::staticGet('code', $this->code); + $this->confirmation = Confirm_address::getKV('code', $this->code); if (empty($this->confirmation)) { // TRANS: Client exception thrown when given confirmation code was not issued. @@ -139,7 +139,7 @@ class EmailregisterAction extends Action } $this->state = self::NEWREGISTER; } else { - $this->invitation = Invitation::staticGet('code', $this->code); + $this->invitation = Invitation::getKV('code', $this->code); if (!empty($this->invitation)) { if (!empty($this->invitation->registered_user_id)) { // TRANS: Client exception trown when using an invitation multiple times. @@ -148,7 +148,7 @@ class EmailregisterAction extends Action $this->state = self::CONFIRMINVITE; } else { $this->state = self::CONFIRMREGISTER; - $this->confirmation = Confirm_address::staticGet('code', $this->code); + $this->confirmation = Confirm_address::getKV('code', $this->code); if (empty($this->confirmation)) { // TRANS: Client exception thrown when given confirmation code was not issued. diff --git a/plugins/EmailReminder/EmailReminderPlugin.php b/plugins/EmailReminder/EmailReminderPlugin.php index 72583f5349..4e144af521 100644 --- a/plugins/EmailReminder/EmailReminderPlugin.php +++ b/plugins/EmailReminder/EmailReminderPlugin.php @@ -168,7 +168,7 @@ class EmailReminderPlugin extends Plugin $inviterurl = null; if ($type == UserInviteReminderHandler::INVITE_REMINDER) { - $user = User::staticGet($object->user_id); + $user = User::getKV($object->user_id); if (!empty($user)) { $profile = $user->getProfile(); $inviter = $profile->getBestName(); diff --git a/plugins/EmailSummary/EmailSummaryPlugin.php b/plugins/EmailSummary/EmailSummaryPlugin.php index 36aec6c96c..15cc0b5bd8 100644 --- a/plugins/EmailSummary/EmailSummaryPlugin.php +++ b/plugins/EmailSummary/EmailSummaryPlugin.php @@ -165,7 +165,7 @@ class EmailSummaryPlugin extends Plugin if (!empty($user)) { - $ess = Email_summary_status::staticGet('user_id', $user->id); + $ess = Email_summary_status::getKV('user_id', $user->id); if (empty($ess)) { diff --git a/plugins/EmailSummary/Email_summary_status.php b/plugins/EmailSummary/Email_summary_status.php index 97acd6ca66..de9e491fa6 100644 --- a/plugins/EmailSummary/Email_summary_status.php +++ b/plugins/EmailSummary/Email_summary_status.php @@ -118,7 +118,7 @@ class Email_summary_status extends Managed_DataObject */ static function getSendSummary($user_id) { - $ess = Email_summary_status::staticGet('user_id', $user_id); + $ess = Email_summary_status::getKV('user_id', $user_id); if (!empty($ess)) { return $ess->send_summary; @@ -136,7 +136,7 @@ class Email_summary_status extends Managed_DataObject */ static function getLastSummaryID($user_id) { - $ess = Email_summary_status::staticGet('user_id', $user_id); + $ess = Email_summary_status::getKV('user_id', $user_id); if (!empty($ess)) { return $ess->last_summary_id; diff --git a/plugins/EmailSummary/useremailsummaryhandler.php b/plugins/EmailSummary/useremailsummaryhandler.php index 61542e4f3b..46275c39c4 100644 --- a/plugins/EmailSummary/useremailsummaryhandler.php +++ b/plugins/EmailSummary/useremailsummaryhandler.php @@ -70,7 +70,7 @@ class UserEmailSummaryHandler extends QueueHandler { // Skip if they've asked not to get summaries - $ess = Email_summary_status::staticGet('user_id', $user_id); + $ess = Email_summary_status::getKV('user_id', $user_id); if (!empty($ess) && !$ess->send_summary) { common_log(LOG_INFO, sprintf('Not sending email summary for user %s by request.', $user_id)); @@ -83,7 +83,7 @@ class UserEmailSummaryHandler extends QueueHandler $since_id = $ess->last_summary_id; } - $user = User::staticGet('id', $user_id); + $user = User::getKV('id', $user_id); if (empty($user)) { common_log(LOG_INFO, sprintf('Not sending email summary for user %s; no such user.', $user_id)); @@ -145,7 +145,7 @@ class UserEmailSummaryHandler extends QueueHandler 'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6')); while ($notice->fetch()) { - $profile = Profile::staticGet('id', $notice->profile_id); + $profile = Profile::getKV('id', $notice->profile_id); if (empty($profile)) { continue; @@ -185,7 +185,7 @@ class UserEmailSummaryHandler extends QueueHandler common_date_string($notice->created)); $out->elementEnd('a'); if ($notice->hasConversation()) { - $conv = Conversation::staticGet('id', $notice->conversation); + $conv = Conversation::getKV('id', $notice->conversation); $convurl = $conv->uri; if (!empty($convurl)) { $out->text(' '); diff --git a/plugins/Enjit/enjitqueuehandler.php b/plugins/Enjit/enjitqueuehandler.php index 284f29477c..c0332b91a2 100644 --- a/plugins/Enjit/enjitqueuehandler.php +++ b/plugins/Enjit/enjitqueuehandler.php @@ -35,7 +35,7 @@ class EnjitQueueHandler extends QueueHandler function handle($notice) { - $profile = Profile::staticGet($notice->profile_id); + $profile = Profile::getKV($notice->profile_id); $this->log(LOG_INFO, "Posting Notice ".$notice->id." from ".$profile->nickname); diff --git a/plugins/Event/EventPlugin.php b/plugins/Event/EventPlugin.php index f2396b8075..7676a25ac0 100644 --- a/plugins/Event/EventPlugin.php +++ b/plugins/Event/EventPlugin.php @@ -197,7 +197,7 @@ class EventPlugin extends MicroappPlugin case RSVP::POSITIVE: case RSVP::NEGATIVE: case RSVP::POSSIBLE: - $happening = Happening::staticGet('uri', $happeningObj->id); + $happening = Happening::getKV('uri', $happeningObj->id); if (empty($happening)) { // FIXME: save the event // TRANS: Exception thrown when trying to RSVP for an unknown event. diff --git a/plugins/Event/Happening.php b/plugins/Event/Happening.php index 52aa206435..2b097e9077 100644 --- a/plugins/Event/Happening.php +++ b/plugins/Event/Happening.php @@ -105,7 +105,7 @@ class Happening extends Managed_DataObject static function saveNew($profile, $start_time, $end_time, $title, $location, $description, $url, $options=array()) { if (array_key_exists('uri', $options)) { - $other = Happening::staticGet('uri', $options['uri']); + $other = Happening::getKV('uri', $options['uri']); if (!empty($other)) { // TRANS: Client exception thrown when trying to create an event that already exists. throw new ClientException(_m('Event already exists.')); @@ -189,12 +189,12 @@ class Happening extends Managed_DataObject function getNotice() { - return Notice::staticGet('uri', $this->uri); + return Notice::getKV('uri', $this->uri); } static function fromNotice($notice) { - return Happening::staticGet('uri', $notice->uri); + return Happening::getKV('uri', $notice->uri); } function getRSVPs() diff --git a/plugins/Event/RSVP.php b/plugins/Event/RSVP.php index 3220661354..0a91106e68 100644 --- a/plugins/Event/RSVP.php +++ b/plugins/Event/RSVP.php @@ -123,7 +123,7 @@ class RSVP extends Managed_DataObject function saveNew($profile, $event, $verb, $options=array()) { if (array_key_exists('uri', $options)) { - $other = RSVP::staticGet('uri', $options['uri']); + $other = RSVP::getKV('uri', $options['uri']); if (!empty($other)) { // TRANS: Client exception thrown when trying to save an already existing RSVP ("please respond"). throw new ClientException(_m('RSVP already exists.')); @@ -228,7 +228,7 @@ class RSVP extends Managed_DataObject function getNotice() { - $notice = Notice::staticGet('uri', $this->uri); + $notice = Notice::getKV('uri', $this->uri); if (empty($notice)) { // TRANS: Server exception thrown when requesting a non-exsting notice for an RSVP ("please respond"). // TRANS: %s is the RSVP with the missing notice. @@ -239,7 +239,7 @@ class RSVP extends Managed_DataObject static function fromNotice($notice) { - return RSVP::staticGet('uri', $notice->uri); + return RSVP::getKV('uri', $notice->uri); } static function forEvent($event) @@ -273,7 +273,7 @@ class RSVP extends Managed_DataObject RSVP::POSSIBLE => array()); foreach ($ids as $id) { - $rsvp = RSVP::staticGet('id', $id); + $rsvp = RSVP::getKV('id', $id); if (!empty($rsvp)) { $verb = self::verbFor($rsvp->response); $rsvps[$verb][] = $rsvp; @@ -285,7 +285,7 @@ class RSVP extends Managed_DataObject function getProfile() { - $profile = Profile::staticGet('id', $this->profile_id); + $profile = Profile::getKV('id', $this->profile_id); if (empty($profile)) { // TRANS: Exception thrown when requesting a non-existing profile. // TRANS: %s is the ID of the non-existing profile. @@ -296,7 +296,7 @@ class RSVP extends Managed_DataObject function getEvent() { - $event = Happening::staticGet('id', $this->event_id); + $event = Happening::getKV('id', $this->event_id); if (empty($event)) { // TRANS: Exception thrown when requesting a non-existing event. // TRANS: %s is the ID of the non-existing event. @@ -307,7 +307,7 @@ class RSVP extends Managed_DataObject function asHTML() { - $event = Happening::staticGet('id', $this->event_id); + $event = Happening::getKV('id', $this->event_id); return self::toHTML($this->getProfile(), $event, @@ -316,7 +316,7 @@ class RSVP extends Managed_DataObject function asString() { - $event = Happening::staticGet('id', $this->event_id); + $event = Happening::getKV('id', $this->event_id); return self::toString($this->getProfile(), $event, diff --git a/plugins/Event/cancelrsvp.php b/plugins/Event/cancelrsvp.php index 6b0ddb2287..ab6cc5037e 100644 --- a/plugins/Event/cancelrsvp.php +++ b/plugins/Event/cancelrsvp.php @@ -82,14 +82,14 @@ class CancelrsvpAction extends Action throw new ClientException(_m('No such RSVP.')); } - $this->rsvp = RSVP::staticGet('id', $rsvpId); + $this->rsvp = RSVP::getKV('id', $rsvpId); if (empty($this->rsvp)) { // TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item. throw new ClientException(_m('No such RSVP.')); } - $this->event = Happening::staticGet('id', $this->rsvp->event_id); + $this->event = Happening::getKV('id', $this->rsvp->event_id); if (empty($this->event)) { // TRANS: Client exception thrown when referring to a non-existing event. diff --git a/plugins/Event/newrsvp.php b/plugins/Event/newrsvp.php index 8052b972a4..272c6f0d9f 100644 --- a/plugins/Event/newrsvp.php +++ b/plugins/Event/newrsvp.php @@ -82,7 +82,7 @@ class NewrsvpAction extends Action throw new ClientException(_m('No such event.')); } - $this->event = Happening::staticGet('id', $eventId); + $this->event = Happening::getKV('id', $eventId); if (empty($this->event)) { // TRANS: Client exception thrown when referring to a non-existing event. diff --git a/plugins/Event/showevent.php b/plugins/Event/showevent.php index 52e17f860a..f1d8c6a0dd 100644 --- a/plugins/Event/showevent.php +++ b/plugins/Event/showevent.php @@ -53,7 +53,7 @@ class ShoweventAction extends ShownoticeAction { $this->id = $this->trimmed('id'); - $this->event = Happening::staticGet('id', $this->id); + $this->event = Happening::getKV('id', $this->id); if (empty($this->event)) { // TRANS: Client exception thrown when referring to a non-existing event. diff --git a/plugins/Event/showrsvp.php b/plugins/Event/showrsvp.php index da80448af8..697bda9610 100644 --- a/plugins/Event/showrsvp.php +++ b/plugins/Event/showrsvp.php @@ -53,7 +53,7 @@ class ShowrsvpAction extends ShownoticeAction { $this->id = $this->trimmed('id'); - $this->rsvp = RSVP::staticGet('id', $this->id); + $this->rsvp = RSVP::getKV('id', $this->id); if (empty($this->rsvp)) { // TRANS: Client exception thrown when referring to a non-existing RSVP. diff --git a/plugins/ExtendedProfile/ExtendedProfilePlugin.php b/plugins/ExtendedProfile/ExtendedProfilePlugin.php index 7b2e53c62a..8436275b78 100644 --- a/plugins/ExtendedProfile/ExtendedProfilePlugin.php +++ b/plugins/ExtendedProfile/ExtendedProfilePlugin.php @@ -116,7 +116,7 @@ class ExtendedProfilePlugin extends Plugin } function onEndShowAccountProfileBlock(HTMLOutputter $out, Profile $profile) { - $user = User::staticGet('id', $profile->id); + $user = User::getKV('id', $profile->id); if ($user) { $url = common_local_url('profiledetail', array('nickname' => $user->nickname)); // TRANS: Link text on user profile page leading to extended profile page. diff --git a/plugins/FacebookBridge/actions/facebookfinishlogin.php b/plugins/FacebookBridge/actions/facebookfinishlogin.php index 2703ab8554..2abbf9c905 100644 --- a/plugins/FacebookBridge/actions/facebookfinishlogin.php +++ b/plugins/FacebookBridge/actions/facebookfinishlogin.php @@ -345,7 +345,7 @@ class FacebookfinishloginAction extends Action return; } - $invite = Invitation::staticGet($code); + $invite = Invitation::getKV($code); if (empty($invite)) { // TRANS: Client error trying to register with an invalid invitation code. @@ -367,7 +367,7 @@ class FacebookfinishloginAction extends Action return; } - if (User::staticGet('nickname', $nickname)) { + if (User::getKV('nickname', $nickname)) { // TRANS: Form validation error displayed when picking a nickname that is already in use. $this->showForm(_m('Nickname already in use. Try another one.')); return; @@ -503,7 +503,7 @@ class FacebookfinishloginAction extends Action return; } - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); $this->tryLinkUser($user); @@ -648,7 +648,7 @@ class FacebookfinishloginAction extends Action return false; } - if (User::staticGet('nickname', $str)) { + if (User::getKV('nickname', $str)) { return false; } @@ -666,7 +666,7 @@ class FacebookfinishloginAction extends Action function isNewEmail($email) { // we shouldn't have to validate the format - $result = User::staticGet('email', $email); + $result = User::getKV('email', $email); if (empty($result)) { return true; diff --git a/plugins/FacebookBridge/classes/Notice_to_item.php b/plugins/FacebookBridge/classes/Notice_to_item.php index fe0a90c848..a7cf5a13aa 100644 --- a/plugins/FacebookBridge/classes/Notice_to_item.php +++ b/plugins/FacebookBridge/classes/Notice_to_item.php @@ -137,13 +137,13 @@ class Notice_to_item extends Managed_DataObject */ static function saveNew($notice_id, $item_id) { - $n2i = Notice_to_item::staticGet('notice_id', $notice_id); + $n2i = Notice_to_item::getKV('notice_id', $notice_id); if (!empty($n2i)) { return $n2i; } - $n2i = Notice_to_item::staticGet('item_id', $item_id); + $n2i = Notice_to_item::getKV('item_id', $item_id); if (!empty($n2i)) { return $n2i; diff --git a/plugins/FacebookBridge/lib/facebookclient.php b/plugins/FacebookBridge/lib/facebookclient.php index 26e21cbd6e..be63051179 100644 --- a/plugins/FacebookBridge/lib/facebookclient.php +++ b/plugins/FacebookBridge/lib/facebookclient.php @@ -897,7 +897,7 @@ class Facebookclient */ static function facebookStatusId($notice) { - $n2i = Notice_to_item::staticGet('notice_id', $notice->id); + $n2i = Notice_to_item::getKV('notice_id', $notice->id); if (empty($n2i)) { return null; @@ -979,7 +979,7 @@ class Facebookclient */ function streamRemove() { - $n2i = Notice_to_item::staticGet('notice_id', $this->notice->id); + $n2i = Notice_to_item::getKV('notice_id', $this->notice->id); if (!empty($this->flink) && !empty($n2i)) { try { @@ -1034,7 +1034,7 @@ class Facebookclient */ function like() { - $n2i = Notice_to_item::staticGet('notice_id', $this->notice->id); + $n2i = Notice_to_item::getKV('notice_id', $this->notice->id); if (!empty($this->flink) && !empty($n2i)) { try { @@ -1085,7 +1085,7 @@ class Facebookclient */ function unLike() { - $n2i = Notice_to_item::staticGet('notice_id', $this->notice->id); + $n2i = Notice_to_item::getKV('notice_id', $this->notice->id); if (!empty($this->flink) && !empty($n2i)) { try { diff --git a/plugins/FollowEveryone/User_followeveryone_prefs.php b/plugins/FollowEveryone/User_followeveryone_prefs.php index e347d492d1..79e3bfa130 100644 --- a/plugins/FollowEveryone/User_followeveryone_prefs.php +++ b/plugins/FollowEveryone/User_followeveryone_prefs.php @@ -120,7 +120,7 @@ class User_followeveryone_prefs extends Managed_DataObject static function followEveryone($user_id) { - $ufep = self::staticGet('user_id', $user_id); + $ufep = self::getKV('user_id', $user_id); if (empty($ufep)) { return true; @@ -131,7 +131,7 @@ class User_followeveryone_prefs extends Managed_DataObject static function savePref($user_id, $followEveryone) { - $ufep = self::staticGet('user_id', $user_id); + $ufep = self::getKV('user_id', $user_id); if (empty($ufep)) { $ufep = new User_followeveryone_prefs(); diff --git a/plugins/GNUsocialPhoto/Photo.php b/plugins/GNUsocialPhoto/Photo.php index 97b78634d7..be354928fb 100644 --- a/plugins/GNUsocialPhoto/Photo.php +++ b/plugins/GNUsocialPhoto/Photo.php @@ -48,12 +48,12 @@ class Photo extends Managed_DataObject public static function getByNotice($notice) { - return self::staticGet('uri', $notice->uri); + return self::getKV('uri', $notice->uri); } public function getNotice() { - return Notice::staticGet('uri', $this->uri); + return Notice::getKV('uri', $this->uri); } public static function schemaDef() diff --git a/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php b/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php index 499d376fcc..f187a22a77 100644 --- a/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php +++ b/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php @@ -114,7 +114,7 @@ class GNUsocialPhotosPlugin extends Plugin function onEndNoticeAsActivity($notice, &$activity) { common_log(LOG_INFO, 'photo plugin: EndNoticeAsActivity'); - $photo = GNUsocialPhoto::staticGet('notice_id', $notice->id); + $photo = GNUsocialPhoto::getKV('notice_id', $notice->id); if(!$photo) { common_log(LOG_INFO, 'not a photo.'); return true; @@ -166,7 +166,7 @@ class GNUsocialPhotosPlugin extends Plugin function onStartShowNoticeItem($action) { - $photo = GNUsocialPhoto::staticGet('notice_id', $action->notice->id); + $photo = GNUsocialPhoto::getKV('notice_id', $action->notice->id); if($photo) { $action->out->elementStart('div', 'entry-title'); $action->showAuthor(); diff --git a/plugins/GNUsocialPhotos/actions/editphoto.php b/plugins/GNUsocialPhotos/actions/editphoto.php index 34f41a2752..7ac8104ae8 100644 --- a/plugins/GNUsocialPhotos/actions/editphoto.php +++ b/plugins/GNUsocialPhotos/actions/editphoto.php @@ -42,7 +42,7 @@ class EditphotoAction extends Action $args = $this->returnToArgs(); $this->user = common_current_user(); $this->photoid = $args[1]['photoid']; - $this->photo = GNUsocialPhoto::staticGet('id', $this->photoid); + $this->photo = GNUsocialPhoto::getKV('id', $this->photoid); return true; } @@ -166,7 +166,7 @@ class EditphotoAction extends Action $profile_id = $cur->id; - $album = GNUsocialPhotoAlbum::staticGet('album_id', $this->trimmed('album')); + $album = GNUsocialPhotoAlbum::getKV('album_id', $this->trimmed('album')); if ($album->profile_id != $profile_id) { $this->showForm(_('Error: This is not your album!')); return; @@ -188,7 +188,7 @@ class EditphotoAction extends Action //For redirection $oldalbum = $this->album_id; - $notice = Notice::staticGet('id', $this->photo->notice_id); + $notice = Notice::getKV('id', $this->photo->notice_id); $this->photo->delete(); diff --git a/plugins/GNUsocialPhotos/actions/photo.php b/plugins/GNUsocialPhotos/actions/photo.php index 4d08e5bbd6..e94073914f 100644 --- a/plugins/GNUsocialPhotos/actions/photo.php +++ b/plugins/GNUsocialPhotos/actions/photo.php @@ -45,10 +45,10 @@ class PhotoAction extends Action $args = $this->returnToArgs(); $this->photoid = $args[1]['photoid']; - $this->photo = GNUsocialPhoto::staticGet('id', $this->photoid); - $this->notice = Notice::staticGet('id', $this->photo->notice_id); + $this->photo = GNUsocialPhoto::getKV('id', $this->photoid); + $this->notice = Notice::getKV('id', $this->photo->notice_id); - $this->user = Profile::staticGet('id', $this->notice->profile_id); + $this->user = Profile::getKV('id', $this->notice->profile_id); $notices = Notice::conversationStream((int)$this->notice->conversation, null, null); $this->conversation = new ConversationTree($notices, $this); diff --git a/plugins/GNUsocialPhotos/actions/photos.php b/plugins/GNUsocialPhotos/actions/photos.php index 3b8a0fd64f..c966d0b71d 100644 --- a/plugins/GNUsocialPhotos/actions/photos.php +++ b/plugins/GNUsocialPhotos/actions/photos.php @@ -48,7 +48,7 @@ class PhotosAction extends Action if (common_valid_profile_tag($username) == 0) { $this->user = null; } else { - $this->user = Profile::staticGet('nickname', $username); + $this->user = Profile::getKV('nickname', $username); } return true; } @@ -120,7 +120,7 @@ class PhotosAction extends Action function showAlbum($album_id) { - $album = GNUSocialPhotoAlbum::staticGet('album_id', $album_id); + $album = GNUSocialPhotoAlbum::getKV('album_id', $album_id); if (!$album) { return; } diff --git a/plugins/GNUsocialPhotos/actions/photoupload.php b/plugins/GNUsocialPhotos/actions/photoupload.php index 5411ec8089..25bd4f84d0 100644 --- a/plugins/GNUsocialPhotos/actions/photoupload.php +++ b/plugins/GNUsocialPhotos/actions/photoupload.php @@ -214,7 +214,7 @@ class PhotouploadAction extends Action $thumb_uri = 'http://' . common_config('site', 'server') . '/file/thumb.' . $filename; $profile_id = $cur->id; - $album = GNUsocialPhotoAlbum::staticGet('album_id', $this->trimmed('album')); + $album = GNUsocialPhotoAlbum::getKV('album_id', $this->trimmed('album')); if ($album->profile_id != $profile_id) { $this->showForm(_('Error: This is not your album!')); return; @@ -241,13 +241,13 @@ class PhotouploadAction extends Action if(empty($cur)) return; $album_id = $this->trimmed('album'); - $album = GNUsocialPhotoAlbum::staticGet('album_id', $album_id); + $album = GNUsocialPhotoAlbum::getKV('album_id', $album_id); if (empty($album)) { $this->showForm(_('This album does not exist or has been deleted.')); return; } //Check if the album has any photos in it before deleting - $photos = GNUsocialPhoto::staticGet('album_id', $album_id); + $photos = GNUsocialPhoto::getKV('album_id', $album_id); if(empty($photos)) { $album->delete(); $this->showForm(_('Album deleted'), true); diff --git a/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php b/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php index 14e673beb7..722a8f69ae 100644 --- a/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php +++ b/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php @@ -69,13 +69,13 @@ class GNUsocialPhotoAlbum extends Managed_DataObject function getPageLink() { - $profile = Profile::StaticGet('id', $this->profile_id); + $profile = Profile::getKV('id', $this->profile_id); return '/' . $profile->nickname . '/photos/' . $this->album_id; } function getThumbUri() { - $photo = GNUsocialPhoto::staticGet('album_id', $this->album_id); + $photo = GNUsocialPhoto::getKV('album_id', $this->album_id); if (empty($photo)) return '/theme/default/default-avatar-profile.png'; //For now... return $photo->thumb_uri; @@ -84,7 +84,7 @@ class GNUsocialPhotoAlbum extends Managed_DataObject static function newAlbum($profile_id, $album_name, $album_description) { //TODO: Should use foreign key instead... - if (!Profile::staticGet('id', $profile_id)){ + if (!Profile::getKV('id', $profile_id)){ //Is this a bit extreme? throw new ServerException(_m('No such user exists with id ' . $profile_id . ', couldn\'t create album.')); } diff --git a/plugins/GNUsocialProfileExtensions/actions/bio.php b/plugins/GNUsocialProfileExtensions/actions/bio.php index bc9f12cb13..32460de426 100644 --- a/plugins/GNUsocialProfileExtensions/actions/bio.php +++ b/plugins/GNUsocialProfileExtensions/actions/bio.php @@ -43,7 +43,7 @@ class BioAction extends Action parent::prepare($args); $args = $this->returnToArgs(); - $this->profile = Profile::staticGet('nickname', $args[1]['nickname']); + $this->profile = Profile::getKV('nickname', $args[1]['nickname']); //die(print_r($this->profile)); gnusocial_profile_merge($this->profile); $this->avatar = $this->profile->getAvatar(96); diff --git a/plugins/GNUsocialProfileExtensions/actions/profilefields.php b/plugins/GNUsocialProfileExtensions/actions/profilefields.php index d8c4e3dd32..0076af1bd6 100644 --- a/plugins/GNUsocialProfileExtensions/actions/profilefields.php +++ b/plugins/GNUsocialProfileExtensions/actions/profilefields.php @@ -54,7 +54,7 @@ class ProfilefieldsAdminPanelAction extends AdminPanelAction function saveSettings() { - $field = GNUsocialProfileExtensionField::staticGet('id', $this->trimmed('id')); + $field = GNUsocialProfileExtensionField::getKV('id', $this->trimmed('id')); if (!$field) $field = new GNUsocialProfileExtensionField(); $field->title = $this->trimmed('title'); @@ -110,7 +110,7 @@ class ProfilefieldsAdminForm extends AdminForm $fieldsettitle = _("New Profile Field"); //Edit a field if ($this->out->trimmed('edit')) { - $field = GNUsocialProfileExtensionField::staticGet('id', $this->out->trimmed('edit')); + $field = GNUsocialProfileExtensionField::getKV('id', $this->out->trimmed('edit')); $title = $field->title; $description = $field->description; $type = $field->type; diff --git a/plugins/GNUsocialVideo/Video.php b/plugins/GNUsocialVideo/Video.php index 543fe9129f..0311ee596c 100644 --- a/plugins/GNUsocialVideo/Video.php +++ b/plugins/GNUsocialVideo/Video.php @@ -45,12 +45,12 @@ class Video extends Managed_DataObject public static function getByNotice($notice) { - return self::staticGet('uri', $notice->uri); + return self::getKV('uri', $notice->uri); } public function getNotice() { - return Notice::staticGet('uri', $this->uri); + return Notice::getKV('uri', $this->uri); } public static function schemaDef() diff --git a/plugins/GNUsocialVideo/showvideo.php b/plugins/GNUsocialVideo/showvideo.php index 3046a6c837..628d08642a 100644 --- a/plugins/GNUsocialVideo/showvideo.php +++ b/plugins/GNUsocialVideo/showvideo.php @@ -38,7 +38,7 @@ class ShowvideoAction extends ShownoticeAction { OwnerDesignAction::prepare($args); $this->id = $this->trimmed('id'); - $this->vid = Video::staticGet('id', $this->id); + $this->vid = Video::getKV('id', $this->id); if (empty($this->vid)) { throw new ClientException(_('No such video.'), 404); @@ -50,7 +50,7 @@ class ShowvideoAction extends ShownoticeAction throw new ClientException(_('No such video'), 404); } - $this->user = User::staticGet('id', $this->vid->profile_id); + $this->user = User::getKV('id', $this->vid->profile_id); if (empty($this->user)) { throw new ClientException(_('No such user.'), 404); diff --git a/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php b/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php index 6e31d69925..468e0eb92e 100644 --- a/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php +++ b/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php @@ -245,7 +245,7 @@ class GroupPrivateMessagePlugin extends Plugin $gps = null; if (!empty($form->group)) { - $gps = Group_privacy_settings::staticGet('group_id', $form->group->id); + $gps = Group_privacy_settings::getKV('group_id', $form->group->id); } $form->out->elementStart('li'); @@ -286,7 +286,7 @@ class GroupPrivateMessagePlugin extends Plugin $gps = null; if (!empty($action->group)) { - $gps = Group_privacy_settings::staticGet('group_id', $action->group->id); + $gps = Group_privacy_settings::getKV('group_id', $action->group->id); } $orig = null; @@ -441,7 +441,7 @@ class GroupPrivateMessagePlugin extends Plugin "but group ".$group->nickname." does not allow them."); } - $user = User::staticGet('id', $notice->profile_id); + $user = User::getKV('id', $notice->profile_id); if (empty($user)) { common_log(LOG_WARNING, diff --git a/plugins/GroupPrivateMessage/Group_message.php b/plugins/GroupPrivateMessage/Group_message.php index a74f7cd60a..05fcdc5c43 100644 --- a/plugins/GroupPrivateMessage/Group_message.php +++ b/plugins/GroupPrivateMessage/Group_message.php @@ -151,7 +151,7 @@ class Group_message extends Managed_DataObject function distribute() { - $group = User_group::staticGet('id', $this->to_group); + $group = User_group::getKV('id', $this->to_group); $member = $group->getMembers(); @@ -162,7 +162,7 @@ class Group_message extends Managed_DataObject function getGroup() { - $group = User_group::staticGet('id', $this->to_group); + $group = User_group::getKV('id', $this->to_group); if (empty($group)) { // TRANS: Exception thrown when trying to send group private message to a non-existing group. throw new ServerException(_m('No group for group message.')); @@ -172,7 +172,7 @@ class Group_message extends Managed_DataObject function getSender() { - $sender = Profile::staticGet('id', $this->from_profile); + $sender = Profile::getKV('id', $this->from_profile); if (empty($sender)) { // TRANS: Exception thrown when trying to send group private message without having a sender. throw new ServerException(_m('No sender for group message.')); diff --git a/plugins/GroupPrivateMessage/Group_message_profile.php b/plugins/GroupPrivateMessage/Group_message_profile.php index b059222dcc..845997f21f 100644 --- a/plugins/GroupPrivateMessage/Group_message_profile.php +++ b/plugins/GroupPrivateMessage/Group_message_profile.php @@ -126,15 +126,15 @@ class Group_message_profile extends Managed_DataObject function notifyByMail() { - $to = User::staticGet('id', $this->to_profile); + $to = User::getKV('id', $this->to_profile); if (empty($to) || is_null($to->email) || !$to->emailnotifymsg) { return true; } - $gm = Group_message::staticGet('id', $this->group_message_id); + $gm = Group_message::getKV('id', $this->group_message_id); - $from_profile = Profile::staticGet('id', $gm->from_profile); + $from_profile = Profile::getKV('id', $gm->from_profile); $group = $gm->getGroup(); diff --git a/plugins/GroupPrivateMessage/Group_privacy_settings.php b/plugins/GroupPrivateMessage/Group_privacy_settings.php index a325dd95f1..771c2ec782 100644 --- a/plugins/GroupPrivateMessage/Group_privacy_settings.php +++ b/plugins/GroupPrivateMessage/Group_privacy_settings.php @@ -126,7 +126,7 @@ class Group_privacy_settings extends Managed_DataObject function forGroup($group) { - $gps = Group_privacy_settings::staticGet('group_id', $group->id); + $gps = Group_privacy_settings::getKV('group_id', $group->id); if (empty($gps)) { // make a fake one with defaults diff --git a/plugins/GroupPrivateMessage/groupinbox.php b/plugins/GroupPrivateMessage/groupinbox.php index b6308c663f..84952d0b06 100644 --- a/plugins/GroupPrivateMessage/groupinbox.php +++ b/plugins/GroupPrivateMessage/groupinbox.php @@ -76,14 +76,14 @@ class GroupinboxAction extends GroupAction return false; } - $localGroup = Local_group::staticGet('nickname', $nickname); + $localGroup = Local_group::getKV('nickname', $nickname); if (empty($localGroup)) { // TRANS: Client exception thrown when trying to view group inbox for non-existing group. throw new ClientException(_m('No such group.'), 404); } - $this->group = User_group::staticGet('id', $localGroup->group_id); + $this->group = User_group::getKV('id', $localGroup->group_id); if (empty($this->group)) { // TRANS: Client exception thrown when trying to view group inbox for non-existing group. diff --git a/plugins/GroupPrivateMessage/newgroupmessage.php b/plugins/GroupPrivateMessage/newgroupmessage.php index 4ba659eacc..37738a385c 100644 --- a/plugins/GroupPrivateMessage/newgroupmessage.php +++ b/plugins/GroupPrivateMessage/newgroupmessage.php @@ -84,14 +84,14 @@ class NewgroupmessageAction extends Action return false; } - $localGroup = Local_group::staticGet('nickname', $nickname); + $localGroup = Local_group::getKV('nickname', $nickname); if (empty($localGroup)) { // TRANS: Client exception thrown when trying to send a private group message to a non-existing group. throw new ClientException(_m('No such group.'), 404); } - $this->group = User_group::staticGet('id', $localGroup->group_id); + $this->group = User_group::getKV('id', $localGroup->group_id); if (empty($this->group)) { // TRANS: Client exception thrown when trying to send a private group message to a non-existing group. diff --git a/plugins/GroupPrivateMessage/showgroupmessage.php b/plugins/GroupPrivateMessage/showgroupmessage.php index a0ec4198c4..8b99ece275 100644 --- a/plugins/GroupPrivateMessage/showgroupmessage.php +++ b/plugins/GroupPrivateMessage/showgroupmessage.php @@ -72,14 +72,14 @@ class ShowgroupmessageAction extends Action $id = $this->trimmed('id'); - $this->gm = Group_message::staticGet('id', $id); + $this->gm = Group_message::getKV('id', $id); if (empty($this->gm)) { // TRANS: Client exception thrown when trying to view a non-existing group private message. throw new ClientException(_m('No such message.'), 404); } - $this->group = User_group::staticGet('id', $this->gm->to_group); + $this->group = User_group::getKV('id', $this->gm->to_group); if (empty($this->group)) { // TRANS: Server exception thrown when trying to view group private messages for a non-exsting group. @@ -91,7 +91,7 @@ class ShowgroupmessageAction extends Action throw new ClientException(_m('Cannot read message.'), 403); } - $this->sender = Profile::staticGet('id', $this->gm->from_profile); + $this->sender = Profile::getKV('id', $this->gm->from_profile); if (empty($this->sender)) { // TRANS: Server exception thrown when trying to view a group private message without a sender. diff --git a/plugins/Mapstraction/map.php b/plugins/Mapstraction/map.php index 856e00e159..15f3b941d7 100644 --- a/plugins/Mapstraction/map.php +++ b/plugins/Mapstraction/map.php @@ -66,7 +66,7 @@ class MapAction extends Action return false; } - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed when referring to a non-existing user. @@ -151,7 +151,7 @@ class MapAction extends Action $arr['source'] = $arr['source']; if (!empty($notice->reply_to)) { - $reply_to = Notice::staticGet('id', $notice->reply_to); + $reply_to = Notice::getKV('id', $notice->reply_to); if (!empty($reply_to)) { $arr['in_reply_to_status_url'] = $reply_to->bestUrl(); } diff --git a/plugins/ModLog/ModLogPlugin.php b/plugins/ModLog/ModLogPlugin.php index 459df63e82..48229232f2 100644 --- a/plugins/ModLog/ModLogPlugin.php +++ b/plugins/ModLog/ModLogPlugin.php @@ -174,7 +174,7 @@ class ModLogPlugin extends Plugin $action->element('td', null, sprintf(($ml->is_grant) ? _('+%s') : _('-%s'), $ml->role)); $action->elementStart('td'); if ($ml->moderator_id) { - $mod = Profile::staticGet('id', $ml->moderator_id); + $mod = Profile::getKV('id', $ml->moderator_id); if (empty($mod)) { $action->text(_('[unknown]')); } else { diff --git a/plugins/ModPlus/ModPlusPlugin.php b/plugins/ModPlus/ModPlusPlugin.php index 95265c52ca..c8c88c9d7a 100644 --- a/plugins/ModPlus/ModPlusPlugin.php +++ b/plugins/ModPlus/ModPlusPlugin.php @@ -134,7 +134,7 @@ class ModPlusPlugin extends Plugin */ protected function showProfileOptions(HTMLOutputter $out, $profile) { - $isRemote = !(User::staticGet('id', $profile->id)); + $isRemote = !(User::getKV('id', $profile->id)); if ($isRemote) { $target = common_local_url('remoteprofile', array('id' => $profile->id)); // TRANS: Label for access to remote profile options. diff --git a/plugins/ModPlus/remoteprofileaction.php b/plugins/ModPlus/remoteprofileaction.php index 1d7a84d9f3..bfcc5a84ca 100644 --- a/plugins/ModPlus/remoteprofileaction.php +++ b/plugins/ModPlus/remoteprofileaction.php @@ -12,7 +12,7 @@ class RemoteProfileAction extends ShowstreamAction $id = $this->arg('id'); $this->user = false; - $this->profile = Profile::staticGet('id', $id); + $this->profile = Profile::getKV('id', $id); if (!$this->profile) { // TRANS: Error message displayed when referring to a user without a profile. @@ -20,7 +20,7 @@ class RemoteProfileAction extends ShowstreamAction return false; } - $user = User::staticGet('id', $this->profile->id); + $user = User::getKV('id', $this->profile->id); if ($user) { // This is a local user -- send to their regular profile. $url = common_local_url('showstream', array('nickname' => $user->nickname)); diff --git a/plugins/NoticeTitle/NoticeTitlePlugin.php b/plugins/NoticeTitle/NoticeTitlePlugin.php index 39df2621ac..b2efe8345b 100644 --- a/plugins/NoticeTitle/NoticeTitlePlugin.php +++ b/plugins/NoticeTitle/NoticeTitlePlugin.php @@ -279,7 +279,7 @@ class NoticeTitlePlugin extends Plugin */ function onNoticeDeleteRelated($notice) { - $nt = Notice_title::staticGet('notice_id', $notice->id); + $nt = Notice_title::getKV('notice_id', $notice->id); if (!empty($nt)) { $nt->delete(); diff --git a/plugins/NoticeTitle/Notice_title.php b/plugins/NoticeTitle/Notice_title.php index 17dc8bdd1e..fff59c43a1 100644 --- a/plugins/NoticeTitle/Notice_title.php +++ b/plugins/NoticeTitle/Notice_title.php @@ -105,7 +105,7 @@ class Notice_title extends Managed_DataObject */ static function fromNotice($notice) { - $nt = Notice_title::staticGet('notice_id', $notice->id); + $nt = Notice_title::getKV('notice_id', $notice->id); if (empty($nt)) { return null; } else { diff --git a/plugins/OMB/OMBPlugin.php b/plugins/OMB/OMBPlugin.php index de0088cc8e..fe4510f4a7 100644 --- a/plugins/OMB/OMBPlugin.php +++ b/plugins/OMB/OMBPlugin.php @@ -190,7 +190,7 @@ class OMBPlugin extends Plugin */ function onStartGetProfileUri($profile, &$uri) { - $remote = Remote_profile::staticGet('id', $this->id); + $remote = Remote_profile::getKV('id', $this->id); if (!empty($remote)) { $uri = $remote->uri; return false; @@ -206,7 +206,7 @@ class OMBPlugin extends Plugin */ function onStartShowProfileListSubscribeButton($action) { - $remote = Remote_profile::staticGet('id', $action->profile->id); + $remote = Remote_profile::getKV('id', $action->profile->id); if (empty($remote)) { false; } @@ -225,7 +225,7 @@ class OMBPlugin extends Plugin // OMB 0.1 doesn't have a mechanism for local-server- // originated subscription. - $omb01 = Remote_profile::staticGet('id', $other_id); + $omb01 = Remote_profile::getKV('id', $other_id); if (!empty($omb01)) { throw new ClientException( @@ -252,7 +252,7 @@ class OMBPlugin extends Plugin // OMB 0.1 doesn't have a mechanism for local-server- // originated tag. - $omb01 = Remote_profile::staticGet('id', $tagged_profile->id); + $omb01 = Remote_profile::getKV('id', $tagged_profile->id); if (!empty($omb01)) { $this->clientError( @@ -276,7 +276,7 @@ class OMBPlugin extends Plugin // OMB 0.1 doesn't have a mechanism for local-server- // originated tag. - $omb01 = Remote_profile::staticGet('id', $ptag->tagged); + $omb01 = Remote_profile::getKV('id', $ptag->tagged); if (!empty($omb01)) { $this->clientError( @@ -339,9 +339,9 @@ class OMBPlugin extends Plugin */ function onStartGetProfileFromURI($uri, &$profile) { - $remote_profile = Remote_profile::staticGet('uri', $uri); + $remote_profile = Remote_profile::getKV('uri', $uri); if (!empty($remote_profile)) { - $profile = Profile::staticGet('id', $remote_profile->profile_id); + $profile = Profile::getKV('id', $remote_profile->profile_id); return false; } @@ -357,7 +357,7 @@ class OMBPlugin extends Plugin */ function onStartCommonProfileURI($profile, &$uri) { - $remote = Remote_profile::staticGet($profile->id); + $remote = Remote_profile::getKV($profile->id); if ($remote) { $uri = $remote->uri; return false; diff --git a/plugins/OMB/actions/finishremotesubscribe.php b/plugins/OMB/actions/finishremotesubscribe.php index fb98dbda6d..e933716f9e 100644 --- a/plugins/OMB/actions/finishremotesubscribe.php +++ b/plugins/OMB/actions/finishremotesubscribe.php @@ -74,7 +74,7 @@ class FinishremotesubscribeAction extends Action /* Create user objects for both users. Do it early for request validation. */ - $user = User::staticGet('uri', $service->getListeneeURI()); + $user = User::getKV('uri', $service->getListeneeURI()); if (!$user) { // TRANS: Client error displayed when subscribing to a remote profile that does not exist. @@ -82,7 +82,7 @@ class FinishremotesubscribeAction extends Action return; } - $other = User::staticGet('uri', $service->getListenerURI()); + $other = User::getKV('uri', $service->getListenerURI()); if ($other) { // TRANS: Client error displayed when subscribing to a remote profile that is a local profile. @@ -90,12 +90,12 @@ class FinishremotesubscribeAction extends Action return; } - $remote = Remote_profile::staticGet('uri', $service->getListenerURI()); + $remote = Remote_profile::getKV('uri', $service->getListenerURI()); if ($remote) { // Note remote profile may not have been saved yet. // @fixme not convinced this is correct at all! - $profile = Profile::staticGet($remote->id); + $profile = Profile::getKV($remote->id); if ($user->hasBlocked($profile)) { // TRANS: Client error displayed when subscribing to a remote profile that is blocked form subscribing to. @@ -132,7 +132,7 @@ class FinishremotesubscribeAction extends Action /* The service URLs are not accessible from datastore, so setting them after insertion of the profile. */ - $remote = Remote_profile::staticGet('uri', $service->getListenerURI()); + $remote = Remote_profile::getKV('uri', $service->getListenerURI()); $orig_remote = clone($remote); $remote->postnoticeurl = diff --git a/plugins/OMB/actions/remotesubscribe.php b/plugins/OMB/actions/remotesubscribe.php index aafbaf5216..1f7b9c0839 100644 --- a/plugins/OMB/actions/remotesubscribe.php +++ b/plugins/OMB/actions/remotesubscribe.php @@ -157,7 +157,7 @@ class RemotesubscribeAction extends Action return; } - $user = User::staticGet('nickname', $this->nickname); + $user = User::getKV('nickname', $this->nickname); $this->profile_url = $this->trimmed('profile_url'); @@ -187,7 +187,7 @@ class RemotesubscribeAction extends Action if ($service->getServiceURI(OAUTH_ENDPOINT_REQUEST) == common_local_url('requesttoken') || - User::staticGet('uri', $service->getRemoteUserURI())) { + User::getKV('uri', $service->getRemoteUserURI())) { // TRANS: Form validation error on page for remote subscribe. $this->showForm(_('That is a local profile! Login to subscribe.')); return; diff --git a/plugins/OMB/actions/userauthorization.php b/plugins/OMB/actions/userauthorization.php index 642a8dc326..848cc77a71 100644 --- a/plugins/OMB/actions/userauthorization.php +++ b/plugins/OMB/actions/userauthorization.php @@ -292,7 +292,7 @@ class UserauthorizationAction extends Action $nickname = $_GET['omb_listenee_nickname']; $profile = $_GET['omb_listenee_profile']; - $user = User::staticGet('uri', $listener); + $user = User::getKV('uri', $listener); if (!$user) { // TRANS: Exception thrown when no valid user is found for an authorisation request. // TRANS: %s is a listener URI. @@ -307,7 +307,7 @@ class UserauthorizationAction extends Action $listenee)); } - $other = User::staticGet('uri', $listenee); + $other = User::getKV('uri', $listenee); if ($other) { // TRANS: Exception thrown when listenee URI is a local user for an authorisation request. // TRANS: %s is a listenee URI. @@ -315,7 +315,7 @@ class UserauthorizationAction extends Action $listenee)); } - $remote = Remote_profile::staticGet('uri', $listenee); + $remote = Remote_profile::getKV('uri', $listenee); if ($remote) { $sub = new Subscription(); $sub->subscriber = $user->id; diff --git a/plugins/OMB/actions/xrds.php b/plugins/OMB/actions/xrds.php index 5e6758eded..8248d460e9 100644 --- a/plugins/OMB/actions/xrds.php +++ b/plugins/OMB/actions/xrds.php @@ -65,7 +65,7 @@ class XrdsAction extends Action { parent::prepare($args); $nickname = $this->trimmed('nickname'); - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed providing a non-existing nickname. $this->clientError(_('No such user.')); diff --git a/plugins/OMB/lib/omb.php b/plugins/OMB/lib/omb.php index 0804b65c36..a2c3d7c45e 100644 --- a/plugins/OMB/lib/omb.php +++ b/plugins/OMB/lib/omb.php @@ -113,7 +113,7 @@ function omb_broadcast_notice($notice) function omb_broadcast_profile($profile) { - $user = User::staticGet('id', $profile->id); + $user = User::getKV('id', $profile->id); if (!$user) { return false; @@ -216,7 +216,7 @@ function profile_to_omb_profile($uri, $profile, $force = false) function notice_to_omb_notice($notice) { /* Create an OMB_Notice for $notice. */ - $user = User::staticGet('id', $notice->profile_id); + $user = User::getKV('id', $notice->profile_id); if (!$user) { return null; diff --git a/plugins/OMB/lib/omboauthstore.php b/plugins/OMB/lib/omboauthstore.php index c29eeb7696..857748bf4a 100644 --- a/plugins/OMB/lib/omboauthstore.php +++ b/plugins/OMB/lib/omboauthstore.php @@ -27,7 +27,7 @@ class OMBOAuthDataStore extends OAuthDataStore // We keep a record of who's contacted us function lookup_consumer($consumer_key) { - $con = Consumer::staticGet('consumer_key', $consumer_key); + $con = Consumer::getKV('consumer_key', $consumer_key); if (!$con) { $con = new Consumer(); $con->consumer_key = $consumer_key; @@ -126,7 +126,7 @@ class OMBOAuthDataStore extends OAuthDataStore common_debug('request token "'.$rt->tok.'" updated', __FILE__); // Update subscription // XXX: mixing levels here - $sub = Subscription::staticGet('token', $rt->tok); + $sub = Subscription::getKV('token', $rt->tok); if (!$sub) { return null; } @@ -218,9 +218,9 @@ class OMBOAuthDataStore extends OAuthDataStore public function getProfile($identifier_uri) { /* getProfile is only used for remote profiles by libomb. @TODO: Make it work with local ones anyway. */ - $remote = Remote_profile::staticGet('uri', $identifier_uri); + $remote = Remote_profile::getKV('uri', $identifier_uri); if (!$remote) throw new Exception('No such remote profile'); - $profile = Profile::staticGet('id', $remote->id); + $profile = Profile::getKV('id', $remote->id); if (!$profile) throw new Exception('No profile for remote user'); require_once dirname(__FILE__) . '/omb.php'; @@ -242,11 +242,11 @@ class OMBOAuthDataStore extends OAuthDataStore $omb_profile->getProfileURL()) { throw new Exception('Not implemented'); } else { - $remote = Remote_profile::staticGet('uri', $omb_profile->getIdentifierURI()); + $remote = Remote_profile::getKV('uri', $omb_profile->getIdentifierURI()); if ($remote) { $exists = true; - $profile = Profile::staticGet($remote->id); + $profile = Profile::getKV($remote->id); $orig_remote = clone($remote); $orig_profile = clone($profile); // XXX: compare current postNotice and updateProfile URLs to the ones @@ -346,15 +346,15 @@ class OMBOAuthDataStore extends OAuthDataStore * @access public **/ public function saveNotice(&$omb_notice) { - if (Notice::staticGet('uri', $omb_notice->getIdentifierURI())) { + if (Notice::getKV('uri', $omb_notice->getIdentifierURI())) { // TRANS: Exception thrown when a notice is denied because it has been sent before. throw new Exception(_('Duplicate notice.')); } $author_uri = $omb_notice->getAuthor()->getIdentifierURI(); common_log(LOG_DEBUG, $author_uri, __FILE__); - $author = Remote_profile::staticGet('uri', $author_uri); + $author = Remote_profile::getKV('uri', $author_uri); if (!$author) { - $author = User::staticGet('uri', $author_uri); + $author = User::getKV('uri', $author_uri); } if (!$author) { throw new Exception('No such user.'); @@ -406,9 +406,9 @@ class OMBOAuthDataStore extends OAuthDataStore private function _getAnyProfile($uri) { - $user = Remote_profile::staticGet('uri', $uri); + $user = Remote_profile::getKV('uri', $uri); if (!$user) { - $user = User::staticGet('uri', $uri); + $user = User::getKV('uri', $uri); } if (!$user) { throw new Exception('No such user.'); @@ -503,7 +503,7 @@ class OMBOAuthDataStore extends OAuthDataStore if ($subscribed instanceof User) { mail_subscribe_notify_profile($subscribed, - Profile::staticGet($subscriber->id)); + Profile::getKV($subscriber->id)); } } } diff --git a/plugins/OMB/lib/ombqueuehandler.php b/plugins/OMB/lib/ombqueuehandler.php index bc70edb095..df443513fa 100644 --- a/plugins/OMB/lib/ombqueuehandler.php +++ b/plugins/OMB/lib/ombqueuehandler.php @@ -50,7 +50,7 @@ class OmbQueueHandler extends QueueHandler function is_remote($notice) { - $user = User::staticGet($notice->profile_id); + $user = User::getKV($notice->profile_id); return is_null($user); } } diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 43b90cfbf7..567989c11e 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -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(); diff --git a/plugins/OStatus/actions/groupsalmon.php b/plugins/OStatus/actions/groupsalmon.php index 0a43c37237..14e66f5ca0 100644 --- a/plugins/OStatus/actions/groupsalmon.php +++ b/plugins/OStatus/actions/groupsalmon.php @@ -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.')); diff --git a/plugins/OStatus/actions/ostatusinit.php b/plugins/OStatus/actions/ostatusinit.php index 1c862aa997..c7c8baa526 100644 --- a/plugins/OStatus/actions/ostatusinit.php +++ b/plugins/OStatus/actions/ostatusinit.php @@ -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.')); diff --git a/plugins/OStatus/actions/peopletagsalmon.php b/plugins/OStatus/actions/peopletagsalmon.php index 19e56cb216..12af8c2b31 100644 --- a/plugins/OStatus/actions/peopletagsalmon.php +++ b/plugins/OStatus/actions/peopletagsalmon.php @@ -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. diff --git a/plugins/OStatus/actions/pushcallback.php b/plugins/OStatus/actions/pushcallback.php index 9252ac61a1..397aa56b90 100644 --- a/plugins/OStatus/actions/pushcallback.php +++ b/plugins/OStatus/actions/pushcallback.php @@ -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); diff --git a/plugins/OStatus/actions/pushhub.php b/plugins/OStatus/actions/pushhub.php index e9dca7ab9d..6e0968bd55 100644 --- a/plugins/OStatus/actions/pushhub.php +++ b/plugins/OStatus/actions/pushhub.php @@ -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); } } diff --git a/plugins/OStatus/actions/usersalmon.php b/plugins/OStatus/actions/usersalmon.php index bc91b31559..ed2c7b3d5f 100644 --- a/plugins/OStatus/actions/usersalmon.php +++ b/plugins/OStatus/actions/usersalmon.php @@ -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. diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index d7eabf33ee..873742c03c 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -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; } diff --git a/plugins/OStatus/classes/HubSub.php b/plugins/OStatus/classes/HubSub.php index 66e7d30e96..4fcb74ea2a 100644 --- a/plugins/OStatus/classes/HubSub.php +++ b/plugins/OStatus/classes/HubSub.php @@ -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); diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 47817f2873..ba3d4f3eb4 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -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 diff --git a/plugins/OStatus/lib/hubprepqueuehandler.php b/plugins/OStatus/lib/hubprepqueuehandler.php index 0ed6a3ec57..90ee6a8bd9 100644 --- a/plugins/OStatus/lib/hubprepqueuehandler.php +++ b/plugins/OStatus/lib/hubprepqueuehandler.php @@ -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; diff --git a/plugins/OStatus/lib/ostatusqueuehandler.php b/plugins/OStatus/lib/ostatusqueuehandler.php index f5284057e3..b2e8401128 100644 --- a/plugins/OStatus/lib/ostatusqueuehandler.php +++ b/plugins/OStatus/lib/ostatusqueuehandler.php @@ -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); diff --git a/plugins/OStatus/lib/pushinqueuehandler.php b/plugins/OStatus/lib/pushinqueuehandler.php index ec1911653a..9802baffe2 100644 --- a/plugins/OStatus/lib/pushinqueuehandler.php +++ b/plugins/OStatus/lib/pushinqueuehandler.php @@ -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); diff --git a/plugins/OStatus/lib/salmon.php b/plugins/OStatus/lib/salmon.php index 8e101bf624..c93b314f8a 100644 --- a/plugins/OStatus/lib/salmon.php +++ b/plugins/OStatus/lib/salmon.php @@ -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(); diff --git a/plugins/OStatus/lib/salmonqueuehandler.php b/plugins/OStatus/lib/salmonqueuehandler.php index e70d5ff521..3b98a34a87 100644 --- a/plugins/OStatus/lib/salmonqueuehandler.php +++ b/plugins/OStatus/lib/salmonqueuehandler.php @@ -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); diff --git a/plugins/OStatus/lib/xrdaction.php b/plugins/OStatus/lib/xrdaction.php index 2ba158a3e6..779ce4d515 100644 --- a/plugins/OStatus/lib/xrdaction.php +++ b/plugins/OStatus/lib/xrdaction.php @@ -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(); diff --git a/plugins/OStatus/scripts/fixup-shadow.php b/plugins/OStatus/scripts/fixup-shadow.php index 18df2995fb..45e2d8c0b0 100644 --- a/plugins/OStatus/scripts/fixup-shadow.php +++ b/plugins/OStatus/scripts/fixup-shadow.php @@ -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 { diff --git a/plugins/OStatus/scripts/resub-feed.php b/plugins/OStatus/scripts/resub-feed.php index a08d837993..e4c64fdcc5 100644 --- a/plugins/OStatus/scripts/resub-feed.php +++ b/plugins/OStatus/scripts/resub-feed.php @@ -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"; diff --git a/plugins/OStatus/scripts/testfeed.php b/plugins/OStatus/scripts/testfeed.php index 149bcc343f..42f21a7aa0 100644 --- a/plugins/OStatus/scripts/testfeed.php +++ b/plugins/OStatus/scripts/testfeed.php @@ -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); diff --git a/plugins/OStatus/scripts/update-profile-data.php b/plugins/OStatus/scripts/update-profile-data.php index 20f6d57d90..bca71b6258 100644 --- a/plugins/OStatus/scripts/update-profile-data.php +++ b/plugins/OStatus/scripts/update-profile-data.php @@ -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"; diff --git a/plugins/OStatus/scripts/update-profile.php b/plugins/OStatus/scripts/update-profile.php index 64afa0f356..ff6a149c60 100644 --- a/plugins/OStatus/scripts/update-profile.php +++ b/plugins/OStatus/scripts/update-profile.php @@ -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"; diff --git a/plugins/OStatus/scripts/updateostatus.php b/plugins/OStatus/scripts/updateostatus.php index 052cca1467..5461eebe7d 100644 --- a/plugins/OStatus/scripts/updateostatus.php +++ b/plugins/OStatus/scripts/updateostatus.php @@ -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); diff --git a/plugins/OStatus/tests/slap.php b/plugins/OStatus/tests/slap.php index b5f9d3e073..e1670bb336 100644 --- a/plugins/OStatus/tests/slap.php +++ b/plugins/OStatus/tests/slap.php @@ -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); diff --git a/plugins/OfflineBackup/offlinebackupqueuehandler.php b/plugins/OfflineBackup/offlinebackupqueuehandler.php index 2de6c9a667..ba95912b3b 100644 --- a/plugins/OfflineBackup/offlinebackupqueuehandler.php +++ b/plugins/OfflineBackup/offlinebackupqueuehandler.php @@ -56,7 +56,7 @@ class OfflineBackupQueueHandler extends QueueHandler { $userId = $object; - $user = User::staticGet($userId); + $user = User::getKV($userId); common_log(LOG_INFO, "Making backup file for user ".$user->nickname); diff --git a/plugins/OpenID/OpenIDPlugin.php b/plugins/OpenID/OpenIDPlugin.php index 3d8dab8213..3dfcf6c68a 100644 --- a/plugins/OpenID/OpenIDPlugin.php +++ b/plugins/OpenID/OpenIDPlugin.php @@ -827,7 +827,7 @@ class OpenIDPlugin extends Plugin function onOtherAccountProfiles($profile, &$links) { - $prefs = User_openid_prefs::staticGet('user_id', $profile->id); + $prefs = User_openid_prefs::getKV('user_id', $profile->id); if (empty($prefs) || !$prefs->hide_profile_link) { diff --git a/plugins/OpenID/finishopenidlogin.php b/plugins/OpenID/finishopenidlogin.php index 0d3f0fcb76..4326f19514 100644 --- a/plugins/OpenID/finishopenidlogin.php +++ b/plugins/OpenID/finishopenidlogin.php @@ -222,7 +222,7 @@ class FinishopenidloginAction extends Action if (common_config('site', 'inviteonly')) { $code = $_SESSION['invitecode']; if ($code) { - $invite = Invitation::staticGet($code); + $invite = Invitation::getKV($code); if ($invite && $invite->address_type == 'email') { return $invite->address; @@ -335,7 +335,7 @@ class FinishopenidloginAction extends Action return; } - $invite = Invitation::staticGet($code); + $invite = Invitation::getKV($code); if (empty($invite)) { // TRANS: OpenID plugin message. No new user registration is allowed on the site without an invitation code, and the one provided was not valid. @@ -357,7 +357,7 @@ class FinishopenidloginAction extends Action return; } - if (User::staticGet('nickname', $nickname)) { + if (User::getKV('nickname', $nickname)) { // TRANS: OpenID plugin message. The entered new user name is already used. $this->showForm(_m('Nickname already in use. Try another one.')); return; @@ -447,7 +447,7 @@ class FinishopenidloginAction extends Action // They're legit! - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); list($display, $canonical, $sreg) = $this->getSavedValues(); @@ -536,7 +536,7 @@ class FinishopenidloginAction extends Action if (!User::allowed_nickname($str)) { return false; } - if (User::staticGet('nickname', $str)) { + if (User::getKV('nickname', $str)) { return false; } return true; diff --git a/plugins/OpenID/openid.php b/plugins/OpenID/openid.php index 49dd53c878..c38b646dc5 100644 --- a/plugins/OpenID/openid.php +++ b/plugins/OpenID/openid.php @@ -102,9 +102,9 @@ function oid_link_user($id, $canonical, $display) function oid_get_user($openid_url) { $user = null; - $oid = User_openid::staticGet('canonical', $openid_url); + $oid = User_openid::getKV('canonical', $openid_url); if ($oid) { - $user = User::staticGet('id', $oid->user_id); + $user = User::getKV('id', $oid->user_id); } return $user; } diff --git a/plugins/OpenID/openidsettings.php b/plugins/OpenID/openidsettings.php index 0dc4930ce1..7bef69bccd 100644 --- a/plugins/OpenID/openidsettings.php +++ b/plugins/OpenID/openidsettings.php @@ -223,7 +223,7 @@ class OpenidsettingsAction extends SettingsAction 'value' => _m('BUTTON','Remove'))); $this->elementEnd('fieldset'); - $prefs = User_openid_prefs::staticGet('user_id', $user->id); + $prefs = User_openid_prefs::getKV('user_id', $user->id); $this->elementStart('fieldset'); $this->element('legend', null, _m('LEGEND','Preferences')); @@ -326,7 +326,7 @@ class OpenidsettingsAction extends SettingsAction { $openid_url = $this->trimmed('openid_url'); - $oid = User_openid::staticGet('canonical', $openid_url); + $oid = User_openid::getKV('canonical', $openid_url); if (!$oid) { // TRANS: Form validation error for a non-existing OpenID. @@ -362,7 +362,7 @@ class OpenidsettingsAction extends SettingsAction } $orig = null; - $prefs = User_openid_prefs::staticGet('user_id', $cur->id); + $prefs = User_openid_prefs::getKV('user_id', $cur->id); if (empty($prefs)) { $prefs = new User_openid_prefs(); diff --git a/plugins/Poll/Poll.php b/plugins/Poll/Poll.php index 41740f9a45..6cc38f7435 100644 --- a/plugins/Poll/Poll.php +++ b/plugins/Poll/Poll.php @@ -101,7 +101,7 @@ class Poll extends Managed_DataObject */ static function getByNotice($notice) { - return self::staticGet('uri', $notice->uri); + return self::getKV('uri', $notice->uri); } function getOptions() @@ -128,7 +128,7 @@ class Poll extends Managed_DataObject function getNotice() { - return Notice::staticGet('uri', $this->uri); + return Notice::getKV('uri', $this->uri); } function bestUrl() diff --git a/plugins/Poll/PollPlugin.php b/plugins/Poll/PollPlugin.php index 1fadcf108c..d09d827bd1 100644 --- a/plugins/Poll/PollPlugin.php +++ b/plugins/Poll/PollPlugin.php @@ -235,7 +235,7 @@ class PollPlugin extends MicroAppPlugin // TRANS: Exception thrown trying to respond to a poll without a poll reference. throw new Exception(_m('Invalid poll response: No poll reference.')); } - $poll = Poll::staticGet('uri', $pollUri); + $poll = Poll::getKV('uri', $pollUri); if (!$poll) { // TRANS: Exception thrown trying to respond to a non-existing poll. throw new Exception(_m('Invalid poll response: Poll is unknown.')); @@ -503,9 +503,9 @@ class PollPlugin extends MicroAppPlugin function onEndNoticeWhoGets($notice, &$ni) { if ($notice->object_type == self::POLL_RESPONSE_OBJECT) { foreach ($ni as $id => $source) { - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if (!empty($user)) { - $pollPrefs = User_poll_prefs::staticGet('user_id', $user->id); + $pollPrefs = User_poll_prefs::getKV('user_id', $user->id); if (!empty($pollPrefs) && ($pollPrefs->hide_responses)) { unset($ni[$id]); } diff --git a/plugins/Poll/Poll_response.php b/plugins/Poll/Poll_response.php index b466e9f592..ab1524c691 100644 --- a/plugins/Poll/Poll_response.php +++ b/plugins/Poll/Poll_response.php @@ -104,7 +104,7 @@ class Poll_response extends Managed_DataObject */ static function getByNotice($notice) { - return self::staticGet('uri', $notice->uri); + return self::getKV('uri', $notice->uri); } /** @@ -114,7 +114,7 @@ class Poll_response extends Managed_DataObject */ function getNotice() { - return Notice::staticGet('uri', $this->uri); + return Notice::getKV('uri', $this->uri); } function bestUrl() @@ -128,7 +128,7 @@ class Poll_response extends Managed_DataObject */ function getPoll() { - return Poll::staticGet('id', $this->poll_id); + return Poll::getKV('id', $this->poll_id); } /** * Save a new poll notice diff --git a/plugins/Poll/pollsettings.php b/plugins/Poll/pollsettings.php index c3128895cf..b390812cf4 100644 --- a/plugins/Poll/pollsettings.php +++ b/plugins/Poll/pollsettings.php @@ -65,7 +65,7 @@ class PollSettingsAction extends SettingsAction { $user = common_current_user(); - $prefs = User_poll_prefs::staticGet('user_id', $user->id); + $prefs = User_poll_prefs::getKV('user_id', $user->id); $form = new PollPrefsForm($this, $prefs); @@ -84,7 +84,7 @@ class PollSettingsAction extends SettingsAction { $user = common_current_user(); - $upp = User_poll_prefs::staticGet('user_id', $user->id); + $upp = User_poll_prefs::getKV('user_id', $user->id); $orig = null; if (!empty($upp)) { diff --git a/plugins/Poll/respondpoll.php b/plugins/Poll/respondpoll.php index 27b9b193fe..df3f68e87c 100644 --- a/plugins/Poll/respondpoll.php +++ b/plugins/Poll/respondpoll.php @@ -90,7 +90,7 @@ class RespondPollAction extends Action } $id = $this->trimmed('id'); - $this->poll = Poll::staticGet('id', $id); + $this->poll = Poll::getKV('id', $id); if (empty($this->poll)) { // TRANS: Client exception thrown trying to respond to a non-existing poll. throw new ClientException(_m('Invalid or missing poll.'), 404); diff --git a/plugins/Poll/showpoll.php b/plugins/Poll/showpoll.php index edfe3fe245..91f661edd2 100644 --- a/plugins/Poll/showpoll.php +++ b/plugins/Poll/showpoll.php @@ -52,7 +52,7 @@ class ShowPollAction extends ShownoticeAction { $this->id = $this->trimmed('id'); - $this->poll = Poll::staticGet('id', $this->id); + $this->poll = Poll::getKV('id', $this->id); if (empty($this->poll)) { // TRANS: Client exception thrown trying to view a non-existing poll. diff --git a/plugins/QnA/QnAPlugin.php b/plugins/QnA/QnAPlugin.php index 4908e93dd0..ce93536388 100644 --- a/plugins/QnA/QnAPlugin.php +++ b/plugins/QnA/QnAPlugin.php @@ -225,7 +225,7 @@ class QnAPlugin extends MicroAppPlugin ); break; case Answer::ObjectType: - $question = QnA_Question::staticGet('uri', $questionObj->id); + $question = QnA_Question::getKV('uri', $questionObj->id); if (empty($question)) { // FIXME: save the question // TRANS: Exception thrown when answering a non-existing question. @@ -308,7 +308,7 @@ class QnAPlugin extends MicroAppPlugin $class .= ' limited-scope'; } - $question = QnA_Question::staticGet('uri', $nli->notice->uri); + $question = QnA_Question::getKV('uri', $nli->notice->uri); if (!empty($question->closed)) { $class .= ' closed'; @@ -328,7 +328,7 @@ class QnAPlugin extends MicroAppPlugin $cls = array('hentry', 'notice', 'answer'); - $answer = QnA_Answer::staticGet('uri', $nli->notice->uri); + $answer = QnA_Answer::getKV('uri', $nli->notice->uri); if (!empty($answer) && !empty($answer->best)) { $cls[] = 'best'; diff --git a/plugins/QnA/actions/qnaclosequestion.php b/plugins/QnA/actions/qnaclosequestion.php index 1ef5063a02..87a848987c 100644 --- a/plugins/QnA/actions/qnaclosequestion.php +++ b/plugins/QnA/actions/qnaclosequestion.php @@ -92,7 +92,7 @@ class QnaclosequestionAction extends Action } $id = substr($this->trimmed('id'), 9); - $this->question = QnA_Question::staticGet('id', $id); + $this->question = QnA_Question::getKV('id', $id); if (empty($this->question)) { // TRANS: Client exception thrown trying to respond to a non-existing question. throw new ClientException(_m('Invalid or missing question.'), 404); diff --git a/plugins/QnA/actions/qnanewanswer.php b/plugins/QnA/actions/qnanewanswer.php index e565b3e93a..661cbcc328 100644 --- a/plugins/QnA/actions/qnanewanswer.php +++ b/plugins/QnA/actions/qnanewanswer.php @@ -93,7 +93,7 @@ class QnanewanswerAction extends Action $id = substr($this->trimmed('id'), 9); - $this->question = QnA_Question::staticGet('id', $id); + $this->question = QnA_Question::getKV('id', $id); if (empty($this->question)) { throw new ClientException( diff --git a/plugins/QnA/actions/qnareviseanswer.php b/plugins/QnA/actions/qnareviseanswer.php index ce4bdea56a..707a81f8ac 100644 --- a/plugins/QnA/actions/qnareviseanswer.php +++ b/plugins/QnA/actions/qnareviseanswer.php @@ -88,7 +88,7 @@ class QnareviseanswerAction extends Action $id = substr($this->trimmed('id'), 7); - $this->answer = QnA_Answer::staticGet('id', $id); + $this->answer = QnA_Answer::getKV('id', $id); $this->question = $this->answer->getQuestion(); if (empty($this->answer) || empty($this->question)) { diff --git a/plugins/QnA/actions/qnashowanswer.php b/plugins/QnA/actions/qnashowanswer.php index 85b39d0053..95a3c595df 100644 --- a/plugins/QnA/actions/qnashowanswer.php +++ b/plugins/QnA/actions/qnashowanswer.php @@ -61,7 +61,7 @@ class QnashowanswerAction extends ShownoticeAction $this->id = $this->trimmed('id'); - $this->answer = QnA_Answer::staticGet('id', $this->id); + $this->answer = QnA_Answer::getKV('id', $this->id); if (empty($this->answer)) { // TRANS: Client exception thrown when requesting a non-existing answer. @@ -75,14 +75,14 @@ class QnashowanswerAction extends ShownoticeAction throw new ClientException(_m('No question for this answer.'), 404); } - $this->notice = Notice::staticGet('uri', $this->answer->uri); + $this->notice = Notice::getKV('uri', $this->answer->uri); if (empty($this->notice)) { // TRANS: Did we used to have it, and it got deleted? throw new ClientException(_m('No such answer.'), 404); } - $this->user = User::staticGet('id', $this->answer->profile_id); + $this->user = User::getKV('id', $this->answer->profile_id); if (empty($this->user)) { // TRANS: Client exception thrown when requesting answer data for a non-existing user. diff --git a/plugins/QnA/actions/qnashowquestion.php b/plugins/QnA/actions/qnashowquestion.php index ca2cb74ba1..f030efadb2 100644 --- a/plugins/QnA/actions/qnashowquestion.php +++ b/plugins/QnA/actions/qnashowquestion.php @@ -61,7 +61,7 @@ class QnashowquestionAction extends ShownoticeAction $this->id = $this->trimmed('id'); - $this->question = QnA_Question::staticGet('id', $this->id); + $this->question = QnA_Question::getKV('id', $this->id); if (empty($this->question)) { // TRANS: Client exception thrown trying to view a non-existing question. @@ -76,7 +76,7 @@ class QnashowquestionAction extends ShownoticeAction throw new ClientException(_m('No such question notice.'), 404); } - $this->user = User::staticGet('id', $this->question->profile_id); + $this->user = User::getKV('id', $this->question->profile_id); if (empty($this->user)) { // TRANS: Client exception thrown trying to view a question of a non-existing user. diff --git a/plugins/QnA/actions/qnavote.php b/plugins/QnA/actions/qnavote.php index 715f81e831..df4898dfe9 100644 --- a/plugins/QnA/actions/qnavote.php +++ b/plugins/QnA/actions/qnavote.php @@ -90,7 +90,7 @@ class Qnavote extends Action } $id = $this->trimmed('id'); - $this->question = QnA_Question::staticGet('id', $id); + $this->question = QnA_Question::getKV('id', $id); if (empty($this->question)) { // TRANS: Client exception thrown trying to respond to a non-existing question. throw new ClientException(_m('Invalid or missing question.'), 404); diff --git a/plugins/QnA/classes/QnA_Answer.php b/plugins/QnA/classes/QnA_Answer.php index 5cbc80594c..96796b80e2 100644 --- a/plugins/QnA/classes/QnA_Answer.php +++ b/plugins/QnA/classes/QnA_Answer.php @@ -122,7 +122,7 @@ class QnA_Answer extends Managed_DataObject */ static function getByNotice($notice) { - $answer = self::staticGet('uri', $notice->uri); + $answer = self::getKV('uri', $notice->uri); if (empty($answer)) { throw new Exception("No answer with URI {$notice->uri}"); } @@ -136,12 +136,12 @@ class QnA_Answer extends Managed_DataObject */ function getNotice() { - return Notice::staticGet('uri', $this->uri); + return Notice::getKV('uri', $this->uri); } static function fromNotice($notice) { - return QnA_Answer::staticGet('uri', $notice->uri); + return QnA_Answer::getKV('uri', $notice->uri); } function bestUrl() @@ -156,7 +156,7 @@ class QnA_Answer extends Managed_DataObject */ function getQuestion() { - $question = QnA_Question::staticGet('id', $this->question_id); + $question = QnA_Question::getKV('id', $this->question_id); if (empty($question)) { // TRANS: Exception thown when getting a question with a non-existing ID. // TRANS: %s is the non-existing question ID. @@ -167,7 +167,7 @@ class QnA_Answer extends Managed_DataObject function getProfile() { - $profile = Profile::staticGet('id', $this->profile_id); + $profile = Profile::getKV('id', $this->profile_id); if (empty($profile)) { // TRANS: Exception thown when getting a profile with a non-existing ID. // TRANS: %s is the non-existing profile ID. diff --git a/plugins/QnA/classes/QnA_Question.php b/plugins/QnA/classes/QnA_Question.php index a029a2434a..58a9cd5e18 100644 --- a/plugins/QnA/classes/QnA_Question.php +++ b/plugins/QnA/classes/QnA_Question.php @@ -116,12 +116,12 @@ class QnA_Question extends Managed_DataObject */ static function getByNotice($notice) { - return self::staticGet('uri', $notice->uri); + return self::getKV('uri', $notice->uri); } function getNotice() { - return Notice::staticGet('uri', $this->uri); + return Notice::getKV('uri', $this->uri); } function bestUrl() @@ -131,7 +131,7 @@ class QnA_Question extends Managed_DataObject function getProfile() { - $profile = Profile::staticGet('id', $this->profile_id); + $profile = Profile::getKV('id', $this->profile_id); if (empty($profile)) { // TRANS: Exception trown when getting a profile for a non-existing ID. // TRANS: %s is the provided profile ID. @@ -183,7 +183,7 @@ class QnA_Question extends Managed_DataObject static function fromNotice($notice) { - return QnA_Question::staticGet('uri', $notice->uri); + return QnA_Question::getKV('uri', $notice->uri); } function asHTML() diff --git a/plugins/RSSCloud/RSSCloudRequestNotify.php b/plugins/RSSCloud/RSSCloudRequestNotify.php index b7954884dd..7fd6da0509 100644 --- a/plugins/RSSCloud/RSSCloudRequestNotify.php +++ b/plugins/RSSCloud/RSSCloudRequestNotify.php @@ -269,7 +269,7 @@ class RSSCloudRequestNotifyAction extends Action $valid = '%^' . $path . '(?.*)\.rss$%'; if (preg_match($valid, $feed, $matches)) { - $user = User::staticGet('id', $matches['id']); + $user = User::getKV('id', $matches['id']); if (!empty($user)) { return $user; } diff --git a/plugins/RSSCloud/RSSCloudSubscription.php b/plugins/RSSCloud/RSSCloudSubscription.php index 595af88446..e5acb9da24 100644 --- a/plugins/RSSCloud/RSSCloudSubscription.php +++ b/plugins/RSSCloud/RSSCloudSubscription.php @@ -36,7 +36,7 @@ class RSSCloudSubscription extends Memcached_DataObject { var $created; // datestamp() var $modified; // timestamp() not_null default_CURRENT_TIMESTAMP - function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('DataObjects_Grp',$k,$v); } + static function getKV($k,$v=NULL) { return DB_DataObject::staticGet('DataObjects_Grp',$k,$v); } function table() { diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 0fa51ce861..aec53d48f3 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -179,7 +179,7 @@ class RealtimePlugin extends Plugin return true; } - $user = User::staticGet('id', $notice->profile_id); + $user = User::getKV('id', $notice->profile_id); if (!empty($user)) { $paths[] = array('showstream', $user->nickname, null); @@ -208,7 +208,7 @@ class RealtimePlugin extends Plugin $ni = $notice->whoGets(); foreach (array_keys($ni) as $user_id) { - $user = User::staticGet('id', $user_id); + $user = User::getKV('id', $user_id); $paths[] = array('all', $user->nickname, null); } @@ -219,7 +219,7 @@ class RealtimePlugin extends Plugin if ($reply->find()) { while ($reply->fetch()) { - $user = User::staticGet('id', $reply->profile_id); + $user = User::getKV('id', $reply->profile_id); if (!empty($user)) { $paths[] = array('replies', $user->nickname, null); } @@ -234,7 +234,7 @@ class RealtimePlugin extends Plugin if ($gi->find()) { while ($gi->fetch()) { - $ug = User_group::staticGet('id', $gi->group_id); + $ug = User_group::getKV('id', $gi->group_id); $paths[] = array('showgroup', $ug->nickname, null); } } @@ -265,7 +265,7 @@ class RealtimePlugin extends Plugin if (is_null($channel->user_id)) { $profile = null; } else { - $profile = Profile::staticGet('id', $channel->user_id); + $profile = Profile::getKV('id', $channel->user_id); } if ($notice->inScope($profile)) { $this->log(LOG_INFO, @@ -345,7 +345,7 @@ class RealtimePlugin extends Plugin // Add needed repeat data if (!empty($notice->repeat_of)) { - $original = Notice::staticGet('id', $notice->repeat_of); + $original = Notice::getKV('id', $notice->repeat_of); if (!empty($original)) { $arr['retweeted_status']['url'] = $original->bestUrl(); $arr['retweeted_status']['html'] = htmlspecialchars($original->rendered); @@ -385,7 +385,7 @@ class RealtimePlugin extends Plugin $convurl = null; if ($notice->hasConversation()) { - $conv = Conversation::staticGet( + $conv = Conversation::getKV( 'id', $notice->conversation ); diff --git a/plugins/Realtime/cleanupchannels.php b/plugins/Realtime/cleanupchannels.php index 1c10bc69e8..ea195b02cd 100644 --- a/plugins/Realtime/cleanupchannels.php +++ b/plugins/Realtime/cleanupchannels.php @@ -48,7 +48,7 @@ function cleanupChannels() $keys = $rc->fetchAll(); foreach ($keys as $key) { - $rc = Realtime_channel::staticGet('channel_key', $key); + $rc = Realtime_channel::getKV('channel_key', $key); if (!empty($rc)) { printfv("Deleting realtime channel '$key'\n"); $rc->delete(); diff --git a/plugins/Realtime/closechannel.php b/plugins/Realtime/closechannel.php index 4c4e5de1cc..ee092ce2bc 100644 --- a/plugins/Realtime/closechannel.php +++ b/plugins/Realtime/closechannel.php @@ -72,7 +72,7 @@ class ClosechannelAction extends Action throw new ClientException(_m('No channel key argument.')); } - $this->channel = Realtime_channel::staticGet('channel_key', $this->channelKey); + $this->channel = Realtime_channel::getKV('channel_key', $this->channelKey); if (empty($this->channel)) { // TRANS: Client exception thrown when referring to a non-existing channel. diff --git a/plugins/Realtime/keepalivechannel.php b/plugins/Realtime/keepalivechannel.php index 7559927d6b..e9319ed916 100644 --- a/plugins/Realtime/keepalivechannel.php +++ b/plugins/Realtime/keepalivechannel.php @@ -72,7 +72,7 @@ class KeepalivechannelAction extends Action throw new ClientException(_m('No channel key argument.')); } - $this->channel = Realtime_channel::staticGet('channel_key', $this->channelKey); + $this->channel = Realtime_channel::getKV('channel_key', $this->channelKey); if (empty($this->channel)) { // TRANS: Client exception thrown when referring to a non-existing channel. diff --git a/plugins/RegisterThrottle/RegisterThrottlePlugin.php b/plugins/RegisterThrottle/RegisterThrottlePlugin.php index 1e686bd62b..93d990ca77 100644 --- a/plugins/RegisterThrottle/RegisterThrottlePlugin.php +++ b/plugins/RegisterThrottle/RegisterThrottlePlugin.php @@ -151,7 +151,7 @@ class RegisterThrottlePlugin extends Plugin if ($this->silenced) { $ids = Registration_ip::usersByIP($ipaddress); foreach ($ids as $id) { - $profile = Profile::staticGet('id', $id); + $profile = Profile::getKV('id', $id); if ($profile && $profile->isSilenced()) { // TRANS: Exception thrown when attempting to register from an IP address from which silenced users have registered. throw new Exception(_m('A banned user has registered from this address.')); @@ -283,7 +283,7 @@ class RegisterThrottlePlugin extends Plugin return true; } - $ri = Registration_ip::staticGet('user_id', $profile->id); + $ri = Registration_ip::getKV('user_id', $profile->id); if (empty($ri)) { return true; @@ -296,7 +296,7 @@ class RegisterThrottlePlugin extends Plugin continue; } - $other = Profile::staticGet('id', $id); + $other = Profile::getKV('id', $id); if (empty($other)) { continue; diff --git a/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php b/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php index 0deba68579..0a79796ebf 100644 --- a/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php +++ b/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php @@ -111,7 +111,7 @@ class RequireValidatedEmailPlugin extends Plugin */ function onStartNoticeSave($notice) { - $user = User::staticGet('id', $notice->profile_id); + $user = User::getKV('id', $notice->profile_id); if (!empty($user)) { // it's a remote notice if (!$this->validated($user)) { // TRANS: Client exception thrown when trying to post notices before validating an e-mail address. @@ -272,7 +272,7 @@ class RequireValidatedEmailPlugin extends Plugin { if ($right == Right::CREATEGROUP || ($this->disallowLogin && ($right == Right::WEBLOGIN || $right == Right::API))) { - $user = User::staticGet('id', $profile->id); + $user = User::getKV('id', $profile->id); if ($user && !$this->validated($user)) { $result = false; return false; diff --git a/plugins/RequireValidatedEmail/confirmfirstemail.php b/plugins/RequireValidatedEmail/confirmfirstemail.php index 0b6843fa47..0019d1c6be 100644 --- a/plugins/RequireValidatedEmail/confirmfirstemail.php +++ b/plugins/RequireValidatedEmail/confirmfirstemail.php @@ -70,7 +70,7 @@ class ConfirmfirstemailAction extends Action $this->code = $this->trimmed('code'); - $this->confirm = Confirm_address::staticGet('code', $this->code); + $this->confirm = Confirm_address::getKV('code', $this->code); if (empty($this->confirm)) { // TRANS: Client exception thrown when trying to register with a non-existing confirmation code. @@ -78,7 +78,7 @@ class ConfirmfirstemailAction extends Action return; } - $this->user = User::staticGet('id', $this->confirm->user_id); + $this->user = User::getKV('id', $this->confirm->user_id); if (empty($this->user)) { // TRANS: Client exception thrown when trying to register with a confirmation code that is not connected with a user. diff --git a/plugins/RequireValidatedEmail/registerbyemail.php b/plugins/RequireValidatedEmail/registerbyemail.php index 59c229b684..4d2000ab0f 100644 --- a/plugins/RequireValidatedEmail/registerbyemail.php +++ b/plugins/RequireValidatedEmail/registerbyemail.php @@ -37,7 +37,7 @@ $email = get_option_value('e', 'email'); $parts = explode('@', $email); $nickname = common_nicknamize($parts[0]); -$user = User::staticGet('nickname', $nickname); +$user = User::getKV('nickname', $nickname); if (!empty($user)) { $confirm = new Confirm_address(); diff --git a/plugins/Sample/User_greeting_count.php b/plugins/Sample/User_greeting_count.php index 6c7bcf4911..415f710440 100644 --- a/plugins/Sample/User_greeting_count.php +++ b/plugins/Sample/User_greeting_count.php @@ -130,7 +130,7 @@ class User_greeting_count extends Managed_DataObject */ static function inc($user_id) { - $gc = User_greeting_count::staticGet('user_id', $user_id); + $gc = User_greeting_count::getKV('user_id', $user_id); if (empty($gc)) { $gc = new User_greeting_count(); diff --git a/plugins/Sitemap/Sitemap_notice_count.php b/plugins/Sitemap/Sitemap_notice_count.php index cb42edcbf6..46ae65c838 100644 --- a/plugins/Sitemap/Sitemap_notice_count.php +++ b/plugins/Sitemap/Sitemap_notice_count.php @@ -211,7 +211,7 @@ class Sitemap_notice_count extends Managed_DataObject static function updateCount($d, $n) { - $snc = Sitemap_notice_count::staticGet('notice_date', DB_DataObject_Cast::date($d)); + $snc = Sitemap_notice_count::getKV('notice_date', DB_DataObject_Cast::date($d)); if (empty($snc)) { // TRANS: Exception diff --git a/plugins/Sitemap/Sitemap_user_count.php b/plugins/Sitemap/Sitemap_user_count.php index 3377879f94..c085e4de9e 100644 --- a/plugins/Sitemap/Sitemap_user_count.php +++ b/plugins/Sitemap/Sitemap_user_count.php @@ -212,7 +212,7 @@ class Sitemap_user_count extends Managed_DataObject static function updateCount($d, $n) { - $suc = Sitemap_user_count::staticGet('registration_date', DB_DataObject_Cast::date($d)); + $suc = Sitemap_user_count::getKV('registration_date', DB_DataObject_Cast::date($d)); if (empty($suc)) { // TRANS: Exception thrown when a registration date cannot be found. diff --git a/plugins/SlicedFavorites/favoritedsliceaction.php b/plugins/SlicedFavorites/favoritedsliceaction.php index 9c8a9f53fb..5c9fb31f8f 100644 --- a/plugins/SlicedFavorites/favoritedsliceaction.php +++ b/plugins/SlicedFavorites/favoritedsliceaction.php @@ -143,7 +143,7 @@ class FavoritedSliceAction extends FavoritedAction $ids = array(); foreach ($nicks as $nick) { // not the most efficient way for a big list! - $user = User::staticGet('nickname', $nick); + $user = User::getKV('nickname', $nick); if ($user) { $ids[] = intval($user->id); } diff --git a/plugins/SubMirror/actions/basemirror.php b/plugins/SubMirror/actions/basemirror.php index e3b67bb1d6..e6bbaf6864 100644 --- a/plugins/SubMirror/actions/basemirror.php +++ b/plugins/SubMirror/actions/basemirror.php @@ -77,7 +77,7 @@ abstract class BaseMirrorAction extends Action protected function validateProfile($id) { $id = intval($id); - $profile = Profile::staticGet('id', $id); + $profile = Profile::getKV('id', $id); if ($profile && $profile->id != $this->user->id) { return $profile; } diff --git a/plugins/SubMirror/actions/editmirror.php b/plugins/SubMirror/actions/editmirror.php index 557eb0aba4..1119e8718f 100644 --- a/plugins/SubMirror/actions/editmirror.php +++ b/plugins/SubMirror/actions/editmirror.php @@ -98,7 +98,7 @@ class EditMirrorAction extends BaseMirrorAction if ($this->delete) { $mirror->delete(); - $oprofile = Ostatus_profile::staticGet('profile_id', $this->profile->id); + $oprofile = Ostatus_profile::getKV('profile_id', $this->profile->id); if ($oprofile) { $oprofile->garbageCollect(); } diff --git a/plugins/SubMirror/actions/mirrorsettings.php b/plugins/SubMirror/actions/mirrorsettings.php index 000d7ecad0..272698abc3 100644 --- a/plugins/SubMirror/actions/mirrorsettings.php +++ b/plugins/SubMirror/actions/mirrorsettings.php @@ -91,7 +91,7 @@ class MirrorSettingsAction extends SettingsAction function showFeedForm($mirror) { - $profile = Profile::staticGet('id', $mirror->subscribed); + $profile = Profile::getKV('id', $mirror->subscribed); if ($profile) { $form = new EditMirrorForm($this, $profile); $form->show(); diff --git a/plugins/SubMirror/classes/SubMirror.php b/plugins/SubMirror/classes/SubMirror.php index f7c8c567c2..ac1eb01f60 100644 --- a/plugins/SubMirror/classes/SubMirror.php +++ b/plugins/SubMirror/classes/SubMirror.php @@ -150,7 +150,7 @@ class SubMirror extends Managed_DataObject */ public function mirrorNotice($notice) { - $profile = Profile::staticGet('id', $this->subscriber); + $profile = Profile::getKV('id', $this->subscriber); if (!$profile) { common_log(LOG_ERR, "SubMirror plugin skipping auto-repeat of notice $notice->id for missing user $profile->id"); return false; diff --git a/plugins/SubMirror/lib/editmirrorform.php b/plugins/SubMirror/lib/editmirrorform.php index c09aa4a7ad..1fc13e8212 100644 --- a/plugins/SubMirror/lib/editmirrorform.php +++ b/plugins/SubMirror/lib/editmirrorform.php @@ -144,7 +144,7 @@ class EditMirrorForm extends Form { // Ok this is a bit of a hack. ;) if (class_exists('Ostatus_profile')) { - $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id); + $oprofile = Ostatus_profile::getKV('profile_id', $profile->id); if ($oprofile) { return $oprofile->feeduri; } diff --git a/plugins/TwitterBridge/Notice_to_status.php b/plugins/TwitterBridge/Notice_to_status.php index f2756060e9..80656ad833 100644 --- a/plugins/TwitterBridge/Notice_to_status.php +++ b/plugins/TwitterBridge/Notice_to_status.php @@ -135,7 +135,7 @@ class Notice_to_status extends Managed_DataObject if (empty($notice_id)) { throw new Exception("Invalid notice_id $notice_id"); } - $n2s = Notice_to_status::staticGet('notice_id', $notice_id); + $n2s = Notice_to_status::getKV('notice_id', $notice_id); if (!empty($n2s)) { return $n2s; @@ -144,7 +144,7 @@ class Notice_to_status extends Managed_DataObject if (empty($status_id)) { throw new Exception("Invalid status_id $status_id"); } - $n2s = Notice_to_status::staticGet('status_id', $status_id); + $n2s = Notice_to_status::getKV('status_id', $status_id); if (!empty($n2s)) { return $n2s; diff --git a/plugins/TwitterBridge/TwitterBridgePlugin.php b/plugins/TwitterBridge/TwitterBridgePlugin.php index 672c1b8451..6dc8ae8b76 100644 --- a/plugins/TwitterBridge/TwitterBridgePlugin.php +++ b/plugins/TwitterBridge/TwitterBridgePlugin.php @@ -441,7 +441,7 @@ class TwitterBridgePlugin extends Plugin */ function onStartDeleteOwnNotice(User $user, Notice $notice) { - $n2s = Notice_to_status::staticGet('notice_id', $notice->id); + $n2s = Notice_to_status::getKV('notice_id', $notice->id); if (!empty($n2s)) { diff --git a/plugins/TwitterBridge/daemons/synctwitterfriends.php b/plugins/TwitterBridge/daemons/synctwitterfriends.php index 38a8b89ebb..b20d8691a3 100755 --- a/plugins/TwitterBridge/daemons/synctwitterfriends.php +++ b/plugins/TwitterBridge/daemons/synctwitterfriends.php @@ -228,7 +228,7 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon // Get associated user and subscribe her - $friend_user = User::staticGet('id', $friend_flink->user_id); + $friend_user = User::getKV('id', $friend_flink->user_id); if (!empty($friend_user)) { $result = subs_subscribe_to($user, $friend_user); diff --git a/plugins/TwitterBridge/scripts/fakestream.php b/plugins/TwitterBridge/scripts/fakestream.php index 3696888162..e827a07117 100644 --- a/plugins/TwitterBridge/scripts/fakestream.php +++ b/plugins/TwitterBridge/scripts/fakestream.php @@ -109,13 +109,13 @@ if (have_option('all')) { } } } else { - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); $users = array($user->id); } $output = array(); foreach ($users as $id) { - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if (!$user) { throw new Exception("No user for id $id"); } diff --git a/plugins/TwitterBridge/scripts/streamtest.php b/plugins/TwitterBridge/scripts/streamtest.php index aad15fdeab..e0c48efe57 100644 --- a/plugins/TwitterBridge/scripts/streamtest.php +++ b/plugins/TwitterBridge/scripts/streamtest.php @@ -113,7 +113,7 @@ function siteStreamForOwner(User $user) } -$user = User::staticGet('nickname', $nickname); +$user = User::getKV('nickname', $nickname); global $myuser; $myuser = $user; diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index ac61cc6160..358c3aa86e 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -132,7 +132,7 @@ function is_twitter_bound($notice, $flink) { function is_twitter_notice($id) { - $n2s = Notice_to_status::staticGet('notice_id', $id); + $n2s = Notice_to_status::getKV('notice_id', $id); return (!empty($n2s)); } @@ -184,7 +184,7 @@ function broadcast_twitter($notice) if (!empty($flink) && TwitterOAuthClient::isPackedToken($flink->credentials)) { if (is_twitter_bound($notice, $flink)) { if (!empty($notice->repeat_of) && is_twitter_notice($notice->repeat_of)) { - $retweet = retweet_notice($flink, Notice::staticGet('id', $notice->repeat_of)); + $retweet = retweet_notice($flink, Notice::getKV('id', $notice->repeat_of)); if (is_object($retweet)) { Notice_to_status::saveNew($notice->id, twitter_id($retweet)); return true; @@ -239,7 +239,7 @@ function retweet_notice($flink, $notice) function twitter_status_id($notice) { - $n2s = Notice_to_status::staticGet('notice_id', $notice->id); + $n2s = Notice_to_status::getKV('notice_id', $notice->id); if (empty($n2s)) { return null; } else { @@ -263,7 +263,7 @@ function twitter_update_params($notice) $params['long'] = $notice->lon; } if (!empty($notice->reply_to) && is_twitter_notice($notice->reply_to)) { - $reply = Notice::staticGet('id', $notice->reply_to); + $reply = Notice::getKV('id', $notice->reply_to); $params['in_reply_to_status_id'] = twitter_status_id($reply); } return $params; diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index 1a7234214e..6a86c81cb7 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -471,7 +471,7 @@ class TwitterauthorizationAction extends Action if (common_config('site', 'inviteonly')) { $code = $_SESSION['invitecode']; if ($code) { - $invite = Invitation::staticGet($code); + $invite = Invitation::getKV($code); if ($invite && $invite->address_type == 'email') { return $invite->address; @@ -509,7 +509,7 @@ class TwitterauthorizationAction extends Action return; } - $invite = Invitation::staticGet($code); + $invite = Invitation::getKV($code); if (empty($invite)) { // TRANS: Client error displayed when trying to create a new user with an invalid invitation code. @@ -531,7 +531,7 @@ class TwitterauthorizationAction extends Action return; } - if (User::staticGet('nickname', $nickname)) { + if (User::getKV('nickname', $nickname)) { // TRANS: Client error displayed when trying to create a new user with a username that is already in use. $this->showForm(_m('Nickname already in use. Try another one.')); return; @@ -594,7 +594,7 @@ class TwitterauthorizationAction extends Action return; } - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); if (!empty($user)) { common_debug('TwitterBridge Plugin - ' . @@ -715,7 +715,7 @@ class TwitterauthorizationAction extends Action if (!User::allowed_nickname($str)) { return false; } - if (User::staticGet('nickname', $str)) { + if (User::getKV('nickname', $str)) { return false; } return true; diff --git a/plugins/TwitterBridge/twitterimport.php b/plugins/TwitterBridge/twitterimport.php index dc7277caf9..cdfb8f8316 100644 --- a/plugins/TwitterBridge/twitterimport.php +++ b/plugins/TwitterBridge/twitterimport.php @@ -90,7 +90,7 @@ class TwitterImport $statusUri = $this->makeStatusURI($status->user->screen_name, $statusId); // check to see if we've already imported the status - $n2s = Notice_to_status::staticGet('status_id', $statusId); + $n2s = Notice_to_status::getKV('status_id', $statusId); if (!empty($n2s)) { common_log( @@ -98,7 +98,7 @@ class TwitterImport $this->name() . " - Ignoring duplicate import: {$statusId}" ); - return Notice::staticGet('id', $n2s->notice_id); + return Notice::getKV('id', $n2s->notice_id); } // If it's a retweet, save it as a repeat! @@ -149,11 +149,11 @@ class TwitterImport $replyTo = twitter_id($status, 'in_reply_to_status_id'); if (!empty($replyTo)) { common_log(LOG_INFO, "Status {$statusId} is a reply to status {$replyTo}"); - $n2s = Notice_to_status::staticGet('status_id', $replyTo); + $n2s = Notice_to_status::getKV('status_id', $replyTo); if (empty($n2s)) { common_log(LOG_INFO, "Couldn't find local notice for status {$replyTo}"); } else { - $reply = Notice::staticGet('id', $n2s->notice_id); + $reply = Notice::getKV('id', $n2s->notice_id); if (empty($reply)) { common_log(LOG_INFO, "Couldn't find local notice for status {$replyTo}"); } else { @@ -215,7 +215,7 @@ class TwitterImport /** - * Look up a Profile by profileurl field. Profile::staticGet() was + * Look up a Profile by profileurl field. Profile::getKV() was * not working consistently. * * @param string $nickname local nickname of the Twitter user @@ -305,7 +305,7 @@ class TwitterImport // check for remote profile - $remote_pro = Remote_profile::staticGet('uri', $profileurl); + $remote_pro = Remote_profile::getKV('uri', $profileurl); if (empty($remote_pro)) { $remote_pro = new Remote_profile(); @@ -440,7 +440,7 @@ class TwitterImport common_debug($this->name() . " - Updating avatar: $size"); - $profile = Profile::staticGet($profile_id); + $profile = Profile::getKV($profile_id); if (empty($profile)) { common_debug($this->name() . " - Couldn't get profile: $profile_id!"); @@ -679,7 +679,7 @@ class TwitterImport foreach ($status->entities->user_mentions as $mention) { $flink = Foreign_link::getByForeignID($mention->id, TWITTER_SERVICE); if (!empty($flink)) { - $user = User::staticGet('id', $flink->user_id); + $user = User::getKV('id', $flink->user_id); if (!empty($user)) { $reply = new Reply(); $reply->notice_id = $notice->id; diff --git a/plugins/UserFlag/adminprofileflag.php b/plugins/UserFlag/adminprofileflag.php index d9e57cfc4b..b7538c6663 100644 --- a/plugins/UserFlag/adminprofileflag.php +++ b/plugins/UserFlag/adminprofileflag.php @@ -169,7 +169,7 @@ class AdminprofileflagAction extends Action if ($ufp->find()) { while ($ufp->fetch()) { - $profile = Profile::staticGet('id', $ufp->profile_id); + $profile = Profile::getKV('id', $ufp->profile_id); if (!empty($profile)) { $profiles[] = $profile; } @@ -354,7 +354,7 @@ class FlaggedProfileListItem extends ProfileListItem if ($ufp->find()) { // XXX: this should always happen while ($ufp->fetch()) { - $user = User::staticGet('id', $ufp->user_id); + $user = User::getKV('id', $ufp->user_id); if (!empty($user)) { // XXX: this would also be unusual $flaggers[] = clone($user); } diff --git a/plugins/YammerImport/lib/yammerimporter.php b/plugins/YammerImport/lib/yammerimporter.php index ffc88ab473..f589753796 100644 --- a/plugins/YammerImport/lib/yammerimporter.php +++ b/plugins/YammerImport/lib/yammerimporter.php @@ -45,9 +45,9 @@ class YammerImporter $profileId = $this->findImportedUser($data['orig_id']); if ($profileId) { - return Profile::staticGet('id', $profileId); + return Profile::getKV('id', $profileId); } else { - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); if ($user) { common_log(LOG_WARN, "Copying Yammer profile info onto existing user $nickname"); $profile = $user->getProfile(); @@ -82,12 +82,12 @@ class YammerImporter $groupId = $this->findImportedGroup($data['orig_id']); if ($groupId) { - return User_group::staticGet('id', $groupId); + return User_group::getKV('id', $groupId); } else { - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if ($local) { common_log(LOG_WARN, "Copying Yammer group info onto existing group $nickname"); - $group = User_group::staticGet('id', $local->group_id); + $group = User_group::getKV('id', $local->group_id); $this->savePropertiesOn($group, $data['options'], array('fullname', 'description')); } else { @@ -130,11 +130,11 @@ class YammerImporter $noticeId = $this->findImportedNotice($data['orig_id']); if ($noticeId) { - return Notice::staticGet('id', $noticeId); + return Notice::getKV('id', $noticeId); } else { - $notice = Notice::staticGet('uri', $data['options']['uri']); + $notice = Notice::getKV('uri', $data['options']['uri']); $content = $data['content']; - $user = User::staticGet($data['profile']); + $user = User::getKV($data['profile']); // Fetch file attachments and add the URLs... $uploads = array(); @@ -156,7 +156,7 @@ class YammerImporter // Save "likes" as favorites... foreach ($data['faves'] as $nickname) { - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); if ($user) { Fave::addNew($user->getProfile(), $notice); } @@ -331,7 +331,7 @@ class YammerImporter $options['groups'] = array($groupId); // @fixme if we see a group link inline, don't add this? - $group = User_group::staticGet('id', $groupId); + $group = User_group::getKV('id', $groupId); if ($group) { $content .= ' !' . $group->nickname; } @@ -365,19 +365,19 @@ class YammerImporter private function findImportedUser($origId) { - $map = Yammer_user::staticGet('id', $origId); + $map = Yammer_user::getKV('id', $origId); return $map ? $map->user_id : null; } private function findImportedGroup($origId) { - $map = Yammer_group::staticGet('id', $origId); + $map = Yammer_group::getKV('id', $origId); return $map ? $map->group_id : null; } private function findImportedNotice($origId) { - $map = Yammer_notice::staticGet('id', $origId); + $map = Yammer_notice::getKV('id', $origId); return $map ? $map->notice_id : null; } diff --git a/plugins/YammerImport/lib/yammerrunner.php b/plugins/YammerImport/lib/yammerrunner.php index 04cc9c0283..5907ce0c32 100644 --- a/plugins/YammerImport/lib/yammerrunner.php +++ b/plugins/YammerImport/lib/yammerrunner.php @@ -40,7 +40,7 @@ class YammerRunner */ public static function init() { - $state = Yammer_state::staticGet('id', 1); + $state = Yammer_state::getKV('id', 1); if (!$state) { $state = self::initState(); } @@ -302,7 +302,7 @@ class YammerRunner $this->state->state = 'save-messages'; } else { foreach ($messages as $item) { - $stub = Yammer_notice_stub::staticGet($item['id']); + $stub = Yammer_notice_stub::getKV($item['id']); if (!$stub) { Yammer_notice_stub::record($item['id'], $item); } diff --git a/scripts/clear_jabber.php b/scripts/clear_jabber.php index 5ec53caf0e..a71ccb2d67 100755 --- a/scripts/clear_jabber.php +++ b/scripts/clear_jabber.php @@ -38,14 +38,14 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if (empty($user)) { print "Can't find user with ID $id\n"; exit(1); } } 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)) { print "Can't find user with nickname '$nickname'\n"; exit(1); @@ -67,7 +67,7 @@ if (have_option('i', 'id')) { function clear_jabber($id) { - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if ($user && $user->jabber) { echo "clearing user $id's user.jabber, was: $user->jabber"; if (have_option('dry-run')) { diff --git a/scripts/command.php b/scripts/command.php index 7b1d651e48..8cf44ecd2d 100755 --- a/scripts/command.php +++ b/scripts/command.php @@ -51,14 +51,14 @@ function interpretCommand($user, $body) if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if (empty($user)) { print "Can't find user with ID $id\n"; exit(1); } } 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)) { print "Can't find user with nickname '$nickname'\n"; exit(1); diff --git a/scripts/commandline.inc b/scripts/commandline.inc index 9390890ef3..b1955a32e3 100644 --- a/scripts/commandline.inc +++ b/scripts/commandline.inc @@ -188,13 +188,13 @@ function getUser() 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'."); } } 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'"); } diff --git a/scripts/createsim.php b/scripts/createsim.php index d5ed227581..9de855ee54 100644 --- a/scripts/createsim.php +++ b/scripts/createsim.php @@ -73,7 +73,7 @@ function newGroup($i, $j) // Pick a random user to be the admin $n = rand(0, max($j - 1, 0)); - $user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n)); + $user = User::getKV('nickname', sprintf('%s%d', $userprefix, $n)); $group = User_group::register(array('nickname' => sprintf('%s%d', $groupprefix, $i), 'local' => true, @@ -88,7 +88,7 @@ function newNotice($i, $tagmax) $options = array('scope' => Notice::defaultScope()); $n = rand(0, $i - 1); - $user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n)); + $user = User::getKV('nickname', sprintf('%s%d', $userprefix, $n)); $is_reply = rand(0, 1); @@ -192,7 +192,7 @@ function newMessage($i) global $userprefix; $n = rand(0, $i - 1); - $user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n)); + $user = User::getKV('nickname', sprintf('%s%d', $userprefix, $n)); $content = testNoticeContent(); @@ -216,7 +216,7 @@ function newSub($i) $fromnick = sprintf('%s%d', $userprefix, $f); - $from = User::staticGet('nickname', $fromnick); + $from = User::getKV('nickname', $fromnick); if (empty($from)) { throw new Exception("Can't find user '$fromnick'."); @@ -233,7 +233,7 @@ function newSub($i) $tunic = sprintf('%s%d', $userprefix, $t); - $to = User::staticGet('nickname', $tunic); + $to = User::getKV('nickname', $tunic); if (empty($to)) { throw new Exception("Can't find user '$tunic'."); @@ -254,7 +254,7 @@ function newJoin($u, $g) $userNick = sprintf('%s%d', $userprefix, $userNumber); - $user = User::staticGet('nickname', $userNick); + $user = User::getKV('nickname', $userNick); if (empty($user)) { throw new Exception("Can't find user '$fromnick'."); @@ -264,7 +264,7 @@ function newJoin($u, $g) $groupNick = sprintf('%s%d', $groupprefix, $groupNumber); - $group = User_group::staticGet('nickname', $groupNick); + $group = User_group::getKV('nickname', $groupNick); if (empty($group)) { throw new Exception("Can't find group '$groupNick'."); @@ -284,7 +284,7 @@ function newFave($u) $userNick = sprintf('%s%d', $userprefix, $userNumber); - $user = User::staticGet('nickname', $userNick); + $user = User::getKV('nickname', $userNick); if (empty($user)) { throw new Exception("Can't find user '$userNick'."); @@ -296,7 +296,7 @@ function newFave($u) $otherNick = sprintf('%s%d', $userprefix, $otherNumber); - $other = User::staticGet('nickname', $otherNick); + $other = User::getKV('nickname', $otherNick); if (empty($other)) { throw new Exception("Can't find user '$otherNick'."); diff --git a/scripts/deletegroup.php b/scripts/deletegroup.php index 5a1ac109fd..f76a3dedc7 100755 --- a/scripts/deletegroup.php +++ b/scripts/deletegroup.php @@ -37,19 +37,19 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); - $group = User_group::staticGet('id', $id); + $group = User_group::getKV('id', $id); if (empty($group)) { print "Can't find group with ID $id\n"; exit(1); } } else if (have_option('n', 'nickname')) { $nickname = get_option_value('n', 'nickname'); - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::getKV('nickname', $nickname); if (empty($local)) { print "Can't find group with nickname '$nickname'\n"; exit(1); } - $group = User_group::staticGet('id', $local->group_id); + $group = User_group::getKV('id', $local->group_id); } else { print "You must provide either an ID or a nickname.\n"; print "\n"; diff --git a/scripts/deleteuser.php b/scripts/deleteuser.php index 5373c73cea..25af1c5ce2 100755 --- a/scripts/deleteuser.php +++ b/scripts/deleteuser.php @@ -37,14 +37,14 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if (empty($user)) { print "Can't find user with ID $id\n"; exit(1); } } 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)) { print "Can't find user with nickname '$nickname'\n"; exit(1); diff --git a/scripts/fixup_blocks.php b/scripts/fixup_blocks.php index 6b0255e720..dabd761318 100755 --- a/scripts/fixup_blocks.php +++ b/scripts/fixup_blocks.php @@ -53,8 +53,8 @@ $dry = have_option('dry-run'); $sub = get_blocked_subs(); $count = $sub->N; while ($sub->fetch()) { - $subber = Profile::staticGet('id', $sub->subscriber); - $subbed = Profile::staticGet('id', $sub->subscribed); + $subber = Profile::getKV('id', $sub->subscriber); + $subbed = Profile::getKV('id', $sub->subscribed); if (!$subber || !$subbed) { print "Bogus entry! $sub->subscriber subbed to $sub->subscribed\n"; continue; diff --git a/scripts/fixup_utf8.php b/scripts/fixup_utf8.php index 796021b721..dc4bb822f1 100755 --- a/scripts/fixup_utf8.php +++ b/scripts/fixup_utf8.php @@ -159,7 +159,7 @@ class UTF8FixerUpper continue; } - $notice = Notice::staticGet('id', $id); + $notice = Notice::getKV('id', $id); $notice->decache(); $notice->free(); @@ -223,7 +223,7 @@ class UTF8FixerUpper continue; } - $profile = Profile::staticGet('id', $id); + $profile = Profile::getKV('id', $id); $profile->decache(); $profile->free(); @@ -287,7 +287,7 @@ class UTF8FixerUpper continue; } - $user_group = User_group::staticGet('id', $id); + $user_group = User_group::getKV('id', $id); $user_group->decache(); $user_group->free(); @@ -344,7 +344,7 @@ class UTF8FixerUpper continue; } - $message = Message::staticGet('id', $id); + $message = Message::getKV('id', $id); $message->decache(); $message->free(); diff --git a/scripts/handlequeued.php b/scripts/handlequeued.php index 8158849695..eb7d829713 100755 --- a/scripts/handlequeued.php +++ b/scripts/handlequeued.php @@ -44,7 +44,7 @@ if (!$handler) { exit(1); } -$notice = Notice::staticGet('id', $noticeId); +$notice = Notice::getKV('id', $noticeId); if (empty($notice)) { print "Invalid notice id $noticeId\n"; exit(1); diff --git a/scripts/joingroup.php b/scripts/joingroup.php index 658244db9d..e1359a7674 100644 --- a/scripts/joingroup.php +++ b/scripts/joingroup.php @@ -41,15 +41,15 @@ try { $lgroup = null; if (have_option('G', 'group-id')) { $gid = get_option_value('G', 'group-id'); - $lgroup = Local_group::staticGet('group_id', $gid); + $lgroup = Local_group::getKV('group_id', $gid); } else if (have_option('g', 'group')) { $gnick = get_option_value('g', 'group'); - $lgroup = Local_group::staticGet('nickname', $gnick); + $lgroup = Local_group::getKV('nickname', $gnick); } if (empty($lgroup)) { throw new Exception("No such local group: $gnick"); } - $group = User_group::staticGet('id', $lgroup->group_id); + $group = User_group::getKV('id', $lgroup->group_id); $user->joinGroup($group); print "OK\n"; } catch (Exception $e) { diff --git a/scripts/leavegroup.php b/scripts/leavegroup.php index 653c3b5aad..2928206605 100644 --- a/scripts/leavegroup.php +++ b/scripts/leavegroup.php @@ -41,15 +41,15 @@ try { $lgroup = null; if (have_option('G', 'group-id')) { $gid = get_option_value('G', 'group-id'); - $lgroup = Local_group::staticGet('group_id', $gid); + $lgroup = Local_group::getKV('group_id', $gid); } else if (have_option('g', 'group')) { $gnick = get_option_value('g', 'group'); - $lgroup = Local_group::staticGet('nickname', $gnick); + $lgroup = Local_group::getKV('nickname', $gnick); } if (empty($lgroup)) { throw new Exception("No such local group: $gnick"); } - $group = User_group::staticGet('id', $lgroup->group_id); + $group = User_group::getKV('id', $lgroup->group_id); $user->leaveGroup($group); print "OK\n"; } catch (Exception $e) { diff --git a/scripts/makegroupadmin.php b/scripts/makegroupadmin.php index a68798451c..345d93c665 100644 --- a/scripts/makegroupadmin.php +++ b/scripts/makegroupadmin.php @@ -44,13 +44,13 @@ if (empty($nickname) || empty($groupname)) { try { - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); if (empty($user)) { throw new Exception("No user named '$nickname'."); } - $group = User_group::staticGet('nickname', $groupname); + $group = User_group::getKV('nickname', $groupname); if (empty($group)) { throw new Exception("No group named '$groupname'."); diff --git a/scripts/registeruser.php b/scripts/registeruser.php index 5d9c8862da..d2a47b6be9 100644 --- a/scripts/registeruser.php +++ b/scripts/registeruser.php @@ -49,7 +49,7 @@ if (empty($nickname) || empty($password)) { try { - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); if (!empty($user)) { throw new Exception("A user named '$nickname' already exists."); diff --git a/scripts/sendemail.php b/scripts/sendemail.php index 436e085bed..0441bfe7ee 100755 --- a/scripts/sendemail.php +++ b/scripts/sendemail.php @@ -37,14 +37,14 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if (empty($user)) { print "Can't find user with ID $id\n"; exit(1); } } 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)) { print "Can't find user with nickname '$nickname'\n"; exit(1); diff --git a/scripts/setpassword.php b/scripts/setpassword.php index 50d49d7dbf..3e9f5c17ca 100755 --- a/scripts/setpassword.php +++ b/scripts/setpassword.php @@ -41,7 +41,7 @@ if (mb_strlen($password) < 6) { exit(1); } -$user = User::staticGet('nickname', $nickname); +$user = User::getKV('nickname', $nickname); if (!$user) { print "No such user '$nickname'.\n"; diff --git a/scripts/strip_geo.php b/scripts/strip_geo.php index b3f27be616..021b668851 100755 --- a/scripts/strip_geo.php +++ b/scripts/strip_geo.php @@ -40,14 +40,14 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); - $profile = Profile::staticGet('id', $id); + $profile = Profile::getKV('id', $id); if (empty($profile)) { print "Can't find local or remote profile with ID $id\n"; exit(1); } } 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)) { print "Can't find local user with nickname '$nickname'\n"; exit(1); diff --git a/scripts/uncache_users.php b/scripts/uncache_users.php index eb7e398023..b5955fd5aa 100644 --- a/scripts/uncache_users.php +++ b/scripts/uncache_users.php @@ -38,7 +38,7 @@ $memc = Cache::instance(); foreach ($ids as $id) { - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if (!$user) { common_log(LOG_WARNING, 'No such user: ' . $id); diff --git a/scripts/updatelocation.php b/scripts/updatelocation.php index 4110660ab0..abf9627cc7 100644 --- a/scripts/updatelocation.php +++ b/scripts/updatelocation.php @@ -41,14 +41,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'."); } updateLocation($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'"); } diff --git a/scripts/updateurls.php b/scripts/updateurls.php index 01b3c2283b..266204dd9f 100644 --- a/scripts/updateurls.php +++ b/scripts/updateurls.php @@ -112,7 +112,7 @@ function updateGroupUrls() while ($group->fetch()) { try { printfv("Updating group {$group->nickname}..."); - $orig = User_group::staticGet('id', $group->id); + $orig = User_group::getKV('id', $group->id); if (!empty($group->original_logo)) { $group->original_logo = Avatar::url(basename($group->original_logo)); $group->homepage_logo = Avatar::url(basename($group->homepage_logo)); diff --git a/scripts/upgrade.php b/scripts/upgrade.php index 7d81c19835..1a87b148b3 100644 --- a/scripts/upgrade.php +++ b/scripts/upgrade.php @@ -124,7 +124,7 @@ function fixupNoticeConversation() if (empty($notice->reply_to)) { $notice->conversation = $notice->id; } else { - $reply = Notice::staticGet('id', $notice->reply_to); + $reply = Notice::getKV('id', $notice->reply_to); if (empty($reply)) { $notice->conversation = $notice->id; @@ -159,7 +159,7 @@ function fixupGroupURI() if ($group->find()) { while ($group->fetch()) { - $orig = User_group::staticGet('id', $group->id); + $orig = User_group::getKV('id', $group->id); $group->uri = $group->getUri(); $group->update($orig); } @@ -281,7 +281,7 @@ function initNoticeReshare() if ($notice->find()) { while ($notice->fetch()) { try { - $orig = Notice::staticGet('id', $notice->id); + $orig = Notice::getKV('id', $notice->id); $notice->verb = ActivityVerb::SHARE; $notice->object_type = ActivityObject::ACTIVITY; $notice->update($orig); diff --git a/scripts/useremail.php b/scripts/useremail.php index a53d857d56..02c34678fb 100755 --- a/scripts/useremail.php +++ b/scripts/useremail.php @@ -37,14 +37,14 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if (empty($user)) { print "Can't find user with ID $id\n"; exit(1); } } 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)) { print "Can't find user with nickname '$nickname'\n"; exit(1); @@ -84,7 +84,7 @@ if (have_option('e', 'email')) { if (empty($unconfirmed_email->user_id)) { print "No users with email $user->email\n"; } else { - $user=User::staticGet('id', $unconfirmed_email->user_id); + $user=User::getKV('id', $unconfirmed_email->user_id); print "Unconfirmed Address: $user->id $user->nickname\n"; } exit(0); diff --git a/scripts/userrole.php b/scripts/userrole.php index a2cc7def88..d1061b1832 100644 --- a/scripts/userrole.php +++ b/scripts/userrole.php @@ -38,14 +38,14 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); - $profile = Profile::staticGet('id', $id); + $profile = Profile::getKV('id', $id); if (empty($profile)) { print "Can't find user with ID $id\n"; exit(1); } } 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)) { print "Can't find user with nickname '$nickname'\n"; exit(1); diff --git a/tests/ActivityGenerationTests.php b/tests/ActivityGenerationTests.php index 8cf1b009ed..8e59050e75 100644 --- a/tests/ActivityGenerationTests.php +++ b/tests/ActivityGenerationTests.php @@ -521,7 +521,7 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase $reply = Notice::saveNew($this->author1->id, $text, 'test', array('uri' => null, 'reply_to' => $orig->id)); - $conv = Conversation::staticGet('id', $reply->conversation); + $conv = Conversation::getKV('id', $reply->conversation); $entry = $reply->asAtomEntry(); diff --git a/tests/UserRightsTest.php b/tests/UserRightsTest.php index d24a172f6f..97bf195749 100644 --- a/tests/UserRightsTest.php +++ b/tests/UserRightsTest.php @@ -16,7 +16,7 @@ class UserRightsTest extends PHPUnit_Framework_TestCase function setUp() { - $user = User::staticGet('nickname', 'userrightstestuser'); + $user = User::getKV('nickname', 'userrightstestuser'); if ($user) { // Leftover from a broken test run? $profile = $user->getProfile();