<commit_before><?php

date_default_timezone_set('America/Detroit');
require 'vendor/autoload.php';
$PROJROOT = dirname(__FILE__) . "/";
require_once $PROJROOT . "src/Utils.php";
require_once $PROJROOT . "src/Hipchat.php";

$CONFIG = getConfig($PROJROOT);

$channels = $CONFIG['channels'];
$outputString = "";

foreach ($channels as $channel) {
    $hipchat = new Hipchat($channel);

    $jenkinsserver = $channel['jenkinsserver'];
    echo "Connecting to " . $jenkinsserver . "\n";
    $jenkins = new \JenkinsApi\Jenkins($jenkinsserver);

    $viewToWatch = $channel['jenkinsview'];
    echo "Loading jobs for view " . $viewToWatch . "\n";

    $view = $jenkins->getView($viewToWatch);

    $outputString = getBrokenBuildOutputText($view, $jenkins, $channel, $outputString);

    if (strlen($outputString) > 0) {
        $outputString = getGreeting() . "\n" . $outputString;
        $hipchat->postOutput($outputString);
    }
}

function getBrokenBuildOutputText($view, \JenkinsApi\Jenkins $jenkins, $channel, $outputString)
{
    foreach ($view->allJobs as $job) {
        if ($job->buildable == true) {
            if (strcmp($job->color, "red") == 0) {
                $failedJob = $jenkins->getJob($job->name);
                if ($failedJob->builds[0]->timestamp / 1000 < strtotime($channel['alerttimestring'])) {
                    $outputString .= "<a href=\"" . $job->url . "\">" . $job->name .
                        "</a> appears to have been broken since " .
                        getPrettyDateFromTimestamp($failedJob->builds[0]->timestamp / 1000) . " " . "\n";
                }<commit_msg>Updated deps requires change since $view->allJobs doesn't exist anymore.<commit_after><?php

date_default_timezone_set('America/Detroit');
require 'vendor/autoload.php';
$PROJROOT = dirname(__FILE__) . "/";
require_once $PROJROOT . "src/Utils.php";
require_once $PROJROOT . "src/Hipchat.php";

$CONFIG = getConfig($PROJROOT);

$channels = $CONFIG['channels'];
$outputString = "";

foreach ($channels as $channel) {
    $hipchat = new Hipchat($channel);

    $jenkinsserver = $channel['jenkinsserver'];
    echo "Connecting to " . $jenkinsserver . "\n";
    $jenkins = new \JenkinsApi\Jenkins($jenkinsserver);

    $viewToWatch = $channel['jenkinsview'];
    echo "Loading jobs for view " . $viewToWatch . "\n";

    $view = $jenkins->getView($viewToWatch);

    $outputString = getBrokenBuildOutputText($view, $jenkins, $channel, $outputString);

    if (strlen($outputString) > 0) {
        $outputString = getGreeting() . "\n" . $outputString;
        $hipchat->postOutput($outputString);
    }
}

function getBrokenBuildOutputText($view, \JenkinsApi\Jenkins $jenkins, $channel, $outputString)
{
    foreach ($view->jobs as $job) {
        if ($job->buildable == true) {
            if (strcmp($job->color, "red") == 0) {
                $failedJob = $jenkins->getJob($job->name);
                if ($failedJob->builds[0]->timestamp / 1000 < strtotime($channel['alerttimestring'])) {
                    $outputString .= "<a href=\"" . $job->url . "\">" . $job->name .
                        "</a> appears to have been broken since " .
                        getPrettyDateFromTimestamp($failedJob->builds[0]->timestamp / 1000) . " " . "\n";
                }
{'fraction_non_alphanumeric': 0.17155963302752295, 'fraction_numerical': 0.007339449541284404, 'mean_word_length': 2.9841656516443362, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2451001', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1018, 'n_words': 200}