From 0e68667bc80343a0aa021455b58cc67d0a3056cb Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 9 Jul 2009 18:22:46 -0400 Subject: 0.9.0 dev version --- lib/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common.php b/lib/common.php index 9d7954fa9..764c5a077 100644 --- a/lib/common.php +++ b/lib/common.php @@ -19,7 +19,7 @@ if (!defined('LACONICA')) { exit(1); } -define('LACONICA_VERSION', '0.8.1dev'); +define('LACONICA_VERSION', '0.9.0dev'); define('AVATAR_PROFILE_SIZE', 96); define('AVATAR_STREAM_SIZE', 48); -- cgit v1.2.3-54-g00ecf From f3af264c03745d42487672d462b6d94d2b537af3 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 16 Jul 2009 00:40:45 -0400 Subject: add a deleted_notice table --- classes/Deleted_notice.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ classes/laconica.ini | 11 +++++++++++ db/laconica.sql | 14 +++++++++++++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100755 classes/Deleted_notice.php mode change 100644 => 100755 classes/laconica.ini diff --git a/classes/Deleted_notice.php b/classes/Deleted_notice.php new file mode 100755 index 000000000..474d0b6f4 --- /dev/null +++ b/classes/Deleted_notice.php @@ -0,0 +1,44 @@ +. + */ + +if (!defined('LACONICA')) { exit(1); } + +/** + * Table Definition for notice + */ +require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; + +class Deleted_notice extends Memcached_DataObject +{ + ###START_AUTOCODE + /* the code below is auto generated do not remove the above tag */ + + public $__table = 'deleted_notice'; // table name + public $id; // int(4) primary_key not_null + public $profile_id; // int(4) not_null + public $uri; // varchar(255) unique_key + public $created; // datetime() not_null + public $deleted; // datetime() not_null + + /* Static get */ + function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Deleted_notice',$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 766bed75d..f8d4eebd3 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -38,6 +38,17 @@ modified = 384 [consumer__keys] consumer_key = K +[deleted_notice] +id = 129 +profile_id = 129 +uri = 2 +created = 142 +deleted = 142 + +[deleted_notice__keys] +id = K +uri = U + [design] id = 129 backgroundcolor = 1 diff --git a/db/laconica.sql b/db/laconica.sql index 2c04f680a..f01107176 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -534,4 +534,16 @@ create table session ( index session_modified_idx (modified) -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; \ No newline at end of file +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + +create table deleted_notice ( + + id integer primary key comment 'identity of notice', + profile_id integer not null comment 'author of the notice', + uri varchar(255) unique key comment 'universally unique identifier, usually a tag URI', + created datetime not null comment 'date the notice record was created', + deleted datetime not null comment 'date the notice record was created', + + index deleted_notice_profile_id_idx (profile_id) + +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; -- cgit v1.2.3-54-g00ecf From b6f816c785d9123e36a84f879b65c073d2023e04 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 16 Jul 2009 00:52:23 -0400 Subject: save an archive of deleted notices --- classes/Notice.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/classes/Notice.php b/classes/Notice.php index 0359c310d..c6ad7d6c4 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -74,7 +74,21 @@ class Notice extends Memcached_DataObject $this->blowFavesCache(true); $this->blowSubsCache(true); + // For auditing purposes, save a record that the notice + // was deleted. + + $deleted = new Deleted_notice(); + + $deleted->id = $this->id; + $deleted->profile_id = $this->profile_id; + $deleted->uri = $this->uri; + $deleted->created = $this->created; + $deleted->deleted = common_sql_now(); + $this->query('BEGIN'); + + $deleted->insert(); + //Null any notices that are replies to this notice $this->query(sprintf("UPDATE notice set reply_to = null WHERE reply_to = %d", $this->id)); $related = array('Reply', -- cgit v1.2.3-54-g00ecf From 0982c7a15441dbc4b5e685620fc72683d8445b3a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 16 Jul 2009 00:56:32 -0400 Subject: use 410 Gone for deleted notices --- actions/shownotice.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/actions/shownotice.php b/actions/shownotice.php index 1ec38a76b..fba1468aa 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -84,7 +84,13 @@ class ShownoticeAction extends OwnerDesignAction $this->notice = Notice::staticGet($id); if (empty($this->notice)) { - $this->clientError(_('No such notice.'), 404); + // Did we used to have it, and it got deleted? + $deleted = Deleted_notice::staticGet($id); + if (!empty($deleted)) { + $this->clientError(_('Notice deleted.'), 410); + } else { + $this->clientError(_('No such notice.'), 404); + } return false; } -- cgit v1.2.3-54-g00ecf From 924e3503dc401c1dafd460f7577f429f7b25607b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 16 Jul 2009 01:01:45 -0400 Subject: use 410 Gone for Twitter API --- actions/twitapistatuses.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php index c9943698d..e3d366ecc 100644 --- a/actions/twitapistatuses.php +++ b/actions/twitapistatuses.php @@ -396,8 +396,14 @@ class TwitapistatusesAction extends TwitterapiAction } else { // XXX: Twitter just sets a 404 header and doens't bother // to return an err msg - $this->clientError(_('No status with that ID found.'), - 404, $apidata['content-type']); + $deleted = Deleted_notice::staticGet($notice_id); + if (!empty($deleted)) { + $this->clientError(_('Status deleted.'), + 410, $apidata['content-type']); + } else { + $this->clientError(_('No status with that ID found.'), + 404, $apidata['content-type']); + } } } -- cgit v1.2.3-54-g00ecf From 9e611b40c643af9f40b9ef84e02b859205943745 Mon Sep 17 00:00:00 2001 From: Eric Helgeson Date: Tue, 28 Jul 2009 20:21:01 -0500 Subject: Splitting br3nda's merge 97db6e17b3f76e9a6acf87ddbad47ba54e9b1a3b Adding deleted_notice to pg.sql --- db/laconica_pg.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index ad34720a2..b5626d3f4 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -529,6 +529,17 @@ create table session ( create index session_modified_idx on session (modified); +create table deleted_notice ( + + id integer primary key /* comment 'identity of notice'*/ , + profile_id integer /* not null comment 'author of the notice'*/, + uri varchar(255) unique /* comment 'universally unique identifier, usually a tag URI'*/, + created timestamp not null /* comment 'date the notice record was created'*/ , + deleted timestamp not null DEFAULT CURRENT_TIMESTAMP /* comment 'date the notice record was created'*/ +); + +CREATE index deleted_notice_profile_id_idx on deleted_notice (profile_id); + /* Textsearch stuff */ -- cgit v1.2.3-54-g00ecf