From bd68154772e80a98e9e5c96c6df8772ce3b2a84f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 24 Feb 2010 23:28:41 -0500 Subject: Make user_group able to handle remote groups We add a local_group table to store data about local groups. It has the unique key for nickname, so /group/ looks up here. Updated DB data object classes and data files. --- db/statusnet.sql | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'db') diff --git a/db/statusnet.sql b/db/statusnet.sql index 97117c80a..75d060e28 100644 --- a/db/statusnet.sql +++ b/db/statusnet.sql @@ -406,7 +406,7 @@ create table profile_block ( create table user_group ( id integer auto_increment primary key comment 'unique identifier', - nickname varchar(64) unique key comment 'nickname for addressing', + nickname varchar(64) comment 'nickname for addressing', fullname varchar(255) comment 'display name', homepage varchar(255) comment 'URL, cached so we dont regenerate', description text comment 'group description', @@ -421,6 +421,8 @@ create table user_group ( created datetime not null comment 'date this record was created', modified timestamp comment 'date this record was modified', + uri varchar(255) unique key comment 'universal identifier', + index user_group_nickname_idx (nickname) ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; @@ -641,3 +643,13 @@ create table conversation ( modified timestamp comment 'date this record was modified' ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; +create table local_group ( + + group_id integer primary key comment 'group represented' references user_group (id), + nickname varchar(64) unique key comment 'group represented', + + created datetime not null comment 'date this record was created', + modified timestamp comment 'date this record was modified' + +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + -- cgit v1.2.3-54-g00ecf From 8f42d375939116eff482b3d07a8feaa4cc29c984 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 25 Feb 2010 09:24:29 -0500 Subject: Add 'mainpage' to User_group Add the mainpage attribute to user_group objects. --- classes/User_group.php | 10 ++++++++-- classes/statusnet.ini | 1 + db/statusnet.sql | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'db') diff --git a/classes/User_group.php b/classes/User_group.php index 5877ce202..a81eb8ce0 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -23,6 +23,7 @@ class User_group extends Memcached_DataObject public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00 public $modified; // timestamp not_null default_CURRENT_TIMESTAMP public $uri; // varchar(255) unique_key + public $mainpage; // varchar(255) /* Static get */ function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('User_group',$k,$v); } @@ -42,8 +43,13 @@ class User_group extends Memcached_DataObject { $url = null; if (Event::handle('StartUserGroupHomeUrl', array($this, &$url))) { - $url = common_local_url('showgroup', - array('nickname' => $this->nickname)); + // normally stored in mainpage, but older ones may be null + if (!empty($this->mainpage)) { + $url = $this->mainpage; + } else { + $url = common_local_url('showgroup', + array('nickname' => $this->nickname)); + } } Event::handle('EndUserGroupHomeUrl', array($this, &$url)); return $url; diff --git a/classes/statusnet.ini b/classes/statusnet.ini index 7444306f0..719dbedf5 100644 --- a/classes/statusnet.ini +++ b/classes/statusnet.ini @@ -601,6 +601,7 @@ design_id = 1 created = 142 modified = 384 uri = 2 +mainpage = 2 [user_group__keys] id = N diff --git a/db/statusnet.sql b/db/statusnet.sql index 75d060e28..4158f0167 100644 --- a/db/statusnet.sql +++ b/db/statusnet.sql @@ -422,6 +422,7 @@ create table user_group ( modified timestamp comment 'date this record was modified', uri varchar(255) unique key comment 'universal identifier', + mainpage varchar(255) comment 'page for group info to link to', index user_group_nickname_idx (nickname) -- cgit v1.2.3-54-g00ecf From 8278eca7ffe5d8c3e05fead042754640b8169411 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 25 Feb 2010 21:15:20 +0000 Subject: Not sure how this ended up in wrong-cased dir... --- DB/local_group.sql | 17 ----------------- db/local_group.sql | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 DB/local_group.sql create mode 100644 db/local_group.sql (limited to 'db') diff --git a/DB/local_group.sql b/DB/local_group.sql deleted file mode 100644 index 14973e755..000000000 --- a/DB/local_group.sql +++ /dev/null @@ -1,17 +0,0 @@ -alter table user_group - add uri varchar(255) unique key comment 'universal identifier', - add mainpage varchar(255) comment 'page for group info to link to', - drop index nickname; - -create table local_group ( - - group_id integer primary key comment 'group represented' references user_group (id), - nickname varchar(64) unique key comment 'group represented', - - created datetime not null comment 'date this record was created', - modified timestamp comment 'date this record was modified' - -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; - -insert into local_group (group_id, nickname, created, modified) - select id, nickname, created, modified from user_group; diff --git a/db/local_group.sql b/db/local_group.sql new file mode 100644 index 000000000..14973e755 --- /dev/null +++ b/db/local_group.sql @@ -0,0 +1,17 @@ +alter table user_group + add uri varchar(255) unique key comment 'universal identifier', + add mainpage varchar(255) comment 'page for group info to link to', + drop index nickname; + +create table local_group ( + + group_id integer primary key comment 'group represented' references user_group (id), + nickname varchar(64) unique key comment 'group represented', + + created datetime not null comment 'date this record was created', + modified timestamp comment 'date this record was modified' + +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + +insert into local_group (group_id, nickname, created, modified) + select id, nickname, created, modified from user_group; -- cgit v1.2.3-54-g00ecf From 00aba4a907839304cf5c31955c3e0b184378a90c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 25 Feb 2010 22:30:04 -0500 Subject: add beta5 to beta6 script --- db/beta5tobeta6.sql | 28 ++++++++++++++++++++++++++++ db/local_group.sql | 17 ----------------- 2 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 db/beta5tobeta6.sql delete mode 100644 db/local_group.sql (limited to 'db') diff --git a/db/beta5tobeta6.sql b/db/beta5tobeta6.sql new file mode 100644 index 000000000..e9dff17ef --- /dev/null +++ b/db/beta5tobeta6.sql @@ -0,0 +1,28 @@ +alter table oauth_application + modify column name varchar(255) not null unique key comment 'name of the application', + modify column access_type tinyint default 0 comment 'access type, bit 1 = read, bit 2 = write'; + +alter table user_group +add column uri varchar(255) unique key comment 'universal identifier', +add column mainpage varchar(255) comment 'page for group info to link to', +drop index nickname; + +create table conversation ( + id integer auto_increment primary key comment 'unique identifier', + uri varchar(225) unique comment 'URI of the conversation', + created datetime not null comment 'date this record was created', + modified timestamp comment 'date this record was modified' +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + +create table local_group ( + group_id integer primary key comment 'group represented' references user_group (id), + nickname varchar(64) unique key comment 'group represented', + + created datetime not null comment 'date this record was created', + modified timestamp comment 'date this record was modified' + +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + +insert into local_group (group_id, nickname, created) +select id, nickname, created from user_group; + diff --git a/db/local_group.sql b/db/local_group.sql deleted file mode 100644 index 14973e755..000000000 --- a/db/local_group.sql +++ /dev/null @@ -1,17 +0,0 @@ -alter table user_group - add uri varchar(255) unique key comment 'universal identifier', - add mainpage varchar(255) comment 'page for group info to link to', - drop index nickname; - -create table local_group ( - - group_id integer primary key comment 'group represented' references user_group (id), - nickname varchar(64) unique key comment 'group represented', - - created datetime not null comment 'date this record was created', - modified timestamp comment 'date this record was modified' - -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; - -insert into local_group (group_id, nickname, created, modified) - select id, nickname, created, modified from user_group; -- cgit v1.2.3-54-g00ecf