From edeaf8a2f810a58678428cd5a0393addd152656c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 20 Jan 2011 16:08:22 -0500 Subject: [PATCH] new group message layout --- ...up_private_inbox.php => Group_message.php} | 12 ++-- plugins/PrivateGroup/PrivateGroupPlugin.php | 55 ++++++++++++++++--- 2 files changed, 52 insertions(+), 15 deletions(-) rename plugins/PrivateGroup/{Group_private_inbox.php => Group_message.php} (93%) diff --git a/plugins/PrivateGroup/Group_private_inbox.php b/plugins/PrivateGroup/Group_message.php similarity index 93% rename from plugins/PrivateGroup/Group_private_inbox.php rename to plugins/PrivateGroup/Group_message.php index 11142314bc..404f663a1f 100644 --- a/plugins/PrivateGroup/Group_private_inbox.php +++ b/plugins/PrivateGroup/Group_message.php @@ -53,7 +53,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * @see DB_DataObject */ -class User_greeting_count extends Memcached_DataObject +class Group_message extends Memcached_DataObject { public $__table = 'user_greeting_count'; // table name public $user_id; // int(4) primary_key not_null @@ -67,12 +67,12 @@ class User_greeting_count extends Memcached_DataObject * @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 + * @return Group_message object found, or null for no hits * */ function staticGet($k, $v=null) { - return Memcached_DataObject::staticGet('User_greeting_count', $k, $v); + return Memcached_DataObject::staticGet('Group_message', $k, $v); } /** @@ -143,15 +143,15 @@ class User_greeting_count extends Memcached_DataObject * * @param integer $user_id ID of the user to get a count for * - * @return User_greeting_count instance for this user, with count already incremented. + * @return Group_message instance for this user, with count already incremented. */ static function inc($user_id) { - $gc = User_greeting_count::staticGet('user_id', $user_id); + $gc = Group_message::staticGet('user_id', $user_id); if (empty($gc)) { - $gc = new User_greeting_count(); + $gc = new Group_message(); $gc->user_id = $user_id; $gc->greeting_count = 1; diff --git a/plugins/PrivateGroup/PrivateGroupPlugin.php b/plugins/PrivateGroup/PrivateGroupPlugin.php index f0f904cca1..0ae1247bee 100644 --- a/plugins/PrivateGroup/PrivateGroupPlugin.php +++ b/plugins/PrivateGroup/PrivateGroupPlugin.php @@ -77,22 +77,59 @@ class PrivateGroupPlugin extends Plugin new ColumnDef('created', 'datetime'), new ColumnDef('modified', - 'timestamp')); - - $schema->ensureTable('group_private_inbox', - array(new ColumnDef('group_id', + 'timestamp'))); + + $schema->ensureTable('group_message', + array(new ColumnDef('id', + 'char', + 36, + false, + 'PRI'), + new ColumnDef('uri', + 'varchar', + 255, + false, + 'UNI'), + new ColumnDef('from_profile', 'integer', null, false, + 'MUL'), + new ColumnDef('to_group', + 'integer', + null, + false, + 'MUL'), + new ColumnDef('content', + 'text'), + new ColumnDef('rendered', + 'text'), + new ColumnDef('url', + 'varchar', + 255, + false, + 'UNI'), + new ColumnDef('created', + 'datetime'), + new ColumnDef('modified', + 'timestamp'))); + + + $schema->ensureTable('group_message_copy', + array(new ColumnDef('group_message_id', + 'char', + 36, + false, + 'PRI'), + new ColumnDef('message_uri', + 'varchar', + 255, + false, 'PRI'), - new ColumnDef('allow_privacy', - 'integer'), - new ColumnDef('allow_sender', - 'integer'), new ColumnDef('created', 'datetime'), new ColumnDef('modified', - 'timestamp')); + 'timestamp'))); return true; } -- 2.39.5