Browse Source

Bugfix: Fetching data from noscrape had several issues

pull/1791/head
Michael Vogel 5 years ago
parent
commit
6ab304b564
4 changed files with 17 additions and 6 deletions
  1. +1
    -1
      boot.php
  2. +1
    -0
      include/dbstructure.php
  3. +14
    -4
      include/socgraph.php
  4. +1
    -1
      update.php

+ 1
- 1
boot.php View File

@ -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' );


+ 1
- 0
include/dbstructure.php View 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" => ""),


+ 14
- 4
include/socgraph.php View 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


+ 1
- 1
update.php View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1186 );
define( 'UPDATE_VERSION' , 1187 );
/**
*


Loading…
Cancel
Save