本文整理汇总了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);
}