Example #1
0
<?php

/*=========================================================================
  Program:   CDash - Cross-Platform Dashboard System
  Module:    $Id$
  Language:  PHP
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) Kitware, Inc. All rights reserved.
  See LICENSE or http://www.cdash.org/licensing/ for details.

  This software is distributed WITHOUT ANY WARRANTY; without even
  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  PURPOSE. See the above copyright notices for more information.
=========================================================================*/
require_once dirname(dirname(__DIR__)) . '/config/config.php';
require_once 'include/dailyupdates.php';
$projectid = pdo_real_escape_numeric($_GET['projectid']);
addDailyChanges($projectid);
Example #2
0
function do_submit($filehandle, $projectid, $expected_md5 = '', $do_checksum = true, $submission_id = 0)
{
    include 'cdash/config.php';
    // We find the daily updates
    // If we have php curl we do it asynchronously
    if (function_exists("curl_init") == TRUE) {
        $currentURI = get_server_URI(true);
        $request = $currentURI . "/cdash/dailyupdatescurl.php?projectid=" . $projectid;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $request);
        curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_TIMEOUT, 1);
        if ($CDASH_USE_HTTPS) {
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        }
        curl_exec($ch);
        curl_close($ch);
    } else {
        include "cdash/dailyupdates.php";
        addDailyChanges($projectid);
    }
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists("local/submit.php")) {
        include "local/submit.php";
    }
    $scheduleid = 0;
    if ($submission_id !== 0) {
        $row = pdo_single_row_query("SELECT scheduleid from client_jobschedule2submission WHERE submissionid={$submission_id}");
        if (!empty($row)) {
            $scheduleid = $row[0];
        }
    } else {
        if (isset($_GET["clientscheduleid"])) {
            $scheduleid = pdo_real_escape_numeric($_GET["clientscheduleid"]);
        }
    }
    if ($CDASH_DB_TYPE != 'pgsql') {
        pdo_query("START TRANSACTION");
    }
    // Parse the XML file
    $handler = ctest_parse($filehandle, $projectid, $expected_md5, $do_checksum, $scheduleid);
    //this is the md5 checksum fail case
    if ($handler == FALSE) {
        //no need to log an error since ctest_parse already did
        return;
    }
    if ($CDASH_DB_TYPE != 'pgsql') {
        pdo_query("COMMIT");
    }
    // Send the emails if necessary
    if ($handler instanceof UpdateHandler) {
        send_update_email($handler, $projectid);
        sendemail($handler, $projectid);
    }
    if ($handler instanceof TestingHandler || $handler instanceof BuildHandler || $handler instanceof ConfigureHandler || $handler instanceof DynamicAnalysisHandler) {
        sendemail($handler, $projectid);
    }
    global $CDASH_ENABLE_FEED;
    if ($CDASH_ENABLE_FEED) {
        // Create the RSS feed
        CreateRSSFeed($projectid);
    }
}