diff options
-rw-r--r-- | boot.php | 2 | ||||
-rw-r--r-- | database.sql | 8 | ||||
-rw-r--r-- | include/items.php | 1 | ||||
-rw-r--r-- | mod/item.php | 6 | ||||
-rw-r--r-- | mod/network.php | 2 | ||||
-rw-r--r-- | update.php | 9 |
6 files changed, 20 insertions, 8 deletions
@@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000); define ( 'FRIENDIKA_VERSION', '2.2.1020' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1066 ); +define ( 'DB_UPDATE_VERSION', 1067 ); define ( 'EOL', "<br />\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index 284ab0afc..b99796d83 100644 --- a/database.sql +++ b/database.sql @@ -169,9 +169,10 @@ CREATE TABLE IF NOT EXISTS `item` ( `parent-uri` char(255) NOT NULL, `extid` char(255) NOT NULL, `thr-parent` char(255) NOT NULL, - `created` datetime NOT NULL, - `edited` datetime NOT NULL, - `changed` datetime NOT NULL, + `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `owner-name` char(255) NOT NULL, `owner-link` char(255) NOT NULL, `owner-avatar` char(255) NOT NULL, @@ -215,6 +216,7 @@ CREATE TABLE IF NOT EXISTS `item` ( KEY `extid` (`extid`), KEY `created` (`created`), KEY `edited` (`edited`), + KEY `received` (`received`), KEY `visible` (`visible`), KEY `deleted` (`deleted`), KEY `last-child` (`last-child`), diff --git a/include/items.php b/include/items.php index 3901927fc..2a934af3a 100644 --- a/include/items.php +++ b/include/items.php @@ -669,6 +669,7 @@ function item_store($arr,$force_parent = false) { $arr['owner-avatar'] = ((x($arr,'owner-avatar')) ? notags(trim($arr['owner-avatar'])) : ''); $arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert()); $arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert()); + $arr['received'] = datetime_convert(); $arr['changed'] = datetime_convert(); $arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : ''); $arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : ''); diff --git a/mod/item.php b/mod/item.php index 22eba7b3f..f87b6074a 100644 --- a/mod/item.php +++ b/mod/item.php @@ -419,6 +419,7 @@ function item_post(&$a) { $datarray['author-avatar'] = $author['thumb']; $datarray['created'] = datetime_convert(); $datarray['edited'] = datetime_convert(); + $datarray['received'] = datetime_convert(); $datarray['changed'] = datetime_convert(); $datarray['uri'] = $uri; $datarray['title'] = $title; @@ -473,9 +474,9 @@ function item_post(&$a) { $r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, - `author-name`, `author-link`, `author-avatar`, `created`, `edited`, `changed`, `uri`, `title`, `body`, `app`, `location`, `coord`, + `author-name`, `author-link`, `author-avatar`, `created`, `edited`, `received`, `changed`, `uri`, `title`, `body`, `app`, `location`, `coord`, `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach` ) - VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s' )", + VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s' )", intval($datarray['uid']), dbesc($datarray['type']), intval($datarray['wall']), @@ -489,6 +490,7 @@ function item_post(&$a) { dbesc($datarray['author-avatar']), dbesc($datarray['created']), dbesc($datarray['edited']), + dbesc($datarray['received']), dbesc($datarray['changed']), dbesc($datarray['uri']), dbesc($datarray['title']), diff --git a/mod/network.php b/mod/network.php index 75775ba50..9c5202ad2 100644 --- a/mod/network.php +++ b/mod/network.php @@ -212,7 +212,7 @@ function network_content(&$a, $update = 0) { AND `contact`.`id` = `item`.`contact-id` AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 $sql_extra - ORDER BY `item`.`created` DESC LIMIT %d ,%d ", + ORDER BY `item`.`received` DESC LIMIT %d ,%d ", intval($_SESSION['uid']), intval($a->pager['start']), intval($a->pager['itemspage']) diff --git a/update.php b/update.php index 8edd2aa92..13187ac51 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1066 ); +define( 'UPDATE_VERSION' , 1067 ); /** * @@ -529,3 +529,10 @@ function update_1065() { q("ALTER TABLE `intro` ADD `fid` INT NOT NULL DEFAULT '0' AFTER `uid`"); } +function update_1066() { + $r = q("ALTER TABLE `item` ADD `received` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` "); + if($r) + q("ALTER TABLE `item` ADD INDEX ( `received` ) "); + + $r = q("UPDATE `item` SET `received` = `edited` WHERE 1"); +}
\ No newline at end of file |