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


PHP Build::FillFromId方法代码示例

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


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

示例1: testGithubPRComment

 public function testGithubPRComment()
 {
     echo "1. testGithubPRComment\n";
     global $configure;
     $this->login();
     // Create a project named CDash and set its repository information.
     $settings = ['Name' => 'CDash', 'Description' => 'CDash', 'CvsUrl' => 'github.com/Kitware/CDash', 'CvsViewerType' => 'github', 'BugTrackerFileUrl' => 'http://public.kitware.com/Bug/view.php?id=', 'repositories' => [['url' => 'https://github.com/Kitware/CDash', 'branch' => 'master', 'username' => $configure['github_username'], 'password' => $configure['github_password']]]];
     $this->ProjectId = $this->createProject($settings);
     if ($this->ProjectId < 1) {
         return 1;
     }
     // Setup subprojects by submitting the Project.xml file.
     global $configure;
     // Submit the file.
     $url = $this->url . '/submit.php?project=CDash';
     $result = $this->uploadfile($url, dirname(__FILE__) . '/data/GithubPR/Project.xml');
     $this->deleteLog($this->logfilename);
     // Submit a failing test.
     echo "Submitting Test.xml\n";
     if (!$this->submitPullRequestFile(dirname(__FILE__) . '/data/GithubPR/Test.xml')) {
         return 1;
     }
     // Submit a broken build.
     echo "Submitting Build.xml\n";
     if (!$this->submitPullRequestFile(dirname(__FILE__) . '/data/GithubPR/Build.xml')) {
         return 1;
     }
     // Submit a failed configure.
     echo "Submitting Configure.xml\n";
     if (!$this->submitPullRequestFile(dirname(__FILE__) . '/data/GithubPR/Configure.xml')) {
         return 1;
     }
     // Make sure these builds link back to the GitHub PR.
     $row = pdo_single_row_query("SELECT id, parentid FROM build\n                WHERE name = 'test_PR_comment' AND parentid>0 LIMIT 1");
     $build = new Build();
     $build->Id = $row['id'];
     $build->FillFromId($build->Id);
     $date = $build->GetDate();
     // Parent view
     $content = $this->connect($this->url . "/api/v1/index.php?project=CDash&date={$date}");
     $jsonobj = json_decode($content, true);
     $buildgroup = array_pop($jsonobj['buildgroups']);
     $build_response = $buildgroup['builds'][0];
     if ($build_response['changelink'] !== 'github.com/Kitware/CDash/pull/80') {
         $this->fail("Expected changelink not found for parent build.  Found: " . $build_response['changelink']);
     }
     if ($build_response['changeicon'] !== 'img/Octocat.png') {
         $this->fail("Expected changeicon not found for parent build.  Found: " . $build_response['changeicon']);
     }
     // Child view
     $parentid = $row['parentid'];
     $content = $this->connect($this->url . "/api/v1/index.php?project=CDash&parentid={$parentid}");
     $jsonobj = json_decode($content, true);
     if ($jsonobj['changelink'] !== 'github.com/Kitware/CDash/pull/80') {
         $this->fail("Expected changelink not found for parent build");
     }
     if ($jsonobj['changeicon'] !== 'img/Octocat.png') {
         $this->fail("Expected changeicon not found for parent build");
     }
     // Delete the project now that we're done with it.
     $this->deleteProject($this->ProjectId);
 }
开发者ID:kitware,项目名称:cdash,代码行数:62,代码来源:test_github_PR_comment.php

示例2: ParseGcovFile

 /**
  * Parse an individual .gcov file.
  **/
 public function ParseGcovFile($fileinfo)
 {
     $coverageFileLog = new CoverageFileLog();
     $coverageFileLog->AggregateBuildId = $this->AggregateBuildId;
     $coverageFileLog->PreviousAggregateParentId = $this->PreviousAggregateParentId;
     $coverageFile = new CoverageFile();
     $coverage = new Coverage();
     $coverage->CoverageFile = $coverageFile;
     // Begin parsing this file.
     // The first thing we look for is the full path to this source file.
     $file = new SplFileObject($fileinfo);
     $path = '';
     while (!$file->eof()) {
         $gcovLine = $file->current();
         $term = ':Source:';
         $pos = strpos($gcovLine, $term);
         if ($pos !== false) {
             $path = substr($gcovLine, $pos + strlen($term));
             break;
         }
         $file->next();
     }
     if (empty($path)) {
         return;
     }
     // Check if this file belongs to a different SubProject.
     $buildid = $this->Build->Id;
     if (!empty($this->SubProjectPath) && strpos($path, $this->SubProjectPath) === false) {
         // Find the SubProject that corresponds to this path.
         $query = "SELECT id, name, path FROM subproject\n                WHERE projectid = {$this->ProjectId} AND\n                endtime = '1980-01-01 00:00:00' AND\n                path != '' AND\n                '{$path}' LIKE CONCAT('%',path,'%')";
         $result = pdo_query($query);
         if (!$result || pdo_num_rows($result) == 0) {
             add_log("No SubProject found for '{$path}'", 'ParseGcovFile', LOG_INFO, $this->ProjectId, $this->Build->Id);
             return;
         }
         $row = pdo_fetch_array($result);
         $subprojectid = $row['id'];
         $subprojectname = $row['name'];
         $subprojectpath = $row['path'];
         // Find the sibling build that performed this SubProject.
         $siblingBuild = new Build();
         $query = 'SELECT b.id FROM build AS b
             INNER JOIN subproject2build AS sp2b ON (sp2b.buildid=b.id)
             WHERE b.parentid=
             (SELECT parentid FROM build WHERE id=' . $this->Build->Id . ")\n                AND sp2b.subprojectid={$subprojectid}";
         $row = pdo_single_row_query($query);
         if ($row && array_key_exists('id', $row)) {
             $buildid = $row['id'];
             $siblingBuild->Id = $buildid;
             $siblingBuild->FillFromId($buildid);
         } else {
             // Build doesn't exist yet, add it here.
             $siblingBuild->Name = $this->Build->Name;
             $siblingBuild->ProjectId = $this->ProjectId;
             $siblingBuild->SiteId = $this->Build->SiteId;
             $siblingBuild->SetParentId($this->Build->GetParentId());
             $siblingBuild->SetStamp($this->Build->GetStamp());
             $siblingBuild->SetSubProject($subprojectname);
             $siblingBuild->StartTime = $this->Build->StartTime;
             $siblingBuild->EndTime = $this->Build->EndTime;
             $siblingBuild->SubmitTime = gmdate(FMT_DATETIME);
             add_build($siblingBuild, 0);
             $buildid = $siblingBuild->Id;
         }
         $coverageFileLog->Build = $siblingBuild;
         // Remove any part of the file path that comes before
         // the subproject path.
         $path = substr($path, strpos($path, $subprojectpath));
         // Replace the subproject path with '.'
         $path = substr_replace($path, '.', 0, strlen($subprojectpath));
     } else {
         // If this source file isn't from the source or binary directory
         // we shouldn't include it in our coverage report.
         if (!empty($this->SubProjectPath) && strpos($path, $this->SubProjectPath) !== false) {
             $path = substr($path, strpos($path, $this->SubProjectPath));
             $path = substr_replace($path, '.', 0, strlen($this->SubProjectPath));
         } elseif (strpos($path, $this->SourceDirectory) !== false) {
             $path = str_replace($this->SourceDirectory, '.', trim($path));
         } elseif (strpos($path, $this->BinaryDirectory) !== false) {
             $path = str_replace($this->BinaryDirectory, '.', trim($path));
         } else {
             return;
         }
         $coverageFileLog->Build = $this->Build;
     }
     // Get a reference to the coverage summary for this build.
     if ($buildid === $this->Build->Id) {
         $coverageSummary = $this->CoverageSummary;
     } else {
         if (!array_key_exists($buildid, $this->SubProjectSummaries)) {
             $coverageSummary = new CoverageSummary();
             $coverageSummary->BuildId = $buildid;
             $this->SubProjectSummaries[$buildid] = $coverageSummary;
         } else {
             $coverageSummary = $this->SubProjectSummaries[$buildid];
         }
     }
//.........这里部分代码省略.........
开发者ID:kitware,项目名称:cdash,代码行数:101,代码来源:GcovTar_handler.php

示例3: rest_post

function rest_post()
{
    global $projectid;
    if (isset($_POST['newbuildgroup'])) {
        // Create a new buildgroup
        $BuildGroup = new BuildGroup();
        $BuildGroup->SetProjectId($projectid);
        $name = htmlspecialchars(pdo_real_escape_string($_POST['newbuildgroup']));
        // Avoid creating a group that uses one of the default names.
        if ($name == "Nightly" || $name == "Experimental" || $name == "Continuous") {
            echo_error("You cannot create a group named 'Nightly','Experimental' or 'Continuous'");
            return;
        }
        $type = htmlspecialchars(pdo_real_escape_string($_POST['type']));
        $BuildGroup->SetName($name);
        $BuildGroup->SetType($type);
        $BuildGroup->Save();
        // Respond with a JSON representation of this new buildgroup
        $response = array();
        $response['id'] = $BuildGroup->GetId();
        $response['name'] = $BuildGroup->GetName();
        $response['autoremovetimeframe'] = $BuildGroup->GetAutoRemoveTimeFrame();
        echo json_encode($response);
        return;
    }
    if (isset($_POST['newLayout'])) {
        // Update the order of the buildgroups for this project.
        $inputRows = $_POST['newLayout'];
        if (count($inputRows) > 0) {
            // Remove old build group layout for this project.
            global $CDASH_DB_TYPE;
            if (isset($CDASH_DB_TYPE) && $CDASH_DB_TYPE == "pgsql") {
                // We use a subquery here because postgres doesn't support
                // JOINs in a DELETE statement.
                $sql = "\n          DELETE FROM buildgroupposition WHERE buildgroupid IN\n            (SELECT bgp.buildgroupid FROM buildgroupposition AS bgp\n             LEFT JOIN buildgroup AS bg ON (bgp.buildgroupid = bg.id)\n             WHERE bg.projectid = '{$projectid}')";
            } else {
                $sql = "\n          DELETE bgp FROM buildgroupposition AS bgp\n          LEFT JOIN buildgroup AS bg ON (bgp.buildgroupid = bg.id)\n          WHERE bg.projectid = '{$projectid}'";
            }
            pdo_query($sql);
            add_last_sql_error("manageBuildGroup::newLayout::DELETE", $projectid);
            // construct query to insert the new layout
            $query = "INSERT INTO buildgroupposition (buildgroupid, position) VALUES ";
            foreach ($inputRows as $inputRow) {
                $query .= "(" . qnum(pdo_real_escape_numeric($inputRow["buildgroupid"])) . ", " . qnum(pdo_real_escape_numeric($inputRow["position"])) . "), ";
            }
            // remove the trailing comma and space, then insert our new values
            $query = rtrim($query, ", ");
            pdo_query($query);
            add_last_sql_error("API::buildgroup::newLayout::INSERT", $projectid);
        }
        return;
    }
    if (isset($_POST['builds'])) {
        // Move builds to a new group.
        $group = $_POST['group'];
        if ($group['id'] < 1) {
            echo_error("Please select a group for these builds");
            return;
        }
        $builds = $_POST['builds'];
        if (array_key_exists('expected', $_POST)) {
            $expected = $_POST['expected'];
        } else {
            $expected = 0;
        }
        foreach ($builds as $buildinfo) {
            $groupid = pdo_real_escape_numeric($group['id']);
            $Build = new Build();
            $buildid = pdo_real_escape_numeric($buildinfo['id']);
            $Build->Id = $buildid;
            $Build->FillFromId($Build->Id);
            $prevgroupid = $Build->GroupId;
            // Change the group for this build.
            pdo_query("UPDATE build2group SET groupid='{$groupid}'\n         WHERE groupid='{$prevgroupid}' AND buildid='{$buildid}'");
            // Delete any previous rules
            pdo_query("\n        DELETE FROM build2grouprule\n        WHERE groupid='{$prevgroupid}' AND buildtype='{$Build->Type}' AND\n              buildname='{$Build->Name}' AND siteid='{$Build->SiteId}'");
            // Add the new rule
            pdo_query("\n        INSERT INTO build2grouprule\n          (groupid,buildtype,buildname,siteid,expected,starttime,endtime)\n        VALUES\n          ('{$groupid}','{$Build->Type}','{$Build->Name}','{$Build->SiteId}',\n           '{$expected}','1980-01-01 00:00:00','1980-01-01 00:00:00')");
        }
    }
    if (isset($_POST['nameMatch'])) {
        // Define a BuildGroup by Build name.
        $group = $_POST['group'];
        $groupid = $group['id'];
        if ($groupid < 1) {
            echo_error("Please select a BuildGroup to define.");
            return;
        }
        $nameMatch = "%" . htmlspecialchars(pdo_real_escape_string($_POST["nameMatch"])) . "%";
        $type = htmlspecialchars(pdo_real_escape_string($_POST["type"]));
        $sql = "INSERT INTO build2grouprule (groupid, buildtype, buildname, siteid)\n       VALUES ('{$groupid}', '{$type}', '{$nameMatch}', '-1')";
        if (!pdo_query($sql)) {
            echo_error(pdo_error());
        }
    }
    if (isset($_POST['dynamic']) && !empty($_POST['dynamic'])) {
        // Add a build row to a dynamic group
        $groupid = pdo_real_escape_numeric($_POST['dynamic']['id']);
        if (empty($_POST['buildgroup'])) {
            $parentgroupid = 0;
//.........这里部分代码省略.........
开发者ID:josephsnyder,项目名称:CDash,代码行数:101,代码来源:buildgroup.php

示例4: sendemail

/** Main function to send email if necessary */
function sendemail($handler, $projectid)
{
    include 'config/config.php';
    include_once 'include/common.php';
    require_once 'include/pdo.php';
    require_once 'models/build.php';
    require_once 'models/project.php';
    require_once 'models/buildgroup.php';
    $Project = new Project();
    $Project->Id = $projectid;
    $Project->Fill();
    $sendEmail = null;
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) {
        include_once 'local/sendemail.php';
        $sendEmail = new SendEmail();
        $sendEmail->SetProjectId($projectid);
    }
    // If we shouldn't sent any emails we stop
    if ($Project->EmailBrokenSubmission == 0) {
        return;
    }
    // If the handler has a buildid (it should), we use it
    if (isset($handler->BuildId) && $handler->BuildId > 0) {
        $buildid = $handler->BuildId;
    } else {
        // Get the build id
        $name = $handler->getBuildName();
        $stamp = $handler->getBuildStamp();
        $sitename = $handler->getSiteName();
        $buildid = get_build_id($name, $stamp, $projectid, $sitename);
    }
    if ($buildid < 0) {
        return;
    }
    //add_log("Buildid ".$buildid,"sendemail ".$Project->Name,LOG_INFO);
    //  Check if the group as no email
    $Build = new Build();
    $Build->Id = $buildid;
    $groupid = $Build->GetGroup();
    $BuildGroup = new BuildGroup();
    $BuildGroup->SetId($groupid);
    // If we specified no email we stop here
    if ($BuildGroup->GetSummaryEmail() == 2) {
        return;
    }
    $emailCommitters = $BuildGroup->GetEmailCommitters();
    $errors = check_email_errors($buildid, $Project->EmailTestTimingChanged, $Project->TestTimeMaxStatus, !$Project->EmailRedundantFailures);
    // We have some fixes
    if ($errors['hasfixes']) {
        $Build->FillFromId($Build->Id);
        // Get the list of person who should get the email
        $lookup_result = lookup_emails_to_send($errors, $buildid, $projectid, $Build->Type, true, $emailCommitters);
        $userids = $lookup_result['userids'];
        foreach ($userids as $userid) {
            $emailtext = array();
            $emailtext['nfixes'] = 0;
            // Check if an email has been sent already for this user
            foreach ($errors['fixes'] as $fixkey => $nfixes) {
                if ($nfixes == 0) {
                    continue;
                }
                if (!check_email_sent($userid, $buildid, $fixkey)) {
                    $emailtext['category'][$fixkey] = $nfixes;
                    $emailtext['nfixes'] = 1;
                }
            }
            // Send the email
            if ($emailtext['nfixes'] == 1) {
                send_email_fix_to_user($userid, $emailtext, $Build, $Project);
            }
        }
    }
    // No error we return
    if (!$errors['errors']) {
        return;
    }
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) {
        $sendEmail->BuildId = $Build->Id;
        $sendEmail->Errors = $errors;
    }
    // If we should send a summary email
    if ($BuildGroup->GetSummaryEmail() == 1) {
        // Send the summary email
        sendsummaryemail($projectid, $groupid, $errors, $buildid);
        if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) {
            $sendEmail->SendSummary();
        }
        return;
    }
    $Build->FillFromId($Build->Id);
    // Send build error
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) {
        $sendEmail->SendBuildError();
    }
    // Lookup the list of people who should get the email, both registered
    // users *and* committers:
    //
    $lookup_result = lookup_emails_to_send($errors, $buildid, $projectid, $Build->Type, false, $emailCommitters);
    // Loop through the *registered* users:
//.........这里部分代码省略.........
开发者ID:kitware,项目名称:cdash,代码行数:101,代码来源:sendemail.php

示例5: testBuildRemovalWorksAsExpected

 public function testBuildRemovalWorksAsExpected()
 {
     require_once 'include/common.php';
     require_once 'include/pdo.php';
     require_once 'models/build.php';
     require_once 'models/buildconfigure.php';
     require_once 'models/builderror.php';
     require_once 'models/buildfailure.php';
     require_once 'models/buildgroup.php';
     require_once 'models/buildnote.php';
     require_once 'models/buildupdate.php';
     require_once 'models/coverage.php';
     require_once 'models/dynamicanalysis.php';
     require_once 'models/dynamicanalysissummary.php';
     require_once 'models/image.php';
     require_once 'models/label.php';
     require_once 'models/test.php';
     require_once 'models/uploadfile.php';
     $time = gmdate(FMT_DATETIME);
     // Find an existing site.
     $row = pdo_single_row_query('SELECT id FROM site LIMIT 1');
     $siteid = $row['id'];
     // Label
     $label = new Label();
     $label->SetText('remove me');
     // Build
     $build = new Build();
     $build->Name = 'RemovalWorksAsExpected';
     $build->SetStamp('20160822-1810-Experimental');
     $build->ProjectId = 1;
     $build->InsertErrors = true;
     $build->SiteId = $siteid;
     $build->StartTime = $time;
     $build->EndTime = $time;
     $build->SubmitTime = $time;
     $build->AddLabel($label);
     $buildgroup = new BuildGroup();
     $build->GroupId = $buildgroup->GetGroupIdFromRule($build);
     $info = new BuildInformation();
     $info->SetValue('OSNAME', 'Windows');
     $build->Information = $info;
     // BuildError
     $error = new BuildError();
     $error->Text = 'error: asdf';
     $build->AddError($error);
     // BuildFailure
     $failure = new BuildFailure();
     $failure->StdError = 'failure: asdf';
     $failure->AddArgument('arg1');
     $failure->AddLabel($label);
     $build->AddError($failure);
     $build->Save();
     // Create another build to test shared resources.
     $existing_build = new Build();
     $existing_build->Id = $build->Id;
     $existing_build->FillFromId($build->Id);
     $existing_build->SetStamp('20160822-1811-Experimental');
     $existing_build->SubmitTime = $time;
     $existing_build->InsertErrors = true;
     $existing_build->AddError($failure);
     $existing_build->Id = null;
     $existing_build->Save();
     // BuildConfigure
     $configure = new BuildConfigure();
     $configure->BuildId = $build->Id;
     $configure->StartTime = $time;
     $configure->EndTime = $time;
     $configure->Command = 'cmake';
     $configure->Log = "precontext\nWARNING: bar\npostcontext";
     $configure->Status = 5;
     $configure->AddLabel($label);
     $configure->Insert();
     $configure->ComputeWarnings();
     $configure->ComputeErrors();
     // BuildNote
     $note = new BuildNote();
     $note->Name = 'my note';
     $note->Text = 'note text';
     $note->Time = $time;
     $note->BuildId = $build->Id;
     $note->Insert();
     $shared_note = new BuildNote();
     $shared_note->Name = 'my shared note';
     $shared_note->Text = 'shared note text';
     $shared_note->Time = $time;
     $shared_note->BuildId = $build->Id;
     $shared_note->Insert();
     $shared_note->BuildId = $existing_build->Id;
     $shared_note->Insert();
     // buildtesttime
     $build->SaveTotalTestsTime(8);
     // BuildUpdate
     $updatefile = new BuildUpdateFile();
     $updatefile->Author = 'My Self';
     $updatefile->Committer = 'My Self';
     $updatefile->Email = 'my@self.com';
     $updatefile->CommitterEmail = 'my@self.com';
     $updatefile->Revision = 2;
     $updatefile->PriorRevision = 1;
     $updatefile->Filename = 'foo.cpp';
//.........这里部分代码省略.........
开发者ID:kitware,项目名称:cdash,代码行数:101,代码来源:test_removebuilds.php

示例6: 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

示例7: dirname

  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.
=========================================================================*/
include dirname(dirname(dirname(__DIR__))) . '/config/config.php';
require_once 'include/pdo.php';
require_once 'include/common.php';
require_once 'models/build.php';
if (!isset($_GET['buildid']) || !is_numeric($_GET['buildid'])) {
    return;
}
// Get details about this build.
$buildid = $_GET['buildid'];
$build = new Build();
$build->Id = $buildid;
$build->FillFromId($build->Id);
if ($build->ProjectId < 1) {
    return;
}
// Take subproject into account, such that if there is one, then the
// previous builds must be associated with the same subproject.
//
$subproj_table = '';
$subproj_criteria = '';
if ($build->SubProjectId > 0) {
    $subproj_table = 'INNER JOIN subproject2build AS sp2b ON (b.id=sp2b.buildid)';
    $subproj_criteria = 'AND sp2b.subprojectid=:subprojectid';
}
// Get details about previous builds.
// Currently just grabbing the info used for the graphs and charts
// on buildSummary.php.
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:getPreviousBuilds.php

示例8: UpdateAggregate

 /** Update the aggregate coverage build to include these results. */
 public function UpdateAggregate()
 {
     if (!$this->Build) {
         $this->Build = new Build();
         $this->Build->Id = $this->BuildId;
     }
     $this->Build->FillFromId($this->BuildId);
     // Only nightly builds count towards aggregate coverage.
     if ($this->Build->Type !== 'Nightly' || $this->Build->Name === 'Aggregate Coverage') {
         return;
     }
     // Find the build ID for this day's edition of 'Aggregate Coverage'.
     $aggregateBuildId = null;
     if ($this->AggregateBuildId) {
         if ($this->Build->SubProjectId) {
             // For SubProject builds, AggregateBuildId refers to the parent.
             // Look up the ID of the appropriate child.
             $query = "SELECT id FROM build\n                    INNER JOIN subproject2build AS sp2b ON (build.id=sp2b.buildid)\n                    WHERE parentid='{$this->AggregateBuildId}' AND\n                    projectid='" . $this->Build->ProjectId . "' AND\n                    sp2b.subprojectid='" . $this->Build->SubProjectId . "'";
             $row = pdo_single_row_query($query);
             if (!$row || !array_key_exists('id', $row)) {
                 // An aggregate build for this SubProject doesn't exist yet.
                 // Create it here.
                 $aggregateBuild = create_aggregate_build($this->Build);
                 $aggregateBuildId = $aggregateBuild->Id;
             } else {
                 $aggregateBuildId = $row['id'];
             }
         } else {
             // For standalone builds AggregateBuildId is exactly what we're
             // looking for.
             $aggregateBuildId = $this->AggregateBuildId;
         }
         $aggregateBuild = new Build();
         $aggregateBuild->Id = $aggregateBuildId;
         $aggregateBuild->FillFromId($aggregateBuildId);
     } else {
         // AggregateBuildId not specified, look it up here.
         $aggregateBuild = get_aggregate_build($this->Build);
         $aggregateBuildId = $aggregateBuild->Id;
         $aggregateBuild->FillFromId($aggregateBuildId);
     }
     // Abort if this log refers to a different version of the file
     // than the one already contained in the aggregate.
     $row = pdo_single_row_query("SELECT id, fullpath FROM coveragefile WHERE id='{$this->FileId}'");
     $path = $row['fullpath'];
     $row = pdo_single_row_query("SELECT id FROM coveragefile AS cf\n                INNER JOIN coveragefilelog AS cfl ON (cfl.fileid=cf.id)\n                WHERE cfl.buildid='{$aggregateBuildId}' AND cf.fullpath='{$path}'");
     if ($row && array_key_exists('id', $row) && $row['id'] != $this->FileId) {
         add_log("Not appending coverage of '{$path}' to aggregate as it " . 'already contains a different version of this file.', 'CoverageFileLog::UpdateAggregate', LOG_INFO, $this->BuildId);
         return;
     }
     // Append these results to the aggregate coverage log.
     $aggregateLog = clone $this;
     $aggregateLog->BuildId = $aggregateBuildId;
     $aggregateLog->Build = $aggregateBuild;
     $aggregateLog->Insert(true);
     // Update the aggregate coverage summary.
     $aggregateSummary = new CoverageSummary();
     $aggregateSummary->BuildId = $aggregateBuildId;
     $coverageFile = new CoverageFile();
     $coverageFile->Id = $this->FileId;
     $coverageFile->Load();
     $coverageFile->Update($aggregateBuildId);
     // Query the log to get how many lines & branches were covered.
     // We do this after inserting the filelog because we want to
     // accurately reflect the union of the current and previously
     // existing results (if any).
     $stats = $aggregateLog->GetStats();
     $aggregateCoverage = new Coverage();
     $aggregateCoverage->CoverageFile = $coverageFile;
     $aggregateCoverage->LocUntested = $stats['locuntested'];
     $aggregateCoverage->LocTested = $stats['loctested'];
     if ($aggregateCoverage->LocTested > 0 || $aggregateCoverage->LocUntested > 0) {
         $aggregateCoverage->Covered = 1;
     } else {
         $aggregateCoverage->Covered = 0;
     }
     $aggregateCoverage->BranchesUntested = $stats['branchesuntested'];
     $aggregateCoverage->BranchesTested = $stats['branchestested'];
     // Add this Coverage to the summary.
     $aggregateSummary->AddCoverage($aggregateCoverage);
     // Insert/Update the aggregate summary.
     $aggregateSummary->Insert(true);
     $aggregateSummary->ComputeDifference($this->PreviousAggregateParentId);
     if ($this->Build->SubProjectId && $this->AggregateBuildId) {
         // Compute diff for the aggregate parent too.
         $aggregateParentSummary = new CoverageSummary();
         $aggregateParentSummary->BuildId = $this->AggregateBuildId;
         $aggregateParentSummary->ComputeDifference();
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:91,代码来源:coveragefilelog.php

示例9: urlencode

 // Find the recent builds for this project
 if ($projectid > 0) {
     $xml .= "<project>";
     $xml .= add_XML_value("id", $Project->Id);
     $xml .= add_XML_value("name", $Project->GetName());
     $xml .= add_XML_value("name_encoded", urlencode($Project->GetName()));
     if ($buildid > 0) {
         $xml .= add_XML_value("buildid", $buildid);
     }
     $CoverageSummary = new CoverageSummary();
     $buildids = $CoverageSummary->GetBuilds($Project->Id, $beginUTCTime, $currentUTCTime);
     rsort($buildids);
     foreach ($buildids as $buildId) {
         $Build = new Build();
         $Build->Id = $buildId;
         $Build->FillFromId($Build->Id);
         $xml .= "<build>";
         $xml .= add_XML_value("id", $buildId);
         $Site = new Site();
         $Site->Id = $Build->SiteId;
         $xml .= add_XML_value("name", $Site->GetName() . "-" . $Build->GetName() . " [" . gmdate(FMT_DATETIME, strtotime($Build->StartTime)) . "]");
         if ($buildid > 0 && $buildId == $buildid) {
             $xml .= add_XML_value("selected", 1);
         }
         $xml .= "</build>";
     }
     // For now take the first one
     if ($buildid > 0) {
         // Find the files associated with the build
         $Coverage = new Coverage();
         $Coverage->BuildId = $buildid;
开发者ID:rpshaw,项目名称:CDash,代码行数:31,代码来源:manageCoverage.php

示例10: Build

require_once "cdash/pdo.php";
include_once 'cdash/common.php';
include "cdash/version.php";
include 'login.php';
include_once 'models/project.php';
include_once 'models/build.php';
include_once 'models/site.php';
include_once 'models/uploadfile.php';
if (!isset($_GET['buildid'])) {
    echo "Build id not set";
    return;
}
$buildid = pdo_real_escape_numeric($_GET['buildid']);
$Build = new Build();
$Build->Id = $buildid;
$Build->FillFromId($buildid);
$Site = new Site();
$Site->Id = $Build->SiteId;
$build_array = pdo_fetch_array(pdo_query("SELECT projectid FROM build WHERE id='{$buildid}'"));
if (!isset($build_array["projectid"])) {
    echo "Build does not exist. Maybe it has been deleted.";
    return;
}
$projectid = $build_array["projectid"];
checkUserPolicy(@$_SESSION['cdash']['loginid'], $projectid);
@($date = $_GET["date"]);
if ($date != NULL) {
    $date = htmlspecialchars(pdo_real_escape_string($date));
}
$xml = begin_XML_for_XSLT();
$xml .= get_cdash_dashboard_xml(get_project_name($projectid), $date);
开发者ID:rpshaw,项目名称:CDash,代码行数:31,代码来源:viewFiles.php

示例11: array

}
$response = begin_JSON_response();
$projectname = get_project_name($projectid);
$response['title'] = "CDash : {$projectname}";
$previous_buildid = $build->GetPreviousBuildId();
$current_buildid = $build->GetCurrentBuildId();
$next_buildid = $build->GetNextBuildId();
$menu = array();
$nightlytime = get_project_property($projectname, 'nightlytime');
$menu['back'] = 'index.php?project=' . urlencode($projectname) . '&date=' . get_dashboard_date_from_build_starttime($build->StartTime, $nightlytime);
if ($previous_buildid > 0) {
    $menu['previous'] = "buildSummary.php?buildid={$previous_buildid}";
    // Find the last submit date.
    $previous_build = new Build();
    $previous_build->Id = $previous_buildid;
    $previous_build->FillFromId($previous_build->Id);
    $lastsubmitdate = date(FMT_DATETIMETZ, strtotime($previous_build->StartTime . ' UTC'));
} else {
    $menu['noprevious'] = '1';
    $lastsubmitdate = 0;
}
$menu['current'] = "buildSummary.php?buildid={$current_buildid}";
if ($next_buildid > 0) {
    $menu['next'] = "buildSummary.php?buildid={$next_buildid}";
} else {
    $menu['nonext'] = '1';
}
$response['menu'] = $menu;
get_dashboard_JSON($projectname, $date, $response);
// User
if ($logged_in) {
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:buildSummary.php

示例12: get_aggregate_build

function get_aggregate_build($build)
{
    require_once 'models/build.php';
    $siteid = get_server_siteid();
    $build->ComputeTestingDayBounds();
    $subproj_table = '';
    $subproj_where = '';
    if ($build->SubProjectId) {
        $subproj_table = "INNER JOIN subproject2build AS sp2b ON (build.id=sp2b.buildid)";
        $subproj_where = "AND sp2b.subprojectid='{$build->SubProjectId}'";
    }
    $query = "SELECT id FROM build\n        {$subproj_table}\n        WHERE name='Aggregate Coverage' AND\n        siteid = '{$siteid}' AND\n        parentid < '1' AND\n        projectid = '{$build->ProjectId}' AND\n        starttime < '{$build->EndOfDay}' AND\n        starttime >= '{$build->BeginningOfDay}'\n        {$subproj_where}";
    $row = pdo_single_row_query($query);
    if (!$row || !array_key_exists('id', $row)) {
        // The aggregate build does not exist yet.
        // Create it here.
        $aggregate_build = create_aggregate_build($build, $siteid);
    } else {
        $aggregate_build = new Build();
        $aggregate_build->Id = $row['id'];
        $aggregate_build->FillFromId($row['id']);
    }
    return $aggregate_build;
}
开发者ID:kitware,项目名称:cdash,代码行数:24,代码来源:common.php

示例13: 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


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