Example #1
0
function get_bug_from_log($log, $baseurl)
{
    $bugurl = '';
    $bugid = -1;
    $pos = -1;
    if ($baseurl != '') {
        $bugid_and_pos = get_bugid_and_pos_from_log($log);
        if ($bugid_and_pos !== false) {
            $bugid = $bugid_and_pos[0];
            $pos = $bugid_and_pos[1];
            $bugurl = XMLStrFormat($baseurl . $bugid);
        }
    }
    if ($bugurl == '') {
        return false;
    }
    return array($bugurl, $bugid, $pos);
}
Example #2
0
function get_bug_from_log($log, $baseurl)
{
    $bugurl = "";
    $bugid = -1;
    $pos = -1;
    if ($baseurl != "") {
        $bugid_and_pos = get_bugid_and_pos_from_log($log);
        if ($bugid_and_pos !== FALSE) {
            $bugid = $bugid_and_pos[0];
            $pos = $bugid_and_pos[1];
            $bugurl = XMLStrFormat($baseurl . $bugid);
        }
    }
    if ($bugurl == "") {
        return FALSE;
    }
    return array($bugurl, $bugid, $pos);
}
Example #3
0
/** Add an XML tag to a string */
function add_XML_value($tag, $value)
{
    $value = preg_replace_callback('/[\\x1b]/', 'xml_replace_callback', $value);
    return "<" . $tag . ">" . XMLStrFormat($value) . "</" . $tag . ">";
}
Example #4
0
        $file['bugpos'] = $bug[2];
    }
    if ($status == "UPDATED") {
        $diff_url = get_diff_url($projectid, $projecturl, $directory, $filename, $revision);
        $diff_url = XMLStrFormat($diff_url);
        $file['diff_url'] = $diff_url;
        $updatedfiles[] = $file;
    } else {
        if ($status == "MODIFIED") {
            $diff_url = get_diff_url($projectid, $projecturl, $directory, $filename);
            $diff_url = XMLStrFormat($diff_url);
            $file['diff_url'] = $diff_url;
            $locallymodified[] = $file;
        } else {
            $diff_url = get_diff_url($projectid, $projecturl, $directory, $filename);
            $diff_url = XMLStrFormat($diff_url);
            $file['diff_url'] = $diff_url;
            $conflictingfiles[] = $file;
        }
    }
}
// Updated files
$xml .= "dbAdd (true, \"" . $projectname . " Updated files  (" . count($updatedfiles) . ")\", \"\", 0, \"\", \"1\", \"\", \"\", \"\", \"\", \"\", \"\")\n";
$previousdir = "";
foreach ($updatedfiles as $file) {
    $directory = $file['directory'];
    if ($previousdir == "" || $directory != $previousdir) {
        $xml .= " dbAdd (true, \"" . $directory . "\", \"\", 1, \"\", \"1\", \"\", \"\", \"\", \"\", \"\", \"\")\n";
        $previousdir = $directory;
    }
    $xml .= " dbAdd ( false, \"" . $file['filename'] . " Revision: " . $file['revision'] . "\",\"" . $file['diff_url'] . "\",2,\"\",\"1\",\"" . $file['author'] . "\",\"" . $file['email'] . "\",\"" . $file['log'] . "\",\"" . $file['bugurl'] . "\",\"" . $file['bugid'] . "\",\"" . $file['bugpos'] . "\")\n";
Example #5
0
function get_updates_xml_from_commits($projectname, $projectid, $dates, $commits)
{
    $xml = "<updates>\n";
    $xml .= "<timestamp>" . date(FMT_DATETIMETZ, $dates['nightly-0']) . "</timestamp>";
    // Get revision numbers for the current day and "the last time it ran before that..."
    // Only works if the LIMIT 2 query below returns exactly 2 records and the date from
    // the most recent record matches the current 'nightly-0' date... If those criteria
    // are not met, the revision strings will be empty and no revision information will
    // be displayed on the resulting web page.
    //
    $revision_current = '';
    $revision_prior = '';
    $qry = "SELECT date, revision FROM dailyupdate " . "WHERE projectid='{$projectid}' " . "  AND date <= '" . gmdate(FMT_DATE, $dates['nightly-0']) . "' " . "ORDER BY date DESC LIMIT 2";
    $rows = pdo_all_rows_query($qry);
    if (count($rows) == 2) {
        if ($rows[0]['date'] == gmdate(FMT_DATE, $dates['nightly-0'])) {
            $revision_current = $rows[0]['revision'];
            $revision_prior = $rows[1]['revision'];
        }
    }
    $xml .= add_XML_value("revision", $revision_current);
    $xml .= add_XML_value("priorrevision", $revision_prior);
    $xml .= add_XML_value("revisionurl", get_revision_url($projectid, $revision_current, $revision_prior));
    $xml .= add_XML_value("revisiondiff", get_revision_url($projectid, $revision_prior, ''));
    // no prior prior revision...
    $xml .= "<javascript>\n";
    // Args to dbAdd : "true" means directory, "false" means file
    //
    $xml .= "dbAdd(true, \"Updated files  (" . count($commits) . ")\", \"\", 0, \"\", \"1\", \"\", \"\", \"\", \"\", \"\")\n";
    $previousdir = "";
    usort($commits, "sort_by_directory_file_time");
    $projecturl = get_project_property($projectname, "cvsurl");
    foreach ($commits as $commit) {
        $directory = $commit['directory'];
        if ($directory != $previousdir) {
            $xml .= "dbAdd(true, \"" . $directory . "\", \"\", 1, \"\", \"1\", \"\", \"\", \"\", \"\", \"\")\n";
            $previousdir = $directory;
        }
        $filename = $commit['filename'];
        $revision = '';
        if ($commit['priorrevision'] != "-1") {
            $revision = $commit['revision'];
        }
        $time = gmdate(FMT_DATETIME, strtotime($commit['time']));
        $author = $commit['author'];
        // Only display email if the user is logged in
        if (isset($_SESSION['cdash'])) {
            if (isset($commit['email'])) {
                $email = $commit['email'];
            } else {
                $email = get_author_email($projectname, $author);
            }
        } else {
            // If the author is an email (git for instance) we remove everything after the @
            $posat = strpos($author, '@');
            if ($posat !== false) {
                $author = substr($author, 0, $posat);
            }
            $email = "";
        }
        $comment = $commit['comment'];
        $comment = str_replace("\n", " ", $comment);
        // Do this twice so that <something> ends up as
        // &amp;lt;something&amp;gt; because it gets sent to a
        // java script function not just displayed as html
        $comment = XMLStrFormat($comment);
        $comment = XMLStrFormat($comment);
        $diff_url = get_diff_url(get_project_id($projectname), $projecturl, $directory, $filename, $revision);
        $diff_url = XMLStrFormat($diff_url);
        $xml .= "dbAdd(false, \"" . $filename . "  Revision: " . $revision . "\",\"" . $diff_url . "\",2,\"\",\"1\",\"" . $author . "\",\"" . $email . "\",\"" . $comment . "\",\"" . $commit['bugurl'] . "\",\"" . $commit['bugid'] . "\",\"" . $commit['bugpos'] . "\")\n";
    }
    $xml .= "</javascript>\n";
    $xml .= "</updates>";
    return $xml;
}
Example #6
0
/** Add an XML tag to a string */
function add_XML_value($tag, $value)
{
    $value = preg_replace_callback('/[\\x1b]/', 'xml_replace_callback', $value);
    return '<' . $tag . '>' . XMLStrFormat($value) . '</' . $tag . '>';
}