some alteration to the way directory sync was originally supposed to work. I'm making this up as I go and not exactly certain where to go next but it makes more sense now and I think the basic idea will actually work. I'll just have to keep making it up until it does work.
This commit is contained in:
parent
f5519d9c77
commit
25a5a5ff4d
@ -493,7 +493,6 @@ function import_xchan($arr) {
|
|||||||
logger('import_xchan: existing: ' . print_r($r[0],true), LOGGER_DATA);
|
logger('import_xchan: existing: ' . print_r($r[0],true), LOGGER_DATA);
|
||||||
logger('import_xchan: new: ' . print_r($arr,true), LOGGER_DATA);
|
logger('import_xchan: new: ' . print_r($arr,true), LOGGER_DATA);
|
||||||
|
|
||||||
update_modtime($xchan_hash);
|
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -532,7 +531,7 @@ function import_xchan($arr) {
|
|||||||
dbesc($arr['name_updated']),
|
dbesc($arr['name_updated']),
|
||||||
intval($new_flags)
|
intval($new_flags)
|
||||||
);
|
);
|
||||||
update_modtime($xchan_hash);
|
|
||||||
$changed = true;
|
$changed = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -553,7 +552,7 @@ function import_xchan($arr) {
|
|||||||
dbesc($xchan_hash)
|
dbesc($xchan_hash)
|
||||||
);
|
);
|
||||||
|
|
||||||
update_modtime($xchan_hash);
|
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,7 +600,7 @@ function import_xchan($arr) {
|
|||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($r[0]['hubloc_id'])
|
intval($r[0]['hubloc_id'])
|
||||||
);
|
);
|
||||||
update_modtime($xchan_hash);
|
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -641,7 +640,7 @@ function import_xchan($arr) {
|
|||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc(datetime_convert())
|
dbesc(datetime_convert())
|
||||||
);
|
);
|
||||||
update_modtime($xchan_hash);
|
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,7 +652,7 @@ function import_xchan($arr) {
|
|||||||
$r = q("delete from hubloc where hubloc_id = %d limit 1",
|
$r = q("delete from hubloc where hubloc_id = %d limit 1",
|
||||||
intval($x['hubloc_id'])
|
intval($x['hubloc_id'])
|
||||||
);
|
);
|
||||||
update_modtime($xchan_hash);
|
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -667,7 +666,7 @@ function import_xchan($arr) {
|
|||||||
if(array_key_exists('profile',$arr) && is_array($arr['profile'])) {
|
if(array_key_exists('profile',$arr) && is_array($arr['profile'])) {
|
||||||
$profile_changed = import_directory_profile($xchan_hash,$arr['profile']);
|
$profile_changed = import_directory_profile($xchan_hash,$arr['profile']);
|
||||||
if($profile_changed) {
|
if($profile_changed) {
|
||||||
update_modtime($xchan_hash);
|
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -686,7 +685,6 @@ function import_xchan($arr) {
|
|||||||
if(array_key_exists('site',$arr) && is_array($arr['site'])) {
|
if(array_key_exists('site',$arr) && is_array($arr['site'])) {
|
||||||
$profile_changed = import_site($arr['site'],$arr['key']);
|
$profile_changed = import_site($arr['site'],$arr['key']);
|
||||||
if($profile_changed) {
|
if($profile_changed) {
|
||||||
update_modtime($xchan_hash);
|
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -694,9 +692,8 @@ function import_xchan($arr) {
|
|||||||
|
|
||||||
|
|
||||||
if($changed) {
|
if($changed) {
|
||||||
// send out a directory mirror update packet if we're a directory server or some kind
|
$guid = random_string() . '@' . get_app()->get_hostname();
|
||||||
|
update_modtime($xchan_hash,$guid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! x($ret,'message')) {
|
if(! x($ret,'message')) {
|
||||||
@ -1431,7 +1428,7 @@ function import_directory_profile($hash,$profile) {
|
|||||||
call_hooks('import_directory_profile', $d);
|
call_hooks('import_directory_profile', $d);
|
||||||
|
|
||||||
if($d['update'])
|
if($d['update'])
|
||||||
update_modtime($arr['xprof_hash']);
|
update_modtime($arr['xprof_hash'],random_string() . '@' . get_app()->get_hostname());
|
||||||
return $d['update'];
|
return $d['update'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1470,18 +1467,10 @@ function import_directory_keywords($hash,$keywords) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function update_modtime($hash) {
|
function update_modtime($hash,$guid) {
|
||||||
$r = q("select * from updates where ud_hash = '%s' limit 1",
|
q("insert into updates (ud_hash, ud_guid, ud_date) values ( '%s', '%s', '%s' )",
|
||||||
dbesc($hash)
|
|
||||||
);
|
|
||||||
if($r)
|
|
||||||
q("update updates set ud_date = '%s' where ud_hash = '%s' limit 1",
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc($hash)
|
|
||||||
);
|
|
||||||
else
|
|
||||||
q("insert into updates (ud_hash, ud_date) values ( '%s', '%s' )",
|
|
||||||
dbesc($hash),
|
dbesc($hash),
|
||||||
|
dbesc($guid),
|
||||||
dbesc(datetime_convert())
|
dbesc(datetime_convert())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
2013-09-08.430
|
2013-09-09.431
|
||||||
|
Reference in New Issue
Block a user