From e95f77d34c501d345e731ccf6bc722034d155b77 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 18 Aug 2013 12:10:44 +0200 Subject: [PATCH] Updating all Memcached_DataObject extended classes to Managed_DataObject In some brief tests, this causes no problems. In this state however, you would need to modify DB_DataObject to have a static declaration of staticget (and probably pkeyGet). The next commit will change the staticGet overload to a unique function name (like getKV for getKeyValue), which means we can properly call the function by PHP Strict Standards. --- classes/Old_school_prefs.php | 4 --- classes/Status_network.php | 2 +- classes/Unavailable_status_network.php | 14 ---------- plugins/AnonymousFave/Fave_tally.php | 5 +--- plugins/Blacklist/Homepage_blacklist.php | 18 +----------- plugins/Blacklist/Nickname_blacklist.php | 18 +----------- plugins/Bookmark/Bookmark.php | 18 +----------- plugins/EmailSummary/Email_summary_status.php | 16 +---------- .../FacebookBridge/classes/Notice_to_item.php | 18 +----------- .../User_followeveryone_prefs.php | 17 +---------- .../classes/gnusocialphoto.php | 13 +-------- .../classes/gnusocialphotoalbum.php | 9 +----- .../GNUsocialProfileExtensionField.php | 13 +-------- .../GNUsocialProfileExtensionResponse.php | 13 +-------- .../classes/ProfileExtensionField.php | 13 +-------- plugins/GroupPrivateMessage/Group_message.php | 17 +---------- .../Group_message_profile.php | 17 +---------- .../Group_privacy_settings.php | 17 +---------- plugins/Irc/Irc_waiting_message.php | 7 +---- plugins/Msn/msn_waiting_message.php | 7 +---- plugins/NoticeTitle/Notice_title.php | 18 +----------- plugins/OStatus/classes/FeedSub.php | 7 +---- plugins/OStatus/classes/HubSub.php | 7 +---- plugins/OStatus/classes/Magicsig.php | 28 +------------------ plugins/OStatus/classes/Ostatus_source.php | 7 +---- plugins/OpenID/User_openid.php | 6 +--- plugins/OpenID/User_openid_trustroot.php | 6 +--- plugins/RegisterThrottle/Registration_ip.php | 16 +---------- plugins/Sample/User_greeting_count.php | 17 +---------- plugins/Sitemap/Sitemap_notice_count.php | 18 +----------- plugins/Sitemap/Sitemap_user_count.php | 18 +----------- plugins/SubMirror/classes/SubMirror.php | 7 +---- plugins/TwitterBridge/Notice_to_status.php | 18 +----------- .../TwitterBridge/Twitter_synch_status.php | 4 +-- plugins/UserFlag/User_flag_profile.php | 5 +--- .../YammerImport/classes/Yammer_common.php | 8 +++--- plugins/YammerImport/classes/Yammer_group.php | 16 ----------- .../YammerImport/classes/Yammer_notice.php | 16 ----------- .../classes/Yammer_notice_stub.php | 17 +---------- plugins/YammerImport/classes/Yammer_state.php | 17 +---------- plugins/YammerImport/classes/Yammer_user.php | 16 ----------- 41 files changed, 40 insertions(+), 488 deletions(-) diff --git a/classes/Old_school_prefs.php b/classes/Old_school_prefs.php index 29e13ddc74..505399c035 100644 --- a/classes/Old_school_prefs.php +++ b/classes/Old_school_prefs.php @@ -81,8 +81,4 @@ class Old_school_prefs extends Managed_DataObject ), ); } - - function staticGet($k,$v=NULL) { - return Memcached_DataObject::staticGet('Old_school_prefs',$k,$v); - } } diff --git a/classes/Status_network.php b/classes/Status_network.php index b7a7e1c0a7..5a683c04d2 100644 --- a/classes/Status_network.php +++ b/classes/Status_network.php @@ -42,7 +42,7 @@ class Status_network extends Safe_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=NULL) { + static function staticGet($k,$v=NULL) { $i = DB_DataObject::staticGet('Status_network',$k,$v); // Don't use local process cache; if we're fetching multiple diff --git a/classes/Unavailable_status_network.php b/classes/Unavailable_status_network.php index 7eefac2c1f..d1160815c7 100644 --- a/classes/Unavailable_status_network.php +++ b/classes/Unavailable_status_network.php @@ -50,20 +50,6 @@ class Unavailable_status_network extends Managed_DataObject public $nickname; // varchar(64) UUID public $created; // datetime - /** - * Get an instance by key - * - * @param string $k Key to use to lookup (usually 'id' for this class) - * @param mixed $v Value to lookup - * - * @return Happening object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Unavailable_status_network', $k, $v); - } - /** * The One True Thingy that must be defined and declared. */ diff --git a/plugins/AnonymousFave/Fave_tally.php b/plugins/AnonymousFave/Fave_tally.php index 7a44c2350d..7a610fb5f5 100644 --- a/plugins/AnonymousFave/Fave_tally.php +++ b/plugins/AnonymousFave/Fave_tally.php @@ -44,7 +44,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ -class Fave_tally extends Memcached_DataObject +class Fave_tally extends Managed_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -54,9 +54,6 @@ class Fave_tally extends Memcached_DataObject public $count; // int(4) not_null public $modified; // datetime not_null default_0000-00-00%2000%3A00%3A00 - /* Static get */ - function staticGet($k, $v = NULL) { return Memcached_DataObject::staticGet('Fave_tally', $k, $v); } - /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/plugins/Blacklist/Homepage_blacklist.php b/plugins/Blacklist/Homepage_blacklist.php index 2820294fa2..99a6786de4 100644 --- a/plugins/Blacklist/Homepage_blacklist.php +++ b/plugins/Blacklist/Homepage_blacklist.php @@ -44,28 +44,12 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class Homepage_blacklist extends Memcached_DataObject +class Homepage_blacklist extends Managed_DataObject { public $__table = 'homepage_blacklist'; // table name public $pattern; // string pattern public $created; // datetime - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup (usually 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return Homepage_blacklist object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Homepage_blacklist', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/Blacklist/Nickname_blacklist.php b/plugins/Blacklist/Nickname_blacklist.php index d5d46a9490..bc466f879d 100644 --- a/plugins/Blacklist/Nickname_blacklist.php +++ b/plugins/Blacklist/Nickname_blacklist.php @@ -44,28 +44,12 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class Nickname_blacklist extends Memcached_DataObject +class Nickname_blacklist extends Managed_DataObject { public $__table = 'nickname_blacklist'; // table name public $pattern; // string pattern public $created; // datetime - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup - * @param mixed $v Value to lookup - * - * @return Nickname_blacklist object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Nickname_blacklist', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/Bookmark/Bookmark.php b/plugins/Bookmark/Bookmark.php index 7e831a3524..f9bc71447e 100644 --- a/plugins/Bookmark/Bookmark.php +++ b/plugins/Bookmark/Bookmark.php @@ -42,7 +42,7 @@ if (!defined('STATUSNET')) { * * @see DB_DataObject */ -class Bookmark extends Memcached_DataObject +class Bookmark extends Managed_DataObject { public $__table = 'bookmark'; // table name public $id; // char(36) primary_key not_null @@ -53,22 +53,6 @@ class Bookmark extends Memcached_DataObject public $uri; // varchar(255) public $created; // datetime - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup (usually 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return User_greeting_count object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Bookmark', $k, $v); - } - /** * Get an instance by compound key * diff --git a/plugins/EmailSummary/Email_summary_status.php b/plugins/EmailSummary/Email_summary_status.php index 0c9e880f18..97acd6ca66 100644 --- a/plugins/EmailSummary/Email_summary_status.php +++ b/plugins/EmailSummary/Email_summary_status.php @@ -46,7 +46,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class Email_summary_status extends Memcached_DataObject +class Email_summary_status extends Managed_DataObject { public $__table = 'email_summary_status'; // table name public $user_id; // int(4) primary_key not_null @@ -55,20 +55,6 @@ class Email_summary_status extends Memcached_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 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return Email_summary_status object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('email_summary_status', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/FacebookBridge/classes/Notice_to_item.php b/plugins/FacebookBridge/classes/Notice_to_item.php index d37c95ffc1..fe0a90c848 100644 --- a/plugins/FacebookBridge/classes/Notice_to_item.php +++ b/plugins/FacebookBridge/classes/Notice_to_item.php @@ -48,29 +48,13 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class Notice_to_item extends Memcached_DataObject +class Notice_to_item extends Managed_DataObject { public $__table = 'notice_to_item'; // table name public $notice_id; // int(4) primary_key not_null public $item_id; // varchar(255) not null public $created; // datetime - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup - * @param mixed $v Value to lookup - * - * @return Notice_to_item object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Notice_to_item', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/FollowEveryone/User_followeveryone_prefs.php b/plugins/FollowEveryone/User_followeveryone_prefs.php index 7690fd220a..e347d492d1 100644 --- a/plugins/FollowEveryone/User_followeveryone_prefs.php +++ b/plugins/FollowEveryone/User_followeveryone_prefs.php @@ -52,27 +52,12 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class User_followeveryone_prefs extends Memcached_DataObject +class User_followeveryone_prefs extends Managed_DataObject { public $__table = 'user_followeveryone_prefs'; // table name public $user_id; // int(4) primary_key not_null public $followeveryone; // tinyint(1) - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup (usually 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return User_followeveryone_prefs object found, or null for no hits - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('User_followeveryone_prefs', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php index a122d44ecb..3898d42994 100644 --- a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php +++ b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php @@ -32,7 +32,7 @@ if (!defined('STATUSNET')) { require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; -class GNUsocialPhoto extends Memcached_DataObject +class GNUsocialPhoto extends Managed_DataObject { public $__table = 'GNUsocialPhoto'; public $id; // int(11) @@ -42,17 +42,6 @@ class GNUsocialPhoto extends Memcached_DataObject public $thumb_uri; // varchar(512) public $title; // varchar(512) public $photo_description; // text - - - /** - * - * k key - * v value - */ - function staticGet($k,$v=NULL) - { - return Memcached_DataObject::staticGet('GNUsocialPhoto',$k,$v); - } /* function delete() { diff --git a/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php b/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php index 848f92dffa..14e673beb7 100644 --- a/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php +++ b/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php @@ -33,7 +33,7 @@ if (!defined('STATUSNET')) { require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; -class GNUsocialPhotoAlbum extends Memcached_DataObject +class GNUsocialPhotoAlbum extends Managed_DataObject { public $__table = 'GNUsocialPhotoAlbum'; public $album_id; // int(11) -- Unique identifier for the album @@ -41,13 +41,6 @@ class GNUsocialPhotoAlbum extends Memcached_DataObject public $album_name; // varchar(256) -- Title for this album public $album_description; // text -- A description of the album - - function staticGet($k,$v=NULL) - { - return Memcached_DataObject::staticGet('GNUsocialPhotoAlbum',$k,$v); - } - - /* TODO: Primary key on both album_id, profile_id / foriegn key on profile_id */ function table() { diff --git a/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionField.php b/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionField.php index 6877eab1bb..f8568c26e4 100644 --- a/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionField.php +++ b/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionField.php @@ -32,7 +32,7 @@ if (!defined('STATUSNET')) { require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; -class GNUsocialProfileExtensionField extends Memcached_DataObject +class GNUsocialProfileExtensionField extends Managed_DataObject { public $__table = 'GNUsocialProfileExtensionField'; public $id; // int(11) @@ -41,17 +41,6 @@ class GNUsocialProfileExtensionField extends Memcached_DataObject public $description; // text public $type; // varchar(256) - /** - * - * k key - * v value - */ - function staticGet($k,$v=NULL) - { - return Memcached_DataObject::staticGet('GNUsocialProfileExtensionField',$k,$v); - } - - function table() { return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, diff --git a/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionResponse.php b/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionResponse.php index fbf5af0dbb..de87447e81 100644 --- a/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionResponse.php +++ b/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionResponse.php @@ -32,7 +32,7 @@ if (!defined('STATUSNET')) { require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; -class GNUsocialProfileExtensionResponse extends Memcached_DataObject +class GNUsocialProfileExtensionResponse extends Managed_DataObject { public $__table = 'GNUsocialProfileExtensionResponse'; public $id; // int(11) @@ -40,17 +40,6 @@ class GNUsocialProfileExtensionResponse extends Memcached_DataObject public $profile_id; // int(11) public $value; // text - /** - * - * k key - * v value - */ - function staticGet($k,$v=NULL) - { - return Memcached_DataObject::staticGet('GNUsocialProfileExtensionResponse',$k,$v); - } - - function table() { return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, diff --git a/plugins/GNUsocialProfileExtensions/classes/ProfileExtensionField.php b/plugins/GNUsocialProfileExtensions/classes/ProfileExtensionField.php index 142b70230b..d815976457 100644 --- a/plugins/GNUsocialProfileExtensions/classes/ProfileExtensionField.php +++ b/plugins/GNUsocialProfileExtensions/classes/ProfileExtensionField.php @@ -32,7 +32,7 @@ if (!defined('STATUSNET')) { require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; -class GNUsocialPhoto extends Memcached_DataObject +class GNUsocialPhoto extends Managed_DataObject { public $__table = 'GNUsocialPhoto'; public $id; // int(11) @@ -42,17 +42,6 @@ class GNUsocialPhoto extends Memcached_DataObject public $thumb_uri; // varchar(512) public $title; // varchar(512) public $photo_description; // text - - - /** - * - * k key - * v value - */ - function staticGet($k,$v=NULL) - { - return Memcached_DataObject::staticGet('GNUsocialPhoto',$k,$v); - } /* function delete() { diff --git a/plugins/GroupPrivateMessage/Group_message.php b/plugins/GroupPrivateMessage/Group_message.php index 53fe0fe90f..a74f7cd60a 100644 --- a/plugins/GroupPrivateMessage/Group_message.php +++ b/plugins/GroupPrivateMessage/Group_message.php @@ -44,7 +44,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class Group_message extends Memcached_DataObject +class Group_message extends Managed_DataObject { public $__table = 'group_message'; // table name public $id; // char(36) primary_key not_null @@ -56,21 +56,6 @@ class Group_message extends Memcached_DataObject public $url; public $created; - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup (usually 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return Group_message object found, or null for no hits - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Group_message', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/GroupPrivateMessage/Group_message_profile.php b/plugins/GroupPrivateMessage/Group_message_profile.php index 69cc3e40d4..b059222dcc 100644 --- a/plugins/GroupPrivateMessage/Group_message_profile.php +++ b/plugins/GroupPrivateMessage/Group_message_profile.php @@ -44,28 +44,13 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class Group_message_profile extends Memcached_DataObject +class Group_message_profile extends Managed_DataObject { public $__table = 'group_message_profile'; // table name public $to_profile; // int public $group_message_id; // char(36) primary_key not_null public $created; - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup (usually 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return Group_message object found, or null for no hits - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Group_message_profile', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/GroupPrivateMessage/Group_privacy_settings.php b/plugins/GroupPrivateMessage/Group_privacy_settings.php index 9a8e5c045a..a325dd95f1 100644 --- a/plugins/GroupPrivateMessage/Group_privacy_settings.php +++ b/plugins/GroupPrivateMessage/Group_privacy_settings.php @@ -44,7 +44,7 @@ if (!defined('STATUSNET')) { * * @see DB_DataObject */ -class Group_privacy_settings extends Memcached_DataObject +class Group_privacy_settings extends Managed_DataObject { public $__table = 'group_privacy_settings'; /** ID of the group. */ @@ -70,21 +70,6 @@ class Group_privacy_settings extends Memcached_DataObject const MEMBER = 2; const ADMIN = 4; - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup (usually 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return User_greeting_count object found, or null for no hits - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Group_privacy_settings', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/Irc/Irc_waiting_message.php b/plugins/Irc/Irc_waiting_message.php index 659a27ffa9..ba8d6bd03d 100644 --- a/plugins/Irc/Irc_waiting_message.php +++ b/plugins/Irc/Irc_waiting_message.php @@ -5,7 +5,7 @@ require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; -class Irc_waiting_message extends Memcached_DataObject { +class Irc_waiting_message extends Managed_DataObject { public $__table = 'irc_waiting_message'; // table name public $id; // int primary_key not_null auto_increment @@ -15,11 +15,6 @@ class Irc_waiting_message extends Memcached_DataObject { public $created; // datetime() not_null public $claimed; // datetime() - /* Static get */ - public function staticGet($k, $v = null) { - return Memcached_DataObject::staticGet('Irc_waiting_message', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/Msn/msn_waiting_message.php b/plugins/Msn/msn_waiting_message.php index 707cd04389..03c03f856e 100644 --- a/plugins/Msn/msn_waiting_message.php +++ b/plugins/Msn/msn_waiting_message.php @@ -4,7 +4,7 @@ */ require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; -class Msn_waiting_message extends Memcached_DataObject { +class Msn_waiting_message extends Managed_DataObject { public $__table = 'msn_waiting_message'; // table name public $id; // int primary_key not_null auto_increment @@ -13,11 +13,6 @@ class Msn_waiting_message extends Memcached_DataObject { public $created; // datetime() not_null public $claimed; // datetime() - /* Static get */ - public function staticGet($k, $v = null) { - return Memcached_DataObject::staticGet('Msn_waiting_message', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/NoticeTitle/Notice_title.php b/plugins/NoticeTitle/Notice_title.php index 4030b5c965..17dc8bdd1e 100644 --- a/plugins/NoticeTitle/Notice_title.php +++ b/plugins/NoticeTitle/Notice_title.php @@ -44,7 +44,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class Notice_title extends Memcached_DataObject +class Notice_title extends Managed_DataObject { const MAXCHARS = 255; @@ -52,22 +52,6 @@ class Notice_title extends Memcached_DataObject public $notice_id; // int(4) primary_key not_null public $title; // varchar(255) - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup (usually 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return Notice_title object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Notice_title', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index 7da8dcd7ee..d7eabf33ee 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -59,7 +59,7 @@ class FeedDBException extends FeedSubException * Higher-level behavior building OStatus stuff on top is handled * under Ostatus_profile. */ -class FeedSub extends Memcached_DataObject +class FeedSub extends Managed_DataObject { public $__table = 'feedsub'; @@ -78,11 +78,6 @@ class FeedSub extends Memcached_DataObject public $created; public $modified; - public /*static*/ function staticGet($k, $v=null) - { - return parent::staticGet(__CLASS__, $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/OStatus/classes/HubSub.php b/plugins/OStatus/classes/HubSub.php index e7ac23af58..66e7d30e96 100644 --- a/plugins/OStatus/classes/HubSub.php +++ b/plugins/OStatus/classes/HubSub.php @@ -26,7 +26,7 @@ if (!defined('STATUSNET')) { * @package Hub * @author Brion Vibber */ -class HubSub extends Memcached_DataObject +class HubSub extends Managed_DataObject { public $__table = 'hubsub'; @@ -40,11 +40,6 @@ class HubSub extends Memcached_DataObject public $created; public $modified; - public /*static*/ function staticGet($topic, $callback) - { - return parent::staticGet(__CLASS__, 'hashkey', self::hashkey($topic, $callback)); - } - protected static function hashkey($topic, $callback) { return sha1($topic . '|' . $callback); diff --git a/plugins/OStatus/classes/Magicsig.php b/plugins/OStatus/classes/Magicsig.php index 31d061e6a0..01c4689676 100644 --- a/plugins/OStatus/classes/Magicsig.php +++ b/plugins/OStatus/classes/Magicsig.php @@ -33,7 +33,7 @@ if (!defined('STATUSNET')) { require_once 'Crypt/RSA.php'; -class Magicsig extends Memcached_DataObject +class Magicsig extends Managed_DataObject { const PUBLICKEYREL = 'magic-public-key'; @@ -81,32 +81,6 @@ class Magicsig extends Memcached_DataObject $this->alg = $alg; } - /** - * Fetch a Magicsig object from the cache or database on a field match. - * - * @param string $k - * @param mixed $v - * @return Magicsig - */ - public /*static*/ function staticGet($k, $v=null) - { - $obj = parent::staticGet(__CLASS__, $k, $v); - if (!empty($obj)) { - $obj = Magicsig::fromString($obj->keypair); - - // Double check keys: Crypt_RSA did not - // consistently generate good keypairs. - // We've also moved to 1024 bit keys. - if (strlen($obj->publicKey->modulus->toBits()) != 1024) { - $obj->delete(); - return false; - } - } - - return $obj; - } - - function table() { return array( diff --git a/plugins/OStatus/classes/Ostatus_source.php b/plugins/OStatus/classes/Ostatus_source.php index 0fd74e48ba..8eefb33fa6 100644 --- a/plugins/OStatus/classes/Ostatus_source.php +++ b/plugins/OStatus/classes/Ostatus_source.php @@ -25,7 +25,7 @@ if (!defined('STATUSNET')) { * @package OStatusPlugin * @maintainer Brion Vibber */ -class Ostatus_source extends Memcached_DataObject +class Ostatus_source extends Managed_DataObject { public $__table = 'ostatus_source'; @@ -33,11 +33,6 @@ class Ostatus_source extends Memcached_DataObject public $profile_uri; // uri of the ostatus_profile this came through -- may be a group feed public $method; // push or salmon - public /*static*/ function staticGet($k, $v=null) - { - return parent::staticGet(__CLASS__, $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/OpenID/User_openid.php b/plugins/OpenID/User_openid.php index 03a0b0ccd9..a8ed576114 100644 --- a/plugins/OpenID/User_openid.php +++ b/plugins/OpenID/User_openid.php @@ -7,7 +7,7 @@ if (!defined('STATUSNET')) { exit(1); } -class User_openid extends Memcached_DataObject +class User_openid extends Managed_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -19,10 +19,6 @@ class User_openid extends Memcached_DataObject public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP - /* Static get */ - function staticGet($k,$v=null) - { return Memcached_DataObject::staticGet('User_openid',$k,$v); } - /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/plugins/OpenID/User_openid_trustroot.php b/plugins/OpenID/User_openid_trustroot.php index eb82115e95..7bfd4d90fd 100644 --- a/plugins/OpenID/User_openid_trustroot.php +++ b/plugins/OpenID/User_openid_trustroot.php @@ -7,7 +7,7 @@ if (!defined('STATUSNET')) { exit(1); } -class User_openid_trustroot extends Memcached_DataObject +class User_openid_trustroot extends Managed_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -18,10 +18,6 @@ class User_openid_trustroot extends Memcached_DataObject public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP - /* Static get */ - function staticGet($k,$v=null) - { return Memcached_DataObject::staticGet('User_openid_trustroot',$k,$v); } - /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/plugins/RegisterThrottle/Registration_ip.php b/plugins/RegisterThrottle/Registration_ip.php index f9fc4918d5..02b137f987 100644 --- a/plugins/RegisterThrottle/Registration_ip.php +++ b/plugins/RegisterThrottle/Registration_ip.php @@ -42,27 +42,13 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ -class Registration_ip extends Memcached_DataObject +class Registration_ip extends Managed_DataObject { public $__table = 'registration_ip'; // table name public $user_id; // int(4) primary_key not_null public $ipaddress; // varchar(15) public $created; // timestamp - /** - * Get an instance by key - * - * @param string $k Key to use to lookup (usually 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return User_greeting_count object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Registration_ip', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/Sample/User_greeting_count.php b/plugins/Sample/User_greeting_count.php index 8128343d81..6c7bcf4911 100644 --- a/plugins/Sample/User_greeting_count.php +++ b/plugins/Sample/User_greeting_count.php @@ -52,27 +52,12 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class User_greeting_count extends Memcached_DataObject +class User_greeting_count extends Managed_DataObject { public $__table = 'user_greeting_count'; // table name public $user_id; // int(4) primary_key not_null public $greeting_count; // int(4) - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup (usually 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return User_greeting_count object found, or null for no hits - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('User_greeting_count', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/Sitemap/Sitemap_notice_count.php b/plugins/Sitemap/Sitemap_notice_count.php index 2238ff5218..cb42edcbf6 100644 --- a/plugins/Sitemap/Sitemap_notice_count.php +++ b/plugins/Sitemap/Sitemap_notice_count.php @@ -51,7 +51,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class Sitemap_notice_count extends Memcached_DataObject +class Sitemap_notice_count extends Managed_DataObject { public $__table = 'sitemap_notice_count'; // table name @@ -60,22 +60,6 @@ class Sitemap_notice_count extends Memcached_DataObject public $created; public $modified; - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup (usually 'notice_id' for this class) - * @param mixed $v Value to lookup - * - * @return Sitemap_notice_count object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Sitemap_notice_count', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/Sitemap/Sitemap_user_count.php b/plugins/Sitemap/Sitemap_user_count.php index 0b45021bf5..3377879f94 100644 --- a/plugins/Sitemap/Sitemap_user_count.php +++ b/plugins/Sitemap/Sitemap_user_count.php @@ -47,7 +47,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class Sitemap_user_count extends Memcached_DataObject +class Sitemap_user_count extends Managed_DataObject { public $__table = 'sitemap_user_count'; // table name @@ -56,22 +56,6 @@ class Sitemap_user_count extends Memcached_DataObject public $created; public $modified; - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup (usually 'user_id' for this class) - * @param mixed $v Value to lookup - * - * @return Sitemap_user_count object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Sitemap_user_count', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/SubMirror/classes/SubMirror.php b/plugins/SubMirror/classes/SubMirror.php index b36677e58a..f7c8c567c2 100644 --- a/plugins/SubMirror/classes/SubMirror.php +++ b/plugins/SubMirror/classes/SubMirror.php @@ -22,7 +22,7 @@ * @maintainer Brion Vibber */ -class SubMirror extends Memcached_DataObject +class SubMirror extends Managed_DataObject { public $__table = 'submirror'; @@ -34,11 +34,6 @@ class SubMirror extends Memcached_DataObject public $created; public $modified; - public /*static*/ function staticGet($k, $v=null) - { - return parent::staticGet(__CLASS__, $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/TwitterBridge/Notice_to_status.php b/plugins/TwitterBridge/Notice_to_status.php index 313adaeafc..f2756060e9 100644 --- a/plugins/TwitterBridge/Notice_to_status.php +++ b/plugins/TwitterBridge/Notice_to_status.php @@ -53,29 +53,13 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * @see DB_DataObject */ -class Notice_to_status extends Memcached_DataObject +class Notice_to_status extends Managed_DataObject { public $__table = 'notice_to_status'; // table name public $notice_id; // int(4) primary_key not_null public $status_id; // int(4) public $created; // datetime - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup - * @param mixed $v Value to lookup - * - * @return Notice_to_status object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Notice_to_status', $k, $v); - } - /** * return table definition for DB_DataObject * diff --git a/plugins/TwitterBridge/Twitter_synch_status.php b/plugins/TwitterBridge/Twitter_synch_status.php index 9c61e7e7e0..c9a0268575 100644 --- a/plugins/TwitterBridge/Twitter_synch_status.php +++ b/plugins/TwitterBridge/Twitter_synch_status.php @@ -48,7 +48,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ -class Twitter_synch_status extends Memcached_DataObject +class Twitter_synch_status extends Managed_DataObject { public $__table = 'twitter_synch_status'; // table name public $foreign_id; // int(4) primary_key not_null @@ -65,7 +65,7 @@ class Twitter_synch_status extends Memcached_DataObject * * @return Twitter_synch_status object found, or null for no hits */ - function staticGet($k, $v=null) + static function staticGet($k, $v=null) { throw new Exception("Use pkeyGet() for this class."); } diff --git a/plugins/UserFlag/User_flag_profile.php b/plugins/UserFlag/User_flag_profile.php index cdc67cf8e7..02b7a7849f 100644 --- a/plugins/UserFlag/User_flag_profile.php +++ b/plugins/UserFlag/User_flag_profile.php @@ -44,7 +44,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ -class User_flag_profile extends Memcached_DataObject +class User_flag_profile extends Managed_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -55,9 +55,6 @@ class User_flag_profile extends Memcached_DataObject public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00 public $cleared; // datetime not_null default_0000-00-00%2000%3A00%3A00 - /* Static get */ - function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_flag_profile',$k,$v); } - /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/plugins/YammerImport/classes/Yammer_common.php b/plugins/YammerImport/classes/Yammer_common.php index e262623263..e794191d1b 100644 --- a/plugins/YammerImport/classes/Yammer_common.php +++ b/plugins/YammerImport/classes/Yammer_common.php @@ -35,12 +35,12 @@ if (!defined('STATUSNET')) { * Common base class for the Yammer import mappings for users, groups, and notices. * * Child classes must override these static methods, since we need to run - * on PHP 5.2.x which has no late static binding: + * on PHP 5.2.x which has no late static binding: (not really anymore) * - staticGet (as our other classes) * - schemaDef (call self::doSchemaDef) * - record (call self::doRecord) */ -class Yammer_common extends Memcached_DataObject +class Yammer_common extends Managed_DataObject { public $__table = 'yammer_XXXX'; // table name public $__field = 'XXXX_id'; // field name to save into @@ -133,13 +133,13 @@ class Yammer_common extends Memcached_DataObject */ protected static function doRecord($class, $field, $orig_id, $local_id) { - $map = parent::staticGet($class, 'id', $orig_id); + $map = Memcached_DataObject::staticGet($class, 'id', $orig_id); if (!empty($map)) { return $map; } - $map = parent::staticGet($class, $field, $local_id); + $map = Memcached_DataObject::staticGet($class, $field, $local_id); if (!empty($map)) { return $map; diff --git a/plugins/YammerImport/classes/Yammer_group.php b/plugins/YammerImport/classes/Yammer_group.php index a52b5119d4..ac4dc79e91 100644 --- a/plugins/YammerImport/classes/Yammer_group.php +++ b/plugins/YammerImport/classes/Yammer_group.php @@ -37,22 +37,6 @@ class Yammer_group extends Yammer_common public $__field = 'group_id'; // field to map to public $group_id; // int - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup - * @param mixed $v Value to lookup - * - * @return Yammer_group object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Yammer_group', $k, $v); - } - /** * Return schema definition to set this table up in onCheckSchema */ diff --git a/plugins/YammerImport/classes/Yammer_notice.php b/plugins/YammerImport/classes/Yammer_notice.php index 118266aed0..d903b127b5 100644 --- a/plugins/YammerImport/classes/Yammer_notice.php +++ b/plugins/YammerImport/classes/Yammer_notice.php @@ -37,22 +37,6 @@ class Yammer_notice extends Yammer_common public $__field = 'notice_id'; // field to map to public $notice_id; // int - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup - * @param mixed $v Value to lookup - * - * @return Yammer_notice object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Yammer_notice', $k, $v); - } - /** * Return schema definition to set this table up in onCheckSchema */ diff --git a/plugins/YammerImport/classes/Yammer_notice_stub.php b/plugins/YammerImport/classes/Yammer_notice_stub.php index 6dd78206d2..e38d3164e3 100644 --- a/plugins/YammerImport/classes/Yammer_notice_stub.php +++ b/plugins/YammerImport/classes/Yammer_notice_stub.php @@ -40,28 +40,13 @@ if (!defined('STATUSNET')) { * down in reverse chronological order, then go back over them from oldest to * newest and actually save them into our notice table. */ -class Yammer_notice_stub extends Memcached_DataObject +class Yammer_notice_stub extends Managed_DataObject { public $__table = 'yammer_notice_stub'; // table name public $id; // int primary_key not_null public $json_data; // text public $created; // datetime - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup - * @param mixed $v Value to lookup - * - * @return Yammer_notice_stub object found, or null for no hits - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Yammer_notice_stub', $k, $v); - } - /** * Return schema definition to set this table up in onCheckSchema */ diff --git a/plugins/YammerImport/classes/Yammer_state.php b/plugins/YammerImport/classes/Yammer_state.php index 548fbbf024..b0f0dfabf3 100644 --- a/plugins/YammerImport/classes/Yammer_state.php +++ b/plugins/YammerImport/classes/Yammer_state.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -class Yammer_state extends Memcached_DataObject +class Yammer_state extends Managed_DataObject { public $__table = 'yammer_state'; // table name public $id; // int primary_key not_null @@ -46,21 +46,6 @@ class Yammer_state extends Memcached_DataObject public $created; // datetime public $modified; // datetime - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup - * @param mixed $v Value to lookup - * - * @return Yammer_state object found, or null for no hits - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Yammer_state', $k, $v); - } - /** * Return schema definition to set this table up in onCheckSchema */ diff --git a/plugins/YammerImport/classes/Yammer_user.php b/plugins/YammerImport/classes/Yammer_user.php index 8139613347..71a025d84c 100644 --- a/plugins/YammerImport/classes/Yammer_user.php +++ b/plugins/YammerImport/classes/Yammer_user.php @@ -37,22 +37,6 @@ class Yammer_user extends Yammer_common public $__field = 'user_id'; // field to map to public $user_id; // int - /** - * Get an instance by key - * - * This is a utility method to get a single instance with a given key value. - * - * @param string $k Key to use to lookup - * @param mixed $v Value to lookup - * - * @return Yammer_user object found, or null for no hits - * - */ - function staticGet($k, $v=null) - { - return Memcached_DataObject::staticGet('Yammer_user', $k, $v); - } - /** * Return schema definition to set this table up in onCheckSchema */