/**
  * PopulateProjects
  *
  * Populates the internal list of projects
  *
  * @access protected
  * @throws Exception if file cannot be read
  */
 protected function PopulateProjects()
 {
     $projectRoot = GitPHP_Util::AddSlash(GitPHP_Config::GetInstance()->GetValue('projectroot'));
     foreach ($this->projectConfig as $cat => $plist) {
         if (is_array($plist)) {
             foreach ($plist as $pname => $ppath) {
                 try {
                     $projObj = new GitPHP_Project($projectRoot, $ppath);
                     if ($cat != GITPHP_NO_CATEGORY) {
                         $projObj->SetCategory($cat);
                     }
                     $this->projects[$ppath] = $projObj;
                 } catch (Exception $e) {
                     GitPHP_Log::GetInstance()->Log($e->getMessage());
                 }
             }
         }
     }
 }
 /**
  * AddProject
  *
  * Add project to collection
  *
  * @access private
  */
 private function AddProject($projectPath)
 {
     try {
         $proj = new GitPHP_Project($this->projectDir, $projectPath);
         $category = trim(dirname($projectPath));
         if (!(empty($category) || strpos($category, '.') === 0)) {
             $proj->SetCategory($category);
         }
         if (!GitPHP_Config::GetInstance()->GetValue('exportedonly', false) || $proj->GetDaemonEnabled()) {
             $this->projects[$projectPath] = $proj;
         }
     } catch (Exception $e) {
         GitPHP_Log::GetInstance()->Log($e->getMessage());
     }
 }
Ejemplo n.º 3
0
 /**
  * Loads a project
  *
  * @param string $proj project
  * @return GitPHP_Project project
  */
 protected function LoadProject($proj)
 {
     try {
         $project = new GitPHP_Project($this->projectRoot, $proj);
         $category = trim(dirname($proj));
         if (!(empty($category) || strpos($category, '.') === 0)) {
             $project->SetCategory($category);
         }
         if ($this->exportedOnly && !$project->GetDaemonEnabled()) {
             $this->Log('Project export disabled', $project->GetPath());
             return null;
         }
         $this->ApplyGlobalConfig($project);
         $this->ApplyGitConfig($project);
         if ($this->projectSettings && isset($this->projectSettings[$proj])) {
             $this->ApplyProjectSettings($project, $this->projectSettings[$proj]);
         }
         $this->InjectProjectDependencies($project);
         return $project;
     } catch (Exception $e) {
         $this->Log('Project error', $e->getMessage());
     }
     return null;
 }
Ejemplo n.º 4
0
 /**
  * Applies override settings for a project
  *
  * @param GitPHP_Project $project the project object
  * @param array $projData project data array
  */
 protected function ApplyProjectSettings($project, $projData)
 {
     if (!$project) {
         return;
     }
     if (isset($projData['category']) && is_string($projData['category'])) {
         $project->SetCategory($projData['category']);
     }
     if (isset($projData['owner']) && is_string($projData['owner'])) {
         $project->SetOwner($projData['owner']);
     }
     if (isset($projData['description']) && is_string($projData['description'])) {
         $project->SetDescription($projData['description']);
     }
     if (isset($projData['cloneurl']) && is_string($projData['cloneurl'])) {
         $project->SetCloneUrl($projData['cloneurl']);
     }
     if (isset($projData['pushurl']) && is_string($projData['pushurl'])) {
         $project->SetPushUrl($projData['pushurl']);
     }
     if (isset($projData['bugpattern']) && is_string($projData['bugpattern'])) {
         $project->SetBugPattern($projData['bugpattern']);
     }
     if (isset($projData['bugurl']) && is_string($projData['bugurl'])) {
         $project->SetBugUrl($projData['bugurl']);
     }
     if (isset($projData['compat'])) {
         $project->SetCompat($projData['compat']);
     }
     if (isset($projData['website']) && is_string($projData['website'])) {
         $project->SetWebsite($projData['website']);
     }
     if (!empty($projData['allowedusers'])) {
         $project->SetAllowedUsers($projData['allowedusers']);
     }
 }