]> git.mxchange.org Git - friendica.git/commitdiff
Use "uri-id" for item relations
authorMichael <heluecht@pirati.ca>
Wed, 17 Oct 2018 18:34:24 +0000 (18:34 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 17 Oct 2018 18:34:24 +0000 (18:34 +0000)
boot.php
config/dbstructure.json
src/Model/Item.php
update.php

index ea1b273f2e8f24fac000e355ce1293ee1bcab174..939c6829fce0acbe50c4e905b3673810b8abaf67 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -41,7 +41,7 @@ define('FRIENDICA_PLATFORM',     'Friendica');
 define('FRIENDICA_CODENAME',     'The Tazmans Flax-lily');
 define('FRIENDICA_VERSION',      '2018.12-dev');
 define('DFRN_PROTOCOL_VERSION',  '2.23');
-define('DB_UPDATE_VERSION',      1287);
+define('DB_UPDATE_VERSION',      1288);
 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
 
 /**
index 51cb3ce4f3f84037259e6b1b39c84c9ac4b843f1..da1da7a66b1a295242db1cf7aaa4ff2af39765c2 100644 (file)
                "indexes": {
                        "PRIMARY": ["id"],
                        "uri-hash": ["UNIQUE", "uri-hash"],
-                       "uri": ["uri(191)"]
+                       "uri": ["uri(191)"],
+                       "uri-id": ["uri-id"]
                }
        },
        "item-content": {
                "indexes": {
                        "PRIMARY": ["id"],
                        "uri-plink-hash": ["UNIQUE", "uri-plink-hash"],
-                       "uri": ["uri(191)"]
+                       "uri": ["uri(191)"],
+                       "uri-id": ["uri-id"]
                }
        },
        "item-delivery-data": {
index 824e240cc36e54edcf7377889a80878ecfbb35d8..1248ddc020112da310de3000d526be6e1f1316ee 100644 (file)
@@ -665,11 +665,11 @@ class Item extends BaseObject
                }
 
                if (strpos($sql_commands, "`item-activity`.") !== false) {
-                       $joins .= " LEFT JOIN `item-activity` ON `item-activity`.`id` = `item`.`iaid`";
+                       $joins .= " LEFT JOIN `item-activity` ON `item-activity`.`uri-id` = `item`.`uri-id`";
                }
 
                if (strpos($sql_commands, "`item-content`.") !== false) {
-                       $joins .= " LEFT JOIN `item-content` ON `item-content`.`id` = `item`.`icid`";
+                       $joins .= " LEFT JOIN `item-content` ON `item-content`.`uri-id` = `item`.`uri-id`";
                }
 
                if (strpos($sql_commands, "`item-delivery-data`.") !== false) {
index 56f285f2df9037f8f2dc405258f7bd51f495554b..d889e241e22061f56b549857a82995ce023c8957 100644 (file)
@@ -246,3 +246,12 @@ function update_1278() {
 
        return UPDATE_SUCCESS;
 }
+
+function update_1288() {
+       // Updates missing `uri-id` values
+
+       DBA::e("UPDATE `item-activity` INNER JOIN `item` ON `item`.`iaid` = `item-activity`.`id` SET `item-activity`.`uri-id` = `item`.`uri-id` WHERE `item-activity`.`uri-id` IS NULL OR `item-activity`.`uri-id` = 0");
+       DBA::e("UPDATE `item-content` INNER JOIN `item` ON `item`.`icid` = `item-content`.`id` SET `item-content`.`uri-id` = `item`.`uri-id` WHERE `item-content`.`uri-id` IS NULL OR `item-content`.`uri-id` = 0");
+
+       return UPDATE_SUCCESS;
+}