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


PHP Build::GetPreviousBuildId方法代码示例

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


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

示例1: Parse

 /**
  * Parse a tarball of .gcov files.
  **/
 public function Parse($filename)
 {
     // Create a new directory where we can extract our tarball.
     $dirName = sys_get_temp_dir() . '/' . pathinfo($filename, PATHINFO_FILENAME);
     mkdir($dirName);
     // Extract the tarball.
     $result = extract_tar($filename, $dirName);
     if ($result === false) {
         add_log('Could not extract ' . $filename . ' into ' . $dirName, 'GCovTarHandler::Parse', LOG_ERR);
         return false;
     }
     // Find the data.json file and extract the source directory from it.
     $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirName), RecursiveIteratorIterator::CHILD_FIRST);
     foreach ($iterator as $fileinfo) {
         if ($fileinfo->getFilename() == 'data.json') {
             $jsonContents = file_get_contents($fileinfo->getRealPath());
             $jsonDecoded = json_decode($jsonContents, true);
             if (is_null($jsonDecoded) || !array_key_exists('Source', $jsonDecoded) || !array_key_exists('Binary', $jsonDecoded)) {
                 DeleteDirectory($dirName);
                 return false;
             }
             $this->SourceDirectory = $jsonDecoded['Source'];
             $this->BinaryDirectory = $jsonDecoded['Binary'];
             break;
         }
     }
     if (empty($this->SourceDirectory) || empty($this->BinaryDirectory)) {
         DeleteDirectory($dirName);
         return false;
     }
     // Check if any Labels.json files were included
     $iterator->rewind();
     foreach ($iterator as $fileinfo) {
         if ($fileinfo->getFilename() == 'Labels.json') {
             $this->ParseLabelsFile($fileinfo);
         }
     }
     // Lookup some data used during coverage aggregation.
     $this->Build->ComputeTestingDayBounds();
     if ($this->Build->Type === 'Nightly') {
         $aggregateBuild = get_aggregate_build($this->Build);
         $aggregateParentId = $aggregateBuild->GetParentId();
         if ($aggregateParentId > 0) {
             $this->AggregateBuildId = $aggregateParentId;
             $aggregateParent = new Build();
             $aggregateParent->Id = $aggregateParentId;
             $this->PreviousAggregateParentId = $aggregateParent->GetPreviousBuildId();
         } else {
             $this->AggregateBuildId = $aggregateBuild->Id;
         }
     }
     // Recursively search for .gcov files and parse them.
     $iterator->rewind();
     foreach ($iterator as $fileinfo) {
         if (pathinfo($fileinfo->getFilename(), PATHINFO_EXTENSION) == 'gcov') {
             $this->ParseGcovFile($fileinfo);
         }
     }
     // Search for uncovered files.
     if (file_exists("{$dirName}/uncovered")) {
         $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("{$dirName}/uncovered"), RecursiveIteratorIterator::LEAVES_ONLY);
         foreach ($iterator as $fileinfo) {
             if ($fileinfo->isFile()) {
                 // Get the path of this uncovered file relative to its
                 // source directory.
                 $relativePath = str_replace("{$dirName}/uncovered/", "./", $fileinfo);
                 $this->ParseUncoveredSourceFile($fileinfo, $relativePath);
             }
         }
     }
     // Insert coverage summary
     $this->CoverageSummary->Insert(true);
     $this->CoverageSummary->ComputeDifference();
     foreach ($this->SubProjectSummaries as $buildid => $subprojectSummary) {
         $subprojectSummary->Insert(true);
         $subprojectSummary->ComputeDifference();
     }
     // Delete the directory when we're done.
     DeleteDirectory($dirName);
     return true;
 }
开发者ID:kitware,项目名称:cdash,代码行数:84,代码来源:GcovTar_handler.php

示例2: echo_main_dashboard_JSON


//.........这里部分代码省略.........
        $response['parentid'] = -1;
    }
    list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $project_array['nightlytime']);
    // Main dashboard section
    get_dashboard_JSON($projectname, $date, $response);
    $response['displaylabels'] = $project_array['displaylabels'];
    $page_id = 'index.php';
    $response['childview'] = 0;
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/models/proProject.php')) {
        include_once 'local/models/proProject.php';
        $pro = new proProject();
        $pro->ProjectId = $projectid;
        $response['proedition'] = $pro->GetEdition(1);
    }
    if ($currentstarttime > time() && !isset($_GET['parentid'])) {
        $response['error'] = 'CDash cannot predict the future (yet)';
        echo json_encode($response);
        return;
    }
    // Menu definition
    $response['menu'] = array();
    $beginning_timestamp = $currentstarttime;
    $end_timestamp = $currentstarttime + 3600 * 24;
    $beginning_UTCDate = gmdate(FMT_DATETIME, $beginning_timestamp);
    $end_UTCDate = gmdate(FMT_DATETIME, $end_timestamp);
    if ($project_instance->GetNumberOfSubProjects($end_UTCDate) > 0) {
        $response['menu']['subprojects'] = 1;
    }
    if (isset($_GET['parentid'])) {
        $page_id = 'indexchildren.php';
        $response['childview'] = 1;
        // When a parentid is specified, we should link to the next build,
        // not the next day.
        $previous_buildid = $parent_build->GetPreviousBuildId();
        $current_buildid = $parent_build->GetCurrentBuildId();
        $next_buildid = $parent_build->GetNextBuildId();
        $base_url = 'index.php?project=' . urlencode($projectname);
        if ($previous_buildid > 0) {
            $response['menu']['previous'] = "{$base_url}&parentid={$previous_buildid}";
        } else {
            $response['menu']['noprevious'] = '1';
        }
        $response['menu']['current'] = "{$base_url}&parentid={$current_buildid}";
        if ($next_buildid > 0) {
            $response['menu']['next'] = "{$base_url}&parentid={$next_buildid}";
        } else {
            $response['menu']['nonext'] = '1';
        }
    } elseif (!has_next_date($date, $currentstarttime)) {
        $response['menu']['nonext'] = 1;
    }
    // Check if a SubProject parameter was specified.
    $subproject_name = @$_GET['subproject'];
    $subprojectid = false;
    if ($subproject_name) {
        $SubProject = new SubProject();
        $subproject_name = htmlspecialchars(pdo_real_escape_string($subproject_name));
        $SubProject->SetName($subproject_name);
        $SubProject->SetProjectId($projectid);
        $subprojectid = $SubProject->GetId();
        if ($subprojectid) {
            // Add an extra URL argument for the menu
            $response['extraurl'] = '&subproject=' . urlencode($subproject_name);
            $response['subprojectname'] = $subproject_name;
            $subproject_response = array();
            $subproject_response['name'] = $SubProject->GetName();
开发者ID:kitware,项目名称:cdash,代码行数:67,代码来源:index.php

示例3: check_email_errors

/** Check for errors for a given build. Return false if no errors */
function check_email_errors($buildid, $checktesttimeingchanged, $testtimemaxstatus, $checkpreviouserrors)
{
    // Includes
    require_once 'models/buildconfigure.php';
    require_once 'models/build.php';
    require_once 'models/buildtest.php';
    require_once 'models/dynamicanalysis.php';
    $errors = array();
    $errors['errors'] = true;
    $errors['hasfixes'] = false;
    // Configure errors
    $BuildConfigure = new BuildConfigure();
    $BuildConfigure->BuildId = $buildid;
    $errors['configure_errors'] = $BuildConfigure->ComputeErrors();
    // Build errors and warnings
    $Build = new Build();
    $Build->Id = $buildid;
    $Build->FillFromId($buildid);
    $errors['build_errors'] = $Build->GetNumberOfErrors();
    $errors['build_warnings'] = $Build->GetNumberOfWarnings();
    // Test errors
    $BuildTest = new BuildTest();
    $BuildTest->BuildId = $buildid;
    $errors['test_errors'] = $BuildTest->GetNumberOfFailures($checktesttimeingchanged, $testtimemaxstatus);
    // Dynamic analysis errors
    $DynamicAnalysis = new DynamicAnalysis();
    $DynamicAnalysis->BuildId = $buildid;
    $errors['dynamicanalysis_errors'] = $DynamicAnalysis->GetNumberOfErrors();
    // Green build we return
    if ($errors['configure_errors'] == 0 && $errors['build_errors'] == 0 && $errors['build_warnings'] == 0 && $errors['test_errors'] == 0 && $errors['dynamicanalysis_errors'] == 0) {
        $errors['errors'] = false;
    }
    // look for the previous build
    $previousbuildid = $Build->GetPreviousBuildId();
    if ($previousbuildid > 0) {
        $error_differences = $Build->GetErrorDifferences($buildid);
        if ($errors['errors'] && $checkpreviouserrors && $errors['dynamicanalysis_errors'] == 0) {
            // If the builderroddiff positive and configureerrordiff and testdiff positive are zero we don't send an email
            // we don't send any emails
            if ($error_differences['buildwarningspositive'] <= 0 && $error_differences['builderrorspositive'] <= 0 && $error_differences['configurewarnings'] <= 0 && $error_differences['configureerrors'] <= 0 && $error_differences['testfailedpositive'] <= 0 && $error_differences['testnotrunpositive'] <= 0) {
                $errors['errors'] = false;
            }
        }
        if ($error_differences['buildwarningsnegative'] > 0 || $error_differences['builderrorsnegative'] > 0 || $error_differences['configurewarnings'] < 0 || $error_differences['configureerrors'] < 0 || $error_differences['testfailednegative'] > 0 || $error_differences['testnotrunnegative'] > 0) {
            $errors['hasfixes'] = true;
            $errors['fixes']['configure_fixes'] = $error_differences['configurewarnings'] + $error_differences['configureerrors'];
            $errors['fixes']['builderror_fixes'] = $error_differences['builderrorsnegative'];
            $errors['fixes']['buildwarning_fixes'] = $error_differences['buildwarningsnegative'];
            $errors['fixes']['test_fixes'] = $error_differences['testfailednegative'] + $error_differences['testnotrunnegative'];
        }
    }
    return $errors;
}
开发者ID:kitware,项目名称:cdash,代码行数:54,代码来源:sendemail.php

示例4: InsertBuild

 /** Helper function to insert the build */
 public function InsertBuild($projectid, $buildid)
 {
     $build = new Build();
     $build->FillFromId($buildid);
     if ($build->GetPreviousBuildId() == 0) {
         // if we don't have a previous build then we need to count ourselves
         $query = pdo_query('SELECT name FROM build WHERE id=' . $buildid);
         if (!$query) {
             add_last_sql_error('Feed::InsertBuild');
             return false;
         }
         $query_array = pdo_fetch_array($query);
         $buildname = $query_array['name'];
         $positives = pdo_query('SELECT count(*) FROM builderror WHERE buildid=' . $buildid . ' AND type=0');
         $positives_array = pdo_fetch_array($positives);
         $npositives = $positives_array[0];
         $positives = pdo_query('SELECT count(*) FROM buildfailure AS bf
      LEFT JOIN buildfailuredetails AS bfd ON (bfd.id=bf.detailsid)
      WHERE bf.buildid=' . $buildid . ' AND bfd.type=0');
         $positives_array = pdo_fetch_array($positives);
         $npositives += $positives_array[0];
         if ($npositives > 0) {
             $description = $npositives . ' error';
             if ($npositives > 1) {
                 $description .= 's';
             }
             $description .= ' introduced on ' . $buildname;
             $this->Insert($projectid, $buildid, Feed::TypeBuildError, $description);
         }
         $positives = pdo_query('SELECT count(*) FROM builderror WHERE buildid=' . $buildid . ' AND type=1');
         $positives_array = pdo_fetch_array($positives);
         $npositives = $positives_array[0];
         $positives = pdo_query('SELECT count(*) FROM buildfailure AS bf
      LEFT JOIN buildfailuredetails AS bfd ON (bfd.id=bf.detailsid)
      WHERE bf.buildid=' . $buildid . ' AND bfd.type=1');
         $positives_array = pdo_fetch_array($positives);
         $npositives += $positives_array[0];
         if ($npositives > 0) {
             $description = $npositives . ' warning';
             if ($npositives > 1) {
                 $description .= 's';
             }
             $description .= ' introduced on ' . $buildname;
             $this->Insert($projectid, $buildid, Feed::TypeBuildWarning, $description);
         }
         return;
     }
     // If we do have a previous build then we use the builderrordiff table
     // Check if we have any fixes or errors
     $query = pdo_query("SELECT * FROM builderrordiff AS bd JOIN build AS b ON (bd.buildid=b.id) WHERE bd.buildid='{$buildid}'");
     if (!$query) {
         add_last_sql_error('Feed::InsertBuild');
         return false;
     }
     while ($query_array = pdo_fetch_array($query)) {
         $type = 'error';
         $feedtype = Feed::TypeBuildError;
         if ($query_array['type'] == 1) {
             // warning
             $type = 'warning';
             $feedtype = Feed::TypeBuildWarning;
         }
         if ($query_array['difference_positive'] > 0) {
             $description .= $query_array['difference_positive'] . ' ' . $type;
             if ($query_array['difference_positive'] > 1) {
                 $description .= 's';
             }
             $description .= ' introduced on ' . $query_array['name'];
             $this->Insert($projectid, $buildid, $feedtype, $description);
         } elseif ($query_array['difference_negative'] > 0) {
             $description .= $query_array['difference_negative'] . ' ' . $type;
             if ($query_array['difference_negative'] > 1) {
                 $description .= 's';
             }
             $description .= ' fixed on ' . $query_array['name'];
             $this->Insert($projectid, $buildid, $feedtype, $description);
         }
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:80,代码来源:feed.php

示例5: qnum

$buildname = $build_array['name'];
$starttime = $build_array['starttime'];
$threshold = $project_array['coveragethreshold'];
if ($build_array['groupid'] > 0) {
    $row = pdo_single_row_query('SELECT coveragethreshold FROM subprojectgroup
     WHERE projectid=' . qnum($projectid) . '
     AND id=' . qnum($build_array['groupid']));
    if (!empty($row) && isset($row['coveragethreshold'])) {
        $threshold = $row['coveragethreshold'];
    }
}
$xml .= '<menu>';
$xml .= add_XML_value('back', 'index.php?project=' . urlencode($projectname) . '&date=' . get_dashboard_date_from_build_starttime($build_array['starttime'], $project_array['nightlytime']));
$build = new Build();
$build->Id = $buildid;
$previous_buildid = $build->GetPreviousBuildId();
$current_buildid = $build->GetCurrentBuildId();
$next_buildid = $build->GetNextBuildId();
if ($previous_buildid > 0) {
    $xml .= add_XML_value('previous', 'viewCoverage.php?buildid=' . $previous_buildid);
} else {
    $xml .= add_XML_value('noprevious', '1');
}
$xml .= add_XML_value('current', "viewCoverage.php?buildid={$current_buildid}");
if ($next_buildid > 0) {
    $xml .= add_XML_value('next', "viewCoverage.php?buildid={$next_buildid}");
} else {
    $xml .= add_XML_value('nonext', '1');
}
$xml .= '</menu>';
$xml .= add_XML_value('filtercount', $filtercount);
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:viewCoverage.php

示例6: urlencode

$nightlytime = get_project_property($projectname, 'nightlytime');
$menu['back'] = 'index.php?project=' . urlencode($projectname) . '&date=' . get_dashboard_date_from_build_starttime($starttime, $nightlytime);
// Get the IDs of the four previous builds.
// These are used to check the recent history of this test.
$build = new Build();
$n = 3;
$id = $buildid;
$previous_buildid = 0;
$previous_buildids = array();
// Include the current buildid in this list so the current status will
// be reflected in the history column.
$previous_buildids[] = $id;
for ($i = 0; $i < $n; $i++) {
    $build->Id = $id;
    $build->Filled = false;
    $id = $build->GetPreviousBuildId();
    if ($i == 0) {
        $previous_buildid = $id;
        $current_buildid = $build->GetCurrentBuildId();
        $next_buildid = $build->GetNextBuildId();
    }
    if ($id == 0) {
        break;
    }
    $previous_buildids[] = $id;
}
$previous_buildids_str = '';
if ($previous_buildid > 0) {
    $menu['previous'] = "viewTest.php?buildid={$previous_buildid}{$extraquery}";
    if (count($previous_buildids) > 1) {
        $previous_buildids_str = implode(', ', $previous_buildids);
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:viewTest.php

示例7: perform_version_only_diff

/** Find changes for a "version only" update. */
function perform_version_only_diff($update, $projectid)
{
    // Return early if we don't have a current revision.
    if (empty($update->Revision)) {
        return;
    }
    // Return early if this project doesn't have a remote repository viewer.
    require_once 'models/buildupdate.php';
    require_once 'models/project.php';
    $project = new Project();
    $project->Id = $projectid;
    $project->Fill();
    if (strlen($project->CvsUrl) === 0 || strlen($project->CvsViewerType) === 0) {
        return;
    }
    // Return early if we don't have an implementation for this repository viewer.
    $viewertype = strtolower($project->CvsViewerType);
    $function_name = 'perform_' . $viewertype . '_version_only_diff';
    if (!function_exists($function_name)) {
        return;
    }
    // Return early if we don't have a previous build to compare against.
    require_once 'models/build.php';
    $build = new Build();
    $build->Id = $update->BuildId;
    $previous_buildid = $build->GetPreviousBuildId();
    if ($previous_buildid < 1) {
        return;
    }
    // Get the revision for the previous build.
    $pdo = get_link_identifier()->getPdo();
    $stmt = $pdo->prepare('SELECT revision FROM buildupdate AS bu
            INNER JOIN build2update AS b2u ON (b2u.updateid=bu.id)
            WHERE b2u.buildid=?');
    $stmt->execute(array($previous_buildid));
    $row = $stmt->fetch();
    if (empty($row) || !isset($row['revision'])) {
        return;
    }
    $previous_revision = $row['revision'];
    if (empty($previous_revision)) {
        return;
    }
    // Record the previous revision in the buildupdate table.
    $stmt = $pdo->prepare('UPDATE buildupdate SET priorrevision=? WHERE id=?');
    $stmt->execute(array($previous_revision, $update->UpdateId));
    // Call the implementation specific to this repository viewer.
    $update->Append = true;
    return $function_name($project, $update, $previous_revision);
}
开发者ID:kitware,项目名称:cdash,代码行数:51,代码来源:repository.php

示例8: ComputeDifference

 /** Compute the coverage summary diff */
 function ComputeDifference()
 {
     $build = new Build();
     $build->FillFromId($this->BuildId);
     $previousBuildId = $build->GetPreviousBuildId();
     if ($previousBuildId === FALSE) {
         return;
     }
     // Look at the number of errors and warnings differences
     $coverage = pdo_query("SELECT loctested,locuntested FROM coveragesummary WHERE buildid=" . qnum($this->BuildId));
     if (!$coverage) {
         add_last_sql_error("CoverageSummary:ComputeDifference");
         return false;
     }
     $coverage_array = pdo_fetch_array($coverage);
     $loctested = $coverage_array['loctested'];
     $locuntested = $coverage_array['locuntested'];
     $previouscoverage = pdo_query("SELECT loctested,locuntested FROM coveragesummary WHERE buildid=" . qnum($previousBuildId));
     if (pdo_num_rows($previouscoverage) > 0) {
         $previouscoverage_array = pdo_fetch_array($previouscoverage);
         $previousloctested = $previouscoverage_array['loctested'];
         $previouslocuntested = $previouscoverage_array['locuntested'];
         // Don't log if no diff
         $loctesteddiff = $loctested - $previousloctested;
         $locuntesteddiff = $locuntested - $previouslocuntested;
         if ($loctesteddiff != 0 && $locuntesteddiff != 0) {
             $summaryDiff = new CoverageSummaryDiff();
             $summaryDiff->BuildId = $this->BuildId;
             $summaryDiff->LocTested = $loctesteddiff;
             $summaryDiff->LocTested = $locuntesteddiff;
             $summaryDiff->Insert();
         }
     }
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:35,代码来源:coveragesummary.php

示例9: array

unset($filterdata['xml']);
$response['filterdata'] = $filterdata;
$filter_sql = $filterdata['sql'];
$limit_sql = '';
if ($filterdata['limit'] > 0) {
    $limit_sql = ' LIMIT ' . $filterdata['limit'];
}
$response['filterurl'] = get_filterurl();
// Menu
$menu = array();
$limit_param = '&limit=' . $filterdata['limit'];
$base_url = 'queryTests.php?project=' . urlencode($project_array['name']);
if (isset($_GET['parentid'])) {
    // When a parentid is specified, we should link to the next build,
    // not the next day.
    $previous_buildid = $parent_build->GetPreviousBuildId();
    $current_buildid = $parent_build->GetCurrentBuildId();
    $next_buildid = $parent_build->GetNextBuildId();
    $menu['back'] = 'index.php?project=' . urlencode($project_array['name']) . '&parentid=' . $_GET['parentid'];
    if ($previous_buildid > 0) {
        $menu['previous'] = "{$base_url}&parentid={$previous_buildid}" . $limit_param;
    } else {
        $menu['noprevious'] = '1';
    }
    $menu['current'] = "{$base_url}&parentid={$current_buildid}" . $limit_param;
    if ($next_buildid > 0) {
        $menu['next'] = "{$base_url}&parentid={$next_buildid}" . $limit_param;
    } else {
        $menu['nonext'] = '1';
    }
} else {
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:queryTests.php

示例10: ComputeDifference

 /** Compute the coverage summary diff */
 public function ComputeDifference($previous_parentid = null)
 {
     $build = new Build();
     $build->Id = $this->BuildId;
     $previousBuildId = $build->GetPreviousBuildId($previous_parentid);
     if ($previousBuildId < 1) {
         return;
     }
     // Look at the number of errors and warnings differences
     $coverage = pdo_query('SELECT loctested,locuntested FROM coveragesummary WHERE buildid=' . qnum($this->BuildId));
     if (!$coverage) {
         add_last_sql_error('CoverageSummary:ComputeDifference');
         return false;
     }
     $coverage_array = pdo_fetch_array($coverage);
     $loctested = $coverage_array['loctested'];
     $locuntested = $coverage_array['locuntested'];
     $previouscoverage = pdo_query('SELECT loctested,locuntested FROM coveragesummary WHERE buildid=' . qnum($previousBuildId));
     if (pdo_num_rows($previouscoverage) > 0) {
         $previouscoverage_array = pdo_fetch_array($previouscoverage);
         $previousloctested = $previouscoverage_array['loctested'];
         $previouslocuntested = $previouscoverage_array['locuntested'];
         $summaryDiff = new CoverageSummaryDiff();
         $summaryDiff->BuildId = $this->BuildId;
         $loctesteddiff = $loctested - $previousloctested;
         $locuntesteddiff = $locuntested - $previouslocuntested;
         // Don't log if no diff unless an entry already exists
         // for this build.
         if ($summaryDiff->Exists() || $loctesteddiff != 0 || $locuntesteddiff != 0) {
             $summaryDiff->LocTested = $loctesteddiff;
             $summaryDiff->LocUntested = $locuntesteddiff;
             $summaryDiff->Insert();
         }
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:36,代码来源:coveragesummary.php


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