new group message layout

This commit is contained in:
Evan Prodromou 2011-01-20 16:08:22 -05:00
parent 4618641da2
commit edeaf8a2f8
2 changed files with 53 additions and 16 deletions

View File

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

View File

@ -77,22 +77,59 @@ class PrivateGroupPlugin extends Plugin
new ColumnDef('created',
'datetime'),
new ColumnDef('modified',
'timestamp'));
'timestamp')));
$schema->ensureTable('group_private_inbox',
array(new ColumnDef('group_id',
$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,
'PRI'),
new ColumnDef('allow_privacy',
'integer'),
new ColumnDef('allow_sender',
'integer'),
'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'));
'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('created',
'datetime'),
new ColumnDef('modified',
'timestamp')));
return true;
}