From fc9453b7e99fd5b87fde4206086ab51b0b1ea9cb Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Jan 2018 23:20:19 +0000 Subject: [PATCH] Corrected field names --- database.sql | 15 +++++++++++++-- src/Database/DBStructure.php | 6 +++--- src/Protocol/Diaspora.php | 4 ++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/database.sql b/database.sql index 48c2e7ecee..79e81f1d22 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 3.6-dev (Asparagus) --- DB_UPDATE_VERSION 1239 +-- DB_UPDATE_VERSION 1241 -- ------------------------------------------ @@ -650,9 +650,10 @@ CREATE TABLE IF NOT EXISTS `notify-threads` ( -- CREATE TABLE IF NOT EXISTS `oembed` ( `url` varbinary(255) NOT NULL, + `maxwidth` int(11) NOT NULL, `content` mediumtext, `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', - PRIMARY KEY(`url`), + PRIMARY KEY(`url`,`maxwidth`), INDEX `created` (`created`) ) DEFAULT COLLATE utf8mb4_general_ci; @@ -669,6 +670,16 @@ CREATE TABLE IF NOT EXISTS `parsed_url` ( INDEX `created` (`created`) ) DEFAULT COLLATE utf8mb4_general_ci; +-- +-- TABLE participation +-- +CREATE TABLE IF NOT EXISTS `participation` ( + `iid` int(10) unsigned NOT NULL, + `server` varchar(60) NOT NULL, + `cid` int(10) unsigned NOT NULL, + PRIMARY KEY(`iid`,`server`) +) DEFAULT COLLATE utf8mb4_general_ci; + -- -- TABLE pconfig -- diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 6ceeb573fe..2d9b4fc13b 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -1301,12 +1301,12 @@ class DBStructure { ); $database["participation"] = array( "fields" => array( - "item" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1", "relation" => array("item" => "id")), - "contact" => array("type" => "int(10) unsigned", "not null" => "1", "relation" => array("contact" => "id")), + "iid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1", "relation" => array("item" => "id")), "server" => array("type" => "varchar(60)", "not null" => "1", "primary" => "1"), + "cid" => array("type" => "int(10) unsigned", "not null" => "1", "relation" => array("contact" => "id")), ), "indexes" => array( - "PRIMARY" => array("item", "server") + "PRIMARY" => array("iid", "server") ) ); $database["pconfig"] = array( diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 747a1b2e1f..b2a4389058 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -115,9 +115,9 @@ class Diaspora { $r = dba::p("SELECT `contact`.`batch`, `contact`.`id`, `contact`.`name`, `contact`.`network`, `fcontact`.`batch` AS `fbatch`, `fcontact`.`network` AS `fnetwork` FROM `participation` - INNER JOIN `contact` ON `contact`.`id` = `participation`.`contact` + INNER JOIN `contact` ON `contact`.`id` = `participation`.`cid` LEFT JOIN `fcontact` ON `fcontact`.`url` = `contact`.`url` - WHERE `participation`.`item` = ?", $thread); + WHERE `participation`.`iid` = ?", $thread); while ($contact = dba::fetch($r)) { if (!empty($contact['fnetwork'])) {