当前位置: 首页>>代码示例>>PHP>>正文


PHP Build::GetIdFromName方法代码示例

本文整理汇总了PHP中Build::GetIdFromName方法的典型用法代码示例。如果您正苦于以下问题:PHP Build::GetIdFromName方法的具体用法?PHP Build::GetIdFromName怎么用?PHP Build::GetIdFromName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Build的用法示例。


在下文中一共展示了Build::GetIdFromName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post_submit

/** Function to deal with the external tool mechanism */
function post_submit()
{
    include "models/buildfile.php";
    // We expect POST to contain the following values.
    $vars = array('project', 'build', 'stamp', 'site', 'track', 'type', 'starttime', 'endtime', 'datafilesmd5');
    foreach ($vars as $var) {
        if (!isset($_POST[$var]) || empty($_POST[$var])) {
            $response_array['status'] = 1;
            $response_array['description'] = 'Variable \'' . $var . '\' not set but required.';
            echo json_encode($response_array);
            return;
        }
    }
    $projectname = htmlspecialchars(pdo_real_escape_string($_POST['project']));
    $buildname = htmlspecialchars(pdo_real_escape_string($_POST['build']));
    $buildstamp = htmlspecialchars(pdo_real_escape_string($_POST['stamp']));
    $sitename = htmlspecialchars(pdo_real_escape_string($_POST['site']));
    $track = htmlspecialchars(pdo_real_escape_string($_POST['track']));
    $type = htmlspecialchars(pdo_real_escape_string($_POST['type']));
    $starttime = htmlspecialchars(pdo_real_escape_string($_POST['starttime']));
    $endtime = htmlspecialchars(pdo_real_escape_string($_POST['endtime']));
    // Check if we have the CDash@Home scheduleid
    $scheduleid = 0;
    if (isset($_POST["clientscheduleid"])) {
        $scheduleid = pdo_real_escape_numeric($_POST["clientscheduleid"]);
    }
    // Add the build
    $build = new Build();
    $build->ProjectId = get_project_id($projectname);
    $build->StartTime = gmdate(FMT_DATETIME, $starttime);
    $build->EndTime = gmdate(FMT_DATETIME, $endtime);
    $build->SubmitTime = gmdate(FMT_DATETIME);
    $build->Name = $buildname;
    $build->InsertErrors = false;
    // we have no idea if we have errors at this point
    $build->SetStamp($buildstamp);
    // Get the site id
    $site = new Site();
    $site->Name = $sitename;
    $site->Insert();
    $build->SiteId = $site->Id;
    // Make this an "append" build, so that it doesn't result in a separate row
    // from the rest of the "normal" submission.
    $build->Append = true;
    // TODO: Check the labels and generator and other optional
    if (isset($_POST["generator"])) {
        $build->Generator = htmlspecialchars(pdo_real_escape_string($_POST['generator']));
    }
    $subprojectname = "";
    if (isset($_POST["subproject"])) {
        $subprojectname = htmlspecialchars(pdo_real_escape_string($_POST['subproject']));
        $build->SetSubProject($subprojectname);
    }
    // Check if this build already exists.
    $buildid = $build->GetIdFromName($subprojectname);
    // If not, add a new one.
    if ($buildid === 0) {
        $buildid = add_build($build, $scheduleid);
    }
    // Returns the OK submission
    $response_array['status'] = 0;
    $response_array['buildid'] = $buildid;
    $buildfile = new BuildFile();
    // Check if the files exists
    foreach ($_POST['datafilesmd5'] as $md5) {
        $buildfile->md5 = $md5;
        $old_buildid = $buildfile->MD5Exists();
        if (!$old_buildid) {
            $response_array['datafilesmd5'][] = 0;
        } else {
            $response_array['datafilesmd5'][] = 1;
            // Associate this build file with the new build if it has been previously
            // uploaded.
            require_once "copy_build_data.php";
            copy_build_data($old_buildid, $buildid, $type);
        }
    }
    echo json_encode($response_array);
}
开发者ID:rpshaw,项目名称:CDash,代码行数:80,代码来源:do_submit.php


注:本文中的Build::GetIdFromName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。