From 861e838adda95bb3b6144ce52468459ca9cb191c Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 18 Aug 2013 15:42:51 +0200 Subject: [PATCH] pkeyGet is now static and more similar to getKV Memcached_DataObject now defines * pkeyGetClass to avoid collision with Managed_DataObject pkeyGet * getClassKV to avoid collision with Managed_DataObject getKV --- classes/Avatar.php | 5 ---- classes/Config.php | 5 ---- classes/Fave.php | 5 ---- classes/File_to_post.php | 5 ---- classes/Group_block.php | 5 ---- classes/Group_inbox.php | 5 ---- classes/Group_join_queue.php | 4 --- classes/Group_member.php | 5 ---- classes/Managed_DataObject.php | 18 ++++++++++++- classes/Memcached_DataObject.php | 10 ++++--- classes/Notice_inbox.php | 5 ---- classes/Notice_tag.php | 5 ---- classes/Profile.php | 5 ++-- classes/Profile_block.php | 5 ++-- classes/Profile_list.php | 13 ---------- classes/Profile_role.php | 5 ---- classes/Profile_tag.php | 4 --- classes/Profile_tag_subscription.php | 5 ---- classes/Reply.php | 5 ---- classes/Status_network_tag.php | 4 +-- classes/Subscription.php | 8 ------ classes/Subscription_queue.php | 4 --- classes/User_im_prefs.php | 5 ---- plugins/AnonymousFave/Fave_tally.php | 12 --------- plugins/Event/RSVP.php | 13 ---------- .../classes/Profile_detail.php | 17 ------------ plugins/ModLog/ModLog.php | 13 ---------- plugins/OpenID/User_openid_trustroot.php | 5 ---- plugins/Poll/Poll.php | 17 ------------ plugins/Poll/Poll_response.php | 17 ------------ plugins/QnA/classes/QnA_Answer.php | 17 ------------ plugins/QnA/classes/QnA_Question.php | 17 ------------ plugins/QnA/classes/QnA_Vote.php | 17 ------------ plugins/Realtime/Realtime_channel.php | 12 --------- plugins/SearchSub/SearchSub.php | 17 ------------ plugins/SubMirror/classes/SubMirror.php | 5 ---- plugins/TagSub/TagSub.php | 17 ------------ .../TwitterBridge/Twitter_synch_status.php | 26 ------------------- plugins/UserFlag/User_flag_profile.php | 12 --------- .../YammerImport/classes/Yammer_common.php | 4 +-- 40 files changed, 31 insertions(+), 347 deletions(-) diff --git a/classes/Avatar.php b/classes/Avatar.php index 6a5aaa3f8c..8cff14273c 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -64,11 +64,6 @@ class Avatar extends Managed_DataObject } } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Avatar', $kv); - } - /** * Where should the avatar go for this user? */ diff --git a/classes/Config.php b/classes/Config.php index 48dd6f38d4..bf9d880cae 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -133,11 +133,6 @@ class Config extends Managed_DataObject return $result; } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Config', $kv); - } - static function save($section, $setting, $value) { $result = null; diff --git a/classes/Fave.php b/classes/Fave.php index 7eb3a89e5a..53d60b3a82 100644 --- a/classes/Fave.php +++ b/classes/Fave.php @@ -99,11 +99,6 @@ class Fave extends Managed_DataObject return $result; } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Fave', $kv); - } - function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false, $since_id=0, $max_id=0) { $stream = new FaveNoticeStream($user_id, $own); diff --git a/classes/File_to_post.php b/classes/File_to_post.php index 95ac660f47..e53b1ebb4c 100644 --- a/classes/File_to_post.php +++ b/classes/File_to_post.php @@ -84,11 +84,6 @@ class File_to_post extends Managed_DataObject } } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('File_to_post', $kv); - } - function delete() { $f = File::getKV('id', $this->file_id); diff --git a/classes/Group_block.php b/classes/Group_block.php index a3a232c80d..8acd2546b9 100644 --- a/classes/Group_block.php +++ b/classes/Group_block.php @@ -55,11 +55,6 @@ class Group_block extends Managed_DataObject ); } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Group_block', $kv); - } - static function isBlocked($group, $profile) { $block = Group_block::pkeyGet(array('group_id' => $group->id, diff --git a/classes/Group_inbox.php b/classes/Group_inbox.php index a2f0879a6d..274f2b8f40 100644 --- a/classes/Group_inbox.php +++ b/classes/Group_inbox.php @@ -37,9 +37,4 @@ class Group_inbox extends Managed_DataObject ), ); } - - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Group_inbox', $kv); - } } diff --git a/classes/Group_join_queue.php b/classes/Group_join_queue.php index 55467d0dd8..8007552fcf 100644 --- a/classes/Group_join_queue.php +++ b/classes/Group_join_queue.php @@ -14,10 +14,6 @@ class Group_join_queue extends Managed_DataObject public $group_id; public $created; - /* Pkey get */ - function pkeyGet($k) - { return Memcached_DataObject::pkeyGet('Group_join_queue',$k); } - /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/classes/Group_member.php b/classes/Group_member.php index 1c37abab14..803f788835 100644 --- a/classes/Group_member.php +++ b/classes/Group_member.php @@ -48,11 +48,6 @@ class Group_member extends Managed_DataObject ); } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Group_member', $kv); - } - /** * Method to add a user to a group. * In most cases, you should call Profile->joinGroup() instead. diff --git a/classes/Managed_DataObject.php b/classes/Managed_DataObject.php index cc982cf63c..e473a2bf03 100644 --- a/classes/Managed_DataObject.php +++ b/classes/Managed_DataObject.php @@ -41,9 +41,25 @@ abstract class Managed_DataObject extends Memcached_DataObject */ static function getKV($k,$v=NULL) { - return parent::getKV(get_called_class(),$k,$v); + return parent::getClassKV(get_called_class(), $k, $v); } + /** + * Get an instance by compound key + * + * This is a utility method to get a single instance with a given set of + * key-value pairs. Usually used for the primary key for a compound key; thus + * the name. + * + * @param array $kv array of key-value mappings + * + * @return get_called_class() object if found, or null for no hits + * + */ + static function pkeyGet($kv) + { + return parent::pkeyGetClass(get_called_class(), $kv); + } /** * get/set an associative array of table columns diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 8ff175db0d..8460931fcc 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -30,14 +30,14 @@ 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 getKV($cls, $k, $v=null) + static function getClassKV($cls, $k, $v=null) { if (is_null($v)) { $v = $k; $keys = self::pkeyCols($cls); if (count($keys) > 1) { - // FIXME: maybe call pkeyGet() ourselves? - throw new Exception('Use pkeyGet() for compound primary keys'); + // FIXME: maybe call pkeyGetClass() ourselves? + throw new Exception('Use pkeyGetClass() for compound primary keys'); } $k = $keys[0]; } @@ -352,7 +352,7 @@ class Memcached_DataObject extends Safe_DataObject /** * @todo FIXME: Should this return false on lookup fail to match getKV? */ - function pkeyGet($cls, $kv) + static function pkeyGetClass($cls, $kv) { $i = Memcached_DataObject::multicache($cls, $kv); if ($i !== false) { // false == cache miss @@ -681,7 +681,9 @@ class Memcached_DataObject extends Safe_DataObject 'update', 'find'); $ignoreStatic = array('getKV', + 'getClassKV', 'pkeyGet', + 'pkeyGetClass', 'cachedQuery'); $here = get_class($this); // if we get confused $bt = debug_backtrace(); diff --git a/classes/Notice_inbox.php b/classes/Notice_inbox.php index 68bea196f2..2dc75959a4 100644 --- a/classes/Notice_inbox.php +++ b/classes/Notice_inbox.php @@ -76,11 +76,6 @@ class Notice_inbox extends Managed_DataObject throw new Exception('Notice_inbox no longer used; use Inbox'); } - function &pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Notice_inbox', $kv); - } - static function gc($user_id) { throw new Exception('Notice_inbox no longer used; use Inbox'); diff --git a/classes/Notice_tag.php b/classes/Notice_tag.php index 663efe7b80..3d7658a1ac 100644 --- a/classes/Notice_tag.php +++ b/classes/Notice_tag.php @@ -68,11 +68,6 @@ class Notice_tag extends Managed_DataObject } } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Notice_tag', $kv); - } - static function url($tag) { if (common_config('singleuser', 'enabled')) { diff --git a/classes/Profile.php b/classes/Profile.php index bee05981d2..bd7976590f 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -1242,9 +1242,8 @@ class Profile extends Managed_DataObject { // XXX: not really a pkey, but should work - $notice = Memcached_DataObject::pkeyGet('Notice', - array('profile_id' => $this->id, - 'repeat_of' => $notice_id)); + $notice = Notice::pkeyGet(array('profile_id' => $this->id, + 'repeat_of' => $notice_id)); return !empty($notice); } diff --git a/classes/Profile_block.php b/classes/Profile_block.php index b2708d564c..d9b5cbba87 100644 --- a/classes/Profile_block.php +++ b/classes/Profile_block.php @@ -56,8 +56,7 @@ class Profile_block extends Managed_DataObject function get($blocker, $blocked) { - return Memcached_DataObject::pkeyGet('Profile_block', - array('blocker' => $blocker, - 'blocked' => $blocked)); + return Profile_block::pkeyGet(array('blocker' => $blocker, + 'blocked' => $blocked)); } } diff --git a/classes/Profile_list.php b/classes/Profile_list.php index 749d98d5fc..0d6c6f284d 100644 --- a/classes/Profile_list.php +++ b/classes/Profile_list.php @@ -86,19 +86,6 @@ class Profile_list extends Managed_DataObject ); } - /** - * return a profile_list record, given its tag and tagger. - * - * @param array $kv ideally array('tag' => $tag, 'tagger' => $tagger) - * - * @return Profile_list a Profile_list object with the given tag and tagger. - */ - - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Profile_list', $kv); - } - /** * get the tagger of this profile_list object * diff --git a/classes/Profile_role.php b/classes/Profile_role.php index c753d1aed4..2f6dff0e1b 100644 --- a/classes/Profile_role.php +++ b/classes/Profile_role.php @@ -56,11 +56,6 @@ class Profile_role extends Managed_DataObject ); } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Profile_role', $kv); - } - const OWNER = 'owner'; const MODERATOR = 'moderator'; const ADMINISTRATOR = 'administrator'; diff --git a/classes/Profile_tag.php b/classes/Profile_tag.php index 4e0900aa63..39095aedde 100644 --- a/classes/Profile_tag.php +++ b/classes/Profile_tag.php @@ -42,10 +42,6 @@ class Profile_tag extends Managed_DataObject ); } - function pkeyGet($kv) { - return Memcached_DataObject::pkeyGet('Profile_tag', $kv); - } - function links() { return array('tagger,tag' => 'profile_list:tagger,tag'); diff --git a/classes/Profile_tag_subscription.php b/classes/Profile_tag_subscription.php index 28b37940a7..b088023fab 100644 --- a/classes/Profile_tag_subscription.php +++ b/classes/Profile_tag_subscription.php @@ -41,11 +41,6 @@ class Profile_tag_subscription extends Managed_DataObject ); } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Profile_tag_subscription', $kv); - } - static function add($peopletag, $profile) { if ($peopletag->private) { diff --git a/classes/Reply.php b/classes/Reply.php index 1f3ed208d9..36686d0c76 100644 --- a/classes/Reply.php +++ b/classes/Reply.php @@ -40,11 +40,6 @@ class Reply extends Managed_DataObject ), ); } - - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Reply',$kv); - } /** * Wrapper for record insertion to update related caches diff --git a/classes/Status_network_tag.php b/classes/Status_network_tag.php index ba0e7d90f2..b7ea2cff3a 100644 --- a/classes/Status_network_tag.php +++ b/classes/Status_network_tag.php @@ -60,9 +60,9 @@ class Status_network_tag extends Safe_DataObject return $i; } - function pkeyGet($kv) + static function pkeyGet($kv) { - return Memcached_DataObject::pkeyGet('Status_network_tag', $kv); + return Memcached_DataObject::pkeyGetClass('Status_network_tag', $kv); } /** diff --git a/classes/Subscription.php b/classes/Subscription.php index 41d31f962f..1a4a714455 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -69,14 +69,6 @@ class Subscription extends Managed_DataObject ); } - /* the code above is auto generated do not remove the tag below */ - ###END_AUTOCODE - - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Subscription', $kv); - } - /** * Make a new subscription * diff --git a/classes/Subscription_queue.php b/classes/Subscription_queue.php index 2711883539..ea0e906d43 100644 --- a/classes/Subscription_queue.php +++ b/classes/Subscription_queue.php @@ -14,10 +14,6 @@ class Subscription_queue extends Managed_DataObject public $subscribed; public $created; - /* Pkey get */ - function pkeyGet($k) - { return Memcached_DataObject::pkeyGet('Subscription_queue',$k); } - /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/classes/User_im_prefs.php b/classes/User_im_prefs.php index 027feff514..cba91ea252 100644 --- a/classes/User_im_prefs.php +++ b/classes/User_im_prefs.php @@ -45,11 +45,6 @@ class User_im_prefs extends Managed_DataObject public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00 public $modified; // timestamp not_null default_CURRENT_TIMESTAMP - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('User_im_prefs', $kv); - } - /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/plugins/AnonymousFave/Fave_tally.php b/plugins/AnonymousFave/Fave_tally.php index 5962e5ad87..eb23a7cb0a 100644 --- a/plugins/AnonymousFave/Fave_tally.php +++ b/plugins/AnonymousFave/Fave_tally.php @@ -118,18 +118,6 @@ class Fave_tally extends Managed_DataObject return array(false, false, false); } - /** - * Get a single object with multiple keys - * - * @param array $kv Map of key-value pairs - * - * @return User_flag_profile found object or null - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Fave_tally', $kv); - } - /** * Increment a notice's tally * diff --git a/plugins/Event/RSVP.php b/plugins/Event/RSVP.php index 0a91106e68..cea916c234 100644 --- a/plugins/Event/RSVP.php +++ b/plugins/Event/RSVP.php @@ -56,19 +56,6 @@ class RSVP extends Managed_DataObject public $response; // tinyint public $created; // datetime - /** - * Get an instance by compound key - * - * @param array $kv array of key-value mappings - * - * @return Bookmark object found, or null for no hits - */ - - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('RSVP', $kv); - } - /** * Add the compound profile_id/event_id index to our cache keys * since the DB_DataObject stuff doesn't understand compound keys diff --git a/plugins/ExtendedProfile/classes/Profile_detail.php b/plugins/ExtendedProfile/classes/Profile_detail.php index 5335786ef9..01cf27c0d0 100644 --- a/plugins/ExtendedProfile/classes/Profile_detail.php +++ b/plugins/ExtendedProfile/classes/Profile_detail.php @@ -69,23 +69,6 @@ class Profile_detail extends Managed_DataObject public $created; public $modified; - /** - * Get an instance by compound key - * - * This is a utility method to get a single instance with a given set of - * key-value pairs. Usually used for the primary key for a compound key; thus - * the name. - * - * @param array $kv array of key-value mappings - * - * @return Bookmark object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Profile_detail', $kv); - } - static function schemaDef() { return array( diff --git a/plugins/ModLog/ModLog.php b/plugins/ModLog/ModLog.php index ff2588cfdb..606b786b29 100644 --- a/plugins/ModLog/ModLog.php +++ b/plugins/ModLog/ModLog.php @@ -55,19 +55,6 @@ class ModLog extends Managed_DataObject public $grant; // 1 = grant, 0 = revoke public $created; // datetime - /** - * Get an instance by compound key - * - * @param array $kv array of key-value mappings - * - * @return TagSub object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Managed_DataObject::pkeyGet('ModLog', $kv); - } - /** * The One True Thingy that must be defined and declared. */ diff --git a/plugins/OpenID/User_openid_trustroot.php b/plugins/OpenID/User_openid_trustroot.php index 7bfd4d90fd..04d06c78f6 100644 --- a/plugins/OpenID/User_openid_trustroot.php +++ b/plugins/OpenID/User_openid_trustroot.php @@ -21,11 +21,6 @@ class User_openid_trustroot extends Managed_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('User_openid_trustroot', $kv); - } - function table() { $db = $this->getDatabaseConnection(); diff --git a/plugins/Poll/Poll.php b/plugins/Poll/Poll.php index 6cc38f7435..213bab4924 100644 --- a/plugins/Poll/Poll.php +++ b/plugins/Poll/Poll.php @@ -53,23 +53,6 @@ class Poll extends Managed_DataObject public $options; // text; newline(?)-delimited public $created; // datetime - /** - * Get an instance by compound key - * - * This is a utility method to get a single instance with a given set of - * key-value pairs. Usually used for the primary key for a compound key; thus - * the name. - * - * @param array $kv array of key-value mappings - * - * @return Bookmark object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Poll', $kv); - } - /** * The One True Thingy that must be defined and declared. */ diff --git a/plugins/Poll/Poll_response.php b/plugins/Poll/Poll_response.php index ab1524c691..21b390db80 100644 --- a/plugins/Poll/Poll_response.php +++ b/plugins/Poll/Poll_response.php @@ -52,23 +52,6 @@ class Poll_response extends Managed_DataObject public $selection; // int -> choice # public $created; // datetime - /** - * Get an instance by compound key - * - * This is a utility method to get a single instance with a given set of - * key-value pairs. Usually used for the primary key for a compound key; thus - * the name. - * - * @param array $kv array of key-value mappings - * - * @return Bookmark object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Poll_response', $kv); - } - /** * The One True Thingy that must be defined and declared. */ diff --git a/plugins/QnA/classes/QnA_Answer.php b/plugins/QnA/classes/QnA_Answer.php index 96796b80e2..7f0ba82ac3 100644 --- a/plugins/QnA/classes/QnA_Answer.php +++ b/plugins/QnA/classes/QnA_Answer.php @@ -55,23 +55,6 @@ class QnA_Answer extends Managed_DataObject public $content; // text -> response text public $created; // datetime - /** - * Get an instance by compound key - * - * This is a utility method to get a single instance with a given set of - * key-value pairs. Usually used for the primary key for a compound key; thus - * the name. - * - * @param array $kv array of key-value mappings - * - * @return QA_Answer object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('QnA_Answer', $kv); - } - /** * The One True Thingy that must be defined and declared. */ diff --git a/plugins/QnA/classes/QnA_Question.php b/plugins/QnA/classes/QnA_Question.php index 58a9cd5e18..481f27cce4 100644 --- a/plugins/QnA/classes/QnA_Question.php +++ b/plugins/QnA/classes/QnA_Question.php @@ -55,23 +55,6 @@ class QnA_Question extends Managed_DataObject public $closed; // int (boolean) whether a question is closed public $created; // datetime - /** - * Get an instance by compound key - * - * This is a utility method to get a single instance with a given set of - * key-value pairs. Usually used for the primary key for a compound key; thus - * the name. - * - * @param array $kv array of key-value mappings - * - * @return Bookmark object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('QnA_Question', $kv); - } - /** * The One True Thingy that must be defined and declared. */ diff --git a/plugins/QnA/classes/QnA_Vote.php b/plugins/QnA/classes/QnA_Vote.php index 025f6b0c6b..13679acd2c 100644 --- a/plugins/QnA/classes/QnA_Vote.php +++ b/plugins/QnA/classes/QnA_Vote.php @@ -55,23 +55,6 @@ class QnA_Vote extends Managed_DataObject public $profile_id; // int -> question.id public $created; // datetime - /** - * Get an instance by compound key - * - * This is a utility method to get a single instance with a given set of - * key-value pairs. Usually used for the primary key for a compound key; thus - * the name. - * - * @param array $kv array of key-value mappings - * - * @return QnA_Vote object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('QnA_Vote', $kv); - } - /** * The One True Thingy that must be defined and declared. */ diff --git a/plugins/Realtime/Realtime_channel.php b/plugins/Realtime/Realtime_channel.php index 3538e884a0..ffd7d34f84 100644 --- a/plugins/Realtime/Realtime_channel.php +++ b/plugins/Realtime/Realtime_channel.php @@ -61,18 +61,6 @@ class Realtime_channel extends Managed_DataObject public $created; // created date public $modified; // modified date - /** - * Get an instance by compound key - * - * @param array $kv array of key-value mappings - * - * @return Realtime_channel object found, or null for no hits - */ - function pkeyGet($kv) - { - return Managed_DataObject::pkeyGet('Realtime_channel', $kv); - } - /** * The One True Thingy that must be defined and declared. */ diff --git a/plugins/SearchSub/SearchSub.php b/plugins/SearchSub/SearchSub.php index 246720b6a5..f3a44854b2 100644 --- a/plugins/SearchSub/SearchSub.php +++ b/plugins/SearchSub/SearchSub.php @@ -50,23 +50,6 @@ class SearchSub extends Managed_DataObject public $profile_id; // int -> profile.id public $created; // datetime - /** - * Get an instance by compound key - * - * This is a utility method to get a single instance with a given set of - * key-value pairs. Usually used for the primary key for a compound key; thus - * the name. - * - * @param array $kv array of key-value mappings - * - * @return SearchSub object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('SearchSub', $kv); - } - /** * The One True Thingy that must be defined and declared. */ diff --git a/plugins/SubMirror/classes/SubMirror.php b/plugins/SubMirror/classes/SubMirror.php index ac1eb01f60..7e8d288b61 100644 --- a/plugins/SubMirror/classes/SubMirror.php +++ b/plugins/SubMirror/classes/SubMirror.php @@ -204,11 +204,6 @@ class SubMirror extends Managed_DataObject return $saved; } - public /*static*/ function pkeyGet($v) - { - return parent::pkeyGet(__CLASS__, $v); - } - /** * Get the mirroring setting for a pair of profiles, if existing. * diff --git a/plugins/TagSub/TagSub.php b/plugins/TagSub/TagSub.php index b917786540..5bc0c436ee 100644 --- a/plugins/TagSub/TagSub.php +++ b/plugins/TagSub/TagSub.php @@ -49,23 +49,6 @@ class TagSub extends Managed_DataObject public $profile_id; // int -> profile.id public $created; // datetime - /** - * Get an instance by compound key - * - * This is a utility method to get a single instance with a given set of - * key-value pairs. Usually used for the primary key for a compound key; thus - * the name. - * - * @param array $kv array of key-value mappings - * - * @return TagSub object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('TagSub', $kv); - } - /** * The One True Thingy that must be defined and declared. */ diff --git a/plugins/TwitterBridge/Twitter_synch_status.php b/plugins/TwitterBridge/Twitter_synch_status.php index c9a0268575..6f5147cb69 100644 --- a/plugins/TwitterBridge/Twitter_synch_status.php +++ b/plugins/TwitterBridge/Twitter_synch_status.php @@ -57,32 +57,6 @@ class Twitter_synch_status extends Managed_DataObject public $created; // datetime not_null public $modified; // datetime not_null - /** - * Get an instance by key - * - * @param string $k Key to use to lookup (usually 'foreign_id' for this class) - * @param mixed $v Value to lookup - * - * @return Twitter_synch_status object found, or null for no hits - */ - static function staticGet($k, $v=null) - { - throw new Exception("Use pkeyGet() for this class."); - } - - /** - * Get an instance by compound primary key - * - * @param array $kv key-value pair array - * - * @return Twitter_synch_status object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Twitter_synch_status', $kv); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/UserFlag/User_flag_profile.php b/plugins/UserFlag/User_flag_profile.php index 02b7a7849f..cd641fc53c 100644 --- a/plugins/UserFlag/User_flag_profile.php +++ b/plugins/UserFlag/User_flag_profile.php @@ -108,18 +108,6 @@ class User_flag_profile extends Managed_DataObject return array(false, false, false); } - /** - * Get a single object with multiple keys - * - * @param array $kv Map of key-value pairs - * - * @return User_flag_profile found object or null - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('User_flag_profile', $kv); - } - /** * Check if a flag exists for given profile and user * diff --git a/plugins/YammerImport/classes/Yammer_common.php b/plugins/YammerImport/classes/Yammer_common.php index e794191d1b..f063484ea9 100644 --- a/plugins/YammerImport/classes/Yammer_common.php +++ b/plugins/YammerImport/classes/Yammer_common.php @@ -133,13 +133,13 @@ class Yammer_common extends Managed_DataObject */ protected static function doRecord($class, $field, $orig_id, $local_id) { - $map = Memcached_DataObject::staticGet($class, 'id', $orig_id); + $map = Memcached_DataObject::getClassKV($class, 'id', $orig_id); if (!empty($map)) { return $map; } - $map = Memcached_DataObject::staticGet($class, $field, $local_id); + $map = Memcached_DataObject::getClassKV($class, $field, $local_id); if (!empty($map)) { return $map;