function send_bug($url, $dat, $bug) { unset($dat['comment']); $dat['bug'] = $bug; // create a request body to test if this bug is already in ES $request = array('query' => array('bool' => array('must' => array(array('field' => array('bug' => $bug)), array('field' => array('machinename' => $dat['machinename'])), array('field' => array('starttime' => $dat['starttime'])))))); log_msg("request: " . json_encode($request) . "\n"); // send the request to the _search url with HTTP GET $result = do_http_request($url . "_search", $request, 'GET'); log_msg("response: " . $result . "\n"); // find how many instances of this bug already exist in ES $hits = json_decode($result)->hits->total; log_msg("hits: " . json_encode($hits) . "\n"); // if no instances exist, add to ES if ($hits == 0) { log_msg("writing bug to ES: " . json_encode($dat) . "\n"); $result = do_http_request($url, $dat); log_msg("result: " . $result . "\n"); } }
} else { $serverParams['AUTH_MODE'] = 'NONE'; } } else { $serverParams['AUTH_MODE'] = 'NONE'; } $serverParams['SECURE'] = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443; } else { //"Failed to perform Web Server Configuration Test for Bitrix WebDAV."; } if ($in = do_http_request('OPTIONS', '/docs/shared', null, null, "Microsoft Data Access Internet Publishing Provider")) { if (get_response_code($in) !== 301) { "Apache 'BrowserMatch \"Microsoft Data Access Internet Publishing Provider\" redirect-carefully' parameter should be disabled. Windows XP users may experience problems working by WebDAV protocol otherwise."; } } if ($in = do_http_request('OPTIONS', '/docs/shared', null, null, "Microsoft-WebDAV-MiniRedir")) { if (get_response_code($in) !== 301) { "Apache 'BrowserMatch \"Microsoft-WebDAV-MiniRedir\" redirect-carefully' parameter should be disabled. Microsoft Windows users may experience problems working by WebDAV protocol otherwise."; } } } else { $serverParams['AUTH_MODE'] = 'DIGEST'; $serverParams['SECURE'] = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443; } // end of admin part // user part /*$client = $_SERVER['HTTP_USER_AGENT']; if (preg_match("/(msie) ([0-9]{1,2}.[0-9]{1,3})/i", $client, $match)) { $browser['name'] = "MSIE"; $browser['version'] = $match[2]; }
function ghchangestate($pull, $state) { $content = json_encode(array("state" => $state)); $opts = array('method' => 'PATCH', 'content' => $content); return (bool) do_http_request($pull->_links->self->href, $opts); }