From 8a5d82bad62610ef6a647de4663088db0e800742 Mon Sep 17 00:00:00 2001 From: Alain Peyrat Date: Mon, 7 May 2012 19:56:43 +0000 Subject: [PATCH] Fix [#374] Create config_dir if missing Misc code cleaning added. --- src/plugins/scmgit/common/GitPlugin.class.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/plugins/scmgit/common/GitPlugin.class.php b/src/plugins/scmgit/common/GitPlugin.class.php index 9ea01cab3b..eb214c1f1c 100644 --- a/src/plugins/scmgit/common/GitPlugin.class.php +++ b/src/plugins/scmgit/common/GitPlugin.class.php @@ -88,7 +88,7 @@ class GitPlugin extends SCMPlugin { if ($rows > 0) { $b .= '

'; $b .= _('Developer\'s repository'); - $b .= '

'; + $b .= ''."\n"; $b .= '

'; $b .= ngettext('One of this project\'s members also has a personal Git repository that can be checked out anonymously.', 'Some of this project\'s members also have personal Git repositories that can be checked out anonymously.', @@ -110,7 +110,7 @@ class GitPlugin extends SCMPlugin { function getInstructionsForRW($project) { if (session_loggedin()) { - $u =& user_get_object(user_getid()); + $u = user_get_object(user_getid()); $d = $u->getUnixName(); if (forge_get_config('use_ssh', 'scmgit')) { $b = '

'; @@ -204,8 +204,6 @@ class GitPlugin extends SCMPlugin { } function printBrowserPage($params) { - global $HTML; - $project = $this->checkParams($params); if (!$project) { return false; @@ -376,6 +374,9 @@ class GitPlugin extends SCMPlugin { } $config_dir = forge_get_config('config_path').'/plugins/scmgit'; + if (!is_dir($config_dir)) { + mkdir($config_dir, 0755, true); + } $fname = $config_dir . '/gitweb.conf' ; $config_f = fopen($fname.'.new', 'w') ; $rootdir = forge_get_config('repos_path', 'scmgit'); @@ -428,9 +429,6 @@ class GitPlugin extends SCMPlugin { } function gatherStats ($params) { - global $last_user, $usr_adds, $usr_deletes, - $usr_updates, $updates, $adds; - $project = $this->checkParams ($params) ; if (!$project) { return false ; @@ -441,8 +439,6 @@ class GitPlugin extends SCMPlugin { } if ($params['mode'] == 'day') { - db_begin(); - $year = $params ['year'] ; $month = $params ['month'] ; $day = $params ['day'] ; @@ -460,11 +456,12 @@ class GitPlugin extends SCMPlugin { $repo = forge_get_config('repos_path', 'scmgit') . '/' . $project->getUnixName() . '/' . $project->getUnixName() . '.git'; if (!is_dir ($repo) || !is_dir ("$repo/refs")) { // echo "No repository\n" ; - db_rollback () ; return false ; } - $pipe = popen ("GIT_DIR=\"$repo\" git log --since=@$start_time --until=@$end_time --all --pretty='format:%n%an <%ae>' --name-status", 'r' ) ; + $pipe = popen ("GIT_DIR=\"$repo\" git log --since=@$start_time --until=@$end_time --all --pretty='format:%n%an <%ae>' --name-status 2>/dev/null", 'r' ) ; + + db_begin(); // cleaning stats_cvs_* table for the current day $res = db_query_params ('DELETE FROM stats_cvs_group WHERE month=$1 AND day=$2 AND group_id=$3', -- 2.30.2