From c63622f05e1a29c6739952e626965c18c913829c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 22 May 2009 21:10:00 -0400 Subject: add design classes --- classes/laconica.ini | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'classes/laconica.ini') diff --git a/classes/laconica.ini b/classes/laconica.ini index 92bbb35d4..105bc9ec8 100644 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -37,6 +37,18 @@ modified = 384 [consumer__keys] consumer_key = K +[design] +id = 129 +backgroundcolor = 1 +contentcolor = 1 +sidebarcolor = 1 +textcolor = 1 +linkcolor = 1 +backgroundimage = 2 + +[design__keys] +id = N + [fave] notice_id = 129 user_id = 129 -- cgit v1.2.3-54-g00ecf From 3f5252c168de7c0a1ffb9625e3926543c5586c6e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 22 May 2009 23:43:08 -0400 Subject: add fields to support designs for users --- classes/laconica.ini | 3 +++ 1 file changed, 3 insertions(+) mode change 100644 => 100755 classes/laconica.ini (limited to 'classes/laconica.ini') diff --git a/classes/laconica.ini b/classes/laconica.ini old mode 100644 new mode 100755 index 105bc9ec8..450af3621 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -1,3 +1,4 @@ + [avatar] profile_id = 129 original = 17 @@ -425,6 +426,8 @@ urlshorteningservice = 2 inboxed = 17 created = 142 modified = 384 +design_id = 1 +viewdesigns = 17 [user__keys] id = K -- cgit v1.2.3-54-g00ecf From 91fc1e36bc268aa2bd7345206cd0e520d91aac26 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 23 May 2009 23:26:29 -0400 Subject: update User.php with new design-related fields --- classes/User.php | 7 +++---- classes/laconica.ini | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'classes/laconica.ini') diff --git a/classes/User.php b/classes/User.php index ea8ba4081..22090b986 100644 --- a/classes/User.php +++ b/classes/User.php @@ -62,14 +62,13 @@ class User extends Memcached_DataObject public $autosubscribe; // tinyint(1) public $urlshorteningservice; // varchar(50) default_ur1.ca public $inboxed; // tinyint(1) + public $design_id; // int(4) + public $viewdesigns; // tinyint(1) default_1 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',$k,$v); - } + function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE diff --git a/classes/laconica.ini b/classes/laconica.ini index 450af3621..07aa016fe 100755 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -424,10 +424,10 @@ uri = 2 autosubscribe = 17 urlshorteningservice = 2 inboxed = 17 -created = 142 -modified = 384 design_id = 1 viewdesigns = 17 +created = 142 +modified = 384 [user__keys] id = K -- cgit v1.2.3-54-g00ecf From 85b74d846dda8781c7e713b403c1229124480d12 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 14 Jun 2009 12:06:22 -0700 Subject: create DB_DataObject classes for group block --- classes/Group_block.php | 23 +++++++++++++++++++++++ classes/laconica.ini | 11 +++++++++++ 2 files changed, 34 insertions(+) create mode 100755 classes/Group_block.php mode change 100644 => 100755 classes/laconica.ini (limited to 'classes/laconica.ini') diff --git a/classes/Group_block.php b/classes/Group_block.php new file mode 100755 index 000000000..437046a9c --- /dev/null +++ b/classes/Group_block.php @@ -0,0 +1,23 @@ + Date: Sun, 14 Jun 2009 12:07:12 -0700 Subject: fix perms on Group_block classes --- classes/Group_block.php | 0 classes/laconica.ini | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 classes/Group_block.php mode change 100755 => 100644 classes/laconica.ini (limited to 'classes/laconica.ini') diff --git a/classes/Group_block.php b/classes/Group_block.php old mode 100755 new mode 100644 diff --git a/classes/laconica.ini b/classes/laconica.ini old mode 100755 new mode 100644 -- cgit v1.2.3-54-g00ecf From 2d63daa71c6ec8ac5fb34004075417c4bb0c6e19 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 14 Jun 2009 21:52:31 -0700 Subject: Added Group_alias class --- classes/Group_alias.php | 41 +++++++++++++++++++++++++++++++++++++++++ classes/laconica.ini | 8 ++++++++ 2 files changed, 49 insertions(+) create mode 100755 classes/Group_alias.php mode change 100644 => 100755 classes/laconica.ini (limited to 'classes/laconica.ini') diff --git a/classes/Group_alias.php b/classes/Group_alias.php new file mode 100755 index 000000000..e801e50e1 --- /dev/null +++ b/classes/Group_alias.php @@ -0,0 +1,41 @@ +. + */ + +if (!defined('LACONICA')) { exit(1); } + +require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; + +class Group_alias extends Memcached_DataObject +{ + ###START_AUTOCODE + /* the code below is auto generated do not remove the above tag */ + + public $__table = 'group_alias'; // table name + public $alias; // varchar(64) primary_key not_null + public $group_id; // int(4) not_null + public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP + + /* Static get */ + function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Group_alias',$k,$v); } + + /* the code above is auto generated do not remove the tag below */ + ###END_AUTOCODE +} diff --git a/classes/laconica.ini b/classes/laconica.ini old mode 100644 new mode 100755 index 8e4e78b79..df292bbff --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -158,6 +158,14 @@ id = K service = K uri = U +[group_alias] +alias = 130 +group_id = 129 +modified = 384 + +[group_alias__keys] +alias = K + [group_block] group_id = 129 blocked = 129 -- cgit v1.2.3-54-g00ecf From a4055fc2f9a79aa9aa2321e132a7133c088859cd Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 14 Jun 2009 21:53:09 -0700 Subject: fixup perms for classes --- classes/Group_alias.php | 0 classes/laconica.ini | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 classes/Group_alias.php mode change 100755 => 100644 classes/laconica.ini (limited to 'classes/laconica.ini') diff --git a/classes/Group_alias.php b/classes/Group_alias.php old mode 100755 new mode 100644 diff --git a/classes/laconica.ini b/classes/laconica.ini old mode 100755 new mode 100644 -- cgit v1.2.3-54-g00ecf From 7b7f11942885666bfe1f03dd6f34e36a82a08484 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 16 Jun 2009 21:36:15 -0700 Subject: Added background image tile flag to Design --- classes/Design.php | 19 ++++++++++--------- classes/laconica.ini | 1 + db/laconica.sql | 3 ++- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'classes/laconica.ini') diff --git a/classes/Design.php b/classes/Design.php index f5c87b489..acc94d196 100644 --- a/classes/Design.php +++ b/classes/Design.php @@ -41,6 +41,7 @@ class Design extends Memcached_DataObject public $textcolor; // int(4) public $linkcolor; // int(4) public $backgroundimage; // varchar(255) + public $tile; // tinyint(1) /* Static get */ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Design',$k,$v); } @@ -63,23 +64,23 @@ class Design extends Memcached_DataObject common_log(LOG_ERR, "Unable to create color for design $id.", __FILE__); } - + $css = 'html, body { background-color: #' . $bgcolor->hexValue() . '} ' . "\n"; $css .= '#content, #site_nav_local_views .current a { background-color: #'; $css .= $ccolor->hexValue() . '} '."\n"; $css .= '#aside_primary { background-color: #'. $sbcolor->hexValue() . '} ' . "\n"; $css .= 'html body { color: #'. $tcolor->hexValue() . '} '. "\n"; $css .= 'a { color: #' . $lcolor->hexValue() . '} ' . "\n"; - + if (!empty($this->backgroundimage)) { - - $css .= 'body { background-image:url(' . - Design::url($this->backgroundimage) . + + $css .= 'body { background-image:url(' . + Design::url($this->backgroundimage) . '); background-repeat:no-repeat; }' . "\n"; } - + $out->element('style', array('type' => 'text/css'), $css); - + } static function filename($id, $extension, $extra=null) @@ -97,7 +98,7 @@ class Design extends Memcached_DataObject return $dir . $filename; } - + static function url($filename) { $path = common_config('background', 'path'); @@ -120,5 +121,5 @@ class Design extends Memcached_DataObject return 'http://'.$server.$path.$filename; } - + } diff --git a/classes/laconica.ini b/classes/laconica.ini index c04ae758f..569681984 100755 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -46,6 +46,7 @@ sidebarcolor = 1 textcolor = 1 linkcolor = 1 backgroundimage = 2 +tile = 17 [design__keys] id = N diff --git a/db/laconica.sql b/db/laconica.sql index bd95d1ade..1f302de16 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -495,7 +495,8 @@ create table design ( sidebarcolor integer comment 'sidebar background color', textcolor integer comment 'text color', linkcolor integer comment 'link color', - backgroundimage varchar(255) comment 'background image, if any' + backgroundimage varchar(255) comment 'background image, if any', + tile tinyint default 0 comment 'tile background image' ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table group_block ( -- cgit v1.2.3-54-g00ecf From 76cbeff33c9659cacbb57943056aabcb1517ca5c Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 17 Jun 2009 02:35:51 -0700 Subject: Update background image settings to use bitflags --- actions/designsettings.php | 100 +++++++++++++++++++++++++++------------------ classes/Design.php | 33 +++++++++++++-- classes/laconica.ini | 2 +- db/laconica.sql | 2 +- lib/common.php | 2 +- 5 files changed, 93 insertions(+), 46 deletions(-) (limited to 'classes/laconica.ini') diff --git a/actions/designsettings.php b/actions/designsettings.php index fbec3fc67..3dfaddd7b 100644 --- a/actions/designsettings.php +++ b/actions/designsettings.php @@ -104,37 +104,52 @@ class DesignsettingsAction extends AccountSettingsAction 'value' => ImageFile::maxFileSizeInt())); $this->elementEnd('li'); - $this->elementStart('li', array('id' => 'design_background-image_onoff')); - if (!empty($design->backgroundimage)) { + + $this->elementStart('li', array('id' => 'design_background-image_onoff')); + $this->element('img', array('src' => Design::url($design->backgroundimage))); - } - $this->element('input', array('name' => 'design_background-image_onoff', - 'type' => 'radio', - 'id' => 'design_background-image_on', - 'class' => 'radio', - 'value' => 'true', - 'checked'=> 'checked')); - $this->element('label', array('for' => 'design_background-image_on', - 'class' => 'radio'), - _('On')); - $this->element('input', array('name' => 'design_background-image_onoff', - 'type' => 'radio', - 'id' => 'design_background-image_off', - 'class' => 'radio', - 'value' => 'false')); - $this->element('label', array('for' => 'design_background-image_off', - 'class' => 'radio'), - _('Off')); - $this->element('p', 'form_guide', _('Turn background image on or off.')); - $this->elementEnd('li'); + $attrs = array('name' => 'design_background-image_onoff', + 'type' => 'radio', + 'id' => 'design_background-image_on', + 'class' => 'radio', + 'value' => 'on'); + + if ($design->disposition & BACKGROUND_ON) { + $attrs['checked'] = 'checked'; + } + + $this->element('input', $attrs); + + $this->element('label', array('for' => 'design_background-image_on', + 'class' => 'radio'), + _('On')); + + $attrs = array('name' => 'design_background-image_onoff', + 'type' => 'radio', + 'id' => 'design_background-image_off', + 'class' => 'radio', + 'value' => 'off'); + + if ($design->disposition & BACKGROUND_OFF) { + $attrs['checked'] = 'checked'; + } + + $this->element('input', $attrs); + + $this->element('label', array('for' => 'design_background-image_off', + 'class' => 'radio'), + _('Off')); + $this->element('p', 'form_guide', _('Turn background image on or off.')); + $this->elementEnd('li'); + } $this->elementStart('li'); $this->checkbox('design_background-image_repeat', _('Tile background image'), - $design->tile); + ($design->disposition & BACKGROUND_TILE) ? true : false ); $this->elementEnd('li'); $this->elementEnd('ul'); @@ -159,7 +174,6 @@ class DesignsettingsAction extends AccountSettingsAction 'value' => '#' . $bgcolor->hexValue())); $this->elementEnd('li'); - $ccolor = new WebColor($design->contentcolor); $this->elementStart('li'); @@ -346,7 +360,7 @@ class DesignsettingsAction extends AccountSettingsAction $design->backgroundimage = $defaults['backgroundimage']; - $deisng->tile = $defaults['tile']; + $deisng->disposition = $defaults['disposition']; } catch (WebColorException $e) { common_log(LOG_ERR, _('Bad default color settings: ' . @@ -377,7 +391,23 @@ class DesignsettingsAction extends AccountSettingsAction return; } - $tile = $this->boolean('design_background-image_repeat'); + $onoff = $this->arg('design_background-image_onoff'); + + $on = false; + $off = false; + $tile = false; + + if ($onoff == 'on') { + $on = true; + } else { + $off = true; + } + + $repeat = $this->boolean('design_background-image_repeat'); + + if ($repeat) { + $tile = true; + } $user = common_current_user(); $design = $user->getDesign(); @@ -392,7 +422,8 @@ class DesignsettingsAction extends AccountSettingsAction $design->textcolor = $tcolor->intValue(); $design->linkcolor = $lcolor->intValue(); $design->backgroundimage = $filepath; - $design->tile = $tile; + + $design->setDisposition($on, $off, $tile); $result = $design->update($original); @@ -416,7 +447,8 @@ class DesignsettingsAction extends AccountSettingsAction $design->textcolor = $tcolor->intValue(); $design->linkcolor = $lcolor->intValue(); $design->backgroundimage = $filepath; - $design->tile = $tile; + + $design->setDisposition($on, $off, $tile); $id = $design->insert(); @@ -481,16 +513,4 @@ class DesignsettingsAction extends AccountSettingsAction $this->showForm(_('Design preferences saved.'), true); } - /** - * Reset design settings to previous saved value if any, or - * the defaults - * - * @return void - */ - - function resetDesign() - { - $this->showForm(_('Design preferences reset.'), true); - } - } diff --git a/classes/Design.php b/classes/Design.php index 4ea176677..5b28bf014 100644 --- a/classes/Design.php +++ b/classes/Design.php @@ -21,6 +21,10 @@ if (!defined('LACONICA')) { exit(1); } +define('BACKGROUND_ON', 1); +define('BACKGROUND_OFF', 2); +define('BACKGROUND_TILE', 4); + /** * Table Definition for design */ @@ -41,7 +45,7 @@ class Design extends Memcached_DataObject public $textcolor; // int(4) public $linkcolor; // int(4) public $backgroundimage; // varchar(255) - public $tile; // tinyint(1) + public $disposition; // tinyint(1) default_1 /* Static get */ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Design',$k,$v); } @@ -72,9 +76,11 @@ class Design extends Memcached_DataObject $css .= 'html body { color: #'. $tcolor->hexValue() . '} '. "\n"; $css .= 'a { color: #' . $lcolor->hexValue() . '} ' . "\n"; - if (!empty($this->backgroundimage)) { + if (!empty($this->backgroundimage) && + $this->disposition & BACKGROUND_ON) { - $repeat = ($this->tile) ? 'background-repeat:repeat;' : + $repeat = ($this->disposition & BACKGROUND_TILE) ? + 'background-repeat:repeat;' : 'background-repeat:no-repeat;'; $css .= 'body { background-image:url(' . @@ -125,4 +131,25 @@ class Design extends Memcached_DataObject return 'http://'.$server.$path.$filename; } + function setDisposition($on, $off, $tile) + { + if ($on) { + $this->disposition |= BACKGROUND_ON; + } else { + $this->disposition &= ~BACKGROUND_ON; + } + + if ($off) { + $this->disposition |= BACKGROUND_OFF; + } else { + $this->disposition &= ~BACKGROUND_OFF; + } + + if ($tile) { + $this->disposition |= BACKGROUND_TILE; + } else { + $this->disposition &= ~BACKGROUND_TILE; + } + } + } diff --git a/classes/laconica.ini b/classes/laconica.ini index 569681984..1a650aba5 100755 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -46,7 +46,7 @@ sidebarcolor = 1 textcolor = 1 linkcolor = 1 backgroundimage = 2 -tile = 17 +disposition = 17 [design__keys] id = N diff --git a/db/laconica.sql b/db/laconica.sql index 1f302de16..b018afec8 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -496,7 +496,7 @@ create table design ( textcolor integer comment 'text color', linkcolor integer comment 'link color', backgroundimage varchar(255) comment 'background image, if any', - tile tinyint default 0 comment 'tile background image' + disposition tinyint default 1 comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image' ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table group_block ( diff --git a/lib/common.php b/lib/common.php index 629fee25b..bcf2e5d0c 100644 --- a/lib/common.php +++ b/lib/common.php @@ -79,7 +79,7 @@ $config = 'textcolor' => '#000000', 'linkcolor' => '#002E6E', 'backgroundimage' => null, - 'tile' => true), + 'disposition' => 1), 'path' => $_path, 'logfile' => null, 'logo' => null, -- cgit v1.2.3-54-g00ecf From dff43c03e4cdd76419a430f0942e9eacf30e13b7 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 17 Jun 2009 22:16:09 -0700 Subject: Add design_id to User_group --- classes/User_group.php | 7 +++++++ classes/laconica.ini | 1 + db/laconica.sql | 1 + 3 files changed, 9 insertions(+) (limited to 'classes/laconica.ini') diff --git a/classes/User_group.php b/classes/User_group.php index 1a24124bb..8a56b9e52 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -19,6 +19,7 @@ class User_group extends Memcached_DataObject public $homepage_logo; // varchar(255) public $stream_logo; // varchar(255) public $mini_logo; // varchar(255) + public $design_id; // int(4) public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -239,4 +240,10 @@ class User_group extends Memcached_DataObject } return null; } + + function getDesign() + { + return Design::staticGet('id', $this->design_id); + } + } diff --git a/classes/laconica.ini b/classes/laconica.ini index 1a650aba5..5ced15885 100755 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -468,6 +468,7 @@ original_logo = 2 homepage_logo = 2 stream_logo = 2 mini_logo = 2 +design_id = 1 created = 142 modified = 384 diff --git a/db/laconica.sql b/db/laconica.sql index b018afec8..8d1d47d38 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -387,6 +387,7 @@ create table user_group ( homepage_logo varchar(255) comment 'homepage (profile) size logo', stream_logo varchar(255) comment 'stream-sized logo', mini_logo varchar(255) comment 'mini logo', + design_id integer comment 'id of a design' references design(id), created datetime not null comment 'date this record was created', modified timestamp comment 'date this record was modified', -- cgit v1.2.3-54-g00ecf From 05e51228020fecaa894523b5159bc412d48e5b19 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 22 Jun 2009 14:19:41 -0700 Subject: Database changes for file tables Some minor database changes for file tables. Namely: * Added a timestamp to all tables * Added a filename column for local files * Change some tables that had unnecessary auto-increment primary keys when they had another unique column that should act as the primary key * Change engine from MyISAM to InnoDB for a couple of files. Also, rebuilt the DB_DataObject files for all these tables. --- classes/File.php | 10 ++++++---- classes/File_oembed.php | 10 +++++----- classes/File_redirection.php | 10 +++++----- classes/File_thumbnail.php | 8 ++++---- classes/File_to_post.php | 6 +++--- classes/laconica.ini | 30 +++++++++++++++++------------- db/laconica.sql | 31 ++++++++++++++++++------------- 7 files changed, 58 insertions(+), 47 deletions(-) (limited to 'classes/laconica.ini') diff --git a/classes/File.php b/classes/File.php index 890536035..800041d5d 100644 --- a/classes/File.php +++ b/classes/File.php @@ -36,13 +36,15 @@ class File extends Memcached_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'file'; // table name - public $id; // int(11) not_null primary_key group_by + public $id; // int(4) primary_key not_null public $url; // varchar(255) unique_key public $mimetype; // varchar(50) - public $size; // int(11) group_by + public $size; // int(4) public $title; // varchar(255) - public $date; // int(11) group_by - public $protected; // int(1) group_by + public $date; // int(4) + public $protected; // int(4) + public $filename; // varchar(255) + public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('File',$k,$v); } diff --git a/classes/File_oembed.php b/classes/File_oembed.php index 2e8e851cd..f9ca14e3c 100644 --- a/classes/File_oembed.php +++ b/classes/File_oembed.php @@ -31,19 +31,19 @@ class File_oembed extends Memcached_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'file_oembed'; // table name - public $id; // int(11) not_null primary_key group_by - public $file_id; // int(11) unique_key group_by + public $file_id; // int(4) primary_key not_null public $version; // varchar(20) public $type; // varchar(20) public $provider; // varchar(50) public $provider_url; // varchar(255) - public $width; // int(11) group_by - public $height; // int(11) group_by - public $html; // blob(65535) blob + public $width; // int(4) + public $height; // int(4) + public $html; // text() public $title; // varchar(255) public $author_name; // varchar(50) public $author_url; // varchar(255) public $url; // varchar(255) + public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('File_oembed',$k,$v); } diff --git a/classes/File_redirection.php b/classes/File_redirection.php index 0d6e2a700..13f02f8e5 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -36,11 +36,11 @@ class File_redirection extends Memcached_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'file_redirection'; // table name - public $id; // int(11) not_null primary_key group_by - public $url; // varchar(255) unique_key - public $file_id; // int(11) group_by - public $redirections; // int(11) group_by - public $httpcode; // int(11) group_by + public $url; // varchar(255) primary_key not_null + public $file_id; // int(4) + public $redirections; // int(4) + public $httpcode; // int(4) + public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('File_redirection',$k,$v); } diff --git a/classes/File_thumbnail.php b/classes/File_thumbnail.php index 2908549da..40d85b258 100644 --- a/classes/File_thumbnail.php +++ b/classes/File_thumbnail.php @@ -31,11 +31,11 @@ class File_thumbnail extends Memcached_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'file_thumbnail'; // table name - public $id; // int(11) not_null primary_key group_by - public $file_id; // int(11) unique_key group_by + public $file_id; // int(4) primary_key not_null public $url; // varchar(255) unique_key - public $width; // int(11) group_by - public $height; // int(11) group_by + public $width; // int(4) + public $height; // int(4) + public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('File_thumbnail',$k,$v); } diff --git a/classes/File_to_post.php b/classes/File_to_post.php index 9362faaae..bb5f4e6e4 100644 --- a/classes/File_to_post.php +++ b/classes/File_to_post.php @@ -31,9 +31,9 @@ class File_to_post extends Memcached_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'file_to_post'; // table name - public $id; // int(11) not_null primary_key group_by - public $file_id; // int(11) multiple_key group_by - public $post_id; // int(11) group_by + public $file_id; // int(4) primary_key not_null + public $post_id; // int(4) primary_key not_null + public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('File_to_post',$k,$v); } diff --git a/classes/laconica.ini b/classes/laconica.ini index 5ced15885..7e9b2b791 100755 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -68,13 +68,14 @@ size = 1 title = 2 date = 1 protected = 1 +filename = 2 +modified = 384 [file__keys] id = N [file_oembed] -id = 129 -file_id = 1 +file_id = 129 version = 2 type = 2 provider = 2 @@ -86,37 +87,40 @@ title = 2 author_name = 2 author_url = 2 url = 2 +modified = 384 [file_oembed__keys] -id = N +file_id = K [file_redirection] -id = 129 -url = 2 +url = 130 file_id = 1 redirections = 1 httpcode = 1 +modified = 384 [file_redirection__keys] -id = N +url = K [file_thumbnail] -id = 129 -file_id = 1 +file_id = 129 url = 2 width = 1 height = 1 +modified = 384 [file_thumbnail__keys] -id = N +file_id = K +url = U [file_to_post] -id = 129 -file_id = 1 -post_id = 1 +file_id = 129 +post_id = 129 +modified = 384 [file_to_post__keys] -id = N +file_id = K +post_id = K [foreign_link] user_id = 129 diff --git a/db/laconica.sql b/db/laconica.sql index 8d1d47d38..95796d5cc 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -431,6 +431,7 @@ create table group_inbox ( ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table file ( + id integer primary key auto_increment, url varchar(255) comment 'destination URL after following redirections', mimetype varchar(50) comment 'mime type of resource', @@ -438,13 +439,15 @@ create table file ( title varchar(255) comment 'title of resource when available', date integer(11) comment 'date of resource according to http query', protected integer(1) comment 'true when URL is private (needs login)', + filename varchar(255) comment 'if a local file, name of the file', + + modified timestamp comment 'date this record was modified', unique(url) -) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci; +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; create table file_oembed ( - id integer primary key auto_increment, - file_id integer comment 'oEmbed for that URL/file' references file (id), + file_id integer primary key comment 'oEmbed for that URL/file' references file (id), version varchar(20) comment 'oEmbed spec. version', type varchar(20) comment 'oEmbed type: photo, video, link, rich', provider varchar(50) comment 'name of this oEmbed provider', @@ -456,37 +459,39 @@ create table file_oembed ( author_name varchar(50) comment 'author name for this oEmbed resource', author_url varchar(255) comment 'author URL for this oEmbed resource', url varchar(255) comment 'URL for this oEmbed resource when applicable (photo, link)', + modified timestamp comment 'date this record was modified' - unique(file_id) -) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci; +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; create table file_redirection ( - id integer primary key auto_increment, - url varchar(255) comment 'short URL (or any other kind of redirect) for file (id)', + + url varchar(255) primary key comment 'short URL (or any other kind of redirect) for file (id)', file_id integer comment 'short URL for what URL/file' references file (id), redirections integer comment 'redirect count', httpcode integer comment 'HTTP status code (20x, 30x, etc.)', + modified timestamp comment 'date this record was modified' - unique(url) ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table file_thumbnail ( - id integer primary key auto_increment, - file_id integer comment 'thumbnail for what URL/file' references file (id), + + file_id integer primary key comment 'thumbnail for what URL/file' references file (id), url varchar(255) comment 'URL of thumbnail', width integer comment 'width of thumbnail', height integer comment 'height of thumbnail', + modified timestamp comment 'date this record was modified', - unique(file_id), unique(url) ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table file_to_post ( - id integer primary key auto_increment, + file_id integer comment 'id of URL/file' references file (id), post_id integer comment 'id of the notice it belongs to' references notice (id), + modified timestamp comment 'date this record was modified', + + constraint primary key (file_id, post_id) - unique(file_id, post_id) ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table design ( -- cgit v1.2.3-54-g00ecf