]> git.mxchange.org Git - friendica.git/commitdiff
Bugfix Diaspora: We exited with the wrong return values and the guid for messages...
authorMichael <heluecht@pirati.ca>
Wed, 17 May 2017 19:25:30 +0000 (19:25 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 17 May 2017 19:25:30 +0000 (19:25 +0000)
boot.php
include/dbstructure.php
include/diaspora.php
mod/receive.php
update.php

index 4c09785c8e240489eb386589cdd9e92cadd7ada7..48381f5435b8043beb23e2638906ff637d1973b3 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -40,7 +40,7 @@ define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_CODENAME',     'Asparagus');
 define ( 'FRIENDICA_VERSION',      '3.5.2-rc' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
-define ( 'DB_UPDATE_VERSION',      1224      );
+define ( 'DB_UPDATE_VERSION',      1225      );
 
 /**
  * @brief Constant with a HTML line break.
index 6a14220c241bcdef90757555074e3a0a000da964..c9c37c9390bcca0f45153d0cd33cc6744ced9320 100644 (file)
@@ -808,7 +808,7 @@ function db_definition() {
        $database["conv"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
+                                       "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "recips" => array("type" => "text"),
                                        "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
                                        "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
@@ -1205,7 +1205,7 @@ function db_definition() {
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
                                        "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
-                                       "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
+                                       "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
index 820f8bd8967d73ed997653e2c1a0aff1e8368f5e..545edcc4bf11a848726589823fc66906d030850a 100644 (file)
@@ -1395,7 +1395,7 @@ class Diaspora {
 
                $message_id = self::message_exists($importer["uid"], $guid);
                if ($message_id) {
-                       return $message_id;
+                       return true;
                }
 
                $parent_item = self::parent_item($importer["uid"], $parent_guid, $author, $contact);
@@ -1454,6 +1454,10 @@ class Diaspora {
 
                $message_id = item_store($datarray);
 
+               if ($message_id <= 0) {
+                       return false;
+               }
+
                if ($message_id) {
                        logger("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
                }
@@ -1472,7 +1476,7 @@ class Diaspora {
                        proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $message_id);
                }
 
-               return $message_id;
+               return true;
        }
 
        /**
@@ -1623,7 +1627,7 @@ class Diaspora {
                }
                if (!$conversation) {
                        logger("unable to create conversation.");
-                       return;
+                       return false;
                }
 
                foreach ($messages as $mesg)
@@ -1701,7 +1705,7 @@ class Diaspora {
 
                $message_id = self::message_exists($importer["uid"], $guid);
                if ($message_id)
-                       return $message_id;
+                       return true;
 
                $parent_item = self::parent_item($importer["uid"], $parent_guid, $author, $contact);
                if (!$parent_item)
@@ -1754,8 +1758,13 @@ class Diaspora {
 
                $message_id = item_store($datarray);
 
-               if ($message_id)
+               if ($message_id <= 0) {
+                       return false;
+               }
+
+               if ($message_id) {
                        logger("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
+               }
 
                // If we are the origin of the parent we store the original data and notify our followers
                if ($message_id AND $parent_item["origin"]) {
@@ -1771,7 +1780,7 @@ class Diaspora {
                        proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $message_id);
                }
 
-               return $message_id;
+               return true;
        }
 
        /**
@@ -2348,7 +2357,7 @@ class Diaspora {
 
                $message_id = self::message_exists($importer["uid"], $guid);
                if ($message_id) {
-                       return $message_id;
+                       return true;
                }
 
                $original_item = self::original_item($root_guid, $root_author, $author);
@@ -2399,9 +2408,10 @@ class Diaspora {
 
                if ($message_id) {
                        logger("Stored reshare ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
+                       return true;
+               } else {
+                       return false;
                }
-
-               return $message_id;
        }
 
        /**
@@ -2532,7 +2542,7 @@ class Diaspora {
 
                $message_id = self::message_exists($importer["uid"], $guid);
                if ($message_id) {
-                       return $message_id;
+                       return true;
                }
 
                $address = array();
@@ -2616,9 +2626,10 @@ class Diaspora {
 
                if ($message_id) {
                        logger("Stored item ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
+                       return true;
+               } else {
+                       return false;
                }
-
-               return $message_id;
        }
 
        /* ************************************************************************************** *
index 2873cb971af703286836e10049a2548c9bf039fc..8b28c1656225cc60dba12e6c0a38c6b9c45f528a 100644 (file)
@@ -63,14 +63,14 @@ function receive_post(App $a) {
 
        logger('mod-diaspora: dispatching', LOGGER_DEBUG);
 
-       $ret = 0;
+       $ret = true;
        if ($public) {
                Diaspora::dispatch_public($msg);
        } else {
                $ret = Diaspora::dispatch($importer, $msg);
        }
 
-       http_status_exit(($ret) ? $ret : 200);
+       http_status_exit(($ret) ? 200 : 500);
        // NOTREACHED
 }
 
index e3b1c31b33a5fee9cc01c8c97eb11b6877ef7a3c..9c509be4b7a4ee5e1876affea8ad44b4942d44d1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define('UPDATE_VERSION' , 1224);
+define('UPDATE_VERSION' , 1225);
 
 /**
  *