The overloaded DB_DataObject function staticGet is now called getKV

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

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

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

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

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

View File

@@ -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));
}

View File

@@ -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');

View File

@@ -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) ||

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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."));

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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()) {

View File

@@ -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()) {

View File

@@ -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;
}

View File

@@ -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 = "@<a href=\"$contactuser->uri\">$contactuser->nickname</a>";
// TRANS: User instructions after registration.

View File

@@ -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();

View File

@@ -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();

View File

@@ -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()

View File

@@ -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.

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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',

View File

@@ -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.

View File

@@ -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.

View File

@@ -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,

View File

@@ -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.

View File

@@ -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?

View File

@@ -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;

View File

@@ -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.'));

View File

@@ -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.");

View File

@@ -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))

View File

@@ -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;
}

View File

@@ -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.

View File

@@ -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();

View File

@@ -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)) {

View File

@@ -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;

View File

@@ -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(' ');

View File

@@ -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);

View File

@@ -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.

View File

@@ -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()

View File

@@ -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,

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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();

View File

@@ -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()

View File

@@ -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();

View File

@@ -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();

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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.'));
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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()

View File

@@ -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);

View File

@@ -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,

View File

@@ -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.'));

View File

@@ -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();

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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();
}

View File

@@ -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 {

View File

@@ -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.

View File

@@ -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));

View File

@@ -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();

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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 =

View File

@@ -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;

View File

@@ -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;

View File

@@ -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.'));

View File

@@ -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;

View File

@@ -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));
}
}
}

View File

@@ -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);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More