From fb87b8489cb7d909d38e05fc38842918990e860e Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 17 Mar 2016 14:53:25 +0000 Subject: [PATCH] changed the site view to hide top projects/committers when the max_top_projects and max_top_commiters are set to 0 in the configuration file --- codepot/etc/codepot.ini.in | 4 ++-- codepot/src/codepot/controllers/site.php | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/codepot/etc/codepot.ini.in b/codepot/etc/codepot.ini.in index f45a28fb..c046a2d4 100644 --- a/codepot/etc/codepot.ini.in +++ b/codepot/etc/codepot.ini.in @@ -153,12 +153,12 @@ max_upload_size = "10000" max_latest_projects = "10" ;------------------------------------------------------------------------------ -; Maximum number of projects to show in the top projects graph +; Maximum number of projects to show in the top projects graph (0 to hide) ;------------------------------------------------------------------------------ max_top_projects = "10" ;------------------------------------------------------------------------------ -; Maximum number of committers to show in the top committers graph +; Maximum number of committers to show in the top committers graph (0 to hide) ;------------------------------------------------------------------------------ max_top_committers = "10" diff --git a/codepot/src/codepot/controllers/site.php b/codepot/src/codepot/controllers/site.php index d13b3d81..4763b459 100644 --- a/codepot/src/codepot/controllers/site.php +++ b/codepot/src/codepot/controllers/site.php @@ -104,8 +104,15 @@ class Site extends Controller $login['id'], $this->issuehelper->_get_open_status_array($this->lang), 0); } - $commit_counts_per_project = $this->logs->countCodeCommitsPerProject ('', 0, CODEPOT_MAX_TOP_PROJECTS); - $commit_counts_per_user = $this->logs->countCodeCommitsPerUser ('', 0, CODEPOT_MAX_TOP_COMMITTERS); + if (CODEPOT_MAX_TOP_PROJECTS > 0) + $commit_counts_per_project = $this->logs->countCodeCommitsPerProject ('', 0, CODEPOT_MAX_TOP_PROJECTS); + else + $commit_counts_per_project = array(); + + if (CODEPOT_MAX_TOP_COMMITTERS > 0) + $commit_counts_per_user = $this->logs->countCodeCommitsPerUser ('', 0, CODEPOT_MAX_TOP_COMMITTERS); + else + $commit_counts_per_user = array(); if (/*$issues === FALSE || $recently_resolved_issues === FALSE ||*/ $open_issue_counts_per_project === FALSE ||