]> git.mxchange.org Git - friendica.git/commitdiff
new item view, sort by received date - not posted date.
authorFriendika <info@friendika.com>
Fri, 24 Jun 2011 00:56:59 +0000 (17:56 -0700)
committerFriendika <info@friendika.com>
Fri, 24 Jun 2011 00:56:59 +0000 (17:56 -0700)
boot.php
database.sql
include/items.php
mod/item.php
mod/network.php
update.php

index 0192f3c0f08567c28241fafb8a647462f2f07408..d042ffdca61b78ac4490ad3891cf3e67506ed0e1 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -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' );
index 284ab0afc87c97c00fa28885b8414071405802aa..b99796d83084ced53f808462b5177f697c503a5d 100644 (file)
@@ -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`),
index 3901927fcd673f801a156a2b7f2204db1ddefdc3..2a934af3ac7b0958f733df4dded402d3449430cf 100644 (file)
@@ -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']))      : '');
index 22eba7b3f5d3848d656edd4c68bc55ec66dc64f8..f87b6074a8e736d2616f3890cf0a1e71a7a58d8d 100644 (file)
@@ -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']),
index 75775ba502300e43a5d8badf4ec2ae6f62274800..9c5202ad2d4f666d6d4a45a54120069a940b2016 100644 (file)
@@ -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'])
index 8edd2aa9200c6c15f38212b9cfaadb70ca99d3ac..13187ac5117a9c802aea4bd608181146709f096e 100644 (file)
@@ -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