]> git.mxchange.org Git - friendica.git/commitdiff
Bugfix: Fetching data from noscrape had several issues
authorMichael Vogel <icarus@dabo.de>
Thu, 30 Jul 2015 14:30:18 +0000 (16:30 +0200)
committerMichael Vogel <icarus@dabo.de>
Thu, 30 Jul 2015 14:30:18 +0000 (16:30 +0200)
boot.php
include/dbstructure.php
include/socgraph.php
update.php

index ec803a1573c35d677ab6146173171a43c9f29e2c..2a11501033cbddc7f954697f180aced146b79204 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -19,7 +19,7 @@ define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_CODENAME',     'Lily of the valley');
 define ( 'FRIENDICA_VERSION',      '3.4.1' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
-define ( 'DB_UPDATE_VERSION',      1186      );
+define ( 'DB_UPDATE_VERSION',      1187      );
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
 
index e14ce64d813cfead61dc73d427c7be1fe23b2440..2370b01becc365b97e64fd5f1fbd6b31f6a65c4c 100644 (file)
@@ -639,6 +639,7 @@ function db_definition() {
                                        "about" => array("type" => "text", "not null" => "1"),
                                        "keywords" => array("type" => "text", "not null" => "1"),
                                        "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
+                                       "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
                                        "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
index 872b730e059ad316c6a708d0547f0b043cf7eef5..d114ef09cce8f304bda8ef72ba66912c25ef0e2d 100644 (file)
@@ -451,12 +451,14 @@ function poco_last_updated($profile, $force = false) {
 
                if ($server) {
                        $noscraperet = z_fetch_url($server[0]["noscrape"]."/".$gcontacts[0]["nick"]);
-                        if ($noscraperet["success"] AND ($noscraperet["body"] = "")) {
+
+                        if ($noscraperet["success"] AND ($noscraperet["body"] != "")) {
+;
                                $noscrape = json_decode($noscraperet["body"], true);
 
-                               if (($noscrape["name"] != "") AND ($noscrape["name"] != $gcontacts[0]["name"]))
+                               if (($noscrape["fn"] != "") AND ($noscrape["fn"] != $gcontacts[0]["name"]))
                                        q("UPDATE `gcontact` SET `name` = '%s' WHERE `nurl` = '%s'",
-                                               dbesc($noscrape["name"]), dbesc(normalise_link($profile)));
+                                               dbesc($noscrape["fn"]), dbesc(normalise_link($profile)));
 
                                if (($noscrape["photo"] != "") AND ($noscrape["photo"] != $gcontacts[0]["photo"]))
                                        q("UPDATE `gcontact` SET `photo` = '%s' WHERE `nurl` = '%s'",
@@ -470,10 +472,18 @@ function poco_last_updated($profile, $force = false) {
                                        q("UPDATE `gcontact` SET `gender` = '%s' WHERE `nurl` = '%s'",
                                                dbesc($noscrape["gender"]), dbesc(normalise_link($profile)));
 
-                               if (($noscrape["about"] != "") AND ($noscrape["about"] != $gcontacts[0]["name"]))
+                               if (($noscrape["pdesc"] != "") AND ($noscrape["pdesc"] != $gcontacts[0]["about"]))
+                                       q("UPDATE `gcontact` SET `about` = '%s' WHERE `nurl` = '%s'",
+                                               dbesc($noscrape["pdesc"]), dbesc(normalise_link($profile)));
+
+                               if (($noscrape["about"] != "") AND ($noscrape["about"] != $gcontacts[0]["about"]))
                                        q("UPDATE `gcontact` SET `about` = '%s' WHERE `nurl` = '%s'",
                                                dbesc($noscrape["about"]), dbesc(normalise_link($profile)));
 
+                               if (isset($noscrape["comm"]) AND ($noscrape["comm"] != $gcontacts[0]["community"]))
+                                       q("UPDATE `gcontact` SET `community` = %d WHERE `nurl` = '%s'",
+                                               intval($noscrape["comm"]), dbesc(normalise_link($profile)));
+
                                if (isset($noscrape["tags"]))
                                        $keywords = implode(" ", $noscrape["tags"]);
                                else
index 4f762661a51f143779e34ca5c521919b30017017..a2c86740284081df3cfe0aea89c6229f41f5652f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define( 'UPDATE_VERSION' , 1186 );
+define( 'UPDATE_VERSION' , 1187 );
 
 /**
  *