Exemplo n.º 1
0
 /**
  * Instantiates the project list
  *
  * @param GitPHP_Config $config config provider
  * @param string $file config file with git projects
  * @param boolean $legacy true if this is the legacy project config
  * @throws Exception if there was an error reading the file
  */
 public static function Instantiate($config, $file = null, $legacy = false)
 {
     $instance = null;
     $projectRoot = $config->GetValue('projectroot');
     if (!empty($file) && is_file($file) && (include $file)) {
         if (isset($git_projects)) {
             if (is_string($git_projects)) {
                 if (function_exists('simplexml_load_file') && GitPHP_ProjectListScmManager::IsSCMManager($git_projects)) {
                     $instance = new GitPHP_ProjectListScmManager($projectRoot, $git_projects);
                 } else {
                     $instance = new GitPHP_ProjectListFile($projectRoot, $git_projects);
                 }
             } else {
                 if (is_array($git_projects)) {
                     if ($legacy) {
                         $instance = new GitPHP_ProjectListArrayLegacy($projectRoot, $git_projects);
                     } else {
                         $instance = new GitPHP_ProjectListArray($projectRoot, $git_projects);
                     }
                 }
             }
         }
     }
     if (!$instance) {
         $instance = new GitPHP_ProjectListDirectory($projectRoot, $config->GetValue('exportedonly'));
     }
     $instance->SetConfig($config);
     if (isset($git_projects_settings) && !$legacy) {
         $instance->SetProjectSettings($git_projects_settings);
     }
     return $instance;
 }
Exemplo n.º 2
0
 /**
  * Renders the output
  */
 public function Render()
 {
     if ($this->config->GetValue('cache') == true && $this->config->GetValue('cacheexpire') === true) {
         $this->CacheExpire();
     }
     $log = GitPHP_DebugLog::GetInstance();
     if (!$this->tpl->isCached($this->GetTemplate(), $this->GetFullCacheKey())) {
         $this->tpl->clearAllAssign();
         $log->TimerStart();
         $this->LoadCommonData();
         $log->TimerStop('Common data');
         $log->TimerStart();
         $this->LoadData();
         $log->TimerStop('Data');
     }
     if (!$this->preserveWhitespace) {
         //$this->tpl->loadFilter('output', 'trimwhitespace');
     }
     $log->TimerStart();
     $this->tpl->display($this->GetTemplate(), $this->GetFullCacheKey());
     $log->TimerStop('Render');
     $this->tpl->clearAllAssign();
     if ($this->projectList) {
         $log->Log('MemoryCache', 'Count: ' . $this->projectList->GetMemoryCache()->GetCount());
     }
     if ($log->GetEnabled()) {
         $this->tpl->assign('debuglog', $log);
         $this->tpl->display('debug.tpl');
     }
 }
Exemplo n.º 3
0
 /**
  * Applies global config settings to a project
  *
  * @param GitPHP_Project $project project
  */
 protected function ApplyGlobalConfig($project)
 {
     if (!$project) {
         return;
     }
     if (!$this->config) {
         return;
     }
     if ($this->config->GetValue('cloneurl')) {
         $project->SetCloneUrl(GitPHP_Util::AddSlash($this->config->GetValue('cloneurl'), false) . $project->GetProject());
     }
     if ($this->config->GetValue('pushurl')) {
         $project->SetPushUrl(GitPHP_Util::AddSlash($this->config->GetValue('pushurl'), false) . $project->GetProject());
     }
     if ($this->config->GetValue('bugpattern')) {
         $project->SetBugPattern($this->config->GetValue('bugpattern'));
     }
     if ($this->config->GetValue('bugurl')) {
         $project->SetBugUrl($this->config->GetValue('bugurl'));
     }
     if ($this->config->HasKey('compat')) {
         $project->SetCompat($this->config->GetValue('compat'));
     }
     if ($this->config->HasKey('uniqueabbrev')) {
         $project->SetUniqueAbbreviation($this->config->GetValue('uniqueabbrev'));
     }
     if ($this->config->GetValue('abbreviateurl')) {
         $project->SetUniqueAbbreviation(true);
     }
 }