Exemplo n.º 1
0
        local_dir_update($argv[1], $force);
        q("update channel set channel_dirdate = '%s' where channel_id = %d limit 1", dbesc(datetime_convert()), intval($channel['channel_id']));
        // Now update all the connections
        if ($pushall) {
            proc_run('php', 'include/notifier.php', 'refresh_all', $channel['channel_id']);
        }
        return;
    }
    $directory = find_upstream_directory($dirmode);
    $url = $directory['url'] . '/post';
    // ensure the upstream directory is updated
    $packet = zot_build_packet($channel, $force ? 'force_refresh' : 'refresh');
    $z = zot_zot($url, $packet);
    // re-queue if unsuccessful
    if (!$z['success']) {
        // FIXME - we aren't updating channel_dirdate if we have to queue
        // the directory packet. That means we'll try again on the next poll run.
        $hash = random_string();
        q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) \n\t\t\tvalues ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )", dbesc($hash), intval($channel['channel_account_id']), intval($channel['channel_id']), dbesc('zot'), dbesc($url), intval(1), dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc($packet), dbesc(''));
    } else {
        q("update channel set channel_dirdate = '%s' where channel_id = %d limit 1", dbesc(datetime_convert()), intval($channel['channel_id']));
    }
    // Now update all the connections
    if ($pushall) {
        proc_run('php', 'include/notifier.php', 'refresh_all', $channel['channel_id']);
    }
}
if (array_search(__FILE__, get_included_files()) === 0) {
    directory_run($argv, $argc);
    killme();
}
Exemplo n.º 2
0
    }
    if (is_null($db)) {
        @(include ".htconfig.php");
        require_once "include/dba.php";
        $db = new dba($db_host, $db_user, $db_pass, $db_data);
        unset($db_host, $db_user, $db_pass, $db_data);
    }
    load_config('config');
    load_config('system');
    if ($argc != 2) {
        return;
    }
    load_config('system');
    load_hooks();
    $a->set_baseurl(get_config('system', 'url'));
    $dir = get_config('system', 'directory_submit_url');
    if (!strlen($dir)) {
        return;
    }
    $arr = array('url' => $argv[1]);
    call_hooks('globaldir_update', $arr);
    logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
    if (strlen($arr['url'])) {
        fetch_url($dir . '?url=' . bin2hex($arr['url']));
    }
    return;
}
if (array_search(__FILE__, get_included_files()) === 0) {
    directory_run($_SERVER["argv"], $_SERVER["argc"]);
    killme();
}