aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-09-15 03:48:43 -0700
committerfriendica <info@friendica.com>2013-09-15 03:48:43 -0700
commit129a119c84d87bffe099cea7ac5b0ed511c26f80 (patch)
tree831b0d681e2748aded17bc59ee4580a72ecd5cd5
parentaefb0f823353d15a281d3c94ec6fc044e1b62580 (diff)
downloadvolse-hubzilla-129a119c84d87bffe099cea7ac5b0ed511c26f80.tar.gz
volse-hubzilla-129a119c84d87bffe099cea7ac5b0ed511c26f80.tar.bz2
volse-hubzilla-129a119c84d87bffe099cea7ac5b0ed511c26f80.zip
implement what I hope will now be the server side of directory sync, add viewsrc to item_photo_menu, and log what changed in import_xchan update objects so we can find out why there are so many updates when nothing _obvious_ has changed that should trigger it.
-rw-r--r--include/conversation.php20
-rw-r--r--include/zot.php17
-rw-r--r--mod/dirsearch.php19
-rw-r--r--version.inc2
4 files changed, 40 insertions, 18 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 0c1479356..e7c7831c0 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -876,6 +876,12 @@ function item_photo_menu($item){
$ssl_state = false;
+ $sub_link="";
+ $poke_link="";
+ $contact_url="";
+ $pm_url="";
+ $vsrc_link = "";
+
if(local_user()) {
$ssl_state = true;
if(! count($a->contacts))
@@ -884,14 +890,11 @@ function item_photo_menu($item){
$channel_hash = (($channel) ? $channel['channel_hash'] : '');
}
- $sub_link="";
- $poke_link="";
- $contact_url="";
- $pm_url="";
-
- if((local_user()) && local_user() == $item['uid'] && $item['parent'] == $item['id']
- && $channel && ($channel_hash != $item['author_xchan'])) {
- $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
+ if((local_user()) && local_user() == $item['uid']) {
+ $vsrc_link = $a->get_baseurl() . '/viewsrc/' . $item['id'];
+ if($item['parent'] == $item['id'] && $channel && ($channel_hash != $item['author_xchan'])) {
+ $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
+ }
}
$profile_link = z_root() . "/chanview/?f=&hash=" . $item['author_xchan'];
@@ -910,6 +913,7 @@ function item_photo_menu($item){
}
$menu = Array(
+ t("View Source") => $vsrc_link,
t("Follow Thread") => $sub_link,
t("View Status") => $status_link,
t("View Profile") => $profile_link,
diff --git a/include/zot.php b/include/zot.php
index 53031a6c5..c461486f0 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -417,6 +417,7 @@ function import_xchan($arr) {
$dirmode = intval(get_config('system','directory_mode'));
$changed = false;
+ $what = '';
if(! (is_array($arr) && array_key_exists('success',$arr) && $arr['success'])) {
logger('import_xchan: invalid data packet: ' . print_r($arr,true));
@@ -492,7 +493,7 @@ function import_xchan($arr) {
logger('import_xchan: existing: ' . print_r($r[0],true), LOGGER_DATA);
logger('import_xchan: new: ' . print_r($arr,true), LOGGER_DATA);
-
+ $what .= 'xchan ';
$changed = true;
}
}
@@ -532,6 +533,7 @@ function import_xchan($arr) {
intval($new_flags)
);
+ $what .= 'new_xchan';
$changed = true;
}
@@ -552,7 +554,7 @@ function import_xchan($arr) {
dbesc($xchan_hash)
);
-
+ $what .= 'photo ';
$changed = true;
}
@@ -605,6 +607,7 @@ function import_xchan($arr) {
dbesc(datetime_convert()),
intval($r[0]['hubloc_id'])
);
+ $what = 'primary_hub ';
$changed = true;
}
continue;
@@ -644,7 +647,7 @@ function import_xchan($arr) {
dbesc(datetime_convert()),
dbesc(datetime_convert())
);
-
+ $what .= 'newhub ';
$changed = true;
}
@@ -656,7 +659,7 @@ function import_xchan($arr) {
$r = q("delete from hubloc where hubloc_id = %d limit 1",
intval($x['hubloc_id'])
);
-
+ $what .= 'removed_hub';
$changed = true;
}
}
@@ -670,7 +673,7 @@ function import_xchan($arr) {
if(array_key_exists('profile',$arr) && is_array($arr['profile'])) {
$profile_changed = import_directory_profile($xchan_hash,$arr['profile']);
if($profile_changed) {
-
+ $what .= 'profile ';
$changed = true;
}
}
@@ -689,6 +692,7 @@ function import_xchan($arr) {
if(array_key_exists('site',$arr) && is_array($arr['site'])) {
$profile_changed = import_site($arr['site'],$arr['key']);
if($profile_changed) {
+ $what .= 'site ';
$changed = true;
}
}
@@ -698,6 +702,7 @@ function import_xchan($arr) {
if($changed) {
$guid = random_string() . '@' . get_app()->get_hostname();
update_modtime($xchan_hash,$guid);
+ logger('import_xchan: changed: ' . $what,LOGGER_DEBUG);
}
if(! x($ret,'message')) {
@@ -1396,6 +1401,7 @@ function import_directory_profile($hash,$profile) {
$update = false;
foreach($r[0] as $k => $v) {
if((array_key_exists($k,$arr)) && ($arr[$k] != $v)) {
+ logger('import_directory_profile: update' . $k . ' => ' . $arr[$k]);
$update = true;
break;
}
@@ -1431,6 +1437,7 @@ function import_directory_profile($hash,$profile) {
}
else {
$update = true;
+ logger('import_directory_profile: new profile');
$x = q("insert into xprof (xprof_hash, xprof_desc, xprof_dob, xprof_age, xprof_gender, xprof_marital, xprof_sexual, xprof_locale, xprof_region, xprof_postcode, xprof_country, xprof_keywords) values ('%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
dbesc($arr['xprof_hash']),
dbesc($arr['xprof_desc']),
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 6034fdc12..04d77a298 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -41,6 +41,7 @@ function dirsearch_content(&$a) {
$agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 );
$agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 );
+ $sync = ((x($_REQUEST,'sync')) ? datetime_convert('UTC','UTC',$_REQUEST['sync']) : '');
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : '');
// TODO - a meta search which joins all of these things to one search string
@@ -82,6 +83,7 @@ function dirsearch_content(&$a) {
$limit = (($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 0);
$return_total = ((x($_REQUEST,'return_total')) ? intval($_REQUEST['return_total']) : 0);
+ // mtime is not currently working
$mtime = ((x($_REQUEST,'mtime')) ? datetime_convert('UTC','UTC',$_REQUEST['mtime']) : '');
@@ -124,11 +126,19 @@ function dirsearch_content(&$a) {
$order = " order by xchan_name asc ";
+ if($sync) {
- $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) $order $qlimit ",
- intval(XCHAN_FLAGS_HIDDEN),
- intval(XCHAN_FLAGS_ORPHAN)
- );
+ $r = q("select xchan.*, updates.* from xchan left join updates on ud_hash = xchan_hash where ud_date >= '%s' and ud_guid != '' order by ud_date desc",
+ dbesc($sync)
+ );
+
+ }
+ else {
+ $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) $order $qlimit ",
+ intval(XCHAN_FLAGS_HIDDEN),
+ intval(XCHAN_FLAGS_ORPHAN)
+ );
+ }
$ret['page'] = $page + 1;
$ret['records'] = count($r);
@@ -145,6 +155,7 @@ function dirsearch_content(&$a) {
$entry['hash'] = $rr['xchan_hash'];
$entry['updated'] = (($rr['ud_date']) ? $rr['ud_date'] : '0000-00-00 00:00:00');
+ $entry['update_guid'] = (($rr['ud_guid']) ? $rr['ud_guid'] : '');
$entry['url'] = $rr['xchan_url'];
$entry['photo'] = $rr['xchan_photo_m'];
$entry['address'] = $rr['xchan_addr'];
diff --git a/version.inc b/version.inc
index ca5f77852..2ee9add97 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-09-14.436
+2013-09-15.437