poco: Only update the global contacts when there is a network value/Export your own contact as well

pull/1318/head
Michael Vogel 2015-01-25 16:40:20 +01:00
parent 105d6a22a4
commit bc2c046446
3 changed files with 18 additions and 16 deletions

View File

@ -345,7 +345,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
$result = Cache::get("probe_url:".$mode.":".$url); $result = Cache::get("probe_url:".$mode.":".$url);
if (!is_null($result)) { if (!is_null($result)) {
$result = unserialize($result); $result = unserialize($result);
return $result; return $result;
} }

View File

@ -113,21 +113,23 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$gender = $entry->gender; $gender = $entry->gender;
if(isset($entry->tags)) if(isset($entry->tags))
$keywords = implode(", ", $entry->tags); foreach($entry->tags as $tag)
$keywords = implode(", ", $tag);
poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $cid, $uid, $zcid); if ($network != "") {
poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $cid, $uid, $zcid);
// Update the Friendica contacts. Diaspora is doing it via a message. (See include/diaspora.php)
if (($location != "") OR ($about != "") OR ($keywords != "") OR ($gender != ""))
q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s'
WHERE `nurl` = '%s' AND NOT `self` AND `network` = '%s'",
dbesc($location),
dbesc($about),
dbesc($keywords),
dbesc($gender),
dbesc(normalise_link($profile_url)),
dbesc(NETWORK_DFRN));
// Update the Friendica contacts. Diaspora is doing it via a message. (See include/diaspora.php)
if (($location != "") OR ($about != "") OR ($keywords != "") OR ($gender != ""))
q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s'
WHERE `nurl` = '%s' AND NOT `self` AND `network` = '%s'",
dbesc($location),
dbesc($about),
dbesc($keywords),
dbesc($gender),
dbesc(normalise_link($profile_url)),
dbesc(NETWORK_DFRN));
}
} }
logger("poco_load: loaded $total entries",LOGGER_DEBUG); logger("poco_load: loaded $total entries",LOGGER_DEBUG);

View File

@ -46,8 +46,8 @@ function poco_init(&$a) {
if($justme) if($justme)
$sql_extra = " AND `contact`.`self` = 1 "; $sql_extra = " AND `contact`.`self` = 1 ";
else // else
$sql_extra = " AND `contact`.`self` = 0 "; // $sql_extra = " AND `contact`.`self` = 0 ";
if($cid) if($cid)
$sql_extra = sprintf(" AND `contact`.`id` = %d ",intval($cid)); $sql_extra = sprintf(" AND `contact`.`id` = %d ",intval($cid));