From 0e35427dfcc06ee00fcb0f6369a0b76a2db1cbff Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 15 Jun 2016 21:20:55 +0200 Subject: [PATCH] New fields "author-id" and "owner-id" in the item table --- boot.php | 2 +- database.sql | 4 +++- include/dbstructure.php | 2 ++ include/items.php | 6 ++++++ update.php | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index 318a873467..62baf116da 100644 --- a/boot.php +++ b/boot.php @@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_CODENAME', 'Asparagus'); define ( 'FRIENDICA_VERSION', '3.5-dev' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1196 ); +define ( 'DB_UPDATE_VERSION', 1197 ); /** * @brief Constant with a HTML line break. diff --git a/database.sql b/database.sql index 8269a8bba0..275982d844 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 3.5-dev (Asparagus) --- DB_UPDATE_VERSION 1196 +-- DB_UPDATE_VERSION 1197 -- ------------------------------------------ @@ -458,9 +458,11 @@ CREATE TABLE IF NOT EXISTS `item` ( `commented` 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-id` int(11) NOT NULL DEFAULT 0, `owner-name` varchar(255) NOT NULL DEFAULT '', `owner-link` varchar(255) NOT NULL DEFAULT '', `owner-avatar` varchar(255) NOT NULL DEFAULT '', + `author-id` int(11) NOT NULL DEFAULT 0, `author-name` varchar(255) NOT NULL DEFAULT '', `author-link` varchar(255) NOT NULL DEFAULT '', `author-avatar` varchar(255) NOT NULL DEFAULT '', diff --git a/include/dbstructure.php b/include/dbstructure.php index f89a3ff926..8ae3ae6c8c 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -792,9 +792,11 @@ function db_definition() { "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), + "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), + "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), diff --git a/include/items.php b/include/items.php index 203b7d0eee..f5e568306e 100644 --- a/include/items.php +++ b/include/items.php @@ -584,6 +584,12 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa "photo" => $arr['author-avatar'], "name" => $arr['author-name'])); } + if ($arr["author-id"] == 0) + $arr["author-id"] = get_contact($arr["author-link"], 0); + + if ($arr["owner-id"] == 0) + $arr["owner-id"] = get_contact($arr["owner-link"], 0); + if ($arr['guid'] != "") { // Checking if there is already an item with the same guid logger('checking for an item for user '.$arr['uid'].' on network '.$arr['network'].' with the guid '.$arr['guid'], LOGGER_DEBUG); diff --git a/update.php b/update.php index 1189ac4a91..f2d790aa4c 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@