diff options
author | friendica <info@friendica.com> | 2013-09-09 01:05:29 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-09-09 01:05:29 -0700 |
commit | 25a5a5ff4dd457398d762f0ff92f01b134b92eaa (patch) | |
tree | f14791c62ee35f3234b72b35dc3064ad93a590bd /include | |
parent | f5519d9c773fc323eed1fa6429864cd4d5f57738 (diff) | |
download | volse-hubzilla-25a5a5ff4dd457398d762f0ff92f01b134b92eaa.tar.gz volse-hubzilla-25a5a5ff4dd457398d762f0ff92f01b134b92eaa.tar.bz2 volse-hubzilla-25a5a5ff4dd457398d762f0ff92f01b134b92eaa.zip |
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.
Diffstat (limited to 'include')
-rw-r--r-- | include/zot.php | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/include/zot.php b/include/zot.php index 46c894351..88a7f4529 100644 --- a/include/zot.php +++ b/include/zot.php @@ -493,7 +493,6 @@ 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); - update_modtime($xchan_hash); $changed = true; } } @@ -532,7 +531,7 @@ function import_xchan($arr) { dbesc($arr['name_updated']), intval($new_flags) ); - update_modtime($xchan_hash); + $changed = true; } @@ -553,7 +552,7 @@ function import_xchan($arr) { dbesc($xchan_hash) ); - update_modtime($xchan_hash); + $changed = true; } @@ -601,7 +600,7 @@ function import_xchan($arr) { dbesc(datetime_convert()), intval($r[0]['hubloc_id']) ); - update_modtime($xchan_hash); + $changed = true; } continue; @@ -641,7 +640,7 @@ function import_xchan($arr) { dbesc(datetime_convert()), dbesc(datetime_convert()) ); - update_modtime($xchan_hash); + $changed = true; } @@ -653,7 +652,7 @@ function import_xchan($arr) { $r = q("delete from hubloc where hubloc_id = %d limit 1", intval($x['hubloc_id']) ); - update_modtime($xchan_hash); + $changed = true; } } @@ -667,7 +666,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) { - update_modtime($xchan_hash); + $changed = true; } } @@ -686,7 +685,6 @@ 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) { - update_modtime($xchan_hash); $changed = true; } } @@ -694,9 +692,8 @@ function import_xchan($arr) { 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')) { @@ -1431,7 +1428,7 @@ function import_directory_profile($hash,$profile) { call_hooks('import_directory_profile', $d); if($d['update']) - update_modtime($arr['xprof_hash']); + update_modtime($arr['xprof_hash'],random_string() . '@' . get_app()->get_hostname()); return $d['update']; } @@ -1470,20 +1467,12 @@ function import_directory_keywords($hash,$keywords) { } -function update_modtime($hash) { - $r = q("select * from updates where ud_hash = '%s' limit 1", - dbesc($hash) +function update_modtime($hash,$guid) { + q("insert into updates (ud_hash, ud_guid, ud_date) values ( '%s', '%s', '%s' )", + dbesc($hash), + dbesc($guid), + dbesc(datetime_convert()) ); - 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(datetime_convert()) - ); } |