public function testSetup() { // Create a project with GitHub credentials named CDash. global $configure; $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); // Create some users for the CDash project. $users_details = array(array('email' => '*****@*****.**', 'firstname' => 'Dan', 'lastname' => 'LaManna'), array('email' => '*****@*****.**', 'firstname' => 'Jamie', 'lastname' => 'Snape'), array('email' => '*****@*****.**', 'firstname' => 'Zack', 'lastname' => 'Galbreath')); $userproject = new UserProject(); $userproject->ProjectId = $this->ProjectId; foreach ($users_details as $user_details) { $user = new User(); $user->Email = $user_details['email']; $user->FirstName = $user_details['firstname']; $user->LastName = $user_details['lastname']; $user->Password = md5('12345'); $user->Institution = 'Kitware'; $user->Admin = 0; $user->Save(); $user->AddProject($userproject); $this->Users[] = $user; } }
/** * Called once when the project is initially created. */ public function InitialSetup() { if (!$this->Id) { return false; } // Add the default groups. $BuildGroup = new BuildGroup(); $BuildGroup->SetName('Nightly'); $BuildGroup->SetDescription('Nightly builds'); $BuildGroup->SetSummaryEmail(0); $this->AddBuildGroup($BuildGroup); $BuildGroup = new BuildGroup(); $BuildGroup->SetName('Continuous'); $BuildGroup->SetDescription('Continuous builds'); $BuildGroup->SetSummaryEmail(0); $this->AddBuildGroup($BuildGroup); $BuildGroup = new BuildGroup(); $BuildGroup->SetName('Experimental'); $BuildGroup->SetDescription('Experimental builds'); // default to "No Email" for the Experimental group $BuildGroup->SetSummaryEmail(2); $this->AddBuildGroup($BuildGroup); // Set up overview page to initially contain just the "Nightly" group. $groups = $this->GetBuildGroups(); foreach ($groups as $group) { if ($group->GetName() == 'Nightly') { $buildgroupid = $group->GetId(); $query = "INSERT INTO overview_components (projectid, buildgroupid, position, type)\n VALUES ('{$this->Id}', '{$buildgroupid}', '1', 'build')"; pdo_query($query); add_last_sql_error('CreateProject :: DefaultOverview', $this->Id); break; } } // Add administrator to the project. $User = new User(); $UserProject = new UserProject(); $UserProject->Role = 2; $UserProject->EmailType = 3; // receive all emails $UserProject->ProjectId = $this->Id; $User->Id = 1; // administrator $User->AddProject($UserProject); }
$buildgroupid = $group->GetId(); $query = "INSERT INTO overview_components (projectid, buildgroupid, position, type)\n VALUES ('{$projectid}', '{$buildgroupid}', '1', 'build')"; pdo_query($query); add_last_sql_error("CreateProject :: DefaultOverview", $projectid); break; } } // Add administrator to the project $UserProject = new UserProject(); $UserProject->Role = 2; $UserProject->EmailType = 3; // receive all emails $UserProject->ProjectId = $projectid; $User->Id = 1; // administrator $User->AddProject($UserProject); // Add current user to the project $User->Id = $userid; if ($userid != 1) { $User->Id = $userid; $User->AddProject($UserProject); } // Add the repositories $Project->AddRepositories($CVSRepositories, $CVSUsernames, $CVSPasswords, $CVSBranches); /** Add the logo if any */ if (isset($_FILES['logo']) && strlen($_FILES['logo']['tmp_name']) > 0) { $handle = fopen($_FILES['logo']['tmp_name'], "r"); $contents = 0; if ($handle) { $contents = addslashes(fread($handle, $_FILES['logo']['size'])); $filetype = $_FILES['logo']['type'];