fix regdir

This commit is contained in:
friendica 2015-03-31 21:06:48 -07:00
parent c98de44528
commit 6f78d7a85d
3 changed files with 13 additions and 6 deletions

View File

@ -174,7 +174,7 @@ function poller_run($argv, $argc){
); );
$dirmode = intval(get_config('system','directory_mode')); $dirmode = intval(get_config('system','directory_mode'));
if($dirmode === DIRECTORY_MODE_SECONDARY) { if($dirmode === DIRECTORY_MODE_SECONDARY || $dirmode === DIRECTORY_MODE_PRIMARY) {
logger('regdir: ' . print_r(z_fetch_url(get_directory_primary() . '/regdir?f=&url=' . urlencode(z_root()) . '&realm=' . urlencode(get_directory_realm())),true)); logger('regdir: ' . print_r(z_fetch_url(get_directory_primary() . '/regdir?f=&url=' . urlencode(z_root()) . '&realm=' . urlencode(get_directory_realm())),true));
} }

View File

@ -622,7 +622,7 @@ function post_post(&$a) {
dbesc($data['callback']) dbesc($data['callback'])
); );
if($r) { if($r) {
logger('mod_zot: succesful pickup message received from ' . $data['callback'] . ' ' . count($r) . ' message(s) picked up', LOGGER_DEBUG); logger('mod_zot: successful pickup message received from ' . $data['callback'] . ' ' . count($r) . ' message(s) picked up', LOGGER_DEBUG);
$ret['success'] = true; $ret['success'] = true;
$ret['pickup'] = array(); $ret['pickup'] = array();
@ -919,6 +919,10 @@ function post_post(&$a) {
} }
if ($msgtype === 'notify') { if ($msgtype === 'notify') {
logger('notify received from ' . $hub['hubloc_url']);
$async = get_config('system','queued_fetch'); $async = get_config('system','queued_fetch');
if ($async) { if ($async) {

View File

@ -50,7 +50,8 @@ function regdir_init(&$a) {
if ($url) { if ($url) {
$m = parse_url($url); $m = parse_url($url);
if ((! $m) || (! @dns_get_record($m['host'], DNS_A + DNS_CNAME + DNS_PTR)) || (! filter_var($m['host'], FILTER_VALIDATE_IP) )) { if ((! $m) || ((! @dns_get_record($m['host'], DNS_A + DNS_CNAME + DNS_PTR)) && (! filter_var($m['host'], FILTER_VALIDATE_IP) ))) {
$result['message'] = 'unparseable url'; $result['message'] = 'unparseable url';
json_return_and_die($result); json_return_and_die($result);
} }
@ -62,11 +63,13 @@ function regdir_init(&$a) {
$x = import_xchan($j); $x = import_xchan($j);
if($x['success']) { if($x['success']) {
$result['success'] = true; $result['success'] = true;
json_return_and_die($result);
} }
} }
} }
if(! $result['success'])
$valid = 0;
q("update site set site_valid = %d where site_url = '%s' limit 1", q("update site set site_valid = %d where site_url = '%s' limit 1",
intval($valid), intval($valid),
strtolower($url) strtolower($url)
@ -75,11 +78,11 @@ function regdir_init(&$a) {
json_return_and_die($result); json_return_and_die($result);
} else { } else {
// We can put this in the sql without the condition after 31 april 2015 assuming // We can put this in the sql without the condition after 31 august 2015 assuming
// most directory servers will have updated by then // most directory servers will have updated by then
// This just makes sure it happens if I forget // This just makes sure it happens if I forget
$sql_extra = ((datetime_convert() > datetime_convert('UTC','UTC','2015-04-31')) ? ' and site_valid = 1 ' : '' ); $sql_extra = ((datetime_convert() > datetime_convert('UTC','UTC','2015-08-31')) ? ' and site_valid = 1 ' : '' );
if ($dirmode == DIRECTORY_MODE_STANDALONE) { if ($dirmode == DIRECTORY_MODE_STANDALONE) {
$r = array(array('site_url' => z_root())); $r = array(array('site_url' => z_root()));
} else { } else {