Exemplo n.º 1
0
function generate_all($userid)
{
    global $db;
    $query = $db->prepare('SELECT MAX(date) AS latest FROM summary WHERE userid = :userid');
    $query->execute(array(':userid' => $userid));
    $result = $query->fetchAll(PDO::FETCH_ASSOC);
    $latest = $result[0]['latest'];
    unset($query, $result);
    generate_status($userid, $latest);
    generate_summary($userid);
    generate_common_words($userid, $latest);
    generate_chapters($userid);
}
Exemplo n.º 2
0
function issue_create()
{
    global $svcissue;
    if ($svcissue) {
        $ngid = getenv("NAGIOS_SERVICEPROBLEMID");
    } else {
        $ngid = getenv("NAGIOS_HOSTPROBLEMID");
    }
    $url = JIRA_BASE . "/rest/api/2/issue/";
    $issue_JSON["fields"]["issuetype"]["id"] = JIRA_ISSUE_TYPE;
    $issue_JSON["fields"]["project"]["id"] = JIRA_PROJECT_ID;
    $issue_JSON["fields"]["priority"]["id"] = "2";
    $issue_JSON["fields"]["summary"] = generate_summary();
    $issue_JSON["fields"]["description"] = generate_description("create");
    $issue_JSON["fields"]["customfield_" . JIRA_FIELD_NGALERTID] = $ngid;
    $issue_create = call_jira($url, $type = "POST", $issue_JSON);
    // Ensure that the cURL request was successful.
    if ($issue_create === FALSE) {
        $errstr = "Unable to initialise cURL session when attempting to create an issue in JIRA! Aborting.";
        trigger_error($errstr, E_USER_ERROR);
        exit(1);
    } else {
        $result_json = json_decode($issue_create, TRUE);
        $issue_id = $result_json["id"];
    }
    exit(0);
}